@qntx/wallet 0.12.0 → 0.14.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 +145 -22
- package/dist/backup-CLzMs8DP.mjs +51 -0
- package/dist/backup-CLzMs8DP.mjs.map +1 -0
- package/dist/card.d.mts +12 -0
- package/dist/card.mjs +119 -0
- package/dist/card.mjs.map +1 -0
- package/dist/{chains-BSP0x9RI.d.mts → chains-u1M0CWkT.d.mts} +175 -26
- package/dist/chains.d.mts +11 -4
- package/dist/chains.mjs +19 -62
- package/dist/chains.mjs.map +1 -1
- package/dist/{channel-BQg--l_3.mjs → channel-BCZXU3pt.mjs} +105 -44
- package/dist/channel-BCZXU3pt.mjs.map +1 -0
- package/dist/check-C1fUpgva.mjs +193 -0
- package/dist/check-C1fUpgva.mjs.map +1 -0
- package/dist/{core-DDfzuSIa.mjs → core-Cx7p-0nG.mjs} +136 -15
- package/dist/core-Cx7p-0nG.mjs.map +1 -0
- package/dist/hardware-BL6zvhQh.d.mts +107 -0
- package/dist/hardware.d.mts +81 -0
- package/dist/hardware.mjs +446 -0
- package/dist/hardware.mjs.map +1 -0
- package/dist/host.d.mts +27 -19
- package/dist/host.mjs +471 -144
- package/dist/host.mjs.map +1 -1
- package/dist/{index-DDyJ9KqA.d.mts → index-UclKfprm.d.mts} +274 -18
- package/dist/index.d.mts +5 -3
- package/dist/index.mjs +3 -33
- package/dist/{internal-CAKfHjIg.mjs → internal-DwCus_Ws.mjs} +1 -6
- package/dist/internal-DwCus_Ws.mjs.map +1 -0
- package/dist/nostr.d.mts +2 -2
- package/dist/nostr.mjs +14 -14
- package/dist/nostr.mjs.map +1 -1
- package/dist/{protocol-C8x0H3Rr.mjs → protocol-DLE6lHmP.mjs} +493 -52
- package/dist/protocol-DLE6lHmP.mjs.map +1 -0
- package/dist/protocol.d.mts +5 -4
- package/dist/protocol.mjs +3 -3
- package/dist/secret-CbjbY5-f.mjs +25 -0
- package/dist/secret-CbjbY5-f.mjs.map +1 -0
- package/dist/sessions.d.mts +52 -0
- package/dist/sessions.mjs +71 -0
- package/dist/sessions.mjs.map +1 -0
- package/dist/spark.d.mts +3 -3
- package/dist/spark.mjs +5 -8
- package/dist/spark.mjs.map +1 -1
- package/dist/types-CRnacSqJ.d.mts +390 -0
- package/dist/types.d.mts +2 -2
- package/dist/types.mjs +7 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +27 -13
- package/dist/channel-BQg--l_3.mjs.map +0 -1
- package/dist/core-DDfzuSIa.mjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/internal-CAKfHjIg.mjs.map +0 -1
- package/dist/protocol-C8x0H3Rr.mjs.map +0 -1
- package/dist/secret-CcjyF8D3.mjs +0 -205
- package/dist/secret-CcjyF8D3.mjs.map +0 -1
- package/dist/types-Dub5eUl3.d.mts +0 -239
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { C as WalletSnapshot,
|
|
2
|
-
import {
|
|
1
|
+
import { A as VerifyFactor, C as PasskeyConfig, D as VaultApi, E as UnlockFactor, F as WalletSnapshot, I as WalletsApi, M as WalletError, N as WalletErrorCode, O as VaultState, P as WalletInfo, S as NostrKeyRef, T as StatusPayload, _ as KeysApi, a as CardInfo, b as NativeAutoLockPolicy, c as DerivedNostrKey, d as FactorInfo, f as HARDWARE_DEVICES, g as KeyInfo, h as InitialFactor, i as BackupInfo, j as Wallet, k as VaultWalletInfo, l as ExportedMnemonic, m as HardwareWalletInfo, n as BackupApi, o as CardWalletInfo, p as HardwareDevice, r as BackupFactorInput, s as DataKeyApi, t as AutoLockPolicy, u as ExportedSecret, v as LockReason, w as SignerTask, x as NostrKeyInfo, y as MnemonicDraft } from "./types-CRnacSqJ.mjs";
|
|
2
|
+
import { S as BackupHeaderWire, b as BackupHeaderKey, ft as SignedEvent } from "./index-UclKfprm.mjs";
|
|
3
3
|
type BackupHeaderWallet = BackupHeaderWire["wallets"][number];
|
|
4
4
|
type BackupHeader = {
|
|
5
5
|
readonly version: 1;
|
|
6
6
|
readonly createdAt: number;
|
|
7
7
|
readonly wallets: ReadonlyArray<BackupHeaderWallet>;
|
|
8
|
+
/** Imported keys carried by the payload; empty when there are none. */
|
|
9
|
+
readonly keys: ReadonlyArray<BackupHeaderKey>;
|
|
8
10
|
/** The factor kinds the envelope can be unwrapped with. */
|
|
9
11
|
readonly factorKinds: ReadonlyArray<"passkey" | "password">;
|
|
10
12
|
};
|
|
@@ -22,5 +24,5 @@ type WalletOptions = {
|
|
|
22
24
|
*/
|
|
23
25
|
readonly verifyEvent: (event: SignedEvent) => boolean;
|
|
24
26
|
};
|
|
25
|
-
export { type AutoLockPolicy, type BackupApi, type BackupHeader, type BackupHeaderWallet, type BackupInfo, type DataKeyApi, type DerivedNostrKey, type ExportedMnemonic, type ExportedSecret, type FactorInfo, type InitialFactor, type LockReason, type MnemonicDraft, type NostrKeyInfo, type NostrKeyRef, type PasskeyConfig, type StatusPayload, type UnlockFactor, type VaultApi, type VaultState, type Wallet, WalletError, type WalletErrorCode, type WalletInfo, type WalletOptions, type WalletSnapshot, type WalletsApi };
|
|
27
|
+
export { type AutoLockPolicy, type BackupApi, type BackupFactorInput, type BackupHeader, type BackupHeaderKey, type BackupHeaderWallet, type BackupInfo, type CardInfo, type CardWalletInfo, type DataKeyApi, type DerivedNostrKey, type ExportedMnemonic, type ExportedSecret, type FactorInfo, HARDWARE_DEVICES, type HardwareDevice, type HardwareWalletInfo, type InitialFactor, type KeyInfo, type KeysApi, type LockReason, type MnemonicDraft, type NativeAutoLockPolicy, type NostrKeyInfo, type NostrKeyRef, type PasskeyConfig, type SignerTask, type StatusPayload, type UnlockFactor, type VaultApi, type VaultState, type VaultWalletInfo, type VerifyFactor, type Wallet, WalletError, type WalletErrorCode, type WalletInfo, type WalletOptions, type WalletSnapshot, type WalletsApi };
|
|
26
28
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,33 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
// src/backup.ts
|
|
5
|
-
function integrity(msg) {
|
|
6
|
-
throw new WalletError("integrity", `backup: ${msg}`);
|
|
7
|
-
}
|
|
8
|
-
function json(text, what) {
|
|
9
|
-
try {
|
|
10
|
-
return JSON.parse(text);
|
|
11
|
-
} catch {
|
|
12
|
-
return integrity(`${what} is not JSON`);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
/** Strictly validates the envelope and returns the header fields — no secrets, no writes. */
|
|
16
|
-
function parseBackupHeader(envelope) {
|
|
17
|
-
if (envelope.length > 4e6) integrity("envelope too large");
|
|
18
|
-
const parsed = validate(backupEnvelope, json(envelope, "envelope"));
|
|
19
|
-
if (parsed === void 0) integrity("malformed envelope");
|
|
20
|
-
const header = validate(backupHeader, json(parsed.header, "header"));
|
|
21
|
-
if (header === void 0) integrity("malformed header");
|
|
22
|
-
const factorKinds = parsed.factors.map((f) => f.kind);
|
|
23
|
-
if (factorKinds.filter((k) => k === "password").length > 1) integrity("at most one password factor");
|
|
24
|
-
return {
|
|
25
|
-
version: 1,
|
|
26
|
-
createdAt: parsed.createdAt,
|
|
27
|
-
wallets: header.wallets,
|
|
28
|
-
factorKinds
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
export { WalletError, parseBackupHeader };
|
|
32
|
-
|
|
33
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
import { HARDWARE_DEVICES, WalletError } from "./types.mjs";
|
|
2
|
+
import { n as parseBackupHeader } from "./backup-CLzMs8DP.mjs";
|
|
3
|
+
export { HARDWARE_DEVICES, WalletError, parseBackupHeader };
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { WalletError } from "./types.mjs";
|
|
2
2
|
// src/internal.ts
|
|
3
|
-
/**
|
|
4
|
-
* Channel internals shared between the core Wallet and the protocol subpath modules
|
|
5
|
-
* (@qntx/wallet/nostr, later spark/chains). This file is NOT a package subpath — modules look a
|
|
6
|
-
* Wallet up in the WeakMap, so a foreign object has no channel to reach.
|
|
7
|
-
*/
|
|
8
3
|
const internals = /* @__PURE__ */ new WeakMap();
|
|
9
4
|
function registerInternals(wallet, value) {
|
|
10
5
|
internals.set(wallet, value);
|
|
@@ -21,4 +16,4 @@ function internalsOf(wallet) {
|
|
|
21
16
|
}
|
|
22
17
|
export { registerInternals as n, internalsOf as t };
|
|
23
18
|
|
|
24
|
-
//# sourceMappingURL=internal-
|
|
19
|
+
//# sourceMappingURL=internal-DwCus_Ws.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-DwCus_Ws.mjs","names":[],"sources":["../src/internal.ts"],"sourcesContent":["/**\n * Channel internals shared between the core Wallet and the protocol subpath modules\n * (@qntx/wallet/nostr, later spark/chains). This file is NOT a package subpath — modules look a\n * Wallet up in the WeakMap, so a foreign object has no channel to reach.\n */\nimport type { PlainMethod, SecretMethod, SecretWire } from \"./factors.ts\";\nimport type {\n ParamsOf,\n ResultOf,\n SignedEvent,\n VerifyFactor as WireVerifyFactor,\n} from \"./protocol/index.ts\";\nimport { WalletError } from \"./types.ts\";\nimport type { VerifyFactor, Wallet, WalletSnapshot } from \"./types.ts\";\n\nexport type WalletInternals = {\n /** One validated request whose params carry no secret bytes. */\n readonly call: <M extends PlainMethod>(method: M, params: ParamsOf<M>) => Promise<ResultOf<M>>;\n /**\n * One validated request whose params carry secret bytes: `build` places them on a fresh wire; the\n * wire is wiped when build throws and otherwise travels or is wiped inside the channel.\n */\n readonly secretCall: <M extends SecretMethod>(\n method: M,\n build: (wire: SecretWire) => ParamsOf<M> | Promise<ParamsOf<M>>,\n ) => Promise<ResultOf<M>>;\n /** The live kernel port's first-status gate — re-read per call (a respawn replaces it). */\n readonly ready: () => Promise<void>;\n readonly snapshot: () => WalletSnapshot;\n /** The host-injected event verifier: the wallet never binds a signing backend itself. */\n readonly verifyEvent: (event: SignedEvent) => boolean;\n /** Marks a user verification in flight on the snapshot (`verifying`). */\n readonly withVerifying: <T>(fn: () => Promise<T>) => Promise<T>;\n /** Public VerifyFactor → wire factor material; a device factor is invalid-input. */\n readonly resolveVerifyFactor: (\n factor: VerifyFactor,\n wire: SecretWire,\n ) => Promise<WireVerifyFactor>;\n};\n\nconst internals = new WeakMap<Wallet, WalletInternals>();\n\nexport function registerInternals(wallet: Wallet, value: WalletInternals): void {\n internals.set(wallet, value);\n}\n\n/**\n * The internals behind a Wallet from this package — or `invalid-input` for anything else. A foreign\n * object can imitate the Wallet shape but can never hold the channel: modules that look it up here\n * get a closed failure, not a crafted kernel.\n */\nexport function internalsOf(wallet: Wallet): WalletInternals {\n const found = internals.get(wallet);\n if (found === undefined) {\n throw new WalletError(\"invalid-input\", \"not a Wallet from @qntx/wallet\");\n }\n return found;\n}\n"],"mappings":";;AAwCA,MAAM,4BAAY,IAAI,QAAiC;AAEvD,SAAgB,kBAAkB,QAAgB,OAA8B;CAC9E,UAAU,IAAI,QAAQ,KAAK;AAC7B;;;;;;AAOA,SAAgB,YAAY,QAAiC;CAC3D,MAAM,QAAQ,UAAU,IAAI,MAAM;CAClC,IAAI,UAAU,KAAA,GACZ,MAAM,IAAI,YAAY,iBAAiB,gCAAgC;CAEzE,OAAO;AACT"}
|
package/dist/nostr.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as VerifyFactor, N as WalletErrorCode, S as NostrKeyRef, c as DerivedNostrKey, j as Wallet, u as ExportedSecret, x as NostrKeyInfo } from "./types-CRnacSqJ.mjs";
|
|
2
2
|
import { Event, NostrSigner, UnsignedEvent } from "@qntx/nostr";
|
|
3
3
|
import { Rumor } from "@qntx/nostr/nips/nip59";
|
|
4
4
|
type NostrUnwrapResult = {
|
|
@@ -37,7 +37,7 @@ type NostrApi = {
|
|
|
37
37
|
readonly deriveKey: (walletId: string, index: number) => Promise<NostrKeyInfo>;
|
|
38
38
|
readonly removeKey: (ref: NostrKeyRef) => Promise<void>;
|
|
39
39
|
/** One-shot key export; requires re-verification every call. */
|
|
40
|
-
readonly exportKey: (ref: NostrKeyRef, format: NostrExportKeyFormat, verify:
|
|
40
|
+
readonly exportKey: (ref: NostrKeyRef, format: NostrExportKeyFormat, verify: VerifyFactor) => Promise<ExportedSecret>;
|
|
41
41
|
};
|
|
42
42
|
export declare function nostr(wallet: Wallet): NostrApi;
|
|
43
43
|
export type { DerivedNostrKey, NostrApi, NostrExportKeyFormat, NostrKeyInfo, NostrKeyRef, NostrUnwrapResult, WalletSigner, WalletSyncSigner };
|
package/dist/nostr.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WalletError } from "./types.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { t as internalsOf } from "./internal-DwCus_Ws.mjs";
|
|
3
|
+
import { r as integrity } from "./channel-BCZXU3pt.mjs";
|
|
4
|
+
import { t as SingleUseSecret } from "./secret-CbjbY5-f.mjs";
|
|
5
5
|
import { signedMatchesUnsigned } from "@qntx/nostr";
|
|
6
6
|
// src/nostr/signer.ts
|
|
7
7
|
/**
|
|
@@ -161,17 +161,17 @@ function createNostrApi(internals) {
|
|
|
161
161
|
},
|
|
162
162
|
exportKey: async (ref, format, verify) => internals.withVerifying(async () => {
|
|
163
163
|
const { publicKey } = keyInfoOf(internals, ref);
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
164
|
+
const bytes = await internals.secretCall("nostr.exportKey", async (wire) => {
|
|
165
|
+
const wireFormat = format.kind === "nsec" ? { kind: "nsec" } : {
|
|
166
|
+
kind: "ncryptsec",
|
|
167
|
+
password: wire.text(format.password)
|
|
168
|
+
};
|
|
169
|
+
return {
|
|
170
|
+
verify: await internals.resolveVerifyFactor(verify, wire),
|
|
171
|
+
publicKey,
|
|
172
|
+
format: wireFormat
|
|
173
|
+
};
|
|
174
|
+
});
|
|
175
175
|
return new SingleUseSecret(bytes);
|
|
176
176
|
})
|
|
177
177
|
};
|
package/dist/nostr.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nostr.mjs","names":[],"sources":["../src/nostr/signer.ts","../src/nostr/index.ts"],"sourcesContent":["/**\n * The proxy NostrSigner: the ref resolves against the CURRENT snapshot at every call, so the same\n * signer object keeps working across lock/unlock and worker respawns. Returned events are checked\n * against the request — a compromised kernel cannot make a valid signature over different content\n * pass as the requested event.\n */\nimport { signedMatchesUnsigned } from \"@qntx/nostr\";\nimport type { UnsignedEvent } from \"@qntx/nostr\";\nimport type { Rumor } from \"@qntx/nostr/nips/nip59\";\n\nimport { integrity } from \"../channel.ts\";\nimport type { WalletInternals } from \"../internal.ts\";\nimport { MAX_BATCH } from \"../protocol/core.ts\";\nimport type { UnsignedEventInput } from \"../protocol/index.ts\";\nimport { WalletError } from \"../types.ts\";\nimport type { NostrKeyInfo, NostrKeyRef } from \"../types.ts\";\nimport type { WalletSigner, WalletSyncSigner } from \"./types.ts\";\n\n/** Resolves a public ref to its stored key record; missing refs are `not-found`. */\nexport function keyInfoOf(internals: WalletInternals, ref: NostrKeyRef): NostrKeyInfo {\n const info = internals.snapshot().nostr.keys.find((key) => {\n const k = key.ref;\n return ref.kind === \"derived\" && k.walletId === ref.walletId && k.index === ref.index;\n });\n if (info === undefined) {\n throw new WalletError(\"not-found\", \"no such nostr key\");\n }\n return info;\n}\n\nexport function proxySigner(ref: NostrKeyRef, internals: WalletInternals): WalletSigner {\n const resolvePublicKey = (): string => keyInfoOf(internals, ref).publicKey;\n return {\n getPublicKey: async () => {\n await internals.ready();\n return resolvePublicKey();\n },\n signEvent: async (unsigned) => {\n const publicKey = resolvePublicKey();\n // An absent pubkey must stay absent: `pubkey: undefined` is not a ProtocolValue and the\n // kernel would reject the params outright.\n const event: UnsignedEventInput =\n unsigned.pubkey === undefined\n ? {\n kind: unsigned.kind,\n created_at: unsigned.created_at,\n tags: unsigned.tags,\n content: unsigned.content,\n }\n : {\n kind: unsigned.kind,\n created_at: unsigned.created_at,\n tags: unsigned.tags,\n content: unsigned.content,\n pubkey: unsigned.pubkey,\n };\n const signed = await internals.call(\"nostr.signEvent\", { publicKey, event });\n // The kernel output must be the requested event, signed by the expected key.\n const requested: UnsignedEvent = {\n kind: unsigned.kind,\n created_at: unsigned.created_at,\n tags: unsigned.tags,\n content: unsigned.content,\n pubkey: publicKey,\n };\n if (\n signed.pubkey !== publicKey ||\n !signedMatchesUnsigned(signed, requested) ||\n !internals.verifyEvent(signed)\n ) {\n throw integrity(\"the kernel returned a forged event\");\n }\n return signed;\n },\n nip04Encrypt: async (peer, plaintext) =>\n internals.call(\"nostr.nip04Encrypt\", {\n publicKey: resolvePublicKey(),\n peer,\n text: plaintext,\n }),\n nip04Decrypt: async (peer, ciphertext) =>\n internals.call(\"nostr.nip04Decrypt\", {\n publicKey: resolvePublicKey(),\n peer,\n text: ciphertext,\n }),\n nip44Encrypt: async (peer, plaintext) =>\n internals.call(\"nostr.nip44Encrypt\", {\n publicKey: resolvePublicKey(),\n peer,\n text: plaintext,\n }),\n nip44Decrypt: async (peer, payload) =>\n internals.call(\"nostr.nip44Decrypt\", {\n publicKey: resolvePublicKey(),\n peer,\n text: payload,\n }),\n unwrapGiftWraps: async (events) => {\n if (events.length === 0) {\n return [];\n }\n const publicKey = resolvePublicKey();\n const results: Array<Rumor | Error> = [];\n // The wire caps one batch at MAX_BATCH; chunk sequentially and concatenate in order —\n // other requests can interleave between chunks.\n for (let start = 0; start < events.length; start += MAX_BATCH) {\n // oxlint-disable-next-line eslint/no-await-in-loop -- sequential on purpose: chunks round-trip in order\n const batch = await internals.call(\"nostr.unwrapGiftWraps\", {\n publicKey,\n events: events.slice(start, start + MAX_BATCH),\n });\n for (const r of batch.results) {\n results.push(\"ok\" in r ? r.ok : new Error(r.err));\n }\n }\n return results;\n },\n };\n}\n\n/**\n * The wallet metadata sync signer (WD-076): the key lives at the reserved NIP-06 segment and is\n * sealed by `nostr.syncKey` on first use, so `getPublicKey` both returns and creates it. Signed\n * events pass the same forged-event check as `proxySigner`.\n */\nexport function syncSigner(walletId: string, internals: WalletInternals): WalletSyncSigner {\n let cached: string | undefined;\n const publicKey = async (): Promise<string> => {\n if (cached === undefined) {\n const resolved = await internals.call(\"nostr.syncKey\", { walletId });\n cached = resolved.publicKey;\n }\n return cached;\n };\n return {\n getPublicKey: publicKey,\n signEvent: async (unsigned) => {\n const expected = await publicKey();\n const event: UnsignedEventInput = {\n kind: unsigned.kind,\n created_at: unsigned.created_at,\n tags: unsigned.tags,\n content: unsigned.content,\n };\n const signed = await internals.call(\"nostr.syncSign\", { walletId, event });\n const requested: UnsignedEvent = {\n kind: unsigned.kind,\n created_at: unsigned.created_at,\n tags: unsigned.tags,\n content: unsigned.content,\n pubkey: expected,\n };\n if (\n signed.pubkey !== expected ||\n !signedMatchesUnsigned(signed, requested) ||\n !internals.verifyEvent(signed)\n ) {\n throw integrity(\"the kernel returned a forged event\");\n }\n return signed;\n },\n encrypt: async (text) => internals.call(\"nostr.syncEncrypt\", { walletId, text }),\n decrypt: async (payload) => internals.call(\"nostr.syncDecrypt\", { walletId, text: payload }),\n };\n}\n","/**\n * The nostr module of @qntx/wallet: `nostr(wallet)` returns the wallet's Nostr API — signer\n * proxies, key discovery/derivation/derivation, guarded export and removal. The API is memoized per\n * wallet so repeated calls return the same object (stable React identity); a foreign object is\n * rejected because only a Wallet from this package holds a registered channel.\n */\nimport { wireSecretText } from \"../factors.ts\";\nimport { internalsOf } from \"../internal.ts\";\nimport type { WalletInternals } from \"../internal.ts\";\nimport { SingleUseSecret } from \"../secret.ts\";\nimport type {\n DerivedNostrKey,\n ExportedSecret,\n NostrKeyInfo,\n NostrKeyRef,\n UnlockFactor,\n Wallet,\n} from \"../types.ts\";\nimport { keyInfoOf, proxySigner, syncSigner } from \"./signer.ts\";\nimport type { NostrApi, NostrExportKeyFormat, WalletSigner, WalletSyncSigner } from \"./types.ts\";\n\nexport type {\n DerivedNostrKey,\n NostrApi,\n NostrExportKeyFormat,\n NostrKeyInfo,\n NostrKeyRef,\n NostrUnwrapResult,\n WalletSigner,\n WalletSyncSigner,\n} from \"./types.ts\";\n\nfunction createNostrApi(internals: WalletInternals): NostrApi {\n return {\n signer: (ref: NostrKeyRef): WalletSigner => proxySigner(ref, internals),\n\n syncSigner: (walletId: string): WalletSyncSigner => syncSigner(walletId, internals),\n\n discover: async (\n walletId: string,\n from: number,\n count: number,\n ): Promise<ReadonlyArray<DerivedNostrKey>> => {\n const result = await internals.call(\"nostr.discover\", { walletId, from, count });\n return result.keys;\n },\n\n deriveKey: async (walletId: string, index: number): Promise<NostrKeyInfo> =>\n internals.call(\"nostr.deriveKey\", { walletId, index }),\n\n removeKey: async (ref: NostrKeyRef): Promise<void> => {\n await internals.call(\"nostr.removeKey\", {\n publicKey: keyInfoOf(internals, ref).publicKey,\n });\n },\n\n exportKey: async (\n ref: NostrKeyRef,\n format: NostrExportKeyFormat,\n verify: UnlockFactor,\n ): Promise<ExportedSecret> =>\n internals.withVerifying(async () => {\n const { publicKey } = keyInfoOf(internals, ref);\n const transfer: ArrayBuffer[] = [];\n const wireVerify = await internals.resolveFactor(verify, transfer);\n const wireFormat =\n format.kind === \"nsec\"\n ? { kind: \"nsec\" as const }\n : {\n kind: \"ncryptsec\" as const,\n password: wireSecretText(format.password, transfer),\n };\n const bytes = await internals.call(\n \"nostr.exportKey\",\n { verify: wireVerify, publicKey, format: wireFormat },\n transfer,\n );\n return new SingleUseSecret(bytes);\n }),\n };\n}\n\nconst apis = new WeakMap<Wallet, NostrApi>();\n\nexport function nostr(wallet: Wallet): NostrApi {\n const internals = internalsOf(wallet);\n let api = apis.get(wallet);\n if (api === undefined) {\n api = createNostrApi(internals);\n apis.set(wallet, api);\n }\n return api;\n}\n"],"mappings":";;;;;;;;;;;;;AAmBA,SAAg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AM,eAAe,SAAS;EAC9B,KAAK,IAAI,QAAQ,GAAG;CACtB;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"nostr.mjs","names":[],"sources":["../src/nostr/signer.ts","../src/nostr/index.ts"],"sourcesContent":["/**\n * The proxy NostrSigner: the ref resolves against the CURRENT snapshot at every call, so the same\n * signer object keeps working across lock/unlock and worker respawns. Returned events are checked\n * against the request — a compromised kernel cannot make a valid signature over different content\n * pass as the requested event.\n */\nimport { signedMatchesUnsigned } from \"@qntx/nostr\";\nimport type { UnsignedEvent } from \"@qntx/nostr\";\nimport type { Rumor } from \"@qntx/nostr/nips/nip59\";\n\nimport { integrity } from \"../channel.ts\";\nimport type { WalletInternals } from \"../internal.ts\";\nimport { MAX_BATCH } from \"../protocol/core.ts\";\nimport type { UnsignedEventInput } from \"../protocol/index.ts\";\nimport { WalletError } from \"../types.ts\";\nimport type { NostrKeyInfo, NostrKeyRef } from \"../types.ts\";\nimport type { WalletSigner, WalletSyncSigner } from \"./types.ts\";\n\n/** Resolves a public ref to its stored key record; missing refs are `not-found`. */\nexport function keyInfoOf(internals: WalletInternals, ref: NostrKeyRef): NostrKeyInfo {\n const info = internals.snapshot().nostr.keys.find((key) => {\n const k = key.ref;\n return ref.kind === \"derived\" && k.walletId === ref.walletId && k.index === ref.index;\n });\n if (info === undefined) {\n throw new WalletError(\"not-found\", \"no such nostr key\");\n }\n return info;\n}\n\nexport function proxySigner(ref: NostrKeyRef, internals: WalletInternals): WalletSigner {\n const resolvePublicKey = (): string => keyInfoOf(internals, ref).publicKey;\n return {\n getPublicKey: async () => {\n await internals.ready();\n return resolvePublicKey();\n },\n signEvent: async (unsigned) => {\n const publicKey = resolvePublicKey();\n // An absent pubkey must stay absent: `pubkey: undefined` is not a ProtocolValue and the\n // kernel would reject the params outright.\n const event: UnsignedEventInput =\n unsigned.pubkey === undefined\n ? {\n kind: unsigned.kind,\n created_at: unsigned.created_at,\n tags: unsigned.tags,\n content: unsigned.content,\n }\n : {\n kind: unsigned.kind,\n created_at: unsigned.created_at,\n tags: unsigned.tags,\n content: unsigned.content,\n pubkey: unsigned.pubkey,\n };\n const signed = await internals.call(\"nostr.signEvent\", { publicKey, event });\n // The kernel output must be the requested event, signed by the expected key.\n const requested: UnsignedEvent = {\n kind: unsigned.kind,\n created_at: unsigned.created_at,\n tags: unsigned.tags,\n content: unsigned.content,\n pubkey: publicKey,\n };\n if (\n signed.pubkey !== publicKey ||\n !signedMatchesUnsigned(signed, requested) ||\n !internals.verifyEvent(signed)\n ) {\n throw integrity(\"the kernel returned a forged event\");\n }\n return signed;\n },\n nip04Encrypt: async (peer, plaintext) =>\n internals.call(\"nostr.nip04Encrypt\", {\n publicKey: resolvePublicKey(),\n peer,\n text: plaintext,\n }),\n nip04Decrypt: async (peer, ciphertext) =>\n internals.call(\"nostr.nip04Decrypt\", {\n publicKey: resolvePublicKey(),\n peer,\n text: ciphertext,\n }),\n nip44Encrypt: async (peer, plaintext) =>\n internals.call(\"nostr.nip44Encrypt\", {\n publicKey: resolvePublicKey(),\n peer,\n text: plaintext,\n }),\n nip44Decrypt: async (peer, payload) =>\n internals.call(\"nostr.nip44Decrypt\", {\n publicKey: resolvePublicKey(),\n peer,\n text: payload,\n }),\n unwrapGiftWraps: async (events) => {\n if (events.length === 0) {\n return [];\n }\n const publicKey = resolvePublicKey();\n const results: Array<Rumor | Error> = [];\n // The wire caps one batch at MAX_BATCH; chunk sequentially and concatenate in order —\n // other requests can interleave between chunks.\n for (let start = 0; start < events.length; start += MAX_BATCH) {\n // oxlint-disable-next-line eslint/no-await-in-loop -- sequential on purpose: chunks round-trip in order\n const batch = await internals.call(\"nostr.unwrapGiftWraps\", {\n publicKey,\n events: events.slice(start, start + MAX_BATCH),\n });\n for (const r of batch.results) {\n results.push(\"ok\" in r ? r.ok : new Error(r.err));\n }\n }\n return results;\n },\n };\n}\n\n/**\n * The wallet metadata sync signer (WD-076): the key lives at the reserved NIP-06 segment and is\n * sealed by `nostr.syncKey` on first use, so `getPublicKey` both returns and creates it. Signed\n * events pass the same forged-event check as `proxySigner`.\n */\nexport function syncSigner(walletId: string, internals: WalletInternals): WalletSyncSigner {\n let cached: string | undefined;\n const publicKey = async (): Promise<string> => {\n if (cached === undefined) {\n const resolved = await internals.call(\"nostr.syncKey\", { walletId });\n cached = resolved.publicKey;\n }\n return cached;\n };\n return {\n getPublicKey: publicKey,\n signEvent: async (unsigned) => {\n const expected = await publicKey();\n const event: UnsignedEventInput = {\n kind: unsigned.kind,\n created_at: unsigned.created_at,\n tags: unsigned.tags,\n content: unsigned.content,\n };\n const signed = await internals.call(\"nostr.syncSign\", { walletId, event });\n const requested: UnsignedEvent = {\n kind: unsigned.kind,\n created_at: unsigned.created_at,\n tags: unsigned.tags,\n content: unsigned.content,\n pubkey: expected,\n };\n if (\n signed.pubkey !== expected ||\n !signedMatchesUnsigned(signed, requested) ||\n !internals.verifyEvent(signed)\n ) {\n throw integrity(\"the kernel returned a forged event\");\n }\n return signed;\n },\n encrypt: async (text) => internals.call(\"nostr.syncEncrypt\", { walletId, text }),\n decrypt: async (payload) => internals.call(\"nostr.syncDecrypt\", { walletId, text: payload }),\n };\n}\n","/**\n * The nostr module of @qntx/wallet: `nostr(wallet)` returns the wallet's Nostr API — signer\n * proxies, key discovery/derivation/derivation, guarded export and removal. The API is memoized per\n * wallet so repeated calls return the same object (stable React identity); a foreign object is\n * rejected because only a Wallet from this package holds a registered channel.\n */\nimport { internalsOf } from \"../internal.ts\";\nimport type { WalletInternals } from \"../internal.ts\";\nimport { SingleUseSecret } from \"../secret.ts\";\nimport type {\n DerivedNostrKey,\n ExportedSecret,\n NostrKeyInfo,\n NostrKeyRef,\n VerifyFactor,\n Wallet,\n} from \"../types.ts\";\nimport { keyInfoOf, proxySigner, syncSigner } from \"./signer.ts\";\nimport type { NostrApi, NostrExportKeyFormat, WalletSigner, WalletSyncSigner } from \"./types.ts\";\n\nexport type {\n DerivedNostrKey,\n NostrApi,\n NostrExportKeyFormat,\n NostrKeyInfo,\n NostrKeyRef,\n NostrUnwrapResult,\n WalletSigner,\n WalletSyncSigner,\n} from \"./types.ts\";\n\nfunction createNostrApi(internals: WalletInternals): NostrApi {\n return {\n signer: (ref: NostrKeyRef): WalletSigner => proxySigner(ref, internals),\n\n syncSigner: (walletId: string): WalletSyncSigner => syncSigner(walletId, internals),\n\n discover: async (\n walletId: string,\n from: number,\n count: number,\n ): Promise<ReadonlyArray<DerivedNostrKey>> => {\n const result = await internals.call(\"nostr.discover\", { walletId, from, count });\n return result.keys;\n },\n\n deriveKey: async (walletId: string, index: number): Promise<NostrKeyInfo> =>\n internals.call(\"nostr.deriveKey\", { walletId, index }),\n\n removeKey: async (ref: NostrKeyRef): Promise<void> => {\n await internals.call(\"nostr.removeKey\", {\n publicKey: keyInfoOf(internals, ref).publicKey,\n });\n },\n\n exportKey: async (\n ref: NostrKeyRef,\n format: NostrExportKeyFormat,\n verify: VerifyFactor,\n ): Promise<ExportedSecret> =>\n internals.withVerifying(async () => {\n const { publicKey } = keyInfoOf(internals, ref);\n const bytes = await internals.secretCall(\"nostr.exportKey\", async (wire) => {\n const wireFormat =\n format.kind === \"nsec\"\n ? { kind: \"nsec\" as const }\n : {\n kind: \"ncryptsec\" as const,\n password: wire.text(format.password),\n };\n return {\n verify: await internals.resolveVerifyFactor(verify, wire),\n publicKey,\n format: wireFormat,\n };\n });\n return new SingleUseSecret(bytes);\n }),\n };\n}\n\nconst apis = new WeakMap<Wallet, NostrApi>();\n\nexport function nostr(wallet: Wallet): NostrApi {\n const internals = internalsOf(wallet);\n let api = apis.get(wallet);\n if (api === undefined) {\n api = createNostrApi(internals);\n apis.set(wallet, api);\n }\n return api;\n}\n"],"mappings":";;;;;;;;;;;;;AAmBA,SAAgB,UAAU,WAA4B,KAAgC;CACpF,MAAM,OAAO,UAAU,SAAS,CAAC,CAAC,MAAM,KAAK,MAAM,QAAQ;EACzD,MAAM,IAAI,IAAI;EACd,OAAO,IAAI,SAAS,aAAa,EAAE,aAAa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