@evolustr/signer 0.0.0-stage → 0.1.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/README.md +29 -2
- package/dist/adapters.d.ts +55 -0
- package/dist/adapters.d.ts.map +1 -0
- package/dist/adapters.js +52 -0
- package/dist/adapters.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/signer.d.ts +235 -0
- package/dist/signer.d.ts.map +1 -0
- package/dist/signer.js +715 -0
- package/dist/signer.js.map +1 -0
- package/package.json +41 -4
- package/src/adapters.ts +104 -0
- package/src/index.ts +2 -0
- package/src/signer.ts +923 -0
package/README.md
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @evolustr/signer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> ⚠️ **Early alpha: don't use it for data you can't afford to lose.**
|
|
4
|
+
>
|
|
5
|
+
> Evolustr has not had a security audit, and its vault format and APIs may still change without a migration path. It has been tested mainly with simulated signers, relays and passkeys; testing on real devices has only started.
|
|
6
|
+
>
|
|
7
|
+
> Keep your own backup of anything important, save your recovery phrase, and don't use it to protect high-value secrets (keys to funds, bank credentials). See the [project README](https://github.com/saintego/evolustr#readme) and the [open issues](https://github.com/saintego/evolustr/issues).
|
|
8
|
+
|
|
9
|
+
The signer side of Evolustr: lets a Nostr signer (iframe signer, browser extension, NIP-46 bunker, NIP-55 Android signer) give each app its own strong key. Read the [integration guide](https://github.com/saintego/evolustr/blob/main/docs/signer-integration.md) first; the design is in [SPEC.md](https://github.com/saintego/evolustr/blob/main/SPEC.md) §5.
|
|
10
|
+
|
|
11
|
+
## Host interface
|
|
12
|
+
|
|
13
|
+
`createEvolustrSigner(host)` needs:
|
|
14
|
+
|
|
15
|
+
| Field | Purpose |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `relays`, `relayUrls` | Where the signer vault (its encrypted master key) lives. |
|
|
18
|
+
| `relayQuorum` (optional) | How many relays must answer before an unlock trusts a vault it found. Reads that find one stop waiting once that many answered, so one slow relay doesn't hold them up. "No vault yet" and every write still wait for every relay, up to the timeout (#62). Default: every relay. The client has the same option. |
|
|
19
|
+
| `signerKey` | A stable name for the signer: origin, extension id, package name or bunker pubkey. |
|
|
20
|
+
| `getPublicKey`, `sign` | The user's pubkey, and signing for the signer vault event. |
|
|
21
|
+
| `getSecretKey` (optional) | The nsec, if the signer holds it. With `allowSkWrap` (default true) it protects the master key, so new devices unlock silently. `allowSkWrap` can be a function, read on every use, for signers where the user decides (e.g. OAuth). Enrolling a passkey while it's false drops the `sk` wrap, keeping the same master key. That stops new devices from unlocking with the nsec, but doesn't take access away from someone who can recover the nsec: the master key stays the same. `rotateMaster()` (from a click, with a signer passkey and `allowSkWrap` false) replaces the master key; the old one stays sealed under the new one so apps can open their old wrap (`getPreviousWrapKey`, `previousSignerId`) and then replace their root key. Every earlier master key is kept (up to 16), so an app that skipped several replacements still opens (`previousSignerIds`, `getPreviousWrapKey(caller, signerId)`). Other signer passkeys must be enrolled again. `capabilities()` reports `nsecExposed`. |
|
|
22
|
+
| `passkeys` (optional) | Signer passkeys on the signer's own origin. |
|
|
23
|
+
| `cache` (optional) | `get` / `set` / `remove` for the unlocked master key on this device, and `getVault` / `setVault` for a local copy of the signer vault. **Provide `getVault` / `setVault`**: without them, a replaced signer vault on the relays locks out devices that don't have the key cached. |
|
|
24
|
+
| `ui.confirm`, `ui.requestGesture` | Prompts with the verified caller, and a click inside the signer before passkey calls. |
|
|
25
|
+
|
|
26
|
+
## Methods
|
|
27
|
+
|
|
28
|
+
`handle(method, params, caller)` routes `evolustr_capabilities`, `evolustr_get_wrap_key` and `evolustr_enroll_passkey`. The caller always comes from the transport (`event.origin`, extension sender, Android package, NIP-46 client pubkey), never from params. `isProtectedEvent(event)` tells auto-approve rules which events need a prompt.
|
|
29
|
+
|
|
30
|
+
`getHostSecret(label)` gives the host signer a 32-byte secret derived from M for its own use, such as the key of its synced settings: `HKDF(M, "evolustr/v1|host|" + label)`, namespaced apart from app keys. It unlocks M like `getWrapKey` (with the signer passkey if needed), shows no app prompt, and isn't reachable through `handle()`, so apps can't ask for it. Labels are 1–200 characters without `|`. After `rotateMaster()`, `getPreviousHostSecret(label)` gives the same secret under the previous M, and `getPreviousHostSecrets(label)` under every earlier one (newest first), so the host can move its data across, as apps do with `getPreviousWrapKey`.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transport adapters for {@link EvolustrSigner} (SPEC §5.1). Each one turns a
|
|
3
|
+
* transport's request into `handle(method, params, caller)`, taking the caller
|
|
4
|
+
* from the transport itself.
|
|
5
|
+
*/
|
|
6
|
+
import type { Result } from "@evolustr/core";
|
|
7
|
+
import type { EvolustrSigner } from "./signer.ts";
|
|
8
|
+
/** postMessage envelope used between the app page and an iframe signer. */
|
|
9
|
+
export interface IframeRequest {
|
|
10
|
+
readonly type: "evolustr";
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly method: string;
|
|
13
|
+
readonly params?: ReadonlyArray<unknown>;
|
|
14
|
+
}
|
|
15
|
+
export interface IframeResponse {
|
|
16
|
+
readonly type: "evolustr";
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly result?: unknown;
|
|
19
|
+
readonly error?: {
|
|
20
|
+
readonly type: string;
|
|
21
|
+
readonly message: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export declare const isIframeRequest: (data: unknown) => data is IframeRequest;
|
|
25
|
+
/**
|
|
26
|
+
* Which app pages may call the signer. Required (#30): without it any site
|
|
27
|
+
* could embed the signer, and the only gate would be a prompt drawn inside an
|
|
28
|
+
* embeddable frame, which is open to clickjacking. Pass the embedding page's
|
|
29
|
+
* origin (e.g. from `location.ancestorOrigins`), a list, or a predicate.
|
|
30
|
+
*/
|
|
31
|
+
export type AllowedOrigins = string | ReadonlyArray<string> | ((origin: string) => boolean);
|
|
32
|
+
/**
|
|
33
|
+
* Handles one message inside an iframe signer. The caller is `event.origin`,
|
|
34
|
+
* which the browser sets, and only allowed origins are served. Reply with
|
|
35
|
+
* `postMessage(response, event.origin)`, never with "*".
|
|
36
|
+
*/
|
|
37
|
+
export declare const handleIframeMessage: (signer: EvolustrSigner, event: {
|
|
38
|
+
readonly origin: string;
|
|
39
|
+
readonly data: unknown;
|
|
40
|
+
}, allowedOrigins: AllowedOrigins) => Promise<IframeResponse | null>;
|
|
41
|
+
/** Wires {@link handleIframeMessage} to a window; returns a function that stops listening. */
|
|
42
|
+
export declare const listenForIframeRequests: (signer: EvolustrSigner, self: Pick<Window, "addEventListener" | "removeEventListener">, reply: (response: IframeResponse, origin: string) => void, allowedOrigins: AllowedOrigins) => (() => void);
|
|
43
|
+
/** NIP-46: `evolustr_*` request from a connected client; results are strings. */
|
|
44
|
+
export declare const handleNip46Request: (signer: EvolustrSigner, clientPubkey: string, request: {
|
|
45
|
+
readonly id: string;
|
|
46
|
+
readonly method: string;
|
|
47
|
+
readonly params: ReadonlyArray<string>;
|
|
48
|
+
}) => Promise<{
|
|
49
|
+
readonly id: string;
|
|
50
|
+
readonly result?: string;
|
|
51
|
+
readonly error?: string;
|
|
52
|
+
}>;
|
|
53
|
+
/** Browser extension: the sender's origin comes from the extension runtime. */
|
|
54
|
+
export declare const handleExtensionRequest: (signer: EvolustrSigner, senderOrigin: string, method: string, params?: ReadonlyArray<unknown>) => Promise<Result<unknown>>;
|
|
55
|
+
//# sourceMappingURL=adapters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../src/adapters.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,2EAA2E;AAC3E,MAAM,WAAW,aAAa;IA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ACX;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAAE,KAChG,OAAO,CAAC;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAYpF,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,WACzB,cAAc,gBACR,MAAM,UACZ,MAAM,WACN,aAAa,CAAC,OAAO,CAAC,KAC7B,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAkF,CAAC"}
|
package/dist/adapters.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const toResponse = (id, r) => r.ok ? { type: "evolustr", id, result: r.value } : { type: "evolustr", id, error: r.error };
|
|
2
|
+
export const isIframeRequest = (data) => typeof data === "object" &&
|
|
3
|
+
data !== null &&
|
|
4
|
+
data.type === "evolustr" &&
|
|
5
|
+
typeof data.id === "string" &&
|
|
6
|
+
typeof data.method === "string";
|
|
7
|
+
const isAllowed = (allowed, origin) => typeof allowed === "function" ? allowed(origin) : typeof allowed === "string" ? origin === allowed : allowed.includes(origin);
|
|
8
|
+
/**
|
|
9
|
+
* Handles one message inside an iframe signer. The caller is `event.origin`,
|
|
10
|
+
* which the browser sets, and only allowed origins are served. Reply with
|
|
11
|
+
* `postMessage(response, event.origin)`, never with "*".
|
|
12
|
+
*/
|
|
13
|
+
export const handleIframeMessage = async (signer, event, allowedOrigins) => {
|
|
14
|
+
if (!isIframeRequest(event.data))
|
|
15
|
+
return null;
|
|
16
|
+
if (!event.origin || event.origin === "null")
|
|
17
|
+
return null;
|
|
18
|
+
if (!isAllowed(allowedOrigins, event.origin))
|
|
19
|
+
return null;
|
|
20
|
+
const r = await signer.handle(event.data.method, event.data.params ?? [], { identity: "verified", origin: event.origin });
|
|
21
|
+
return toResponse(event.data.id, r);
|
|
22
|
+
};
|
|
23
|
+
/** Wires {@link handleIframeMessage} to a window; returns a function that stops listening. */
|
|
24
|
+
export const listenForIframeRequests = (signer, self, reply, allowedOrigins) => {
|
|
25
|
+
const listener = (e) => {
|
|
26
|
+
const m = e;
|
|
27
|
+
void handleIframeMessage(signer, { origin: m.origin, data: m.data }, allowedOrigins).then((r) => {
|
|
28
|
+
if (r !== null)
|
|
29
|
+
reply(r, m.origin);
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
self.addEventListener("message", listener);
|
|
33
|
+
return () => self.removeEventListener("message", listener);
|
|
34
|
+
};
|
|
35
|
+
/** NIP-46: `evolustr_*` request from a connected client; results are strings. */
|
|
36
|
+
export const handleNip46Request = async (signer, clientPubkey, request) => {
|
|
37
|
+
const params = request.params.map((p) => {
|
|
38
|
+
try {
|
|
39
|
+
return JSON.parse(p);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return p;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const r = await signer.handle(request.method, params, { identity: "connection", clientPubkey });
|
|
46
|
+
return r.ok
|
|
47
|
+
? { id: request.id, result: typeof r.value === "string" ? r.value : JSON.stringify(r.value ?? null) }
|
|
48
|
+
: { id: request.id, error: r.error.message };
|
|
49
|
+
};
|
|
50
|
+
/** Browser extension: the sender's origin comes from the extension runtime. */
|
|
51
|
+
export const handleExtensionRequest = (signer, senderOrigin, method, params = []) => signer.handle(method, params, { identity: "verified", origin: senderOrigin });
|
|
52
|
+
//# sourceMappingURL=adapters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.js","sourceRoot":"","sources":["../src/adapters.ts"],"names":[],"mappings":"AAuBA,MAAM,UAAU,GAAG,CAAC,EAAU,EAAE,CAAkB,EAAkB,EAAE,CACpE,CAAC,CAAC,EAAE,CAAC,CAA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MAAM,CAAC,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAC;IAChG,OAAO,CAAC,CAAC,EAAE;QACT,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,EAAE;QACrG,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;AACjD,CAAC,CAAC;AAEF,+EAA+E;AAC/E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,MAAsB,EACtB,YAAoB,EACpB,MAAc,EACd,MAAM,GAA2B,EAAE,EACT,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
|
package/dist/signer.d.ts
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@evolustr/signer` (SPEC §5): the signer side of Evolustr, embedded by a
|
|
3
|
+
* host signer (iframe signer, browser extension, NIP-46 bunker, Android signer).
|
|
4
|
+
*
|
|
5
|
+
* The host supplies what only it knows: who is calling, how to sign, its nsec
|
|
6
|
+
* (if it holds one), and how to ask the user. Everything else lives here.
|
|
7
|
+
*/
|
|
8
|
+
import { type Bytes, type EvolustrError, type Passkeys, type Relays, type Result, type Sealed, type UnsignedEvent, type NostrEvent } from "@evolustr/core";
|
|
9
|
+
/** Who is calling, as the host knows it (SPEC §5.2). Never taken from request params. */
|
|
10
|
+
export type Caller = {
|
|
11
|
+
readonly identity: "verified";
|
|
12
|
+
readonly origin: string;
|
|
13
|
+
} | {
|
|
14
|
+
readonly identity: "verified";
|
|
15
|
+
readonly androidPackage: string;
|
|
16
|
+
} | {
|
|
17
|
+
readonly identity: "connection";
|
|
18
|
+
readonly clientPubkey: string;
|
|
19
|
+
};
|
|
20
|
+
export type SignerWrap = ({
|
|
21
|
+
readonly type: "sk";
|
|
22
|
+
readonly tag?: string;
|
|
23
|
+
} & Sealed) | ({
|
|
24
|
+
readonly type: "passkey";
|
|
25
|
+
readonly rpId: string;
|
|
26
|
+
readonly credId: string;
|
|
27
|
+
/** The passkey was synced (BS flag) when enrolled (#42). */
|
|
28
|
+
readonly synced?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* HMAC under a key derived from M over the wrap's fields (#54). Wraps from
|
|
31
|
+
* older versions have none.
|
|
32
|
+
*/
|
|
33
|
+
readonly tag?: string;
|
|
34
|
+
} & Sealed);
|
|
35
|
+
export interface SignerVault {
|
|
36
|
+
readonly v: 1;
|
|
37
|
+
readonly wraps: ReadonlyArray<SignerWrap>;
|
|
38
|
+
/**
|
|
39
|
+
* Unix seconds when an `sk` wrap was removed for this M (#52). M didn't
|
|
40
|
+
* change, so anyone who can recover the nsec may still open an older copy.
|
|
41
|
+
*/
|
|
42
|
+
readonly skDroppedAt?: number;
|
|
43
|
+
/** Public id of the M this vault holds (#52 phase B); missing in older vaults. */
|
|
44
|
+
readonly mId?: string;
|
|
45
|
+
/** Set after {@link EvolustrSigner.rotateMaster}: the previous M authorises this one. */
|
|
46
|
+
readonly rotatedFrom?: {
|
|
47
|
+
readonly mId: string;
|
|
48
|
+
readonly proof: string;
|
|
49
|
+
};
|
|
50
|
+
/** The previous M, sealed with a key from this M, so apps can still open their old wrap. */
|
|
51
|
+
readonly previous?: PreviousMaster;
|
|
52
|
+
/**
|
|
53
|
+
* The Ms before `previous`, newest first (#58): each sealed with a key from
|
|
54
|
+
* the one before it in this chain (`older[0]` with `previous`'s M). Carried
|
|
55
|
+
* over unchanged at each rotation, at most {@link MAX_PREVIOUS_MASTERS} in all.
|
|
56
|
+
*/
|
|
57
|
+
readonly older?: ReadonlyArray<PreviousMaster>;
|
|
58
|
+
}
|
|
59
|
+
/** An earlier M, sealed with `HKDF(M_next, "evolustr/v1/signer-previous")` (#52 phase B, #58). */
|
|
60
|
+
export type PreviousMaster = {
|
|
61
|
+
readonly mId: string;
|
|
62
|
+
} & Sealed;
|
|
63
|
+
/** How many earlier Ms a signer vault keeps (`previous` plus `older`, #58). */
|
|
64
|
+
export declare const MAX_PREVIOUS_MASTERS = 16;
|
|
65
|
+
export type ConfirmRequest = {
|
|
66
|
+
readonly kind: "appKey";
|
|
67
|
+
readonly appId: string;
|
|
68
|
+
readonly identity: Caller["identity"];
|
|
69
|
+
} | {
|
|
70
|
+
readonly kind: "enrollPasskey";
|
|
71
|
+
} | {
|
|
72
|
+
readonly kind: "rotateMaster";
|
|
73
|
+
};
|
|
74
|
+
export interface SignerHost {
|
|
75
|
+
readonly relays: Relays;
|
|
76
|
+
readonly relayUrls: ReadonlyArray<string>;
|
|
77
|
+
/** Stable name of this signer: its origin, extension id, package name or bunker pubkey (SPEC §5.3). */
|
|
78
|
+
readonly signerKey: string;
|
|
79
|
+
/** Signs the signer's own vault event. */
|
|
80
|
+
readonly sign: (event: UnsignedEvent) => Promise<NostrEvent>;
|
|
81
|
+
readonly getPublicKey: () => Promise<string>;
|
|
82
|
+
/** The nsec, for signers that hold it; omit in passthrough mode. */
|
|
83
|
+
readonly getSecretKey?: () => Bytes | null;
|
|
84
|
+
/**
|
|
85
|
+
* False when a third party can recover the nsec (SPEC §5.7). Default true.
|
|
86
|
+
* A function is read on every use, so a host can ask the user and change it
|
|
87
|
+
* at runtime (e.g. OAuth signers, where the user decides).
|
|
88
|
+
*/
|
|
89
|
+
readonly allowSkWrap?: boolean | (() => boolean);
|
|
90
|
+
/** Passkeys on the signer's own origin. */
|
|
91
|
+
readonly passkeys?: Passkeys;
|
|
92
|
+
/** Optional device cache for the unlocked M. */
|
|
93
|
+
readonly cache?: {
|
|
94
|
+
readonly get: (pubkey: string) => Promise<Bytes | null>;
|
|
95
|
+
readonly set: (pubkey: string, m: Bytes) => Promise<void>;
|
|
96
|
+
readonly remove: (pubkey: string) => Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* The last good signer vault (JSON), kept on the device (#41). Without these,
|
|
99
|
+
* a replaced signer vault on the relays locks out devices that don't have M cached.
|
|
100
|
+
*/
|
|
101
|
+
readonly getVault?: (pubkey: string) => Promise<string | null>;
|
|
102
|
+
readonly setVault?: (pubkey: string, json: string) => Promise<void>;
|
|
103
|
+
};
|
|
104
|
+
readonly ui: {
|
|
105
|
+
/** Show a prompt with the verified caller; the host may remember answers. */
|
|
106
|
+
readonly confirm: (request: ConfirmRequest) => Promise<boolean>;
|
|
107
|
+
/** Resolve after the user clicks inside the signer (needed before passkeys and popups). */
|
|
108
|
+
readonly requestGesture: (reason: "unlock" | "enrollPasskey" | "rotateMaster") => Promise<void>;
|
|
109
|
+
};
|
|
110
|
+
readonly knownNsiteGateways?: ReadonlyArray<string>;
|
|
111
|
+
readonly now?: () => number;
|
|
112
|
+
readonly randomBytes?: (length: number) => Bytes;
|
|
113
|
+
readonly timeoutMs?: number;
|
|
114
|
+
/**
|
|
115
|
+
* Enough relays to trust a vault an unlock found (#60): such reads stop
|
|
116
|
+
* waiting once this many answered, so one slow relay doesn't hold them up.
|
|
117
|
+
* "No vault" and reads before a write still wait for every relay (#62).
|
|
118
|
+
* Default: every relay.
|
|
119
|
+
*/
|
|
120
|
+
readonly relayQuorum?: number;
|
|
121
|
+
}
|
|
122
|
+
export interface Capabilities {
|
|
123
|
+
readonly identity: Caller["identity"];
|
|
124
|
+
readonly appId: string;
|
|
125
|
+
readonly signerId: string | null;
|
|
126
|
+
readonly ready: boolean;
|
|
127
|
+
readonly signerPasskey: boolean;
|
|
128
|
+
/** M can be recovered on another device: an `sk` wrap, or a synced signer passkey (#42). */
|
|
129
|
+
readonly recoverable: boolean;
|
|
130
|
+
/** M is protected by the nsec (an `sk` wrap): anyone with the nsec can derive app keys (#43). */
|
|
131
|
+
readonly nsecProtected: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* The nsec could open M now or did before (an `sk` wrap, or one removed for
|
|
134
|
+
* this M): anyone who can recover the nsec may have M and every app key (#52).
|
|
135
|
+
*/
|
|
136
|
+
readonly nsecExposed: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* After a key rotation (#52 phase B): this app's signer id under the previous
|
|
139
|
+
* M, so the client can open its old wrap and then replace its root key.
|
|
140
|
+
*/
|
|
141
|
+
readonly previousSignerId: string | null;
|
|
142
|
+
/**
|
|
143
|
+
* Every earlier M's signer id for this app, newest first (#58): an app that
|
|
144
|
+
* skipped rotations finds the one its wrap used and asks for that key.
|
|
145
|
+
* `previousSignerIds[0]` is `previousSignerId`.
|
|
146
|
+
*/
|
|
147
|
+
readonly previousSignerIds: ReadonlyArray<string>;
|
|
148
|
+
}
|
|
149
|
+
export declare const METHODS: readonly ["evolustr_capabilities", "evolustr_get_wrap_key", "evolustr_get_previous_wrap_key", "evolustr_enroll_passkey"];
|
|
150
|
+
export type Method = (typeof METHODS)[number];
|
|
151
|
+
export interface EvolustrSigner {
|
|
152
|
+
/** For the host's message handler: `caller` comes from the host, never from params. */
|
|
153
|
+
readonly handle: (method: string, params: ReadonlyArray<unknown>, caller: Caller) => Promise<Result<unknown>>;
|
|
154
|
+
/** No prompt, and never creates or publishes anything (#29). */
|
|
155
|
+
readonly capabilities: (caller: Caller) => Promise<Result<Capabilities>>;
|
|
156
|
+
/** 32-byte key for the caller's app vault (SPEC §5.3). */
|
|
157
|
+
readonly getWrapKey: (caller: Caller) => Promise<Result<Bytes>>;
|
|
158
|
+
readonly enrollPasskey: () => Promise<Result<void>>;
|
|
159
|
+
/**
|
|
160
|
+
* The caller's key under an earlier M, after {@link rotateMaster} (#52 phase
|
|
161
|
+
* B): the one whose signer id for this app is `signerId` (#58), else the
|
|
162
|
+
* previous one.
|
|
163
|
+
*/
|
|
164
|
+
readonly getPreviousWrapKey: (caller: Caller, signerId?: string) => Promise<Result<Bytes>>;
|
|
165
|
+
/**
|
|
166
|
+
* Replaces M with a new one, from a click in the signer's own UI (#52 phase
|
|
167
|
+
* B). Needs a signer passkey and `allowSkWrap` false. Only the passkey used
|
|
168
|
+
* here wraps the new M: other signer passkeys must be enrolled again.
|
|
169
|
+
*/
|
|
170
|
+
readonly rotateMaster: () => Promise<Result<{
|
|
171
|
+
readonly droppedWraps: number;
|
|
172
|
+
}>>;
|
|
173
|
+
/**
|
|
174
|
+
* 32-byte secret from M for the host's own use (§5.6), e.g. its synced
|
|
175
|
+
* settings. Host-only: no `handle()` method reaches it, so apps can't ask for
|
|
176
|
+
* it. Unlocks M like `getWrapKey` (passkey if needed), without the app prompt.
|
|
177
|
+
*/
|
|
178
|
+
readonly getHostSecret: (label: string) => Promise<Result<Bytes>>;
|
|
179
|
+
/**
|
|
180
|
+
* The same host secret under the previous M, after {@link rotateMaster}, so
|
|
181
|
+
* the host can move its own data across, like apps with getPreviousWrapKey.
|
|
182
|
+
*/
|
|
183
|
+
readonly getPreviousHostSecret: (label: string) => Promise<Result<Bytes>>;
|
|
184
|
+
/** The host secret under every earlier M, newest first (#58); empty before any rotation. */
|
|
185
|
+
readonly getPreviousHostSecrets: (label: string) => Promise<Result<ReadonlyArray<Bytes>>>;
|
|
186
|
+
/** For the host's auto-approve list (SPEC §5.5 rule 2). */
|
|
187
|
+
readonly isProtectedEvent: (event: {
|
|
188
|
+
readonly kind: number;
|
|
189
|
+
readonly tags: ReadonlyArray<ReadonlyArray<string>>;
|
|
190
|
+
}) => boolean;
|
|
191
|
+
readonly appIdFor: (caller: Caller) => Result<string>;
|
|
192
|
+
readonly lock: () => Promise<void>;
|
|
193
|
+
}
|
|
194
|
+
export declare const parseSignerVault: (json: string) => Result<SignerVault, EvolustrError>;
|
|
195
|
+
export declare const MAX_SIGNER_WRAPS = 32;
|
|
196
|
+
/** Above this many wraps, untagged ones are dropped once M is unlocked (#54). */
|
|
197
|
+
export declare const UNTAGGED_SIGNER_WRAP_LIMIT = 16;
|
|
198
|
+
/**
|
|
199
|
+
* Union of two signer vaults by wrap id; `local` wins on the same id (#41).
|
|
200
|
+
* With `dropSk`, `sk` wraps are left out (#52): a relay vault without one is
|
|
201
|
+
* never "healed" back to one by a device that may not use it.
|
|
202
|
+
*/
|
|
203
|
+
export declare const mergeSignerVaults: (local: SignerVault, fetched: SignerVault, opts?: {
|
|
204
|
+
readonly dropSk?: boolean;
|
|
205
|
+
}) => SignerVault;
|
|
206
|
+
/** Two versions of the signer vault hold different master secrets: never merge them (#52 phase B). */
|
|
207
|
+
export declare const differentMaster: (a: SignerVault, b: SignerVault) => boolean;
|
|
208
|
+
/** Proof that the M behind `oldMId` authorised `newMId` (#52 phase B). */
|
|
209
|
+
export declare const masterRotationProof: (oldM: Bytes, newMId: string) => string;
|
|
210
|
+
type UntaggedSignerWrap = {
|
|
211
|
+
readonly type: "sk";
|
|
212
|
+
readonly iv: string;
|
|
213
|
+
readonly ct: string;
|
|
214
|
+
} | {
|
|
215
|
+
readonly type: "passkey";
|
|
216
|
+
readonly rpId: string;
|
|
217
|
+
readonly credId: string;
|
|
218
|
+
readonly synced?: boolean;
|
|
219
|
+
readonly iv: string;
|
|
220
|
+
readonly ct: string;
|
|
221
|
+
};
|
|
222
|
+
/** HMAC tag of a signer-vault wrap under a key derived from M (#54). Covers `synced` too. */
|
|
223
|
+
export declare const signerWrapTag: (pubkey: string, signerKey: string, m: Bytes, w: UntaggedSignerWrap) => string;
|
|
224
|
+
/**
|
|
225
|
+
* Once M is known (#54): drops wraps whose tag is wrong. Untagged wraps from
|
|
226
|
+
* older versions are kept, unless the vault has more than
|
|
227
|
+
* {@link UNTAGGED_SIGNER_WRAP_LIMIT} wraps: then only the one just opened stays.
|
|
228
|
+
*/
|
|
229
|
+
export declare const pruneSignerVault: (vault: SignerVault, pubkey: string, signerKey: string, m: Bytes, openedId?: string) => SignerVault;
|
|
230
|
+
/** App identity from the caller only (SPEC §5.2); insecure or malformed callers get none (#30). */
|
|
231
|
+
export declare const appIdForCaller: (caller: Caller, knownNsiteGateways?: ReadonlyArray<string>) => Result<string, EvolustrError>;
|
|
232
|
+
export declare const isProtectedEvent: EvolustrSigner["isProtectedEvent"];
|
|
233
|
+
export declare const createEvolustrSigner: (host: SignerHost) => EvolustrSigner;
|
|
234
|
+
export {};
|
|
235
|
+
//# sourceMappingURL=signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,aAAa,EAgClB,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAC;AAIxB,yFAAyF;AACzF,MAAM,MAAM,MAAM,GACd;IAAE,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GAClE;IAAE,QAAQ,CAAC,QAAQ,EAAE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