enclave-link 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +388 -2
- package/dist/chunk-7QIF4PCL.js +6783 -0
- package/dist/chunk-RHLID3KU.js +11923 -0
- package/dist/enclave.js +90 -0
- package/dist/index.js +11 -0
- package/dist/mcp-GVB6A3NA.js +17073 -0
- package/dist/types/answer.d.ts +3 -0
- package/dist/types/base64url.d.ts +2 -0
- package/dist/types/hpke.d.ts +8 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/passkey.d.ts +19 -0
- package/dist/types/proton.d.ts +30 -0
- package/dist/types/run.d.ts +8 -0
- package/dist/types/store.d.ts +14 -0
- package/dist/types/totp.d.ts +1 -0
- package/dist/types/vault.d.ts +57 -0
- package/package.json +43 -4
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type Answer = Record<string, string>;
|
|
2
|
+
export declare function sealAnswer(publicKey: Uint8Array<ArrayBuffer>, name: string, answer: Answer): Promise<Uint8Array<ArrayBuffer>>;
|
|
3
|
+
export declare function openAnswer(privateKey: Uint8Array<ArrayBuffer>, name: string, sealed: Uint8Array<ArrayBuffer>): Promise<any>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type Bytes = Uint8Array<ArrayBuffer>;
|
|
2
|
+
export declare function generateKeyPair(): Promise<{
|
|
3
|
+
publicKey: Uint8Array<ArrayBuffer>;
|
|
4
|
+
privateKey: Uint8Array<ArrayBuffer>;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function seal(publicKey: Bytes, info: Bytes, aad: Bytes, plaintext: Bytes): Promise<Uint8Array<ArrayBuffer>>;
|
|
7
|
+
export declare function open(privateKey: Bytes, info: Bytes, aad: Bytes, sealed: Bytes): Promise<Uint8Array<ArrayBuffer>>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import type { Passkey } from "./proton.js";
|
|
3
|
+
export declare const signRequest: z.ZodObject<{
|
|
4
|
+
origin: z.ZodString;
|
|
5
|
+
rpId: z.ZodOptional<z.ZodString>;
|
|
6
|
+
challenge: z.ZodString;
|
|
7
|
+
allowCredentials: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export type SignRequest = z.infer<typeof signRequest>;
|
|
10
|
+
export interface Assertion {
|
|
11
|
+
id: string;
|
|
12
|
+
authenticatorData: string;
|
|
13
|
+
clientDataJSON: string;
|
|
14
|
+
signature: string;
|
|
15
|
+
userHandle: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function relyingParty({ origin, rpId }: SignRequest): string;
|
|
18
|
+
export declare function accepts(passkey: Passkey, request: SignRequest): boolean;
|
|
19
|
+
export declare function signAssertion(passkey: Passkey, request: SignRequest): Assertion;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import type { Item } from "./store.js";
|
|
3
|
+
declare const protonItem: z.ZodObject<{
|
|
4
|
+
title: z.ZodString;
|
|
5
|
+
content: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
6
|
+
note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
7
|
+
extra_fields: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
content: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
10
|
+
}, z.core.$strip>>>>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export type ProtonItem = z.input<typeof protonItem>;
|
|
13
|
+
export interface Passkey {
|
|
14
|
+
rpId: string;
|
|
15
|
+
credentialId: string;
|
|
16
|
+
userHandle: string;
|
|
17
|
+
userName: string;
|
|
18
|
+
privateKey: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ProtonEntry {
|
|
21
|
+
id: string;
|
|
22
|
+
vault: string;
|
|
23
|
+
content: ProtonItem;
|
|
24
|
+
}
|
|
25
|
+
export declare function protonVaults(): Promise<string[]>;
|
|
26
|
+
export declare function readProton(vault: string): Promise<ProtonEntry[]>;
|
|
27
|
+
export declare function toItems<Entry extends ProtonItem>(proton: Iterable<Entry>, items?: Map<string, true | Item>): Generator<readonly [string, Item, Entry], void, unknown>;
|
|
28
|
+
export declare function toItem({ content, note, extra_fields }: ProtonItem): Item;
|
|
29
|
+
export declare function readPasskey(content: number[]): Passkey;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Transform, type Writable } from "node:stream";
|
|
2
|
+
export interface Stdio {
|
|
3
|
+
stdin: "inherit" | "ignore";
|
|
4
|
+
stdout: Writable;
|
|
5
|
+
stderr: Writable;
|
|
6
|
+
}
|
|
7
|
+
export declare function runWithSecrets(command: string[], secrets: Record<string, string>, stdio?: Stdio): Promise<number>;
|
|
8
|
+
export declare function redact(secrets: Record<string, string>): Transform;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Item = Record<string, string>;
|
|
2
|
+
export declare class Store {
|
|
3
|
+
readonly dir: string;
|
|
4
|
+
private keys?;
|
|
5
|
+
constructor(dir: string);
|
|
6
|
+
get(name: string): Promise<Item | undefined>;
|
|
7
|
+
put(name: string, item: Item): Promise<void>;
|
|
8
|
+
remove(name: string): Promise<void>;
|
|
9
|
+
names(): Promise<string[]>;
|
|
10
|
+
private path;
|
|
11
|
+
private key;
|
|
12
|
+
private load;
|
|
13
|
+
private temporary;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function totp(setupKey: string, now?: number): Promise<string>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type SignRequest } from "./passkey.js";
|
|
2
|
+
import { type Stdio } from "./run.js";
|
|
3
|
+
import { Store } from "./store.js";
|
|
4
|
+
export interface VaultOptions {
|
|
5
|
+
from?: string;
|
|
6
|
+
home?: string;
|
|
7
|
+
relay?: string;
|
|
8
|
+
store?: ItemStore;
|
|
9
|
+
}
|
|
10
|
+
export type ItemStore = Pick<Store, "get" | "put" | "remove" | "names">;
|
|
11
|
+
export interface Request {
|
|
12
|
+
url: string;
|
|
13
|
+
wait(): Promise<string[]>;
|
|
14
|
+
}
|
|
15
|
+
export declare function openVault({ from, home, relay, store, }?: VaultOptions): {
|
|
16
|
+
ask: (name: string, fields?: string[]) => Promise<Request>;
|
|
17
|
+
wait: (name: string, signal?: AbortSignal) => Promise<string[]>;
|
|
18
|
+
get: (name: string, field: string) => Promise<string>;
|
|
19
|
+
save: (name: string, field: string, value: string) => Promise<void>;
|
|
20
|
+
list: (search?: string) => Promise<{
|
|
21
|
+
name: string;
|
|
22
|
+
fields: string[];
|
|
23
|
+
}[]>;
|
|
24
|
+
remove: (name: string) => Promise<void>;
|
|
25
|
+
run: (command: string[], secrets: Record<string, string>, stdio?: Stdio) => Promise<number>;
|
|
26
|
+
importProton: (vaults?: string[]) => Promise<{
|
|
27
|
+
items: {
|
|
28
|
+
name: string;
|
|
29
|
+
fields: string[];
|
|
30
|
+
}[];
|
|
31
|
+
removed: string[];
|
|
32
|
+
}>;
|
|
33
|
+
passkey: (name: string, field?: string, timeout?: number) => Promise<void>;
|
|
34
|
+
sign: (request: SignRequest) => Promise<import("./passkey.ts").Assertion>;
|
|
35
|
+
};
|
|
36
|
+
export type Vault = ReturnType<typeof openVault>;
|
|
37
|
+
export declare const vault: {
|
|
38
|
+
ask: (name: string, fields?: string[]) => Promise<Request>;
|
|
39
|
+
wait: (name: string, signal?: AbortSignal) => Promise<string[]>;
|
|
40
|
+
get: (name: string, field: string) => Promise<string>;
|
|
41
|
+
save: (name: string, field: string, value: string) => Promise<void>;
|
|
42
|
+
list: (search?: string) => Promise<{
|
|
43
|
+
name: string;
|
|
44
|
+
fields: string[];
|
|
45
|
+
}[]>;
|
|
46
|
+
remove: (name: string) => Promise<void>;
|
|
47
|
+
run: (command: string[], secrets: Record<string, string>, stdio?: Stdio) => Promise<number>;
|
|
48
|
+
importProton: (vaults?: string[]) => Promise<{
|
|
49
|
+
items: {
|
|
50
|
+
name: string;
|
|
51
|
+
fields: string[];
|
|
52
|
+
}[];
|
|
53
|
+
removed: string[];
|
|
54
|
+
}>;
|
|
55
|
+
passkey: (name: string, field?: string, timeout?: number) => Promise<void>;
|
|
56
|
+
sign: (request: SignRequest) => Promise<import("./passkey.ts").Assertion>;
|
|
57
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "enclave-link",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "A vault for your agent: ask for secrets by encrypted one-time link, use them unseen, 2FA and passkeys too",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"bin": {
|
|
7
|
+
"enclave": "dist/enclave.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"type": "module",
|
|
13
|
+
"types": "./dist/types/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/types/index.d.ts",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"dev": "node scripts/page.ts && convex dev",
|
|
22
|
+
"deploy": "node scripts/page.ts && convex deploy",
|
|
23
|
+
"build": "node scripts/build.ts",
|
|
24
|
+
"prepack": "npm run build",
|
|
25
|
+
"check": "node scripts/page.ts && tsc -p . && oxlint && oxfmt --check && node --test 'test/*.test.ts'",
|
|
26
|
+
"format": "oxfmt && oxlint --fix"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@convex-dev/rate-limiter": "^0.4.1",
|
|
30
|
+
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
31
|
+
"@msgpack/msgpack": "^3.1.3",
|
|
32
|
+
"@oxlint/plugins": "^1.90.0",
|
|
33
|
+
"@types/node": "^24.0.0",
|
|
34
|
+
"convex": "^1.46.0",
|
|
35
|
+
"esbuild": "0.27.0",
|
|
36
|
+
"oxfmt": "^0.75.0",
|
|
37
|
+
"oxlint": "^1.90.0",
|
|
38
|
+
"typescript": "^7.0.2",
|
|
39
|
+
"zod": "^4.6.5"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=22"
|
|
43
|
+
},
|
|
44
|
+
"mcpName": "io.github.avgvstvs96/enclave"
|
|
45
|
+
}
|