@qntx/wallet 0.1.0 → 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/dist/host.d.mts +2 -2
- package/dist/{index-0nfJuuWM.d.mts → index-BJfyIwOZ.d.mts} +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/nostr.d.mts +1 -1
- package/dist/protocol.d.mts +2 -2
- package/dist/{types-DXNdAt_L.d.mts → types-CEy7At1l.d.mts} +2 -7
- package/dist/types.d.mts +2 -2
- package/dist/types.mjs.map +1 -1
- package/package.json +1 -1
package/dist/host.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as PasskeyConfig, h as Wallet } from "./types-
|
|
2
|
-
import { l as ProtocolValue } from "./index-
|
|
1
|
+
import { d as PasskeyConfig, h as Wallet } from "./types-CEy7At1l.mjs";
|
|
2
|
+
import { l as ProtocolValue } from "./index-BJfyIwOZ.mjs";
|
|
3
3
|
//#region src/channel.d.ts
|
|
4
4
|
/** The host packages' side of the kernel channel (worker, JSI runtime, in-process test port). */
|
|
5
5
|
type MainPort = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as WalletErrorCode, a as FactorInfo, f as StatusPayload, l as NostrKeyInfo, r as DerivedNostrKey, s as LockReason, v as WalletInfo } from "./types-
|
|
1
|
+
import { _ as WalletErrorCode, a as FactorInfo, f as StatusPayload, l as NostrKeyInfo, r as DerivedNostrKey, s as LockReason, v as WalletInfo } from "./types-CEy7At1l.mjs";
|
|
2
2
|
//#region src/protocol/validate.d.ts
|
|
3
3
|
declare class ValidationError extends Error {
|
|
4
4
|
name: string;
|
|
@@ -283,4 +283,4 @@ declare const responseError: Validator<{
|
|
|
283
283
|
}>;
|
|
284
284
|
//#endregion
|
|
285
285
|
export { Validator as A, union as B, UnsignedEventInput as C, Factor as D, CreatedResult as E, literal as F, nullValue as I, obj as L, bool as M, bytes as N, MethodSpec as O, int as P, opt as R, SignedEvent as S, CORE_METHODS as T, validate as V, KeyResult as _, MethodTablesDisjoint as a, NostrImportInput as b, ParamsOf as c, Response as d, ResultOf as f, responseError as g, kernelEvent as h, MethodName as i, arr as j, ValidationError as k, ProtocolValue as l, isProtocolValue as m, KernelEvent as n, NullValue as o, UNATTRIBUTED_ID as p, METHODS as r, PROTOCOL_VERSION as s, ErrorPayload as t, Request as u, NOSTR_METHODS as v, UnwrapResult as w, Rumor as x, NostrExportFormat as y, str as z };
|
|
286
|
-
//# sourceMappingURL=index-
|
|
286
|
+
//# sourceMappingURL=index-BJfyIwOZ.d.mts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { type AutoLockPolicy, type DataKeyApi, type DerivedNostrKey, type ExportedSecret, type FactorInfo, type InitialFactor, type LockReason, type MnemonicDraft, type NostrKeyInfo, type NostrKeyRef, type PasskeyConfig, type StatusPayload, type UnlockFactor, type VaultApi, type Wallet, WalletError, type WalletErrorCode, type WalletInfo, type
|
|
1
|
+
import { _ as WalletErrorCode, a as FactorInfo, b as WalletSnapshot, c as MnemonicDraft, d as PasskeyConfig, f as StatusPayload, g as WalletError, h as Wallet, i as ExportedSecret, l as NostrKeyInfo, m as VaultApi, n as DataKeyApi, o as InitialFactor, p as UnlockFactor, r as DerivedNostrKey, s as LockReason, t as AutoLockPolicy, u as NostrKeyRef, v as WalletInfo, x as WalletsApi, y as WalletOptions } from "./types-CEy7At1l.mjs";
|
|
2
|
+
export { type AutoLockPolicy, type DataKeyApi, type DerivedNostrKey, type ExportedSecret, type FactorInfo, type InitialFactor, type LockReason, type MnemonicDraft, type NostrKeyInfo, type NostrKeyRef, type PasskeyConfig, type StatusPayload, type UnlockFactor, type VaultApi, type Wallet, WalletError, type WalletErrorCode, type WalletInfo, type WalletOptions, type WalletSnapshot, type WalletsApi };
|
package/dist/nostr.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as WalletErrorCode, h as Wallet, i as ExportedSecret, l as NostrKeyInfo, o as InitialFactor, p as UnlockFactor, r as DerivedNostrKey, u as NostrKeyRef } from "./types-
|
|
1
|
+
import { _ as WalletErrorCode, h as Wallet, i as ExportedSecret, l as NostrKeyInfo, o as InitialFactor, p as UnlockFactor, r as DerivedNostrKey, u as NostrKeyRef } from "./types-CEy7At1l.mjs";
|
|
2
2
|
import { Event, NostrSigner } from "@qntx/nostr";
|
|
3
3
|
import { Rumor } from "@qntx/nostr/nips/nip59";
|
|
4
4
|
//#region src/nostr/types.d.ts
|
package/dist/protocol.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as WalletErrorCode } from "./types-
|
|
2
|
-
import { A as Validator, B as union, C as UnsignedEventInput, D as Factor, E as CreatedResult, F as literal, I as nullValue, L as obj, M as bool, N as bytes, O as MethodSpec, P as int, R as opt, S as SignedEvent, T as CORE_METHODS, V as validate, _ as KeyResult, a as MethodTablesDisjoint, b as NostrImportInput, c as ParamsOf, d as Response, f as ResultOf, g as responseError, h as kernelEvent, i as MethodName, j as arr, k as ValidationError, l as ProtocolValue, m as isProtocolValue, n as KernelEvent, o as NullValue, p as UNATTRIBUTED_ID, r as METHODS, s as PROTOCOL_VERSION, t as ErrorPayload, u as Request, v as NOSTR_METHODS, w as UnwrapResult, x as Rumor, y as NostrExportFormat, z as str } from "./index-
|
|
1
|
+
import { _ as WalletErrorCode } from "./types-CEy7At1l.mjs";
|
|
2
|
+
import { A as Validator, B as union, C as UnsignedEventInput, D as Factor, E as CreatedResult, F as literal, I as nullValue, L as obj, M as bool, N as bytes, O as MethodSpec, P as int, R as opt, S as SignedEvent, T as CORE_METHODS, V as validate, _ as KeyResult, a as MethodTablesDisjoint, b as NostrImportInput, c as ParamsOf, d as Response, f as ResultOf, g as responseError, h as kernelEvent, i as MethodName, j as arr, k as ValidationError, l as ProtocolValue, m as isProtocolValue, n as KernelEvent, o as NullValue, p as UNATTRIBUTED_ID, r as METHODS, s as PROTOCOL_VERSION, t as ErrorPayload, u as Request, v as NOSTR_METHODS, w as UnwrapResult, x as Rumor, y as NostrExportFormat, z as str } from "./index-BJfyIwOZ.mjs";
|
|
3
3
|
export { CORE_METHODS, type CreatedResult, ErrorPayload, type Factor, KernelEvent, type KeyResult, METHODS, MethodName, type MethodSpec, MethodTablesDisjoint, NOSTR_METHODS, type NostrExportFormat, type NostrImportInput, NullValue, PROTOCOL_VERSION, ParamsOf, ProtocolValue, Request, Response, ResultOf, type Rumor, type SignedEvent, UNATTRIBUTED_ID, type UnsignedEventInput, type UnwrapResult, ValidationError, type Validator, type WalletErrorCode, arr, bool, bytes, int, isProtocolValue, kernelEvent, literal, nullValue, obj, opt, responseError, str, union, validate };
|
|
@@ -99,14 +99,9 @@ type AutoLockPolicy = {
|
|
|
99
99
|
readonly platform: "web";
|
|
100
100
|
readonly idleMinutes: 5 | 15 | 60;
|
|
101
101
|
};
|
|
102
|
-
/** Structured events only — never anything secret-bearing. */
|
|
103
|
-
type WalletLogger = (event: {
|
|
104
|
-
readonly name: string;
|
|
105
|
-
}) => void;
|
|
106
102
|
type WalletOptions = {
|
|
107
103
|
readonly passkey: PasskeyConfig;
|
|
108
104
|
readonly autoLock: AutoLockPolicy;
|
|
109
|
-
readonly logger?: WalletLogger;
|
|
110
105
|
};
|
|
111
106
|
type WalletSnapshot = {
|
|
112
107
|
readonly vault: "uninitialized" | "locked" | "unlocked" | "corrupted";
|
|
@@ -169,5 +164,5 @@ type Wallet = {
|
|
|
169
164
|
readonly destroy: () => Promise<void>;
|
|
170
165
|
};
|
|
171
166
|
//#endregion
|
|
172
|
-
export {
|
|
173
|
-
//# sourceMappingURL=types-
|
|
167
|
+
export { WalletErrorCode as _, FactorInfo as a, WalletSnapshot as b, MnemonicDraft as c, PasskeyConfig as d, StatusPayload as f, WalletError as g, Wallet as h, ExportedSecret as i, NostrKeyInfo as l, VaultApi as m, DataKeyApi as n, InitialFactor as o, UnlockFactor as p, DerivedNostrKey as r, LockReason as s, AutoLockPolicy as t, NostrKeyRef as u, WalletInfo as v, WalletsApi as x, WalletOptions as y };
|
|
168
|
+
//# sourceMappingURL=types-CEy7At1l.d.mts.map
|
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { AutoLockPolicy, DataKeyApi, DerivedNostrKey, ExportedSecret, FactorInfo, InitialFactor, LockReason, MnemonicDraft, NostrKeyInfo, NostrKeyRef, PasskeyConfig, StatusPayload, UnlockFactor, VaultApi, Wallet, WalletError, WalletErrorCode, WalletInfo,
|
|
1
|
+
import { _ as WalletErrorCode, a as FactorInfo, b as WalletSnapshot, c as MnemonicDraft, d as PasskeyConfig, f as StatusPayload, g as WalletError, h as Wallet, i as ExportedSecret, l as NostrKeyInfo, m as VaultApi, n as DataKeyApi, o as InitialFactor, p as UnlockFactor, r as DerivedNostrKey, s as LockReason, t as AutoLockPolicy, u as NostrKeyRef, v as WalletInfo, x as WalletsApi, y as WalletOptions } from "./types-CEy7At1l.mjs";
|
|
2
|
+
export { AutoLockPolicy, DataKeyApi, DerivedNostrKey, ExportedSecret, FactorInfo, InitialFactor, LockReason, MnemonicDraft, NostrKeyInfo, NostrKeyRef, PasskeyConfig, StatusPayload, UnlockFactor, VaultApi, Wallet, WalletError, WalletErrorCode, WalletInfo, WalletOptions, WalletSnapshot, WalletsApi };
|
package/dist/types.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["/** Public types of @qntx/wallet, per design/entry.mdx. Secret data never appears here. */\nexport type LockReason = \"cold-start\" | \"user\" | \"idle\" | \"background\" | \"expired\" | \"crashed\";\n\nexport type FactorInfo =\n | { readonly kind: \"hardware\" }\n | {\n readonly kind: \"passkey\";\n readonly id: string;\n /** Base64url, public data — the main side passes it as allowCredentials. */\n readonly credentialId: string;\n readonly createdAt: number;\n }\n | { readonly kind: \"password\"; readonly id: string; readonly createdAt: number };\n\nexport type WalletInfo = {\n readonly walletId: string;\n readonly origin: \"passkey\" | \"mnemonic\";\n readonly words: 12 | 15 | 18 | 21 | 24;\n readonly backedUp: boolean;\n readonly createdAt: number;\n};\n\nexport type NostrKeyRef =\n | { readonly kind: \"derived\"; readonly walletId: string; readonly groupIndex: number }\n | { readonly kind: \"standalone\"; readonly id: string }\n | { readonly kind: \"nip46-client\"; readonly id: string };\n\nexport type NostrKeyInfo = {\n readonly ref: NostrKeyRef;\n readonly publicKey: string; // 64 lowercase hex\n readonly origin: \"derived\" | \"nsec\" | \"ncryptsec\" | \"generated\" | \"nip46-client\";\n readonly createdAt: number;\n};\n\n/** One entry of a `nostr.discover` result: the public key an account group would produce. */\nexport type DerivedNostrKey = { readonly groupIndex: number; readonly publicKey: string };\n\nexport type WalletErrorCode =\n | \"locked\"\n | \"cancelled\"\n | \"factor-unavailable\"\n | \"factor-invalidated\"\n | \"wrong-password\"\n | \"rate-limited\"\n | \"invalid-input\"\n | \"not-found\"\n | \"already-exists\"\n | \"integrity\"\n | \"crashed\";\n\n/**\n * `status` result / status event payload. Locked snapshots come from unauthenticated headers;\n * \"corrupted\" means the vault data itself failed to load or verify (reset is the only way out).\n * Each protocol module contributes one section (here: `nostr`).\n */\nexport type StatusPayload = {\n readonly protocol: 1;\n readonly vault: \"uninitialized\" | \"locked\" | \"unlocked\" | \"corrupted\";\n readonly factors: ReadonlyArray<FactorInfo>;\n readonly wallets: ReadonlyArray<WalletInfo>;\n readonly nostr: { readonly keys: ReadonlyArray<NostrKeyInfo> };\n};\n\n/** One error class for the whole API; `code` carries the distinction. Messages never echo input. */\nexport class WalletError extends Error {\n readonly code: WalletErrorCode;\n readonly retryAt: number | undefined;\n\n constructor(code: WalletErrorCode, message: string, retryAt?: number) {\n super(message);\n this.name = \"WalletError\";\n this.code = code;\n this.retryAt = retryAt;\n }\n}\n\n/** A factor the user proves again for a guarded operation (Web/Node). */\nexport type UnlockFactor =\n | { readonly kind: \"passkey\" }\n | { readonly kind: \"password\"; readonly password: string };\n\n/**\n * A factor being created; `hardware` exists only on React Native. `name` is the passkey\n * credential's display name — the host validates it before the ceremony (1–64 characters).\n */\nexport type InitialFactor =\n | { readonly kind: \"hardware\" }\n | { readonly kind: \"passkey\"; readonly name: string }\n | { readonly kind: \"password\"; readonly password: string };\n\n/** WebAuthn RP identity + PRF salt labels the host configures once (distinct strings). */\nexport type PasskeyConfig = {\n /** RP id — the origin's effective domain or a registrable parent of it (e.g. meowl.social). */\n readonly rpId: string;\n readonly rpName: string;\n readonly walletSalt: string;\n readonly vaultSalt: string;\n};\n\nexport type AutoLockPolicy =\n | { readonly platform: \"native\"; readonly backgroundSeconds: 0 | 60 | 300 | 900 }\n | { readonly platform: \"web\"; readonly idleMinutes: 5 | 15 | 60 };\n\
|
|
1
|
+
{"version":3,"file":"types.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["/** Public types of @qntx/wallet, per design/entry.mdx. Secret data never appears here. */\nexport type LockReason = \"cold-start\" | \"user\" | \"idle\" | \"background\" | \"expired\" | \"crashed\";\n\nexport type FactorInfo =\n | { readonly kind: \"hardware\" }\n | {\n readonly kind: \"passkey\";\n readonly id: string;\n /** Base64url, public data — the main side passes it as allowCredentials. */\n readonly credentialId: string;\n readonly createdAt: number;\n }\n | { readonly kind: \"password\"; readonly id: string; readonly createdAt: number };\n\nexport type WalletInfo = {\n readonly walletId: string;\n readonly origin: \"passkey\" | \"mnemonic\";\n readonly words: 12 | 15 | 18 | 21 | 24;\n readonly backedUp: boolean;\n readonly createdAt: number;\n};\n\nexport type NostrKeyRef =\n | { readonly kind: \"derived\"; readonly walletId: string; readonly groupIndex: number }\n | { readonly kind: \"standalone\"; readonly id: string }\n | { readonly kind: \"nip46-client\"; readonly id: string };\n\nexport type NostrKeyInfo = {\n readonly ref: NostrKeyRef;\n readonly publicKey: string; // 64 lowercase hex\n readonly origin: \"derived\" | \"nsec\" | \"ncryptsec\" | \"generated\" | \"nip46-client\";\n readonly createdAt: number;\n};\n\n/** One entry of a `nostr.discover` result: the public key an account group would produce. */\nexport type DerivedNostrKey = { readonly groupIndex: number; readonly publicKey: string };\n\nexport type WalletErrorCode =\n | \"locked\"\n | \"cancelled\"\n | \"factor-unavailable\"\n | \"factor-invalidated\"\n | \"wrong-password\"\n | \"rate-limited\"\n | \"invalid-input\"\n | \"not-found\"\n | \"already-exists\"\n | \"integrity\"\n | \"crashed\";\n\n/**\n * `status` result / status event payload. Locked snapshots come from unauthenticated headers;\n * \"corrupted\" means the vault data itself failed to load or verify (reset is the only way out).\n * Each protocol module contributes one section (here: `nostr`).\n */\nexport type StatusPayload = {\n readonly protocol: 1;\n readonly vault: \"uninitialized\" | \"locked\" | \"unlocked\" | \"corrupted\";\n readonly factors: ReadonlyArray<FactorInfo>;\n readonly wallets: ReadonlyArray<WalletInfo>;\n readonly nostr: { readonly keys: ReadonlyArray<NostrKeyInfo> };\n};\n\n/** One error class for the whole API; `code` carries the distinction. Messages never echo input. */\nexport class WalletError extends Error {\n readonly code: WalletErrorCode;\n readonly retryAt: number | undefined;\n\n constructor(code: WalletErrorCode, message: string, retryAt?: number) {\n super(message);\n this.name = \"WalletError\";\n this.code = code;\n this.retryAt = retryAt;\n }\n}\n\n/** A factor the user proves again for a guarded operation (Web/Node). */\nexport type UnlockFactor =\n | { readonly kind: \"passkey\" }\n | { readonly kind: \"password\"; readonly password: string };\n\n/**\n * A factor being created; `hardware` exists only on React Native. `name` is the passkey\n * credential's display name — the host validates it before the ceremony (1–64 characters).\n */\nexport type InitialFactor =\n | { readonly kind: \"hardware\" }\n | { readonly kind: \"passkey\"; readonly name: string }\n | { readonly kind: \"password\"; readonly password: string };\n\n/** WebAuthn RP identity + PRF salt labels the host configures once (distinct strings). */\nexport type PasskeyConfig = {\n /** RP id — the origin's effective domain or a registrable parent of it (e.g. meowl.social). */\n readonly rpId: string;\n readonly rpName: string;\n readonly walletSalt: string;\n readonly vaultSalt: string;\n};\n\nexport type AutoLockPolicy =\n | { readonly platform: \"native\"; readonly backgroundSeconds: 0 | 60 | 300 | 900 }\n | { readonly platform: \"web\"; readonly idleMinutes: 5 | 15 | 60 };\n\nexport type WalletOptions = {\n readonly passkey: PasskeyConfig;\n readonly autoLock: AutoLockPolicy;\n};\n\nexport type WalletSnapshot = {\n readonly vault: \"uninitialized\" | \"locked\" | \"unlocked\" | \"corrupted\";\n readonly lockReason: LockReason | undefined;\n readonly verifying: boolean; // a user verification is in flight\n readonly factors: ReadonlyArray<FactorInfo>;\n readonly wallets: ReadonlyArray<WalletInfo>;\n readonly nostr: { readonly keys: ReadonlyArray<NostrKeyInfo> };\n};\n\n/** A one-shot secret buffer: `read` detaches the bytes to the caller, `wipe` zeroes them. */\nexport type ExportedSecret = {\n readonly read: () => Uint8Array; // UTF-8 text; single use — the second call throws\n readonly wipe: () => void;\n};\n\nexport type MnemonicDraft = {\n readonly words: ExportedSecret; // read once, then the host is responsible for wiping\n readonly quiz: ReadonlyArray<number>; // three positions the enclave picked\n readonly confirm: (answers: ReadonlyArray<string>) => Promise<WalletInfo>;\n readonly discard: () => Promise<void>;\n};\n\nexport type VaultApi = {\n readonly unlock: (factor?: UnlockFactor) => Promise<void>;\n readonly lock: () => Promise<void>;\n readonly addFactor: (factor: InitialFactor, verify: UnlockFactor) => Promise<FactorInfo>;\n readonly removeFactor: (id: string, verify: UnlockFactor) => Promise<void>; // ≥1 factor remains\n readonly reset: () => Promise<void>;\n};\n\nexport type WalletsApi = {\n readonly createWithPasskey: (options: {\n /** Display name for the new passkey credential (1–64 characters after trimming). */\n readonly name: string;\n readonly factor?: InitialFactor;\n }) => Promise<WalletInfo>;\n readonly restoreWithPasskey: (options?: {\n readonly factor?: InitialFactor;\n }) => Promise<WalletInfo>;\n readonly createMnemonic: (options: {\n readonly words: 12 | 24;\n readonly factor?: InitialFactor;\n }) => Promise<MnemonicDraft>;\n readonly importMnemonic: (options: {\n readonly mnemonic: string;\n readonly factor?: InitialFactor;\n }) => Promise<WalletInfo>;\n /** One-shot mnemonic export; requires re-verification every call. */\n readonly exportMnemonic: (walletId: string, verify: UnlockFactor) => Promise<ExportedSecret>;\n readonly delete: (walletId: string, verify: UnlockFactor) => Promise<void>;\n};\n\nexport type DataKeyApi = {\n readonly get: (purpose: string) => Promise<Uint8Array>;\n};\n\nexport type Wallet = {\n readonly getSnapshot: () => WalletSnapshot;\n readonly subscribe: (listener: () => void) => () => void;\n readonly vault: VaultApi;\n readonly wallets: WalletsApi;\n readonly dataKeys: DataKeyApi;\n readonly destroy: () => Promise<void>;\n};\n"],"mappings":";;AAgEA,IAAa,cAAb,cAAiC,MAAM;CACrC;CACA;CAEA,YAAY,MAAuB,SAAiB,SAAkB;EACpE,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,UAAU;CACjB;AACF"}
|