@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/spark.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spark.mjs","names":[],"sources":["../src/spark/wire.ts","../src/spark/signer.ts","../src/spark/index.ts"],"sourcesContent":["/**\n * Input projection for the proxy signer: every request value is rebuilt from its declared wire\n * fields only — callers (e.g. SparkClient) hand us library objects that may carry extra keys\n * (protobuf-es `$typeName`, branding), and the kernel's strict obj() validators reject any key not\n * in the shape. Unknown `kind`/`type` discriminants fail `invalid-input` here, before any request\n * is posted.\n */\nimport type {\n FrostAggregateJob,\n FrostSignJob,\n HtlcTimeoutSignRequest,\n IdentityStatement,\n OperatorCommitment,\n PrepareClaimRequest,\n PrepareTransferRequest,\n SigningCommitment,\n SigningTarget,\n SparkKey,\n SparkLeafKey,\n StaticDepositClaimRequest,\n StaticDepositClaimStatement,\n} from \"../protocol/index.ts\";\nimport { WalletError } from \"../types.ts\";\n\nfunction bad(what: string): never {\n throw new WalletError(\"invalid-input\", `spark: unexpected ${what}`);\n}\n\nconst u8 = (v: Uint8Array, what: string): Uint8Array => (v instanceof Uint8Array ? v : bad(what));\nconst s = (v: string, what: string): string => (typeof v === \"string\" ? v : bad(what));\nconst n = (v: number, what: string): number => (typeof v === \"number\" ? v : bad(what));\n\nexport function leafKey(key: SparkLeafKey): SparkLeafKey {\n if (key.type === \"leaf\") {\n return { type: \"leaf\", leafId: s(key.leafId, \"leafId\") };\n }\n if (key.type === \"static-deposit\") {\n return { type: \"static-deposit\", index: n(key.index, \"index\") };\n }\n return bad(\"leaf key type\");\n}\n\nexport function sparkKey(key: SparkKey): SparkKey {\n if (key.type === \"received\") {\n return { type: \"received\", ciphertext: u8(key.ciphertext, \"ciphertext\") };\n }\n return leafKey(key);\n}\n\nexport function commitment(c: SigningCommitment): SigningCommitment {\n return {\n hiding: u8(c.hiding, \"commitment.hiding\"),\n binding: u8(c.binding, \"commitment.binding\"),\n };\n}\n\nfunction operatorCommitment(c: OperatorCommitment): OperatorCommitment {\n return { identifier: s(c.identifier, \"identifier\"), commitment: commitment(c.commitment) };\n}\n\nexport function signingTarget(target: SigningTarget): SigningTarget {\n return {\n transaction: u8(target.transaction, \"target.transaction\"),\n inputIndex: n(target.inputIndex, \"target.inputIndex\"),\n prevouts: target.prevouts.map((p) => ({\n script: u8(p.script, \"prevout.script\"),\n amount: n(p.amount, \"prevout.amount\"),\n })),\n };\n}\n\nexport function frostSignJob(job: FrostSignJob): FrostSignJob {\n return {\n key: sparkKey(job.key),\n target: signingTarget(job.target),\n verifyingKey: u8(job.verifyingKey, \"verifyingKey\"),\n commitment: commitment(job.commitment),\n operatorCommitments: job.operatorCommitments.map(operatorCommitment),\n ...(job.adaptorPublicKey === undefined\n ? {}\n : { adaptorPublicKey: u8(job.adaptorPublicKey, \"adaptorPublicKey\") }),\n ...(job.exit === undefined\n ? {}\n : {\n exit: {\n connectorTx: u8(job.exit.connectorTx, \"exit.connectorTx\"),\n exitTx: u8(job.exit.exitTx, \"exit.exitTx\"),\n },\n }),\n };\n}\n\nexport function frostAggregateJob(job: FrostAggregateJob): FrostAggregateJob {\n return {\n key: sparkKey(job.key),\n target: signingTarget(job.target),\n verifyingKey: u8(job.verifyingKey, \"verifyingKey\"),\n commitment: commitment(job.commitment),\n signatureShare: u8(job.signatureShare, \"signatureShare\"),\n operators: job.operators.map((op) => ({\n identifier: s(op.identifier, \"identifier\"),\n commitment: commitment(op.commitment),\n signatureShare: u8(op.signatureShare, \"operator.signatureShare\"),\n publicKey: u8(op.publicKey, \"operator.publicKey\"),\n })),\n ...(job.adaptorPublicKey === undefined\n ? {}\n : { adaptorPublicKey: u8(job.adaptorPublicKey, \"adaptorPublicKey\") }),\n };\n}\n\nfunction depositClaimStatement(\n st: Extract<IdentityStatement, { kind: \"static-deposit-claim\" }>,\n): StaticDepositClaimStatement {\n return {\n kind: \"static-deposit-claim\",\n network: st.network,\n txid: u8(st.txid, \"txid\"),\n vout: n(st.vout, \"vout\"),\n creditAmountSats: n(st.creditAmountSats, \"creditAmountSats\"),\n sspSignature: u8(st.sspSignature, \"sspSignature\"),\n };\n}\n\nexport function identityStatement(statement: IdentityStatement): IdentityStatement {\n const { kind } = statement;\n if (kind === \"so-challenge\") {\n return { kind: \"so-challenge\", challenge: u8(statement.challenge, \"challenge\") };\n }\n if (kind === \"ssp-challenge\") {\n return {\n kind: \"ssp-challenge\",\n protectedChallenge: s(statement.protectedChallenge, \"protectedChallenge\"),\n };\n }\n if (kind === \"transfer-package\" || kind === \"claim-package\") {\n return {\n kind,\n transferId: s(statement.transferId, \"transferId\"),\n package: u8(statement.package, \"package\"),\n };\n }\n if (kind === \"static-deposit-claim\") {\n return depositClaimStatement(statement);\n }\n if (kind === \"static-deposit-refund\") {\n return {\n kind: \"static-deposit-refund\",\n network: statement.network,\n txid: u8(statement.txid, \"txid\"),\n vout: n(statement.vout, \"vout\"),\n amount: n(statement.amount, \"amount\"),\n target: signingTarget(statement.target),\n };\n }\n if (kind === \"watchtower-recovery\") {\n return {\n kind: \"watchtower-recovery\",\n network: statement.network,\n leafId: s(statement.leafId, \"leafId\"),\n target: signingTarget(statement.target),\n };\n }\n if (kind === \"spark-invoice\") {\n return { kind: \"spark-invoice\", invoice: u8(statement.invoice, \"invoice\") };\n }\n if (kind === \"token-transaction\") {\n return {\n kind: \"token-transaction\",\n partialTransaction: u8(statement.partialTransaction, \"partialTransaction\"),\n };\n }\n if (kind === \"lightning-address\") {\n return statement.action === \"register\"\n ? {\n kind: \"lightning-address\",\n action: \"register\",\n domain: s(statement.domain, \"domain\"),\n username: s(statement.username, \"username\"),\n description: s(statement.description, \"description\"),\n timestamp: n(statement.timestamp, \"timestamp\"),\n }\n : {\n kind: \"lightning-address\",\n action: \"unregister\",\n domain: s(statement.domain, \"domain\"),\n username: s(statement.username, \"username\"),\n timestamp: n(statement.timestamp, \"timestamp\"),\n };\n }\n return bad(\"statement kind\");\n}\nexport function prepareTransferRequest(req: PrepareTransferRequest): PrepareTransferRequest {\n return {\n transferId: s(req.transferId, \"transferId\"),\n leaves: req.leaves.map((leaf) => ({\n leafId: s(leaf.leafId, \"leafId\"),\n key: leafKey(leaf.key),\n receiverIdentityPublicKey: u8(leaf.receiverIdentityPublicKey, \"receiverIdentityPublicKey\"),\n })),\n };\n}\n\nexport function prepareClaimRequest(req: PrepareClaimRequest): PrepareClaimRequest {\n return {\n transferId: s(req.transferId, \"transferId\"),\n leaves: req.leaves.map((leaf) => ({\n leafId: s(leaf.leafId, \"leafId\"),\n secretCipher: u8(leaf.secretCipher, \"secretCipher\"),\n })),\n };\n}\n\nexport function htlcTimeoutRequest(req: HtlcTimeoutSignRequest): HtlcTimeoutSignRequest {\n return {\n transaction: u8(req.transaction, \"transaction\"),\n inputIndex: n(req.inputIndex, \"inputIndex\"),\n prevoutAmountSats: n(req.prevoutAmountSats, \"prevoutAmountSats\"),\n paymentHash: u8(req.paymentHash, \"paymentHash\"),\n hashLockPublicKey: u8(req.hashLockPublicKey, \"hashLockPublicKey\"),\n };\n}\n\nexport function staticDepositClaimRequest(\n req: StaticDepositClaimRequest,\n): StaticDepositClaimRequest {\n return { index: n(req.index, \"index\"), statement: depositClaimStatement(req.statement) };\n}\n","/**\n * The proxy SparkSigner: every method is one spark.* request on the kernel channel carrying the\n * account ref. List-shaped calls chunk by MAX_BATCH sequentially and concatenate in order — the\n * wire caps a batch at 64 while the signer interface allows up to 256 — exactly like the nostr\n * proxy's unwrapGiftWraps. `dispose` is a no-op: signer lifetime belongs to the kernel, which wipes\n * signers on lock and on wallet deletion.\n */\nimport type { SparkSigner } from \"@qntx/spark/signer\";\n\nimport type { WalletInternals } from \"../internal.ts\";\nimport { MAX_BATCH } from \"../protocol/core.ts\";\nimport type { SparkAccountRef } from \"../protocol/index.ts\";\nimport {\n frostAggregateJob,\n frostSignJob,\n htlcTimeoutRequest,\n identityStatement,\n leafKey,\n prepareClaimRequest,\n prepareTransferRequest,\n signingTarget,\n sparkKey,\n staticDepositClaimRequest,\n} from \"./wire.ts\";\n\nexport function proxySigner(account: SparkAccountRef, internals: WalletInternals): SparkSigner {\n return {\n identityPublicKey: async () => internals.call(\"spark.identityPublicKey\", { account }),\n\n publicKeys: async (keys) => {\n const wire = keys.map(leafKey);\n const results: Uint8Array[] = [];\n for (let start = 0; start < wire.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(\"spark.publicKeys\", {\n account,\n keys: wire.slice(start, start + MAX_BATCH),\n });\n results.push(...batch);\n }\n return results;\n },\n\n receivedPublicKeys: async (ciphertexts) => {\n const results: Uint8Array[] = [];\n for (let start = 0; start < ciphertexts.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(\"spark.receivedPublicKeys\", {\n account,\n ciphertexts: ciphertexts.slice(start, start + MAX_BATCH),\n });\n results.push(...batch);\n }\n return results;\n },\n\n newCommitments: async (count) => {\n const results: Array<Awaited<ReturnType<SparkSigner[\"newCommitments\"]>>[number]> = [];\n for (let remaining = count; remaining > 0; remaining -= 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(\"spark.newCommitments\", {\n account,\n count: Math.min(MAX_BATCH, remaining),\n });\n results.push(...batch);\n }\n return results;\n },\n\n signFrost: async (jobs) => {\n const wire = jobs.map(frostSignJob);\n const results: Uint8Array[] = [];\n for (let start = 0; start < wire.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(\"spark.signFrost\", {\n account,\n jobs: wire.slice(start, start + MAX_BATCH),\n });\n results.push(...batch);\n }\n return results;\n },\n\n aggregateFrost: async (jobs) => {\n const wire = jobs.map(frostAggregateJob);\n const results: Uint8Array[] = [];\n for (let start = 0; start < wire.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(\"spark.aggregateFrost\", {\n account,\n jobs: wire.slice(start, start + MAX_BATCH),\n });\n results.push(...batch);\n }\n return results;\n },\n\n signIdentity: async (statement) =>\n internals.call(\"spark.signIdentity\", { account, statement: identityStatement(statement) }),\n\n signKeySpend: async (key, target) =>\n internals.call(\"spark.signKeySpend\", {\n account,\n key: sparkKey(key),\n target: signingTarget(target),\n }),\n\n signHtlcTimeout: async (request) =>\n internals.call(\"spark.signHtlcTimeout\", { account, request: htlcTimeoutRequest(request) }),\n\n prepareTransfer: async (request) =>\n internals.call(\"spark.prepareTransfer\", {\n account,\n request: prepareTransferRequest(request),\n }),\n\n prepareClaim: async (request) =>\n internals.call(\"spark.prepareClaim\", { account, request: prepareClaimRequest(request) }),\n\n prepareLightningReceive: async () =>\n internals.call(\"spark.prepareLightningReceive\", { account }),\n\n claimStaticDeposit: async (request) =>\n internals.call(\"spark.claimStaticDeposit\", {\n account,\n request: staticDepositClaimRequest(request),\n }),\n\n dispose: () => undefined,\n };\n}\n","/**\n * The spark module of @qntx/wallet: `spark(wallet)` returns the wallet's Spark API — proxy\n * SparkSigners backed by the enclave's signer pool. The API is memoized per wallet so repeated\n * calls return the same object (stable React identity); a foreign object is rejected because only a\n * Wallet from this package holds a registered channel.\n */\nimport { internalsOf } from \"../internal.ts\";\nimport type { WalletInternals } from \"../internal.ts\";\nimport type { Wallet } from \"../types.ts\";\nimport { proxySigner } from \"./signer.ts\";\nimport type { SparkApi } from \"./types.ts\";\n\nexport type { SparkAccountRef, SparkApi, SparkSigner } from \"./types.ts\";\n\nfunction createSparkApi(internals: WalletInternals): SparkApi {\n return {\n signer: (ref) => proxySigner(ref, internals),\n approve: async (params) =>\n internals.withVerifying(async () => {\n const transfer: ArrayBuffer[] = [];\n const verify = await internals.resolveFactor(params.verify, transfer);\n return internals.call(\"spark.approve\", { ...params, verify });\n }),\n };\n}\n\nconst apis = new WeakMap<Wallet, SparkApi>();\n\nexport function spark(wallet: Wallet): SparkApi {\n const internals = internalsOf(wallet);\n let api = apis.get(wallet);\n if (api === undefined) {\n api = createSparkApi(internals);\n apis.set(wallet, api);\n }\n return api;\n}\n"],"mappings":";;;AAwBA,SAAS,IAAI,MAAqB;CAChC,MAAM,IAAI,YAAY,iBAAiB,qBAAqB,MAAM;AACpE;AAEA,MAAM,MAAM,GAAe,SAA8B,aAAa,aAAa,IAAI,IAAI,IAAI;AAC/F,MAAM,KAAK,GAAW,SAA0B,OAAO,MAAM,WAAW,IAAI,IAAI,IAAI;AACpF,MAAM,KAAK,GAAW,SAA0B,OAAO,MAAM,WAAW,IAAI,IAAI,IAAI;AAEpF,SAAgB,QAAQ,KAAiC;CACvD,IAAI,IAAI,SAAS,QACf,OAAO;EAAE,MAAM;EAAQ,QAAQ,EAAE,IAAI,QAAQ,QAAQ;CAAE;CAEzD,IAAI,IAAI,SAAS,kBACf,OAAO;EAAE,MAAM;EAAkB,OAAO,EAAE,IAAI,OAAO,OAAO;CAAE;CAEhE,OAAO,IAAI,eAAe;AAC5B;AAEA,SAAgB,SAAS,KAAyB;CAChD,IAAI,IAAI,SAAS,YACf,OAAO;EAAE,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ACzC;GACA,SAAS,0BAA0B,OAAO;EAC5C,CAAC;EAEH,eAAe,KAAA;CACjB;AACF;;;;;;;;ACpHA,SAAS,eAAe,WAAsC;CAC5D,OAAO;EACL,SAAS,QAAQ,YAAY,KAAK,SAAS;EAC3C,SAAS,OAAO,WACd,UAAU,cAAc,YAAY;GAElC,MAAM,SAAS,MAAM,UAAU,cAAc,OAAO,QAAQ,CAAO,CAAC;GACpE,OAAO,UAAU,KAAK,iBAAiB;IAAE,GAAG;IAAQ;GAAO,CAAC;EAC9D,CAAC;CACL;AACF;AAEA,MAAM,uBAAO,IAAI,QAA0B;AAE3C,SAAgB,MAAM,QAA0B;CAC9C,MAAM,YAAY,YAAY,MAAM;CACpC,IAAI,MAAM,KAAK,IAAI,MAAM;CACzB,IAAI,QAAQ,KAAA,GAAW;EACrB,MAAM,eAAe,SAAS;EAC9B,KAAK,IAAI,QAAQ,GAAG;CACtB;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"spark.mjs","names":[],"sources":["../src/spark/wire.ts","../src/spark/signer.ts","../src/spark/index.ts"],"sourcesContent":["/**\n * Input projection for the proxy signer: every request value is rebuilt from its declared wire\n * fields only — callers (e.g. SparkClient) hand us library objects that may carry extra keys\n * (protobuf-es `$typeName`, branding), and the kernel's strict obj() validators reject any key not\n * in the shape. Unknown `kind`/`type` discriminants fail `invalid-input` here, before any request\n * is posted.\n */\nimport type {\n FrostAggregateJob,\n FrostSignJob,\n HtlcTimeoutSignRequest,\n IdentityStatement,\n OperatorCommitment,\n PrepareClaimRequest,\n PrepareTransferRequest,\n SigningCommitment,\n SigningTarget,\n SparkKey,\n SparkLeafKey,\n StaticDepositClaimRequest,\n StaticDepositClaimStatement,\n} from \"../protocol/index.ts\";\nimport { WalletError } from \"../types.ts\";\n\nfunction bad(what: string): never {\n throw new WalletError(\"invalid-input\", `spark: unexpected ${what}`);\n}\n\nconst u8 = (v: Uint8Array, what: string): Uint8Array => (v instanceof Uint8Array ? v : bad(what));\nconst s = (v: string, what: string): string => (typeof v === \"string\" ? v : bad(what));\nconst n = (v: number, what: string): number => (typeof v === \"number\" ? v : bad(what));\n\nexport function leafKey(key: SparkLeafKey): SparkLeafKey {\n if (key.type === \"leaf\") {\n return { type: \"leaf\", leafId: s(key.leafId, \"leafId\") };\n }\n if (key.type === \"static-deposit\") {\n return { type: \"static-deposit\", index: n(key.index, \"index\") };\n }\n return bad(\"leaf key type\");\n}\n\nexport function sparkKey(key: SparkKey): SparkKey {\n if (key.type === \"received\") {\n return { type: \"received\", ciphertext: u8(key.ciphertext, \"ciphertext\") };\n }\n return leafKey(key);\n}\n\nexport function commitment(c: SigningCommitment): SigningCommitment {\n return {\n hiding: u8(c.hiding, \"commitment.hiding\"),\n binding: u8(c.binding, \"commitment.binding\"),\n };\n}\n\nfunction operatorCommitment(c: OperatorCommitment): OperatorCommitment {\n return { identifier: s(c.identifier, \"identifier\"), commitment: commitment(c.commitment) };\n}\n\nexport function signingTarget(target: SigningTarget): SigningTarget {\n return {\n transaction: u8(target.transaction, \"target.transaction\"),\n inputIndex: n(target.inputIndex, \"target.inputIndex\"),\n prevouts: target.prevouts.map((p) => ({\n script: u8(p.script, \"prevout.script\"),\n amount: n(p.amount, \"prevout.amount\"),\n })),\n };\n}\n\nexport function frostSignJob(job: FrostSignJob): FrostSignJob {\n return {\n key: sparkKey(job.key),\n target: signingTarget(job.target),\n verifyingKey: u8(job.verifyingKey, \"verifyingKey\"),\n commitment: commitment(job.commitment),\n operatorCommitments: job.operatorCommitments.map(operatorCommitment),\n ...(job.adaptorPublicKey === undefined\n ? {}\n : { adaptorPublicKey: u8(job.adaptorPublicKey, \"adaptorPublicKey\") }),\n ...(job.exit === undefined\n ? {}\n : {\n exit: {\n connectorTx: u8(job.exit.connectorTx, \"exit.connectorTx\"),\n exitTx: u8(job.exit.exitTx, \"exit.exitTx\"),\n },\n }),\n };\n}\n\nexport function frostAggregateJob(job: FrostAggregateJob): FrostAggregateJob {\n return {\n key: sparkKey(job.key),\n target: signingTarget(job.target),\n verifyingKey: u8(job.verifyingKey, \"verifyingKey\"),\n commitment: commitment(job.commitment),\n signatureShare: u8(job.signatureShare, \"signatureShare\"),\n operators: job.operators.map((op) => ({\n identifier: s(op.identifier, \"identifier\"),\n commitment: commitment(op.commitment),\n signatureShare: u8(op.signatureShare, \"operator.signatureShare\"),\n publicKey: u8(op.publicKey, \"operator.publicKey\"),\n })),\n ...(job.adaptorPublicKey === undefined\n ? {}\n : { adaptorPublicKey: u8(job.adaptorPublicKey, \"adaptorPublicKey\") }),\n };\n}\n\nfunction depositClaimStatement(\n st: Extract<IdentityStatement, { kind: \"static-deposit-claim\" }>,\n): StaticDepositClaimStatement {\n return {\n kind: \"static-deposit-claim\",\n network: st.network,\n txid: u8(st.txid, \"txid\"),\n vout: n(st.vout, \"vout\"),\n creditAmountSats: n(st.creditAmountSats, \"creditAmountSats\"),\n sspSignature: u8(st.sspSignature, \"sspSignature\"),\n };\n}\n\nexport function identityStatement(statement: IdentityStatement): IdentityStatement {\n const { kind } = statement;\n if (kind === \"so-challenge\") {\n return { kind: \"so-challenge\", challenge: u8(statement.challenge, \"challenge\") };\n }\n if (kind === \"ssp-challenge\") {\n return {\n kind: \"ssp-challenge\",\n protectedChallenge: s(statement.protectedChallenge, \"protectedChallenge\"),\n };\n }\n if (kind === \"transfer-package\" || kind === \"claim-package\") {\n return {\n kind,\n transferId: s(statement.transferId, \"transferId\"),\n package: u8(statement.package, \"package\"),\n };\n }\n if (kind === \"static-deposit-claim\") {\n return depositClaimStatement(statement);\n }\n if (kind === \"static-deposit-refund\") {\n return {\n kind: \"static-deposit-refund\",\n network: statement.network,\n txid: u8(statement.txid, \"txid\"),\n vout: n(statement.vout, \"vout\"),\n amount: n(statement.amount, \"amount\"),\n target: signingTarget(statement.target),\n };\n }\n if (kind === \"watchtower-recovery\") {\n return {\n kind: \"watchtower-recovery\",\n network: statement.network,\n leafId: s(statement.leafId, \"leafId\"),\n target: signingTarget(statement.target),\n };\n }\n if (kind === \"spark-invoice\") {\n return { kind: \"spark-invoice\", invoice: u8(statement.invoice, \"invoice\") };\n }\n if (kind === \"token-transaction\") {\n return {\n kind: \"token-transaction\",\n partialTransaction: u8(statement.partialTransaction, \"partialTransaction\"),\n };\n }\n if (kind === \"lightning-address\") {\n return statement.action === \"register\"\n ? {\n kind: \"lightning-address\",\n action: \"register\",\n domain: s(statement.domain, \"domain\"),\n username: s(statement.username, \"username\"),\n description: s(statement.description, \"description\"),\n timestamp: n(statement.timestamp, \"timestamp\"),\n }\n : {\n kind: \"lightning-address\",\n action: \"unregister\",\n domain: s(statement.domain, \"domain\"),\n username: s(statement.username, \"username\"),\n timestamp: n(statement.timestamp, \"timestamp\"),\n };\n }\n return bad(\"statement kind\");\n}\nexport function prepareTransferRequest(req: PrepareTransferRequest): PrepareTransferRequest {\n return {\n transferId: s(req.transferId, \"transferId\"),\n leaves: req.leaves.map((leaf) => ({\n leafId: s(leaf.leafId, \"leafId\"),\n key: leafKey(leaf.key),\n receiverIdentityPublicKey: u8(leaf.receiverIdentityPublicKey, \"receiverIdentityPublicKey\"),\n })),\n };\n}\n\nexport function prepareClaimRequest(req: PrepareClaimRequest): PrepareClaimRequest {\n return {\n transferId: s(req.transferId, \"transferId\"),\n leaves: req.leaves.map((leaf) => ({\n leafId: s(leaf.leafId, \"leafId\"),\n secretCipher: u8(leaf.secretCipher, \"secretCipher\"),\n })),\n };\n}\n\nexport function htlcTimeoutRequest(req: HtlcTimeoutSignRequest): HtlcTimeoutSignRequest {\n return {\n transaction: u8(req.transaction, \"transaction\"),\n inputIndex: n(req.inputIndex, \"inputIndex\"),\n prevoutAmountSats: n(req.prevoutAmountSats, \"prevoutAmountSats\"),\n paymentHash: u8(req.paymentHash, \"paymentHash\"),\n hashLockPublicKey: u8(req.hashLockPublicKey, \"hashLockPublicKey\"),\n };\n}\n\nexport function staticDepositClaimRequest(\n req: StaticDepositClaimRequest,\n): StaticDepositClaimRequest {\n return { index: n(req.index, \"index\"), statement: depositClaimStatement(req.statement) };\n}\n","/**\n * The proxy SparkSigner: every method is one spark.* request on the kernel channel carrying the\n * account ref. List-shaped calls chunk by MAX_BATCH sequentially and concatenate in order — the\n * wire caps a batch at 64 while the signer interface allows up to 256 — exactly like the nostr\n * proxy's unwrapGiftWraps. `dispose` is a no-op: signer lifetime belongs to the kernel, which wipes\n * signers on lock and on wallet deletion.\n */\nimport type { SparkSigner } from \"@qntx/spark/signer\";\n\nimport type { WalletInternals } from \"../internal.ts\";\nimport { MAX_BATCH } from \"../protocol/core.ts\";\nimport type { SparkAccountRef } from \"../protocol/index.ts\";\nimport {\n frostAggregateJob,\n frostSignJob,\n htlcTimeoutRequest,\n identityStatement,\n leafKey,\n prepareClaimRequest,\n prepareTransferRequest,\n signingTarget,\n sparkKey,\n staticDepositClaimRequest,\n} from \"./wire.ts\";\n\nexport function proxySigner(account: SparkAccountRef, internals: WalletInternals): SparkSigner {\n return {\n identityPublicKey: async () => internals.call(\"spark.identityPublicKey\", { account }),\n\n publicKeys: async (keys) => {\n const wire = keys.map(leafKey);\n const results: Uint8Array[] = [];\n for (let start = 0; start < wire.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(\"spark.publicKeys\", {\n account,\n keys: wire.slice(start, start + MAX_BATCH),\n });\n results.push(...batch);\n }\n return results;\n },\n\n receivedPublicKeys: async (ciphertexts) => {\n const results: Uint8Array[] = [];\n for (let start = 0; start < ciphertexts.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(\"spark.receivedPublicKeys\", {\n account,\n ciphertexts: ciphertexts.slice(start, start + MAX_BATCH),\n });\n results.push(...batch);\n }\n return results;\n },\n\n newCommitments: async (count) => {\n const results: Array<Awaited<ReturnType<SparkSigner[\"newCommitments\"]>>[number]> = [];\n for (let remaining = count; remaining > 0; remaining -= 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(\"spark.newCommitments\", {\n account,\n count: Math.min(MAX_BATCH, remaining),\n });\n results.push(...batch);\n }\n return results;\n },\n\n signFrost: async (jobs) => {\n const wire = jobs.map(frostSignJob);\n const results: Uint8Array[] = [];\n for (let start = 0; start < wire.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(\"spark.signFrost\", {\n account,\n jobs: wire.slice(start, start + MAX_BATCH),\n });\n results.push(...batch);\n }\n return results;\n },\n\n aggregateFrost: async (jobs) => {\n const wire = jobs.map(frostAggregateJob);\n const results: Uint8Array[] = [];\n for (let start = 0; start < wire.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(\"spark.aggregateFrost\", {\n account,\n jobs: wire.slice(start, start + MAX_BATCH),\n });\n results.push(...batch);\n }\n return results;\n },\n\n signIdentity: async (statement) =>\n internals.call(\"spark.signIdentity\", { account, statement: identityStatement(statement) }),\n\n signKeySpend: async (key, target) =>\n internals.call(\"spark.signKeySpend\", {\n account,\n key: sparkKey(key),\n target: signingTarget(target),\n }),\n\n signHtlcTimeout: async (request) =>\n internals.call(\"spark.signHtlcTimeout\", { account, request: htlcTimeoutRequest(request) }),\n\n prepareTransfer: async (request) =>\n internals.call(\"spark.prepareTransfer\", {\n account,\n request: prepareTransferRequest(request),\n }),\n\n prepareClaim: async (request) =>\n internals.call(\"spark.prepareClaim\", { account, request: prepareClaimRequest(request) }),\n\n prepareLightningReceive: async () =>\n internals.call(\"spark.prepareLightningReceive\", { account }),\n\n claimStaticDeposit: async (request) =>\n internals.call(\"spark.claimStaticDeposit\", {\n account,\n request: staticDepositClaimRequest(request),\n }),\n\n dispose: () => undefined,\n };\n}\n","/**\n * The spark module of @qntx/wallet: `spark(wallet)` returns the wallet's Spark API — proxy\n * SparkSigners backed by the enclave's signer pool. The API is memoized per wallet so repeated\n * calls return the same object (stable React identity); a foreign object is rejected because only a\n * Wallet from this package holds a registered channel.\n */\nimport { internalsOf } from \"../internal.ts\";\nimport type { WalletInternals } from \"../internal.ts\";\nimport type { Wallet } from \"../types.ts\";\nimport { proxySigner } from \"./signer.ts\";\nimport type { SparkApi } from \"./types.ts\";\n\nexport type { SparkAccountRef, SparkApi, SparkSigner } from \"./types.ts\";\n\nfunction createSparkApi(internals: WalletInternals): SparkApi {\n return {\n signer: (ref) => proxySigner(ref, internals),\n approve: async (params) =>\n internals.withVerifying(async () =>\n internals.secretCall(\"spark.approve\", async (wire) => ({\n ...params,\n verify: await internals.resolveVerifyFactor(params.verify, wire),\n })),\n ),\n };\n}\n\nconst apis = new WeakMap<Wallet, SparkApi>();\n\nexport function spark(wallet: Wallet): SparkApi {\n const internals = internalsOf(wallet);\n let api = apis.get(wallet);\n if (api === undefined) {\n api = createSparkApi(internals);\n apis.set(wallet, api);\n }\n return api;\n}\n"],"mappings":";;;AAwBA,SAAS,IAAI,MAAqB;CAChC,MAAM,IAAI,YAAY,iBAAiB,qBAAqB,MAAM;AACpE;AAEA,MAAM,MAAM,GAAe,SAA8B,aAAa,aAAa,IAAI,IAAI,IAAI;AAC/F,MAAM,KAAK,GAAW,SAA0B,OAAO,MAAM,WAAW,IAAI,IAAI,IAAI;AACpF,MAAM,KAAK,GAAW,SAA0B,OAAO,MAAM,WAAW,IAAI,IAAI,IAAI;AAEpF,SAAgB,QAAQ,KAAiC;CACvD,IAAI,IAAI,SAAS,QACf,OAAO;EAAE,MAAM;EAAQ,QAAQ,EAAE,IAAI,QAAQ,QAAQ;CAAE;CAEzD,IAAI,IAAI,SAAS,kBACf,OAAO;EAAE,MAAM;EAAkB,OAAO,EAAE,IAAI,OAAO,OAAO;CAAE;CAEhE,OAAO,IAAI,eAAe;AAC5B;AAEA,SAAgB,SAAS,KAAyB;CAChD,IAAI,IAAI,SAAS,YACf,OAAO;EAAE,MAAM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GACA,SAAS,0BAA0B,OAAO;EAC5C,CAAC;EAEH,eAAe,KAAA;CACjB;AACF;;;;;;;;ACpHA,SAAS,eAAe,WAAsC;CAC5D,OAAO;EACL,SAAS,QAAQ,YAAY,KAAK,SAAS;EAC3C,SAAS,OAAO,WACd,UAAU,cAAc,YACtB,UAAU,WAAW,iBAAiB,OAAO,UAAU;GACrD,GAAG;GACH,QAAQ,MAAM,UAAU,oBAAoB,OAAO,QAAQ,IAAI;EACjE,EAAE,CACJ;CACJ;AACF;AAEA,MAAM,uBAAO,IAAI,QAA0B;AAE3C,SAAgB,MAAM,QAA0B;CAC9C,MAAM,YAAY,YAAY,MAAM;CACpC,IAAI,MAAM,KAAK,IAAI,MAAM;CACzB,IAAI,QAAQ,KAAA,GAAW;EACrB,MAAM,eAAe,SAAS;EAC9B,KAAK,IAAI,QAAQ,GAAG;CACtB;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
/** Public types of @qntx/wallet, per design/entry.mdx. Secret data never appears here. */
|
|
2
|
+
type LockReason = "cold-start" | "user" | "idle" | "background" | "expired" | "crashed" | "invalidated";
|
|
3
|
+
type FactorInfo = {
|
|
4
|
+
readonly kind: "device";
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly createdAt: number;
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: "hardware";
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly createdAt: number;
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: "passkey";
|
|
13
|
+
readonly id: string;
|
|
14
|
+
/** Base64url, public data — the main side passes it as allowCredentials. */
|
|
15
|
+
readonly credentialId: string;
|
|
16
|
+
readonly createdAt: number;
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: "password";
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly createdAt: number;
|
|
21
|
+
};
|
|
22
|
+
/** The hardware-signing device families the kernel knows; each signer lane adds a literal. */
|
|
23
|
+
declare const HARDWARE_DEVICES: readonly ["keystone", "ledger", "onekey"];
|
|
24
|
+
/** A hardware-signing device family the kernel knows; each signer adds a literal. */
|
|
25
|
+
type HardwareDevice = (typeof HARDWARE_DEVICES)[number];
|
|
26
|
+
/** A wallet whose seed lives sealed in this vault (an `entropy` record). */
|
|
27
|
+
type VaultWalletInfo = {
|
|
28
|
+
readonly custody: "vault";
|
|
29
|
+
readonly walletId: string;
|
|
30
|
+
readonly origin: "passkey" | "mnemonic";
|
|
31
|
+
readonly words: 12 | 15 | 18 | 21 | 24;
|
|
32
|
+
/**
|
|
33
|
+
* Mnemonic: the user holds the phrase (passed the writing-down quiz, imported it, or exported at
|
|
34
|
+
* least once). passkey: protected only by a synced passkey — still lost when the password manager
|
|
35
|
+
* or account is lost, so the UI should prompt to export. none: exists only on this device (a
|
|
36
|
+
* device-bound passkey).
|
|
37
|
+
*/
|
|
38
|
+
readonly backup: "none" | "passkey" | "mnemonic";
|
|
39
|
+
/** The wallet derives from its mnemonic plus a BIP-39 passphrase; only mnemonic wallets can. */
|
|
40
|
+
readonly passphrase: boolean;
|
|
41
|
+
readonly createdAt: number;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* An externally signed wallet: the vault stores the device's master fingerprint and its pinned
|
|
45
|
+
* public material — never a seed — so there is no origin, word count or backup state to report.
|
|
46
|
+
*/
|
|
47
|
+
type HardwareWalletInfo = {
|
|
48
|
+
readonly custody: "hardware";
|
|
49
|
+
readonly walletId: string;
|
|
50
|
+
/** The paired device kind — possibly one this build does not know (see `supported`). */
|
|
51
|
+
readonly device: string;
|
|
52
|
+
/** Whether this build ships a driver for `device`; unknown kinds stay inert. */
|
|
53
|
+
readonly supported: boolean;
|
|
54
|
+
/** The device master fingerprint as 8 lowercase hex chars. */
|
|
55
|
+
readonly fingerprint: string;
|
|
56
|
+
readonly model?: string;
|
|
57
|
+
readonly firmware?: string;
|
|
58
|
+
readonly createdAt: number;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* A wallet whose seed lives only on qntx cards (a `card-wallet` record): the vault caches the
|
|
62
|
+
* public material a tap fetched, never the seed. `members` is the card count k (1–3).
|
|
63
|
+
*/
|
|
64
|
+
type CardWalletInfo = {
|
|
65
|
+
readonly custody: "card";
|
|
66
|
+
readonly walletId: string;
|
|
67
|
+
readonly origin: "card-generated" | "card-imported";
|
|
68
|
+
readonly backup: "cards";
|
|
69
|
+
readonly createdAt: number;
|
|
70
|
+
readonly members: number;
|
|
71
|
+
readonly cards: ReadonlyArray<CardInfo>;
|
|
72
|
+
};
|
|
73
|
+
type CardInfo = {
|
|
74
|
+
/** `ID(A)`: 32 lowercase hex identifying the card's identity key. */
|
|
75
|
+
readonly cardId: string;
|
|
76
|
+
/** `XXXX-XXXX` display id — only when the record pins this card's certificate. */
|
|
77
|
+
readonly shortId?: string;
|
|
78
|
+
/** `pending` never finished its IMPORT; `unknown` this kernel has not checked it yet. */
|
|
79
|
+
readonly state: "ready" | "unknown" | "pending";
|
|
80
|
+
/** Remaining access-code tries this kernel recorded (0..10). */
|
|
81
|
+
readonly tries?: number;
|
|
82
|
+
readonly verifiedAt?: number;
|
|
83
|
+
};
|
|
84
|
+
type WalletInfo = VaultWalletInfo | HardwareWalletInfo | CardWalletInfo;
|
|
85
|
+
type NostrKeyRef = {
|
|
86
|
+
readonly kind: "derived";
|
|
87
|
+
readonly walletId: string;
|
|
88
|
+
readonly index: number;
|
|
89
|
+
};
|
|
90
|
+
type NostrKeyInfo = {
|
|
91
|
+
readonly ref: NostrKeyRef;
|
|
92
|
+
readonly publicKey: string;
|
|
93
|
+
readonly createdAt: number;
|
|
94
|
+
};
|
|
95
|
+
/** One entry of a `nostr.discover` result: the public key an identity index produces. */
|
|
96
|
+
type DerivedNostrKey = {
|
|
97
|
+
readonly index: number;
|
|
98
|
+
readonly publicKey: string;
|
|
99
|
+
};
|
|
100
|
+
type WalletErrorCode = "locked" | "cancelled" | "factor-invalidated" | "verification-unavailable" | "passkey-not-configured" | "passkey-prf-unsupported" | "wrong-password" | "wrong-passkey" | "rate-limited" | "invalid-input" | "not-found" | "already-exists" | "conflict" | "unsupported" | "unavailable" | "integrity" | "blind-signing-disabled" | "approval-required" | "card-not-genuine" | "card-id-mismatch" | "card-erased" | "card-locked" | "card-tampered" | "card-fault" | "card-unsupported" | "app-lock-required" | "limit-exceeded" | "crashed" | "device-required" | "device-locked" | "device-app-closed" | "device-rejected" | "wrong-device";
|
|
101
|
+
/**
|
|
102
|
+
* The vault half of the status payload: `corrupted` means authentication or structural data failed
|
|
103
|
+
* to verify, `unsupported` means a different build wrote it — a newer one, or (before 1.0) an older
|
|
104
|
+
* one whose format this build never read; the data is left untouched either way — a newer build's
|
|
105
|
+
* vault reads again once the app is updated, while a pre-1.0 older format has no reader here and
|
|
106
|
+
* the only way out is the explicit `vault.reset`. `unavailable` means a transient store I/O failure
|
|
107
|
+
* (retried on the next request or change).
|
|
108
|
+
*/
|
|
109
|
+
type VaultState = "uninitialized" | "locked" | "unlocked" | "corrupted" | "unsupported" | "unavailable";
|
|
110
|
+
/**
|
|
111
|
+
* `status` result / status event payload. Locked snapshots come from unauthenticated headers;
|
|
112
|
+
* "corrupted" means the vault data itself failed to load or verify (reset is the only way out).
|
|
113
|
+
* Each protocol module contributes one section (here: `nostr`).
|
|
114
|
+
*/
|
|
115
|
+
type StatusPayload = {
|
|
116
|
+
readonly protocol: 3;
|
|
117
|
+
readonly vault: VaultState;
|
|
118
|
+
/** Whether the vault requires a verifying unlock (established vaults without a device factor). */
|
|
119
|
+
readonly appLock: boolean;
|
|
120
|
+
/** Whether any factor that can prove user presence exists (hardware, passkey or password). */
|
|
121
|
+
readonly verification: "available" | "unavailable";
|
|
122
|
+
readonly factors: ReadonlyArray<FactorInfo>;
|
|
123
|
+
readonly wallets: ReadonlyArray<WalletInfo>;
|
|
124
|
+
readonly nostr: {
|
|
125
|
+
readonly keys: ReadonlyArray<NostrKeyInfo>;
|
|
126
|
+
};
|
|
127
|
+
readonly importedKeys: ReadonlyArray<KeyInfo>;
|
|
128
|
+
readonly backup: BackupInfo | null;
|
|
129
|
+
/**
|
|
130
|
+
* Whether the vault signs requests the chain decoder marks blind — content it cannot show or
|
|
131
|
+
* bound.
|
|
132
|
+
*/
|
|
133
|
+
readonly blindSigning: boolean;
|
|
134
|
+
};
|
|
135
|
+
/** Public summary of a retained backup key — factors are the unwrap paths, never secrets. */
|
|
136
|
+
type BackupInfo = {
|
|
137
|
+
readonly id: string;
|
|
138
|
+
readonly factors: ReadonlyArray<"passkey" | "password">;
|
|
139
|
+
readonly createdAt: number;
|
|
140
|
+
};
|
|
141
|
+
/** One error class for the whole API; `code` carries the distinction. Messages never echo input. */
|
|
142
|
+
declare class WalletError extends Error {
|
|
143
|
+
readonly code: WalletErrorCode;
|
|
144
|
+
readonly retryAt: number | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* A platform diagnostic as `"<domain>:<code>"` (e.g. `"LAErrorDomain:-5"`,
|
|
147
|
+
* `"android:KeyPermanentlyInvalidatedException"`): never userInfo, localized text or input.
|
|
148
|
+
*/
|
|
149
|
+
readonly detail: string | undefined;
|
|
150
|
+
constructor(code: WalletErrorCode, message: string, retryAt?: number, detail?: string);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* A factor that opens the vault. `device` is the silent React Native factor (no user presence);
|
|
154
|
+
* `hardware` is the React Native factor that proves presence — the kernel shows the system
|
|
155
|
+
* verification prompt with text it renders itself.
|
|
156
|
+
*/
|
|
157
|
+
type UnlockFactor = {
|
|
158
|
+
readonly kind: "device";
|
|
159
|
+
} | {
|
|
160
|
+
readonly kind: "hardware";
|
|
161
|
+
} | {
|
|
162
|
+
readonly kind: "passkey";
|
|
163
|
+
} | {
|
|
164
|
+
readonly kind: "password";
|
|
165
|
+
readonly password: string;
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* A factor the user proves again for a guarded operation — `device` can never verify: it proves no
|
|
169
|
+
* user presence.
|
|
170
|
+
*/
|
|
171
|
+
type VerifyFactor = Exclude<UnlockFactor, {
|
|
172
|
+
readonly kind: "device";
|
|
173
|
+
}>;
|
|
174
|
+
/**
|
|
175
|
+
* A cloud-backup factor. On React Native the kernel collects the backup password through its own
|
|
176
|
+
* secure input — pass `{ kind: "password" }` there and the user types it into the trusted field; a
|
|
177
|
+
* `password` string is `unsupported`. On the web the password is required.
|
|
178
|
+
*/
|
|
179
|
+
type BackupFactorInput = {
|
|
180
|
+
readonly kind: "passkey";
|
|
181
|
+
} | {
|
|
182
|
+
readonly kind: "password";
|
|
183
|
+
readonly password?: string;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* A factor being created; `name` is the passkey credential's display name — the host validates it
|
|
187
|
+
* before the ceremony (1–64 characters). React Native hosts choose their own vault factors, so an
|
|
188
|
+
* initial factor exists only on hosts without a platform keystore.
|
|
189
|
+
*/
|
|
190
|
+
type InitialFactor = {
|
|
191
|
+
readonly kind: "passkey";
|
|
192
|
+
readonly name: string;
|
|
193
|
+
} | {
|
|
194
|
+
readonly kind: "password";
|
|
195
|
+
readonly password: string;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* WebAuthn RP identity + PRF salt labels the host configures once. `rpId`, `walletSalt` and
|
|
199
|
+
* `vaultSalt` are permanent identifiers: changing any of them makes every existing passkey factor
|
|
200
|
+
* and passkey-derived wallet unrecoverable, and the two salts must differ. Moving a wallet to a
|
|
201
|
+
* different domain requires WebAuthn related origins (`/.well-known/webauthn`); hosts should offer
|
|
202
|
+
* `exportMnemonic` for passkey-derived wallets so they survive an RP migration.
|
|
203
|
+
*
|
|
204
|
+
* The `rpId` scope is the wallet's trust boundary. WebAuthn binds a credential, and its PRF, to the
|
|
205
|
+
* RP id, not to one origin: a script on any origin that may claim this RP id — every subdomain of
|
|
206
|
+
* it, every related origin, every associated app — can evaluate the PRF over `walletSalt` and
|
|
207
|
+
* derive the seed of a passkey wallet from one ordinary-looking passkey prompt.
|
|
208
|
+
*/
|
|
209
|
+
type PasskeyConfig = {
|
|
210
|
+
/**
|
|
211
|
+
* RP id — a domain that serves nothing but the wallet (e.g. `wallet.example.com`), never a
|
|
212
|
+
* registrable parent shared with other content.
|
|
213
|
+
*/
|
|
214
|
+
readonly rpId: string;
|
|
215
|
+
readonly rpName: string;
|
|
216
|
+
readonly walletSalt: string;
|
|
217
|
+
readonly vaultSalt: string;
|
|
218
|
+
/** PRF salt for the cloud-backup factor — a third, distinct permanent label. */
|
|
219
|
+
readonly backupSalt: string;
|
|
220
|
+
};
|
|
221
|
+
type AutoLockPolicy = {
|
|
222
|
+
readonly platform: "native";
|
|
223
|
+
readonly backgroundSeconds: 0 | 60 | 300 | 900;
|
|
224
|
+
} | {
|
|
225
|
+
readonly platform: "web";
|
|
226
|
+
readonly idleMinutes: 5 | 15 | 60;
|
|
227
|
+
};
|
|
228
|
+
type NativeAutoLockPolicy = Extract<AutoLockPolicy, {
|
|
229
|
+
readonly platform: "native";
|
|
230
|
+
}>;
|
|
231
|
+
/** Public info for an imported private key — the record id, family and address. */
|
|
232
|
+
type KeyInfo = {
|
|
233
|
+
readonly keyId: string;
|
|
234
|
+
readonly family: "evm" | "solana" | "bitcoin" | "tron";
|
|
235
|
+
readonly address: string;
|
|
236
|
+
readonly createdAt: number;
|
|
237
|
+
};
|
|
238
|
+
/** The `wallet.keys` facade — import/list/remove/export for single private keys. */
|
|
239
|
+
type KeysApi = {
|
|
240
|
+
/**
|
|
241
|
+
* `secret` is the family's canonical encoding: `0x`-prefixed 64-hex or 32 bytes for EVM; base58
|
|
242
|
+
* or raw bytes for a Solana 32-byte seed or 64-byte keypair; bare 64-hex or 32 bytes for TRON.
|
|
243
|
+
*/
|
|
244
|
+
readonly import: (family: "evm" | "solana" | "bitcoin" | "tron", secret: string | Uint8Array) => Promise<KeyInfo>;
|
|
245
|
+
readonly list: () => Promise<ReadonlyArray<KeyInfo>>;
|
|
246
|
+
readonly remove: (keyId: string, verify: VerifyFactor) => Promise<void>;
|
|
247
|
+
readonly export: (keyId: string, verify: VerifyFactor) => Promise<Uint8Array>;
|
|
248
|
+
};
|
|
249
|
+
type WalletSnapshot = {
|
|
250
|
+
readonly vault: VaultState;
|
|
251
|
+
readonly lockReason: LockReason | undefined;
|
|
252
|
+
readonly verifying: boolean;
|
|
253
|
+
/** Established vault without a device factor: every unlock verifies (native app lock). */
|
|
254
|
+
readonly appLock: boolean;
|
|
255
|
+
/** Whether any presence-proving factor exists on this vault. */
|
|
256
|
+
readonly verification: "available" | "unavailable";
|
|
257
|
+
readonly factors: ReadonlyArray<FactorInfo>;
|
|
258
|
+
readonly wallets: ReadonlyArray<WalletInfo>;
|
|
259
|
+
readonly nostr: {
|
|
260
|
+
readonly keys: ReadonlyArray<NostrKeyInfo>;
|
|
261
|
+
};
|
|
262
|
+
readonly importedKeys: ReadonlyArray<KeyInfo>;
|
|
263
|
+
/** The retained backup key's public id, or null when cloud backup is off. */
|
|
264
|
+
readonly backup: BackupInfo | null;
|
|
265
|
+
/**
|
|
266
|
+
* Whether the vault signs requests the chain decoder marks blind — content it cannot show or
|
|
267
|
+
* bound.
|
|
268
|
+
*/
|
|
269
|
+
readonly blindSigning: boolean;
|
|
270
|
+
};
|
|
271
|
+
/** A one-shot secret buffer: `read` detaches the bytes to the caller, `wipe` zeroes them. */
|
|
272
|
+
type ExportedSecret = {
|
|
273
|
+
readonly read: () => Uint8Array;
|
|
274
|
+
readonly wipe: () => void;
|
|
275
|
+
};
|
|
276
|
+
/** What `exportMnemonic` returns: the phrase, and the BIP-39 passphrase when the wallet has one. */
|
|
277
|
+
type ExportedMnemonic = {
|
|
278
|
+
readonly mnemonic: ExportedSecret;
|
|
279
|
+
readonly passphrase?: ExportedSecret;
|
|
280
|
+
};
|
|
281
|
+
type MnemonicDraft = {
|
|
282
|
+
readonly words: ExportedSecret;
|
|
283
|
+
readonly quiz: ReadonlyArray<number>;
|
|
284
|
+
/** `passphrase` becomes the wallet's BIP-39 passphrase; omit or pass "" for none. */
|
|
285
|
+
readonly confirm: (answers: ReadonlyArray<string>, options?: {
|
|
286
|
+
readonly passphrase?: string;
|
|
287
|
+
}) => Promise<VaultWalletInfo>;
|
|
288
|
+
readonly discard: () => Promise<void>;
|
|
289
|
+
};
|
|
290
|
+
type VaultApi = {
|
|
291
|
+
readonly unlock: (factor?: UnlockFactor) => Promise<void>;
|
|
292
|
+
readonly lock: () => Promise<void>;
|
|
293
|
+
readonly addFactor: (factor: InitialFactor, verify: VerifyFactor) => Promise<FactorInfo>;
|
|
294
|
+
readonly removeFactor: (id: string, verify: VerifyFactor) => Promise<void>;
|
|
295
|
+
/** Registers the verifying (hardware) factor on a native vault that has none — no prior verify. */
|
|
296
|
+
readonly enrolVerification: () => Promise<void>;
|
|
297
|
+
/** Turns the native app lock on (drops the silent device factor) or off (restores it). */
|
|
298
|
+
readonly setAppLock: (enabled: boolean, verify: VerifyFactor) => Promise<void>;
|
|
299
|
+
/**
|
|
300
|
+
* Allows or refuses blind signing: the requests the chain decoder marks blind — raw-byte
|
|
301
|
+
* messages, typed data too large or misformed to show, an unrecognised function of a listed
|
|
302
|
+
* token, calldata that runs the signing account's own code, or a Safe delegatecall or unbounded
|
|
303
|
+
* refund. Off on a new vault; while off such a request fails with `blind-signing-disabled` before
|
|
304
|
+
* any verification prompt. Requests the wallet can describe but not verify sign without the
|
|
305
|
+
* setting.
|
|
306
|
+
*/
|
|
307
|
+
readonly setBlindSigning: (enabled: boolean, verify: VerifyFactor) => Promise<void>;
|
|
308
|
+
readonly reset: () => Promise<void>;
|
|
309
|
+
};
|
|
310
|
+
type WalletsApi = {
|
|
311
|
+
readonly createWithPasskey: (options: {
|
|
312
|
+
/** Display name for the new passkey credential (1–64 characters after trimming). */
|
|
313
|
+
readonly name: string;
|
|
314
|
+
readonly factor?: InitialFactor;
|
|
315
|
+
}) => Promise<VaultWalletInfo>;
|
|
316
|
+
readonly restoreWithPasskey: (options?: {
|
|
317
|
+
readonly factor?: InitialFactor;
|
|
318
|
+
}) => Promise<VaultWalletInfo>;
|
|
319
|
+
readonly createMnemonic: (options: {
|
|
320
|
+
readonly words: 12 | 24;
|
|
321
|
+
readonly factor?: InitialFactor;
|
|
322
|
+
}) => Promise<MnemonicDraft>;
|
|
323
|
+
readonly importMnemonic: (options: {
|
|
324
|
+
readonly mnemonic: string;
|
|
325
|
+
/** BIP-39 passphrase; omit or pass "" for none. Spaces are significant. */
|
|
326
|
+
readonly passphrase?: string;
|
|
327
|
+
readonly factor?: InitialFactor;
|
|
328
|
+
}) => Promise<VaultWalletInfo>;
|
|
329
|
+
/** One-shot mnemonic (and passphrase) export; requires re-verification every call. */
|
|
330
|
+
readonly exportMnemonic: (walletId: string, verify: VerifyFactor) => Promise<ExportedMnemonic>;
|
|
331
|
+
readonly delete: (walletId: string, verify: VerifyFactor) => Promise<void>;
|
|
332
|
+
};
|
|
333
|
+
type DataKeyApi = {
|
|
334
|
+
readonly get: (purpose: string) => Promise<Uint8Array>;
|
|
335
|
+
};
|
|
336
|
+
/**
|
|
337
|
+
* Cloud-backup entry points. `enable` re-verifies and retains a fresh BEK in the vault; `update`
|
|
338
|
+
* rewrites the sealed envelope JSON with the retained BEK (no factor ceremony, so an auto-sync can
|
|
339
|
+
* run silently); `disable` re-verifies and drops the retained BEK; `restore` merges an envelope
|
|
340
|
+
* into the vault. Factor inputs are `BackupFactorInput` — passkey assertions evaluate the PRF over
|
|
341
|
+
* `backupSalt`; on React Native a password factor carries no string, the kernel collects it through
|
|
342
|
+
* its secure input.
|
|
343
|
+
*/
|
|
344
|
+
type BackupApi = {
|
|
345
|
+
readonly enable: (options: {
|
|
346
|
+
readonly verify: VerifyFactor;
|
|
347
|
+
readonly factors: ReadonlyArray<BackupFactorInput>;
|
|
348
|
+
}) => Promise<void>;
|
|
349
|
+
readonly update: () => Promise<string>;
|
|
350
|
+
readonly disable: (verify: VerifyFactor) => Promise<void>;
|
|
351
|
+
/**
|
|
352
|
+
* Wallets whose header is flagged `passphrase` restore only when `passphrases` carries theirs;
|
|
353
|
+
* the rest are listed in `passphraseRequired` and a later restore can bring them in.
|
|
354
|
+
*/
|
|
355
|
+
readonly restore: (options: {
|
|
356
|
+
readonly envelope: string;
|
|
357
|
+
readonly backupFactor: BackupFactorInput;
|
|
358
|
+
readonly passphrases?: ReadonlyArray<{
|
|
359
|
+
readonly walletId: string;
|
|
360
|
+
readonly passphrase: string;
|
|
361
|
+
}>;
|
|
362
|
+
readonly factor?: InitialFactor;
|
|
363
|
+
}) => Promise<{
|
|
364
|
+
readonly wallets: ReadonlyArray<VaultWalletInfo>;
|
|
365
|
+
readonly passphraseRequired: ReadonlyArray<string>;
|
|
366
|
+
}>;
|
|
367
|
+
};
|
|
368
|
+
/**
|
|
369
|
+
* One running signer operation (card or device): `observe` replays the current step first, then
|
|
370
|
+
* every step the kernel reports; `cancel` is idempotent and resolves once the kernel answered the
|
|
371
|
+
* cancellation; `result` resolves with the operation's result or rejects —
|
|
372
|
+
* `WalletError("cancelled")` after a cancel.
|
|
373
|
+
*/
|
|
374
|
+
type SignerTask<Step, Result> = {
|
|
375
|
+
readonly observe: (listener: (step: Step) => void) => () => void;
|
|
376
|
+
readonly cancel: () => Promise<void>;
|
|
377
|
+
readonly result: Promise<Result>;
|
|
378
|
+
};
|
|
379
|
+
type Wallet = {
|
|
380
|
+
readonly getSnapshot: () => WalletSnapshot;
|
|
381
|
+
readonly subscribe: (listener: () => void) => () => void;
|
|
382
|
+
readonly vault: VaultApi;
|
|
383
|
+
readonly wallets: WalletsApi;
|
|
384
|
+
readonly keys: KeysApi;
|
|
385
|
+
readonly dataKeys: DataKeyApi;
|
|
386
|
+
readonly backup: BackupApi;
|
|
387
|
+
readonly destroy: () => Promise<void>;
|
|
388
|
+
};
|
|
389
|
+
export { VerifyFactor as A, PasskeyConfig as C, VaultApi as D, UnlockFactor as E, WalletSnapshot as F, WalletsApi as I, WalletError as M, WalletErrorCode as N, VaultState as O, WalletInfo as P, NostrKeyRef as S, StatusPayload as T, KeysApi as _, CardInfo as a, NativeAutoLockPolicy as b, DerivedNostrKey as c, FactorInfo as d, HARDWARE_DEVICES as f, KeyInfo as g, InitialFactor as h, BackupInfo as i, Wallet as j, VaultWalletInfo as k, ExportedMnemonic as l, HardwareWalletInfo as m, BackupApi as n, CardWalletInfo as o, HardwareDevice as p, BackupFactorInput as r, DataKeyApi as s, AutoLockPolicy as t, ExportedSecret as u, LockReason as v, SignerTask as w, NostrKeyInfo as x, MnemonicDraft as y };
|
|
390
|
+
//# sourceMappingURL=types-CRnacSqJ.d.mts.map
|
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as WalletSnapshot,
|
|
2
|
-
export { AutoLockPolicy, BackupApi, BackupInfo, DataKeyApi, DerivedNostrKey, ExportedMnemonic, ExportedSecret, FactorInfo, InitialFactor, LockReason, MnemonicDraft, NostrKeyInfo, NostrKeyRef, PasskeyConfig, StatusPayload, UnlockFactor, VaultApi, VaultState, Wallet, WalletError, WalletErrorCode, WalletInfo, WalletSnapshot, WalletsApi };
|
|
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
|
+
export { AutoLockPolicy, BackupApi, BackupFactorInput, BackupInfo, CardInfo, CardWalletInfo, DataKeyApi, DerivedNostrKey, ExportedMnemonic, ExportedSecret, FactorInfo, HARDWARE_DEVICES, HardwareDevice, HardwareWalletInfo, InitialFactor, KeyInfo, KeysApi, LockReason, MnemonicDraft, NativeAutoLockPolicy, NostrKeyInfo, NostrKeyRef, PasskeyConfig, SignerTask, StatusPayload, UnlockFactor, VaultApi, VaultState, VaultWalletInfo, VerifyFactor, Wallet, WalletError, WalletErrorCode, WalletInfo, WalletSnapshot, WalletsApi };
|
package/dist/types.mjs
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
// src/types.ts
|
|
2
|
+
/** The hardware-signing device families the kernel knows; each signer lane adds a literal. */
|
|
3
|
+
const HARDWARE_DEVICES = [
|
|
4
|
+
"keystone",
|
|
5
|
+
"ledger",
|
|
6
|
+
"onekey"
|
|
7
|
+
];
|
|
2
8
|
/** One error class for the whole API; `code` carries the distinction. Messages never echo input. */
|
|
3
9
|
var WalletError = class extends Error {
|
|
4
10
|
code;
|
|
@@ -16,6 +22,6 @@ var WalletError = class extends Error {
|
|
|
16
22
|
this.detail = detail;
|
|
17
23
|
}
|
|
18
24
|
};
|
|
19
|
-
export { WalletError };
|
|
25
|
+
export { HARDWARE_DEVICES, WalletError };
|
|
20
26
|
|
|
21
27
|
//# sourceMappingURL=types.mjs.map
|
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 =\n | \"cold-start\"\n | \"user\"\n | \"idle\"\n | \"background\"\n | \"expired\"\n | \"crashed\"\n | \"invalidated\";\n\nexport type FactorInfo =\n | { readonly kind: \"hardware\"; readonly id: string; readonly createdAt: number }\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 /**\n * Mnemonic: the user holds the phrase (passed the writing-down quiz, imported it, or exported at\n * least once). passkey: protected only by a synced passkey — still lost when the password manager\n * or account is lost, so the UI should prompt to export. none: exists only on this device (a\n * device-bound passkey).\n */\n readonly backup: \"none\" | \"passkey\" | \"mnemonic\";\n /** The wallet derives from its mnemonic plus a BIP-39 passphrase; only mnemonic wallets can. */\n readonly passphrase: boolean;\n readonly createdAt: number;\n};\n\nexport type NostrKeyRef = {\n readonly kind: \"derived\";\n readonly walletId: string;\n readonly index: number;\n};\n\nexport type NostrKeyInfo = {\n readonly ref: NostrKeyRef;\n readonly publicKey: string; // 64 lowercase hex\n readonly createdAt: number;\n};\n\n/** One entry of a `nostr.discover` result: the public key an identity index produces. */\nexport type DerivedNostrKey = { readonly index: number; readonly publicKey: string };\n\nexport type WalletErrorCode =\n | \"locked\"\n | \"cancelled\"\n | \"factor-invalidated\"\n | \"no-device-credential\"\n | \"passkey-not-configured\"\n | \"passkey-prf-unsupported\"\n | \"wrong-password\"\n | \"wrong-passkey\"\n | \"rate-limited\"\n | \"invalid-input\"\n | \"not-found\"\n | \"already-exists\"\n | \"conflict\"\n | \"unsupported\"\n | \"unavailable\"\n | \"integrity\"\n | \"approval-required\"\n | \"crashed\";\n\n/**\n * The vault half of the status payload: `corrupted` means authentication or structural data failed\n * to verify, `unsupported` means a newer build wrote it (data untouched, update the app),\n * `unavailable` means a transient store I/O failure (retried on the next request or change).\n */\nexport type VaultState =\n | \"uninitialized\"\n | \"locked\"\n | \"unlocked\"\n | \"corrupted\"\n | \"unsupported\"\n | \"unavailable\";\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: 2; // PROTOCOL_VERSION — literal to keep types.ts import-free\n readonly vault: VaultState;\n readonly factors: ReadonlyArray<FactorInfo>;\n readonly wallets: ReadonlyArray<WalletInfo>;\n readonly nostr: { readonly keys: ReadonlyArray<NostrKeyInfo> };\n // oxlint-disable-next-line typescript/no-restricted-types -- wire contract: backup is null when off\n readonly backup: BackupInfo | null;\n};\n\n/** Public summary of a retained backup key — factors are the unwrap paths, never secrets. */\nexport type BackupInfo = {\n readonly id: string; // 32 lowercase hex, derived from the BEK\n readonly factors: ReadonlyArray<\"passkey\" | \"password\">;\n readonly createdAt: number;\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 * A platform diagnostic as `\"<domain>:<code>\"` (e.g. `\"LAErrorDomain:-5\"`,\n * `\"android:KeyPermanentlyInvalidatedException\"`): never userInfo, localized text or input.\n */\n readonly detail: string | undefined;\n\n constructor(code: WalletErrorCode, message: string, retryAt?: number, detail?: string) {\n super(message);\n this.name = \"WalletError\";\n this.code = code;\n this.retryAt = retryAt;\n this.detail = detail;\n }\n}\n\n/**\n * A factor the user proves again for a guarded operation. `hardware` is the React Native factor:\n * the kernel shows the system verification prompt with text it renders itself.\n */\nexport type UnlockFactor =\n | { readonly kind: \"hardware\" }\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/**\n * WebAuthn RP identity + PRF salt labels the host configures once. `rpId`, `walletSalt` and\n * `vaultSalt` are permanent identifiers: changing any of them makes every existing passkey factor\n * and passkey-derived wallet unrecoverable, and the two salts must differ. Moving a wallet to a\n * different domain requires WebAuthn related origins (`/.well-known/webauthn`); hosts should offer\n * `exportMnemonic` for passkey-derived wallets so they survive an RP migration.\n */\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 /** PRF salt for the cloud-backup factor — a third, distinct permanent label. */\n readonly backupSalt: 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 WalletSnapshot = {\n readonly vault: VaultState;\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 /** The retained backup key's public id, or null when cloud backup is off. */\n // oxlint-disable-next-line typescript/no-restricted-types -- wire contract: backup is null when off\n readonly backup: BackupInfo | null;\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\n/** What `exportMnemonic` returns: the phrase, and the BIP-39 passphrase when the wallet has one. */\nexport type ExportedMnemonic = {\n readonly mnemonic: ExportedSecret;\n readonly passphrase?: ExportedSecret;\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 /** `passphrase` becomes the wallet's BIP-39 passphrase; omit or pass \"\" for none. */\n readonly confirm: (\n answers: ReadonlyArray<string>,\n options?: { readonly passphrase?: string },\n ) => 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 /** BIP-39 passphrase; omit or pass \"\" for none. Spaces are significant. */\n readonly passphrase?: string;\n readonly factor?: InitialFactor;\n }) => Promise<WalletInfo>;\n /** One-shot mnemonic (and passphrase) export; requires re-verification every call. */\n readonly exportMnemonic: (walletId: string, verify: UnlockFactor) => Promise<ExportedMnemonic>;\n readonly delete: (walletId: string, verify: UnlockFactor) => Promise<void>;\n};\n\nexport type DataKeyApi = {\n readonly get: (purpose: string) => Promise<Uint8Array>;\n};\n\n/**\n * Cloud-backup entry points. `enable` re-verifies and retains a fresh BEK in the vault; `update`\n * rewrites the sealed envelope JSON with the retained BEK (no factor ceremony, so an auto-sync can\n * run silently); `restore` merges an envelope into the vault. Factor inputs reuse `UnlockFactor` —\n * passkey assertions evaluate the PRF over `backupSalt`.\n */\nexport type BackupApi = {\n readonly enable: (options: {\n readonly verify: UnlockFactor;\n readonly factors: ReadonlyArray<UnlockFactor>;\n }) => Promise<void>;\n readonly update: () => Promise<string>;\n readonly disable: () => Promise<void>;\n /**\n * Wallets whose header is flagged `passphrase` restore only when `passphrases` carries theirs;\n * the rest are listed in `passphraseRequired` and a later restore can bring them in.\n */\n readonly restore: (options: {\n readonly envelope: string;\n readonly backupFactor: UnlockFactor;\n readonly passphrases?: ReadonlyArray<{\n readonly walletId: string;\n readonly passphrase: string;\n }>;\n readonly factor?: InitialFactor;\n }) => Promise<{\n readonly wallets: ReadonlyArray<WalletInfo>;\n readonly passphraseRequired: ReadonlyArray<string>;\n }>;\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 backup: BackupApi;\n readonly destroy: () => Promise<void>;\n};\n"],"mappings":";;AA4GA,IAAa,cAAb,cAAiC,MAAM;CACrC;CACA;;;;;CAKA;CAEA,YAAY,MAAuB,SAAiB,SAAkB,QAAiB;EACrF,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,UAAU;EACf,KAAK,SAAS;CAChB;AACF"}
|
|
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 =\n | \"cold-start\"\n | \"user\"\n | \"idle\"\n | \"background\"\n | \"expired\"\n | \"crashed\"\n | \"invalidated\";\n\nexport type FactorInfo =\n | { readonly kind: \"device\"; readonly id: string; readonly createdAt: number }\n | { readonly kind: \"hardware\"; readonly id: string; readonly createdAt: number }\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\n/** The hardware-signing device families the kernel knows; each signer lane adds a literal. */\nexport const HARDWARE_DEVICES = [\"keystone\", \"ledger\", \"onekey\"] as const;\n\n/** A hardware-signing device family the kernel knows; each signer adds a literal. */\nexport type HardwareDevice = (typeof HARDWARE_DEVICES)[number];\n\n/** A wallet whose seed lives sealed in this vault (an `entropy` record). */\nexport type VaultWalletInfo = {\n readonly custody: \"vault\";\n readonly walletId: string;\n readonly origin: \"passkey\" | \"mnemonic\";\n readonly words: 12 | 15 | 18 | 21 | 24;\n /**\n * Mnemonic: the user holds the phrase (passed the writing-down quiz, imported it, or exported at\n * least once). passkey: protected only by a synced passkey — still lost when the password manager\n * or account is lost, so the UI should prompt to export. none: exists only on this device (a\n * device-bound passkey).\n */\n readonly backup: \"none\" | \"passkey\" | \"mnemonic\";\n /** The wallet derives from its mnemonic plus a BIP-39 passphrase; only mnemonic wallets can. */\n readonly passphrase: boolean;\n readonly createdAt: number;\n};\n\n/**\n * An externally signed wallet: the vault stores the device's master fingerprint and its pinned\n * public material — never a seed — so there is no origin, word count or backup state to report.\n */\nexport type HardwareWalletInfo = {\n readonly custody: \"hardware\";\n readonly walletId: string;\n /** The paired device kind — possibly one this build does not know (see `supported`). */\n readonly device: string;\n /** Whether this build ships a driver for `device`; unknown kinds stay inert. */\n readonly supported: boolean;\n /** The device master fingerprint as 8 lowercase hex chars. */\n readonly fingerprint: string;\n readonly model?: string;\n readonly firmware?: string;\n readonly createdAt: number;\n};\n\n/**\n * A wallet whose seed lives only on qntx cards (a `card-wallet` record): the vault caches the\n * public material a tap fetched, never the seed. `members` is the card count k (1–3).\n */\nexport type CardWalletInfo = {\n readonly custody: \"card\";\n readonly walletId: string;\n readonly origin: \"card-generated\" | \"card-imported\";\n readonly backup: \"cards\";\n readonly createdAt: number;\n readonly members: number;\n readonly cards: ReadonlyArray<CardInfo>;\n};\n\nexport type CardInfo = {\n /** `ID(A)`: 32 lowercase hex identifying the card's identity key. */\n readonly cardId: string;\n /** `XXXX-XXXX` display id — only when the record pins this card's certificate. */\n readonly shortId?: string;\n /** `pending` never finished its IMPORT; `unknown` this kernel has not checked it yet. */\n readonly state: \"ready\" | \"unknown\" | \"pending\";\n /** Remaining access-code tries this kernel recorded (0..10). */\n readonly tries?: number;\n readonly verifiedAt?: number;\n};\n\nexport type WalletInfo = VaultWalletInfo | HardwareWalletInfo | CardWalletInfo;\n\nexport type NostrKeyRef = {\n readonly kind: \"derived\";\n readonly walletId: string;\n readonly index: number;\n};\n\nexport type NostrKeyInfo = {\n readonly ref: NostrKeyRef;\n readonly publicKey: string; // 64 lowercase hex\n readonly createdAt: number;\n};\n\n/** One entry of a `nostr.discover` result: the public key an identity index produces. */\nexport type DerivedNostrKey = { readonly index: number; readonly publicKey: string };\n\nexport type WalletErrorCode =\n | \"locked\"\n | \"cancelled\"\n | \"factor-invalidated\"\n | \"verification-unavailable\"\n | \"passkey-not-configured\"\n | \"passkey-prf-unsupported\"\n | \"wrong-password\"\n | \"wrong-passkey\"\n | \"rate-limited\"\n | \"invalid-input\"\n | \"not-found\"\n | \"already-exists\"\n | \"conflict\"\n | \"unsupported\"\n | \"unavailable\"\n | \"integrity\"\n | \"blind-signing-disabled\"\n | \"approval-required\"\n | \"card-not-genuine\"\n | \"card-id-mismatch\"\n | \"card-erased\"\n | \"card-locked\"\n | \"card-tampered\"\n | \"card-fault\"\n | \"card-unsupported\"\n | \"app-lock-required\"\n | \"limit-exceeded\"\n | \"crashed\"\n | \"device-required\"\n | \"device-locked\"\n | \"device-app-closed\"\n | \"device-rejected\"\n | \"wrong-device\";\n\n/**\n * The vault half of the status payload: `corrupted` means authentication or structural data failed\n * to verify, `unsupported` means a different build wrote it — a newer one, or (before 1.0) an older\n * one whose format this build never read; the data is left untouched either way — a newer build's\n * vault reads again once the app is updated, while a pre-1.0 older format has no reader here and\n * the only way out is the explicit `vault.reset`. `unavailable` means a transient store I/O failure\n * (retried on the next request or change).\n */\nexport type VaultState =\n | \"uninitialized\"\n | \"locked\"\n | \"unlocked\"\n | \"corrupted\"\n | \"unsupported\"\n | \"unavailable\";\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: 3; // PROTOCOL_VERSION — literal to keep types.ts import-free\n readonly vault: VaultState;\n /** Whether the vault requires a verifying unlock (established vaults without a device factor). */\n readonly appLock: boolean;\n /** Whether any factor that can prove user presence exists (hardware, passkey or password). */\n readonly verification: \"available\" | \"unavailable\";\n readonly factors: ReadonlyArray<FactorInfo>;\n readonly wallets: ReadonlyArray<WalletInfo>;\n readonly nostr: { readonly keys: ReadonlyArray<NostrKeyInfo> };\n readonly importedKeys: ReadonlyArray<KeyInfo>;\n // oxlint-disable-next-line typescript/no-restricted-types -- wire contract: backup is null when off\n readonly backup: BackupInfo | null;\n /**\n * Whether the vault signs requests the chain decoder marks blind — content it cannot show or\n * bound.\n */\n readonly blindSigning: boolean;\n};\n\n/** Public summary of a retained backup key — factors are the unwrap paths, never secrets. */\nexport type BackupInfo = {\n readonly id: string; // 32 lowercase hex, derived from the BEK\n readonly factors: ReadonlyArray<\"passkey\" | \"password\">;\n readonly createdAt: number;\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 * A platform diagnostic as `\"<domain>:<code>\"` (e.g. `\"LAErrorDomain:-5\"`,\n * `\"android:KeyPermanentlyInvalidatedException\"`): never userInfo, localized text or input.\n */\n readonly detail: string | undefined;\n\n constructor(code: WalletErrorCode, message: string, retryAt?: number, detail?: string) {\n super(message);\n this.name = \"WalletError\";\n this.code = code;\n this.retryAt = retryAt;\n this.detail = detail;\n }\n}\n\n/**\n * A factor that opens the vault. `device` is the silent React Native factor (no user presence);\n * `hardware` is the React Native factor that proves presence — the kernel shows the system\n * verification prompt with text it renders itself.\n */\nexport type UnlockFactor =\n | { readonly kind: \"device\" }\n | { readonly kind: \"hardware\" }\n | { readonly kind: \"passkey\" }\n | { readonly kind: \"password\"; readonly password: string };\n\n/**\n * A factor the user proves again for a guarded operation — `device` can never verify: it proves no\n * user presence.\n */\nexport type VerifyFactor = Exclude<UnlockFactor, { readonly kind: \"device\" }>;\n\n/**\n * A cloud-backup factor. On React Native the kernel collects the backup password through its own\n * secure input — pass `{ kind: \"password\" }` there and the user types it into the trusted field; a\n * `password` string is `unsupported`. On the web the password is required.\n */\nexport type BackupFactorInput =\n | { readonly kind: \"passkey\" }\n | { readonly kind: \"password\"; readonly password?: string };\n\n/**\n * A factor being created; `name` is the passkey credential's display name — the host validates it\n * before the ceremony (1–64 characters). React Native hosts choose their own vault factors, so an\n * initial factor exists only on hosts without a platform keystore.\n */\nexport type InitialFactor =\n | { readonly kind: \"passkey\"; readonly name: string }\n | { readonly kind: \"password\"; readonly password: string };\n\n/**\n * WebAuthn RP identity + PRF salt labels the host configures once. `rpId`, `walletSalt` and\n * `vaultSalt` are permanent identifiers: changing any of them makes every existing passkey factor\n * and passkey-derived wallet unrecoverable, and the two salts must differ. Moving a wallet to a\n * different domain requires WebAuthn related origins (`/.well-known/webauthn`); hosts should offer\n * `exportMnemonic` for passkey-derived wallets so they survive an RP migration.\n *\n * The `rpId` scope is the wallet's trust boundary. WebAuthn binds a credential, and its PRF, to the\n * RP id, not to one origin: a script on any origin that may claim this RP id — every subdomain of\n * it, every related origin, every associated app — can evaluate the PRF over `walletSalt` and\n * derive the seed of a passkey wallet from one ordinary-looking passkey prompt.\n */\nexport type PasskeyConfig = {\n /**\n * RP id — a domain that serves nothing but the wallet (e.g. `wallet.example.com`), never a\n * registrable parent shared with other content.\n */\n readonly rpId: string;\n readonly rpName: string;\n readonly walletSalt: string;\n readonly vaultSalt: string;\n /** PRF salt for the cloud-backup factor — a third, distinct permanent label. */\n readonly backupSalt: 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 NativeAutoLockPolicy = Extract<AutoLockPolicy, { readonly platform: \"native\" }>;\n\n/** Public info for an imported private key — the record id, family and address. */\nexport type KeyInfo = {\n readonly keyId: string;\n readonly family: \"evm\" | \"solana\" | \"bitcoin\" | \"tron\";\n readonly address: string;\n readonly createdAt: number;\n};\n\n/** The `wallet.keys` facade — import/list/remove/export for single private keys. */\nexport type KeysApi = {\n /**\n * `secret` is the family's canonical encoding: `0x`-prefixed 64-hex or 32 bytes for EVM; base58\n * or raw bytes for a Solana 32-byte seed or 64-byte keypair; bare 64-hex or 32 bytes for TRON.\n */\n readonly import: (\n family: \"evm\" | \"solana\" | \"bitcoin\" | \"tron\",\n secret: string | Uint8Array,\n ) => Promise<KeyInfo>;\n readonly list: () => Promise<ReadonlyArray<KeyInfo>>;\n readonly remove: (keyId: string, verify: VerifyFactor) => Promise<void>;\n readonly export: (keyId: string, verify: VerifyFactor) => Promise<Uint8Array>;\n};\n\nexport type WalletSnapshot = {\n readonly vault: VaultState;\n readonly lockReason: LockReason | undefined;\n readonly verifying: boolean; // a user verification is in flight\n /** Established vault without a device factor: every unlock verifies (native app lock). */\n readonly appLock: boolean;\n /** Whether any presence-proving factor exists on this vault. */\n readonly verification: \"available\" | \"unavailable\";\n readonly factors: ReadonlyArray<FactorInfo>;\n readonly wallets: ReadonlyArray<WalletInfo>;\n readonly nostr: { readonly keys: ReadonlyArray<NostrKeyInfo> };\n readonly importedKeys: ReadonlyArray<KeyInfo>;\n /** The retained backup key's public id, or null when cloud backup is off. */\n // oxlint-disable-next-line typescript/no-restricted-types -- wire contract: backup is null when off\n readonly backup: BackupInfo | null;\n /**\n * Whether the vault signs requests the chain decoder marks blind — content it cannot show or\n * bound.\n */\n readonly blindSigning: boolean;\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\n/** What `exportMnemonic` returns: the phrase, and the BIP-39 passphrase when the wallet has one. */\nexport type ExportedMnemonic = {\n readonly mnemonic: ExportedSecret;\n readonly passphrase?: ExportedSecret;\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 /** `passphrase` becomes the wallet's BIP-39 passphrase; omit or pass \"\" for none. */\n readonly confirm: (\n answers: ReadonlyArray<string>,\n options?: { readonly passphrase?: string },\n ) => Promise<VaultWalletInfo>;\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: VerifyFactor) => Promise<FactorInfo>;\n readonly removeFactor: (id: string, verify: VerifyFactor) => Promise<void>; // ≥1 factor remains\n /** Registers the verifying (hardware) factor on a native vault that has none — no prior verify. */\n readonly enrolVerification: () => Promise<void>;\n /** Turns the native app lock on (drops the silent device factor) or off (restores it). */\n readonly setAppLock: (enabled: boolean, verify: VerifyFactor) => Promise<void>;\n /**\n * Allows or refuses blind signing: the requests the chain decoder marks blind — raw-byte\n * messages, typed data too large or misformed to show, an unrecognised function of a listed\n * token, calldata that runs the signing account's own code, or a Safe delegatecall or unbounded\n * refund. Off on a new vault; while off such a request fails with `blind-signing-disabled` before\n * any verification prompt. Requests the wallet can describe but not verify sign without the\n * setting.\n */\n readonly setBlindSigning: (enabled: boolean, verify: VerifyFactor) => Promise<void>;\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<VaultWalletInfo>;\n readonly restoreWithPasskey: (options?: {\n readonly factor?: InitialFactor;\n }) => Promise<VaultWalletInfo>;\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 /** BIP-39 passphrase; omit or pass \"\" for none. Spaces are significant. */\n readonly passphrase?: string;\n readonly factor?: InitialFactor;\n }) => Promise<VaultWalletInfo>;\n /** One-shot mnemonic (and passphrase) export; requires re-verification every call. */\n readonly exportMnemonic: (walletId: string, verify: VerifyFactor) => Promise<ExportedMnemonic>;\n readonly delete: (walletId: string, verify: VerifyFactor) => Promise<void>;\n};\n\nexport type DataKeyApi = {\n readonly get: (purpose: string) => Promise<Uint8Array>;\n};\n\n/**\n * Cloud-backup entry points. `enable` re-verifies and retains a fresh BEK in the vault; `update`\n * rewrites the sealed envelope JSON with the retained BEK (no factor ceremony, so an auto-sync can\n * run silently); `disable` re-verifies and drops the retained BEK; `restore` merges an envelope\n * into the vault. Factor inputs are `BackupFactorInput` — passkey assertions evaluate the PRF over\n * `backupSalt`; on React Native a password factor carries no string, the kernel collects it through\n * its secure input.\n */\nexport type BackupApi = {\n readonly enable: (options: {\n readonly verify: VerifyFactor;\n readonly factors: ReadonlyArray<BackupFactorInput>;\n }) => Promise<void>;\n readonly update: () => Promise<string>;\n readonly disable: (verify: VerifyFactor) => Promise<void>;\n /**\n * Wallets whose header is flagged `passphrase` restore only when `passphrases` carries theirs;\n * the rest are listed in `passphraseRequired` and a later restore can bring them in.\n */\n readonly restore: (options: {\n readonly envelope: string;\n readonly backupFactor: BackupFactorInput;\n readonly passphrases?: ReadonlyArray<{\n readonly walletId: string;\n readonly passphrase: string;\n }>;\n readonly factor?: InitialFactor;\n }) => Promise<{\n readonly wallets: ReadonlyArray<VaultWalletInfo>;\n readonly passphraseRequired: ReadonlyArray<string>;\n }>;\n};\n\n/**\n * One running signer operation (card or device): `observe` replays the current step first, then\n * every step the kernel reports; `cancel` is idempotent and resolves once the kernel answered the\n * cancellation; `result` resolves with the operation's result or rejects —\n * `WalletError(\"cancelled\")` after a cancel.\n */\nexport type SignerTask<Step, Result> = {\n readonly observe: (listener: (step: Step) => void) => () => void;\n readonly cancel: () => Promise<void>;\n readonly result: Promise<Result>;\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 keys: KeysApi;\n readonly dataKeys: DataKeyApi;\n readonly backup: BackupApi;\n readonly destroy: () => Promise<void>;\n};\n"],"mappings":";;AAuBA,MAAa,mBAAmB;CAAC;CAAY;CAAU;AAAQ;;AAwK/D,IAAa,cAAb,cAAiC,MAAM;CACrC;CACA;;;;;CAKA;CAEA,YAAY,MAAuB,SAAiB,SAAkB,QAAiB;EACrF,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,UAAU;EACf,KAAK,SAAS;CAChB;AACF"}
|