@invisi-labs/sdk 1.1.1 → 1.1.3

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/index.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as _invisi_labs_core from '@invisi-labs/core';
2
2
  import { WalletAuthorizationProvider, CreditDeliveryState, Wallet, Note, DisclosureOutput, Disclosure, DisclosureResult } from '@invisi-labs/core';
3
- export { Address, CreditDeliveryState, CreditNote, CreditOpening, Detector, Disclosure, DisclosureExport, DisclosureOutput, DisclosureResult, Hex, MissingCapabilityError, Note, NullifierCapability, ReceivingKeys, ViewingCapability, Wallet, WalletAuthorization, WalletAuthorizationProvider } from '@invisi-labs/core';
4
- import { O as OperationRuntime, a as OperationPlan, G as GasReference, F as FundingSigner, b as OperationAggregateMember, C as CancelCreditPreparation, c as CreateCreditPreparation, D as DrawCreditPreparation, S as ShieldPreparation, d as SweepPreparation, T as TopUpCreditPreparation, e as TransferPreparation, W as WithdrawalPreparation, f as WalletSessionOptions } from './gas-estimation-Byi278aa.cjs';
5
- export { g as CoinSelector, h as FundingAuthorizationVerifier, i as FundingSource, j as FundingTypedData, k as GasBenchmarkCircuit, l as GasBenchmarkDeployment, m as GasBenchmarkProfile, n as GasBenchmarkSample, o as GasBenchmarkShape, p as defineGasBenchmarks } from './gas-estimation-Byi278aa.cjs';
3
+ export { Address, CreditDeliveryState, CreditNote, CreditOpening, CreditPolicy, Detector, Disclosure, DisclosureExport, DisclosureOutput, DisclosureResult, Hex, MAX_MEMO_BYTES, Memo, MissingCapabilityError, Note, NullifierCapability, ReceivingKeys, ViewingCapability, Wallet, WalletAuthorization, WalletAuthorizationProvider, decodeMemoText, encodeMemo } from '@invisi-labs/core';
4
+ import { O as OperationRuntime, a as OperationPlan, G as GasReference, F as FundingSigner, b as OperationAggregateMember, C as CancelCreditPreparation, c as CreateCreditPreparation, D as DrawCreditPreparation, S as ShieldPreparation, d as SweepPreparation, T as TopUpCreditPreparation, e as TransferPreparation, W as WithdrawalPreparation, f as WalletSessionOptions } from './gas-estimation-C1OEgFFJ.cjs';
5
+ export { g as CoinSelector, h as FundingAuthorizationVerifier, i as FundingSource, j as FundingTypedData, k as GasBenchmarkCircuit, l as GasBenchmarkDeployment, m as GasBenchmarkProfile, n as GasBenchmarkSample, o as GasBenchmarkShape, p as defineGasBenchmarks } from './gas-estimation-C1OEgFFJ.cjs';
6
6
  import * as _invisi_labs_protocol from '@invisi-labs/protocol';
7
7
  import { TransactionCall, Protocol, CanonicalBlock, ChainReader, TokenProtocol, AddressRegistry as AddressRegistry$1, RegistrationPreparation } from '@invisi-labs/protocol';
8
8
  export { AddressRegistryOptions, CanonicalBlock, CanonicalReceipt, ChainReader, FactoryReader, Membership, Protocol, ProtocolDataProvider, ProtocolDataStatus, ProtocolOptions, ProtocolUpdateRange, ProtocolUpdates, RegistrationOperation, RegistryContext, RegistryReader, TokenProtocol, TokenProtocolOptions, TransactionCall, TransactionContext } from '@invisi-labs/protocol';
@@ -24,15 +24,16 @@ declare class PreparedTransaction {
24
24
  private constructor();
25
25
  static prepare(runtime: Runtime, plan: OperationPlan): PreparedTransaction;
26
26
  get id(): string;
27
- get kind(): "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
27
+ get kind(): "shield" | "transfer" | "withdraw" | "sweep" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
28
28
  estimateGas(): GasReference;
29
29
  preview(): {
30
30
  id: string;
31
- kind: "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
31
+ kind: "shield" | "transfer" | "withdraw" | "sweep" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
32
32
  status: OperationStatus;
33
33
  context: {
34
34
  tokenAddress: _invisi_labs_core.Address;
35
35
  now?: bigint;
36
+ timestamp?: bigint;
36
37
  chainId: bigint;
37
38
  protocolAddress: _invisi_labs_core.Address;
38
39
  };
@@ -87,7 +88,7 @@ declare class PreparedTransaction {
87
88
  toJSON(): {
88
89
  transaction: boolean;
89
90
  id: string;
90
- kind: "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
91
+ kind: "shield" | "transfer" | "withdraw" | "sweep" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
91
92
  status: OperationStatus;
92
93
  };
93
94
  }
@@ -185,11 +186,12 @@ declare class Operation {
185
186
  estimateGas(): GasReference;
186
187
  preview(): {
187
188
  id: string;
188
- kind: "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
189
+ kind: "shield" | "transfer" | "withdraw" | "sweep" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
189
190
  status: OperationStatus;
190
191
  context: {
191
192
  tokenAddress: _invisi_labs_core.Address;
192
193
  now?: bigint;
194
+ timestamp?: bigint;
193
195
  chainId: bigint;
194
196
  protocolAddress: _invisi_labs_core.Address;
195
197
  };
@@ -245,7 +247,7 @@ declare class Operation {
245
247
  }): Promise<Operation>;
246
248
  toJSON(): {
247
249
  id: string;
248
- kind: "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
250
+ kind: "shield" | "transfer" | "withdraw" | "sweep" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
249
251
  status: OperationStatus;
250
252
  };
251
253
  }
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as _invisi_labs_core from '@invisi-labs/core';
2
2
  import { WalletAuthorizationProvider, CreditDeliveryState, Wallet, Note, DisclosureOutput, Disclosure, DisclosureResult } from '@invisi-labs/core';
3
- export { Address, CreditDeliveryState, CreditNote, CreditOpening, Detector, Disclosure, DisclosureExport, DisclosureOutput, DisclosureResult, Hex, MissingCapabilityError, Note, NullifierCapability, ReceivingKeys, ViewingCapability, Wallet, WalletAuthorization, WalletAuthorizationProvider } from '@invisi-labs/core';
4
- import { O as OperationRuntime, a as OperationPlan, G as GasReference, F as FundingSigner, b as OperationAggregateMember, C as CancelCreditPreparation, c as CreateCreditPreparation, D as DrawCreditPreparation, S as ShieldPreparation, d as SweepPreparation, T as TopUpCreditPreparation, e as TransferPreparation, W as WithdrawalPreparation, f as WalletSessionOptions } from './gas-estimation-CUZXjsO7.js';
5
- export { g as CoinSelector, h as FundingAuthorizationVerifier, i as FundingSource, j as FundingTypedData, k as GasBenchmarkCircuit, l as GasBenchmarkDeployment, m as GasBenchmarkProfile, n as GasBenchmarkSample, o as GasBenchmarkShape, p as defineGasBenchmarks } from './gas-estimation-CUZXjsO7.js';
3
+ export { Address, CreditDeliveryState, CreditNote, CreditOpening, CreditPolicy, Detector, Disclosure, DisclosureExport, DisclosureOutput, DisclosureResult, Hex, MAX_MEMO_BYTES, Memo, MissingCapabilityError, Note, NullifierCapability, ReceivingKeys, ViewingCapability, Wallet, WalletAuthorization, WalletAuthorizationProvider, decodeMemoText, encodeMemo } from '@invisi-labs/core';
4
+ import { O as OperationRuntime, a as OperationPlan, G as GasReference, F as FundingSigner, b as OperationAggregateMember, C as CancelCreditPreparation, c as CreateCreditPreparation, D as DrawCreditPreparation, S as ShieldPreparation, d as SweepPreparation, T as TopUpCreditPreparation, e as TransferPreparation, W as WithdrawalPreparation, f as WalletSessionOptions } from './gas-estimation-BU3or4AH.js';
5
+ export { g as CoinSelector, h as FundingAuthorizationVerifier, i as FundingSource, j as FundingTypedData, k as GasBenchmarkCircuit, l as GasBenchmarkDeployment, m as GasBenchmarkProfile, n as GasBenchmarkSample, o as GasBenchmarkShape, p as defineGasBenchmarks } from './gas-estimation-BU3or4AH.js';
6
6
  import * as _invisi_labs_protocol from '@invisi-labs/protocol';
7
7
  import { TransactionCall, Protocol, CanonicalBlock, ChainReader, TokenProtocol, AddressRegistry as AddressRegistry$1, RegistrationPreparation } from '@invisi-labs/protocol';
8
8
  export { AddressRegistryOptions, CanonicalBlock, CanonicalReceipt, ChainReader, FactoryReader, Membership, Protocol, ProtocolDataProvider, ProtocolDataStatus, ProtocolOptions, ProtocolUpdateRange, ProtocolUpdates, RegistrationOperation, RegistryContext, RegistryReader, TokenProtocol, TokenProtocolOptions, TransactionCall, TransactionContext } from '@invisi-labs/protocol';
@@ -24,15 +24,16 @@ declare class PreparedTransaction {
24
24
  private constructor();
25
25
  static prepare(runtime: Runtime, plan: OperationPlan): PreparedTransaction;
26
26
  get id(): string;
27
- get kind(): "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
27
+ get kind(): "shield" | "transfer" | "withdraw" | "sweep" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
28
28
  estimateGas(): GasReference;
29
29
  preview(): {
30
30
  id: string;
31
- kind: "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
31
+ kind: "shield" | "transfer" | "withdraw" | "sweep" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
32
32
  status: OperationStatus;
33
33
  context: {
34
34
  tokenAddress: _invisi_labs_core.Address;
35
35
  now?: bigint;
36
+ timestamp?: bigint;
36
37
  chainId: bigint;
37
38
  protocolAddress: _invisi_labs_core.Address;
38
39
  };
@@ -87,7 +88,7 @@ declare class PreparedTransaction {
87
88
  toJSON(): {
88
89
  transaction: boolean;
89
90
  id: string;
90
- kind: "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
91
+ kind: "shield" | "transfer" | "withdraw" | "sweep" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
91
92
  status: OperationStatus;
92
93
  };
93
94
  }
@@ -185,11 +186,12 @@ declare class Operation {
185
186
  estimateGas(): GasReference;
186
187
  preview(): {
187
188
  id: string;
188
- kind: "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
189
+ kind: "shield" | "transfer" | "withdraw" | "sweep" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
189
190
  status: OperationStatus;
190
191
  context: {
191
192
  tokenAddress: _invisi_labs_core.Address;
192
193
  now?: bigint;
194
+ timestamp?: bigint;
193
195
  chainId: bigint;
194
196
  protocolAddress: _invisi_labs_core.Address;
195
197
  };
@@ -245,7 +247,7 @@ declare class Operation {
245
247
  }): Promise<Operation>;
246
248
  toJSON(): {
247
249
  id: string;
248
- kind: "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
250
+ kind: "shield" | "transfer" | "withdraw" | "sweep" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
249
251
  status: OperationStatus;
250
252
  };
251
253
  }
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  signOperationFunding,
20
20
  statement,
21
21
  walletBalance
22
- } from "./chunk-7TFLU2Z6.js";
22
+ } from "./chunk-FSQYZO66.js";
23
23
  import {
24
24
  EthersAddressResolver,
25
25
  EthersChainReader,
@@ -436,7 +436,10 @@ import {
436
436
  NullifierCapability,
437
437
  WalletAuthorization,
438
438
  MissingCapabilityError as MissingCapabilityError3,
439
- Disclosure
439
+ Disclosure,
440
+ encodeMemo,
441
+ decodeMemoText,
442
+ MAX_MEMO_BYTES
440
443
  } from "@invisi-labs/core";
441
444
  import { Protocol, RegistrationOperation } from "@invisi-labs/protocol";
442
445
  import { ProtocolRpcError } from "@invisi-labs/rpc";
@@ -554,6 +557,7 @@ export {
554
557
  DisclosureVerifier,
555
558
  EncryptedWalletCodec,
556
559
  Invisi,
560
+ MAX_MEMO_BYTES,
557
561
  MissingCapabilityError3 as MissingCapabilityError,
558
562
  NullifierCapability,
559
563
  Operation,
@@ -566,7 +570,9 @@ export {
566
570
  Wallet,
567
571
  WalletAuthorization,
568
572
  WalletSession,
573
+ decodeMemoText,
569
574
  defineGasBenchmarks,
575
+ encodeMemo,
570
576
  walletBalance
571
577
  };
572
578
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/explicit-preparation.ts","../src/PreparedTransaction.ts","../src/Invisi.ts","../src/index.ts","../src/ProtocolRpcClient.ts","../src/AddressRegistry.ts","../src/integrations/encrypted-codec.ts"],"sourcesContent":["import { getAddress } from \"ethers\";\nimport type { CreditInput, NoteInput } from \"./explicit-types\";\nimport { PreparedTransaction } from \"./PreparedTransaction\";\nimport { positiveAmount } from \"./session/prepare-common\";\nimport { TransactionPreparation } from \"./session/transaction-preparation\";\nimport type { PreparationInventory, WalletSessionOptions } from \"./session/operation-types\";\n\n/** Only explicitly supplied records participate. No store or automatic coin selection. */\nexport function explicitPreparation(\n options: WalletSessionOptions,\n data: {\n inputs?: readonly NoteInput[];\n creditInputs?: readonly CreditInput[];\n changeAddress?: string;\n },\n tokenAddress: `0x${string}`\n) {\n if (!options.chainReader) throw new Error(\"chain reader required\");\n const inputs = structuredClone(data.inputs ?? []);\n const credits = structuredClone(data.creditInputs ?? []);\n const inventory: PreparationInventory = { notes: {}, credits: {}, reservations: {} };\n const context = options.protocol.context;\n function position(input: NoteInput | CreditInput) {\n if (\n typeof input.treeId !== \"bigint\" ||\n input.treeId < 0n ||\n input.treeId >= 1n << 256n ||\n !Number.isInteger(input.leafIndex) ||\n input.leafIndex < 0 ||\n input.leafIndex >= 65536\n )\n throw new Error(\"invalid explicit input position\");\n }\n for (const input of inputs) {\n position(input);\n positiveAmount(input.note.amount);\n if (inventory.notes[input.commitment]) throw new Error(\"duplicate explicit note input\");\n if (\n input.note.chainId !== context.chainId ||\n input.note.protocolAddress !== BigInt(context.protocolAddress) ||\n input.note.walletIdentity !== options.wallet.walletIdentity\n )\n throw new Error(\"explicit note identity or deployment mismatch\");\n inventory.notes[input.commitment] = { ...input, spent: \"unspent\" };\n }\n for (const input of credits) {\n position(input);\n if (input.role !== \"owner\" && input.role !== \"spender\")\n throw new Error(\"invalid explicit Credit role\");\n const key = input.commitment + \":\" + input.role;\n if (inventory.credits[key]) throw new Error(\"duplicate explicit Credit input\");\n inventory.credits[key] = { ...input, spent: \"unspent\" };\n }\n const scope = {\n ...context,\n namespace: \"explicit\",\n walletIdentity: options.wallet.walletIdentity,\n };\n const { store: _store, coinSelector: _selector, ...capabilities } = options;\n\n if (inputs.some((input) => input.note.tokenAddress !== BigInt(getAddress(tokenAddress))))\n throw new Error(\"explicit note token mismatch\");\n const runtime = {\n options: { ...capabilities, protocol: options.protocol.forToken(tokenAddress) },\n reader: options.chainReader!,\n scope,\n authorization: () => options.authorization ?? options.wallet.exportAuthorization(),\n };\n return new TransactionPreparation<PreparedTransaction>({\n ...runtime,\n explicitInputs: true,\n ...(data.changeAddress ? { changeAddress: data.changeAddress } : {}),\n readInventory: async () => structuredClone(inventory),\n complete: async (plan) => PreparedTransaction.prepare(runtime, plan),\n });\n}\n","import { estimateGasReference } from \"./gas-estimation\";\nimport {\n authorizeOperation,\n proveOperation,\n signOperationFunding,\n} from \"./session/operation-execution\";\nimport {\n MissingCapabilityError,\n type AuthorizedStatement,\n type WalletAuthorizationProvider,\n} from \"@invisi-labs/core\";\nimport { normalizeFunding, type TransactionCall } from \"@invisi-labs/protocol\";\nimport type { Prover, ProverOptions, ProofBundle } from \"@invisi-labs/prover\";\nimport type {\n FundingSigner,\n OperationPlan,\n OperationRuntime,\n OperationAggregateMember,\n SavedOperation,\n} from \"./session/operation-types\";\nimport type { OperationStatus } from \"./session/state\";\nimport {\n encodeOperation,\n publicProof,\n requiresAuthorization,\n statement,\n} from \"./session/operation-protocol\";\nimport { sameStatement } from \"./session/proof-integrity\";\nimport { operationPreview } from \"./session/operation-preview\";\nfunction check(ok: unknown, message: string): asserts ok {\n if (!ok) throw new Error(message);\n}\n\ntype Runtime = Omit<OperationRuntime, \"store\">;\ntype Lifecycle = { generation: number; busy: boolean };\n/** An immutable, local transaction handle. No wallet inventory, reservations or persistence. */\nexport class PreparedTransaction {\n readonly #runtime: Runtime;\n readonly #saved: SavedOperation;\n readonly #authorization: AuthorizedStatement | undefined;\n readonly #lifecycle: Lifecycle;\n readonly status: OperationStatus;\n private constructor(\n runtime: Runtime,\n saved: SavedOperation,\n status: OperationStatus,\n lifecycle: Lifecycle,\n authorization?: AuthorizedStatement\n ) {\n this.#runtime = runtime;\n this.#saved = structuredClone(saved);\n this.#lifecycle = lifecycle;\n this.#authorization = authorization;\n this.status = status;\n Object.freeze(this);\n }\n static prepare(runtime: Runtime, plan: OperationPlan): PreparedTransaction {\n return new PreparedTransaction(\n runtime,\n { plan: structuredClone(plan), generation: 0 },\n \"prepared\",\n { generation: 0, busy: false }\n );\n }\n get id() {\n return this.#saved.plan.id;\n }\n get kind() {\n return this.#saved.plan.kind;\n }\n estimateGas() {\n return estimateGasReference(\n this.#saved.plan,\n this.#runtime.options.protocol,\n this.#runtime.options.gasBenchmarks\n );\n }\n preview() {\n return operationPreview(this.#saved.plan, this.status);\n }\n private current() {\n check(\n !this.#lifecycle.busy && this.#lifecycle.generation === this.#saved.generation,\n \"stale transaction handle or active worker\"\n );\n }\n private async stage(\n stage: string,\n allowed: OperationStatus[],\n work: (\n saved: SavedOperation\n ) => Promise<{ status: OperationStatus; authorization?: AuthorizedStatement }>,\n signal?: AbortSignal\n ): Promise<PreparedTransaction> {\n signal?.throwIfAborted();\n this.current();\n check(allowed.includes(this.status), `invalid transaction stage for ${stage}`);\n this.#lifecycle.busy = true;\n const saved = structuredClone(this.#saved);\n try {\n const next = await work(saved);\n signal?.throwIfAborted();\n saved.generation++;\n this.#lifecycle.generation = saved.generation;\n return new PreparedTransaction(\n this.#runtime,\n saved,\n next.status,\n this.#lifecycle,\n next.authorization ?? this.#authorization\n );\n } finally {\n this.#lifecycle.busy = false;\n }\n }\n async authorize(options?: { signal?: AbortSignal }): Promise<PreparedTransaction>;\n async authorize(\n provider: WalletAuthorizationProvider,\n options?: { signal?: AbortSignal }\n ): Promise<PreparedTransaction>;\n async authorize(\n providerOrOptions: WalletAuthorizationProvider | { signal?: AbortSignal } = {},\n suppliedOptions: { signal?: AbortSignal } = {}\n ): Promise<PreparedTransaction> {\n const options = \"authorize\" in providerOrOptions ? suppliedOptions : providerOrOptions;\n const provider =\n \"authorize\" in providerOrOptions ? providerOrOptions : this.#runtime.authorization();\n check(\n requiresAuthorization(this.#saved.plan),\n \"operation does not require wallet authorization\"\n );\n const selectedProvider = provider;\n check(\n provider.walletIdentity === this.#runtime.scope.walletIdentity,\n \"wallet authorization capability mismatch\"\n );\n return this.stage(\n \"wallet authorization\",\n [\"prepared\", \"authorized\"],\n async (saved) => {\n const authorization = await authorizeOperation(saved.plan, selectedProvider);\n return { status: \"authorized\", authorization };\n },\n options.signal\n );\n }\n\n async prove(options?: ProverOptions): Promise<PreparedTransaction>;\n async prove(backend: Prover, options?: ProverOptions): Promise<PreparedTransaction>;\n async prove(\n backendOrOptions: Prover | ProverOptions = {},\n suppliedOptions: ProverOptions = {}\n ): Promise<PreparedTransaction> {\n const options = \"prove\" in backendOrOptions ? suppliedOptions : backendOrOptions;\n const plan = this.#saved.plan;\n check(plan.kind !== \"shield\", \"shield requires no proof\");\n if (requiresAuthorization(plan)) {\n check(\n this.#authorization,\n \"local wallet authorization required; authorize again after recovery\"\n );\n }\n const prover =\n \"prove\" in backendOrOptions ? backendOrOptions : this.#runtime.options.prover;\n if (!prover) {\n throw new MissingCapabilityError(\"prover\");\n }\n return this.stage(\n \"proof\",\n requiresAuthorization(plan) ? [\"authorized\"] : [\"prepared\"],\n async (saved) => {\n const p = saved.plan;\n saved.proof = await proveOperation(\n this.#runtime.options.protocol,\n p,\n this.#authorization,\n prover,\n options\n );\n if (p.fundingMode === \"signature\") {\n return { status: \"proved\" };\n }\n if (p.statement?.target !== \"noir-recursive\") {\n saved.call = await this.encode(saved);\n }\n return { status: \"ready\" };\n },\n options.signal\n );\n }\n\n private encode(saved: SavedOperation): Promise<TransactionCall> {\n return encodeOperation(saved);\n }\n\n async authorizeFunding(options?: { signal?: AbortSignal }): Promise<PreparedTransaction>;\n async authorizeFunding(\n signer: FundingSigner,\n options?: { signal?: AbortSignal }\n ): Promise<PreparedTransaction>;\n async authorizeFunding(\n signerOrOptions: FundingSigner | { signal?: AbortSignal } = {},\n suppliedOptions: { signal?: AbortSignal } = {}\n ): Promise<PreparedTransaction> {\n const options = \"signTypedData\" in signerOrOptions ? suppliedOptions : signerOrOptions;\n const suppliedSigner = \"signTypedData\" in signerOrOptions ? signerOrOptions : undefined;\n const p = this.#saved.plan;\n check(p.fundingMode === \"signature\", \"operation does not require a funding signature\");\n check(p.kind === \"shield\" || this.#saved.proof, \"proof must precede funding authorization\");\n const signer = suppliedSigner ?? this.#runtime.options.fundingSigner;\n if (!signer) {\n throw new MissingCapabilityError(\"EVM funding signer\");\n }\n check(\n signer.address.toLowerCase() === p.funding.payer!.toLowerCase(),\n \"funding signer is not the payer\"\n );\n return this.stage(\n \"funding authorization\",\n p.kind === \"shield\" ? [\"prepared\"] : [\"proved\"],\n async (saved) => {\n saved.plan.funding.signature = await signOperationFunding(\n saved,\n signer,\n this.#runtime.options.fundingVerifier\n );\n if (saved.plan.statement?.target !== \"noir-recursive\") {\n saved.call = await this.encode(saved);\n }\n return { status: \"ready\" };\n },\n options.signal\n );\n }\n\n /** Shield caller funding needs no wallet signing or proof; this step only encodes its frozen request. */\n async ready(): Promise<PreparedTransaction> {\n check(\n this.kind === \"shield\" && this.#saved.plan.fundingMode === \"caller\",\n \"operation needs authorization or proof first\"\n );\n return this.stage(\"encoding\", [\"prepared\"], async (saved) => {\n saved.call = await this.encode(saved);\n return { status: \"ready\" };\n });\n }\n\n async exportTransaction(): Promise<TransactionCall> {\n this.current();\n check(\n this.#saved.plan.statement?.target !== \"noir-recursive\",\n \"recursive operations must be exported as aggregate members\"\n );\n check(this.status === \"ready\" && this.#saved.call, \"transaction is not ready\");\n return structuredClone(this.#saved.call);\n }\n exportProof(): ProofBundle {\n this.current();\n check(this.#saved.proof, \"transaction has no proof\");\n return publicProof(this.#saved.proof);\n }\n exportAggregateMember(): OperationAggregateMember {\n this.current();\n const saved = this.#saved,\n plan = saved.plan;\n check(\n this.status === \"ready\" &&\n plan.params &&\n saved.proof &&\n plan.statement?.target === \"noir-recursive\" &&\n plan.statement.circuitName === \"transact_user_slots14\",\n \"ready recursive slots14 transaction required\"\n );\n sameStatement(saved.proof, statement(plan));\n check(\n saved.proof.proofHex.length === 2 + 458 * 64,\n \"recursive member proof must have 458 fields\"\n );\n return {\n bundle: publicProof(saved.proof),\n statement: structuredClone(plan.statement),\n context: { ...plan.context },\n request: {\n params: structuredClone(plan.params),\n deliveries: plan.outputs.map((output) => structuredClone(output.delivery)),\n funding: normalizeFunding(plan.funding),\n },\n };\n }\n toJSON() {\n return { transaction: true, id: this.id, kind: this.kind, status: this.status };\n }\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n return this.toJSON();\n }\n}\n","import { copyGasBenchmarks } from \"./gas-estimation\";\nimport { explicitPreparation } from \"./explicit-preparation\";\nimport type { PreparedTransaction } from \"./PreparedTransaction\";\nimport type {\n ExplicitTransferPreparation,\n ExplicitWithdrawalPreparation,\n ExplicitSweepPreparation,\n ExplicitShieldPreparation,\n ExplicitCreateCreditPreparation,\n ExplicitDrawCreditPreparation,\n ExplicitTopUpCreditPreparation,\n ExplicitCancelCreditPreparation,\n} from \"./explicit-types\";\nimport { ProtocolRpcClient } from \"@invisi-labs/rpc\";\nimport type { Provider, Signer } from \"ethers\";\nimport {\n EthersChainReader,\n EthersFundingSigner,\n EthersFundingVerifier,\n EthersAddressResolver,\n} from \"./integrations/ethers\";\nimport { MissingCapabilityError } from \"@invisi-labs/core\";\nimport { Protocol, type ChainReader } from \"@invisi-labs/protocol\";\nimport { WalletSession, type WalletSessionOptions } from \"./session\";\n\n/** Compose independent Chain RPC and indexed Protocol RPC with local wallet capabilities. */\nexport type InvisiOptions = Omit<\n WalletSessionOptions,\n \"wallet\" | \"protocol\" | \"namespace\" | \"viewing\" | \"authorization\" | \"chainReader\"\n> & {\n provider?: Provider;\n signer?: Signer;\n chainReader?: ChainReader;\n};\n\n/** Wallet identity and session permissions; shared infrastructure belongs to InvisiOptions. */\nexport type ConnectionOptions = Pick<\n WalletSessionOptions,\n \"wallet\" | \"protocol\" | \"namespace\" | \"viewing\" | \"authorization\"\n>;\n\n/** A neutral composition entry point; every resolved instance owns an independent session. */\nexport class Invisi {\n readonly #options: InvisiOptions;\n\n constructor(options: InvisiOptions = {}) {\n this.#options = {\n ...options,\n ...(options.gasBenchmarks\n ? { gasBenchmarks: copyGasBenchmarks(options.gasBenchmarks) }\n : {}),\n };\n Object.freeze(this);\n }\n\n async connect(options: ConnectionOptions): Promise<WalletSession> {\n return new WalletSession(await this.resolve(options));\n }\n private async resolve(options: ConnectionOptions): Promise<WalletSessionOptions> {\n // Snapshot session permissions before the first network request.\n const allowed = [\"wallet\", \"protocol\", \"namespace\", \"viewing\", \"authorization\"];\n for (const key of Object.keys(options)) {\n if (!allowed.includes(key))\n throw new Error(\n `Unknown connection option: ${key}; configure infrastructure on Invisi`\n );\n }\n const selected = { ...options };\n const combined = { ...this.#options, ...selected };\n const { provider, signer, ...runtime } = combined;\n const reader =\n combined.chainReader ?? (provider ? new EthersChainReader(provider) : undefined);\n if (!reader) throw new MissingCapabilityError(\"chain reader\");\n if (provider && (await provider.getNetwork()).chainId !== selected.protocol.context.chainId)\n throw new Error(\"provider deployment chain mismatch\");\n await selected.protocol.validateDeployment(reader);\n if (runtime.protocolRpc instanceof ProtocolRpcClient) {\n runtime.protocolRpc = runtime.protocolRpc.withReader(reader);\n }\n if (signer) {\n if (!provider) throw new MissingCapabilityError(\"provider for signer\");\n if (!signer.provider) throw new Error(\"signer must be connected to a provider\");\n if ((await signer.provider.getNetwork()).chainId !== selected.protocol.context.chainId)\n throw new Error(\"signer-provider deployment chain mismatch\");\n }\n const registry = selected.protocol.deployment.registry;\n const fundingSigner =\n combined.fundingSigner ??\n (signer\n ? await EthersFundingSigner.create(signer, selected.protocol.context.chainId)\n : undefined);\n const fundingVerifier =\n combined.fundingVerifier ??\n (provider\n ? new EthersFundingVerifier(provider, selected.protocol.context.chainId)\n : undefined);\n const addressResolver =\n combined.addressResolver ??\n (provider && registry\n ? new EthersAddressResolver(\n provider,\n {\n chainId: selected.protocol.context.chainId,\n registryAddress: registry.address,\n },\n registry.runtimeCodeHash\n ).lookup\n : undefined);\n return {\n ...runtime,\n chainReader: reader,\n ...(signer ? { signer } : {}),\n ...(fundingSigner ? { fundingSigner } : {}),\n ...(fundingVerifier ? { fundingVerifier } : {}),\n ...(addressResolver ? { addressResolver } : {}),\n protocol: selected.protocol,\n };\n }\n\n async prepareTransfer(options: ExplicitTransferPreparation): Promise<PreparedTransaction> {\n const { wallet, protocol, ...input } = options;\n const request = structuredClone(input);\n const runtime = await this.resolve({ wallet, protocol });\n const preparation = explicitPreparation(runtime, request, request.tokenAddress);\n return preparation.prepareTransfer(request);\n }\n async prepareWithdraw(options: ExplicitWithdrawalPreparation): Promise<PreparedTransaction> {\n const { wallet, protocol, ...input } = options;\n const request = structuredClone(input);\n const runtime = await this.resolve({ wallet, protocol });\n const preparation = explicitPreparation(runtime, request, request.tokenAddress);\n return preparation.prepareWithdraw(request);\n }\n async prepareSweep(options: ExplicitSweepPreparation): Promise<PreparedTransaction> {\n const { wallet, protocol, ...input } = options;\n const request = structuredClone(input);\n const runtime = await this.resolve({ wallet, protocol });\n const preparation = explicitPreparation(runtime, request, request.tokenAddress);\n return preparation.prepareSweep(request);\n }\n async prepareShield(options: ExplicitShieldPreparation): Promise<PreparedTransaction> {\n const { wallet, protocol, ...input } = options;\n const request = structuredClone(input);\n const runtime = await this.resolve({ wallet, protocol });\n const preparation = explicitPreparation(runtime, {}, request.tokenAddress);\n return preparation.prepareShield(request);\n }\n async prepareCreateCredit(\n options: ExplicitCreateCreditPreparation\n ): Promise<PreparedTransaction> {\n const { wallet, protocol, ...input } = options;\n const request = structuredClone(input);\n const runtime = await this.resolve({ wallet, protocol });\n const preparation = explicitPreparation(runtime, request, request.tokenAddress);\n return preparation.prepareCreateCredit(request);\n }\n async prepareDrawCredit(options: ExplicitDrawCreditPreparation): Promise<PreparedTransaction> {\n const { wallet, protocol, ...input } = options;\n const request = structuredClone(input);\n const runtime = await this.resolve({ wallet, protocol });\n const preparation = explicitPreparation(runtime, request, request.tokenAddress);\n return preparation.prepareDrawCredit(request);\n }\n async prepareTopUpCredit(\n options: ExplicitTopUpCreditPreparation\n ): Promise<PreparedTransaction> {\n const { wallet, protocol, ...input } = options;\n const request = structuredClone(input);\n const runtime = await this.resolve({ wallet, protocol });\n const preparation = explicitPreparation(runtime, request, request.tokenAddress);\n return preparation.prepareTopUpCredit(request);\n }\n async prepareCancelCredit(\n options: ExplicitCancelCreditPreparation\n ): Promise<PreparedTransaction> {\n const { wallet, protocol, ...input } = options;\n const request = structuredClone(input);\n const runtime = await this.resolve({ wallet, protocol });\n const preparation = explicitPreparation(runtime, request, request.tokenAddress);\n return preparation.prepareCancelCredit(request);\n }\n\n toJSON() {\n return { invisi: true };\n }\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n return this.toJSON();\n }\n}\n","export { Invisi } from \"./Invisi\";\nexport type { InvisiOptions, ConnectionOptions } from \"./Invisi\";\nexport {\n Wallet,\n ViewingCapability,\n Detector,\n NullifierCapability,\n WalletAuthorization,\n MissingCapabilityError,\n Disclosure,\n} from \"@invisi-labs/core\";\nexport type {\n Address,\n Hex,\n Note,\n CreditNote,\n CreditDeliveryState,\n ReceivingKeys,\n WalletAuthorizationProvider,\n CreditOpening,\n DisclosureOutput,\n DisclosureExport,\n DisclosureResult,\n} from \"@invisi-labs/core\";\nexport { Protocol, RegistrationOperation } from \"@invisi-labs/protocol\";\nexport type {\n ChainReader,\n ProtocolDataProvider,\n ProtocolDataStatus,\n ProtocolUpdates,\n ProtocolUpdateRange,\n TransactionCall,\n CanonicalBlock,\n CanonicalReceipt,\n Membership,\n RegistryReader,\n ProtocolOptions,\n TokenProtocol,\n TokenProtocolOptions,\n FactoryReader,\n AddressRegistryOptions,\n RegistryContext,\n TransactionContext,\n} from \"@invisi-labs/protocol\";\nexport { WalletSession, Operation, walletBalance, DisclosureVerifier } from \"./session\";\nexport type {\n RefreshOptions,\n RefreshResult,\n WalletStore,\n WalletScope,\n WalletState,\n BalanceSnapshot,\n WalletSessionOptions,\n TransferPreparation,\n WithdrawalPreparation,\n SweepPreparation,\n ShieldPreparation,\n CreateCreditPreparation,\n DrawCreditPreparation,\n TopUpCreditPreparation,\n CancelCreditPreparation,\n FundingSigner,\n FundingAuthorizationVerifier,\n FundingTypedData,\n FundingSource,\n CoinSelector,\n OperationStatus,\n OperationAggregateMember,\n DisclosureReference,\n DisclosureReader,\n DisclosureVerifierOptions,\n DisclosureEvidence,\n VerifiedDisclosure,\n} from \"./session\";\nexport type {\n Prover,\n ProverOptions,\n ProofBundle,\n ProofStatement,\n AggregatorCapability,\n AggregateMember,\n} from \"@invisi-labs/prover\";\n\nexport { ProtocolRpcError } from \"@invisi-labs/rpc\";\nexport type { ProtocolDeployment } from \"@invisi-labs/rpc\";\nexport { ProtocolRpcClient } from \"./ProtocolRpcClient\";\nexport { AddressRegistry } from \"./AddressRegistry\";\nexport type {\n ProtocolRpcClientOptions,\n ProtocolRpcReader,\n ProtocolRpcConnectionOptions,\n ProtocolRpcChain,\n} from \"@invisi-labs/rpc\";\n\nexport { EncryptedWalletCodec } from \"./integrations/encrypted-codec\";\n\nexport { PreparedTransaction } from \"./PreparedTransaction\";\nexport type {\n NoteInput,\n CreditInput,\n TransactionIdentity,\n ExplicitTransferPreparation,\n ExplicitWithdrawalPreparation,\n ExplicitSweepPreparation,\n ExplicitShieldPreparation,\n ExplicitCreateCreditPreparation,\n ExplicitDrawCreditPreparation,\n ExplicitTopUpCreditPreparation,\n ExplicitCancelCreditPreparation,\n} from \"./explicit-types\";\n\nexport type { SessionTransactionOptions } from \"./session/WalletSession\";\n\nexport type {\n GasBenchmarkProfile,\n GasBenchmarkShape,\n GasBenchmarkDeployment,\n GasBenchmarkCircuit,\n GasBenchmarkSample,\n GasReference,\n} from \"./gas-estimation\";\n\nexport { defineGasBenchmarks } from \"./gas-estimation\";\n","import type { Provider } from \"ethers\";\nimport { ProtocolRpcClient as RpcClient } from \"@invisi-labs/rpc\";\nimport { EthersChainReader } from \"./integrations/ethers\";\n\n/** Protocol RPC transport with ethers provider integration for independent chain checks. */\nexport class ProtocolRpcClient extends RpcClient {\n withProvider(provider: Provider): RpcClient {\n return this.withReader(new EthersChainReader(provider));\n }\n}\n","import type { Provider } from \"ethers\";\nimport { AddressRegistry as Registry, type RegistrationPreparation } from \"@invisi-labs/protocol\";\nimport { EthersChainReader } from \"./integrations/ethers\";\n\n/** Registry operations accept the application's existing ethers provider. */\nexport class AddressRegistry extends Registry {\n override prepareRegistration(\n options:\n | RegistrationPreparation\n | (Omit<RegistrationPreparation, \"reader\"> & { provider: Provider })\n ) {\n if (\"provider\" in options) {\n const { provider, ...preparation } = options;\n return super.prepareRegistration({\n ...preparation,\n reader: new EthersChainReader(provider),\n });\n }\n return super.prepareRegistration(options);\n }\n}\n","import {\n serializeState,\n deserializeState,\n type WalletState,\n type WalletRecordCodec,\n} from \"../session\";\n/** Caller-owned, nonextractable AES-GCM key. The SDK does not persist the key. */\nexport class EncryptedWalletCodec implements WalletRecordCodec {\n readonly #key: CryptoKey;\n private constructor(key: CryptoKey) {\n this.#key = key;\n }\n static fromKey(key: CryptoKey): EncryptedWalletCodec {\n if (\n key.type !== \"secret\" ||\n key.algorithm.name !== \"AES-GCM\" ||\n (key.algorithm as AesKeyAlgorithm).length !== 256 ||\n !key.usages.includes(\"encrypt\") ||\n !key.usages.includes(\"decrypt\")\n )\n throw new Error(\"wallet record key must support AES-256-GCM encryption and decryption\");\n return new EncryptedWalletCodec(key);\n }\n static async fromBytes(key: Uint8Array): Promise<EncryptedWalletCodec> {\n if (key.length !== 32) throw new Error(\"wallet record encryption requires 32 key bytes\");\n const copy = Uint8Array.from(key);\n try {\n return EncryptedWalletCodec.fromKey(\n await crypto.subtle.importKey(\"raw\", copy, { name: \"AES-GCM\" }, false, [\n \"encrypt\",\n \"decrypt\",\n ])\n );\n } finally {\n copy.fill(0);\n }\n }\n private aad(context: { key: string; revision: number }): Uint8Array<ArrayBuffer> {\n if (!Number.isSafeInteger(context.revision) || context.revision < 1)\n throw new Error(\"invalid encrypted record revision\");\n return new TextEncoder().encode(\n `Invisi.WalletRecord.v1\\0${context.revision}\\0${context.key}`\n );\n }\n async encode(\n state: WalletState,\n context: { key: string; revision: number }\n ): Promise<Uint8Array> {\n const iv = crypto.getRandomValues(new Uint8Array(12)),\n plain = Uint8Array.from(serializeState(state));\n try {\n const encrypted = new Uint8Array(\n await crypto.subtle.encrypt(\n { name: \"AES-GCM\", iv, additionalData: this.aad(context) },\n this.#key,\n plain\n )\n );\n const out = new Uint8Array(13 + encrypted.length);\n out[0] = 1;\n out.set(iv, 1);\n out.set(encrypted, 13);\n return out;\n } finally {\n plain.fill(0);\n }\n }\n async decode(\n data: Uint8Array,\n context: { key: string; revision: number }\n ): Promise<WalletState> {\n if (data.length < 29 || data[0] !== 1)\n throw new Error(\"wallet record authentication failed\");\n let plain: Uint8Array;\n try {\n plain = new Uint8Array(\n await crypto.subtle.decrypt(\n {\n name: \"AES-GCM\",\n iv: Uint8Array.from(data.subarray(1, 13)),\n additionalData: this.aad(context),\n },\n this.#key,\n Uint8Array.from(data.subarray(13))\n )\n );\n } catch {\n throw new Error(\"wallet record authentication failed\");\n }\n try {\n return deserializeState(plain);\n } finally {\n plain.fill(0);\n }\n }\n toJSON() {\n return { walletRecordCodec: \"AES-256-GCM\" };\n }\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n return this.toJSON();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;;;ACM3B;AAAA,EACI;AAAA,OAGG;AACP,SAAS,wBAA8C;AAkBvD,SAAS,MAAM,IAAa,SAA6B;AACrD,MAAI,C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AAM,WAAW,IAAI,gBAAgB,KAAK,IAAI,OAAO,EAAE;AAAA,UACzD,KAAK;AAAA,UACL;AAAA,QACJ;AAAA,MACJ;AACA,YAAM,MAAM,IAAI,WAAW,KAAK,UAAU,MAAM;AAChD,UAAI,CAAC,IAAI;AACT,UAAI,IAAI,IAAI,CAAC;AACb,UAAI,IAAI,WAAW,EAAE;AACrB,aAAO;AAAA,IACX,UAAE;AACE,YAAM,KAAK,CAAC;AAAA,IAChB;AAAA,EACJ;AAAA,EACA,MAAM,OACF,MACA,SACoB;AACpB,QAAI,KAAK,SAAS,MAAM,KAAK,CAAC,MAAM;AAChC,YAAM,IAAI,MAAM,qCAAqC;AACzD,QAAI;AACJ,QAAI;AACA,cAAQ,IAAI;AAAA,QACR,MAAM,OAAO,OAAO;AAAA,UAChB;AAAA,YACI,MAAM;AAAA,YACN,IAAI,WAAW,KAAK,KAAK,SAAS,GAAG,EAAE,CAAC;AAAA,YACxC,gBAAgB,KAAK,IAAI,OAAO;AAAA,UACpC;AAAA,UACA,KAAK;AAAA,UACL,WAAW,KAAK,KAAK,SAAS,EAAE,CAAC;AAAA,QACrC;AAAA,MACJ;AAAA,IACJ,QAAQ;AACJ,YAAM,IAAI,MAAM,qCAAqC;AAAA,IACzD;AACA,QAAI;AACA,aAAO,iBAAiB,KAAK;AAAA,IACjC,UAAE;AACE,YAAM,KAAK,CAAC;AAAA,IAChB;AAAA,EACJ;AAAA,EACA,SAAS;AACL,WAAO,EAAE,mBAAmB,cAAc;AAAA,EAC9C;AAAA,EACA,CAAC,uBAAO,IAAI,4BAA4B,CAAC,IAAI;AACzC,WAAO,KAAK,OAAO;AAAA,EACvB;AACJ;","names":["MissingCapabilityError","MissingCapabilityError","MissingCapabilityError","ProtocolRpcClient"]}
1
+ {"version":3,"sources":["../src/explicit-preparation.ts","../src/PreparedTransaction.ts","../src/Invisi.ts","../src/index.ts","../src/ProtocolRpcClient.ts","../src/AddressRegistry.ts","../src/integrations/encrypted-codec.ts"],"sourcesContent":["import { getAddress } from \"ethers\";\nimport type { CreditInput, NoteInput } from \"./explicit-types\";\nimport { PreparedTransaction } from \"./PreparedTransaction\";\nimport { positiveAmount } from \"./session/prepare-common\";\nimport { TransactionPreparation } from \"./session/transaction-preparation\";\nimport type { PreparationInventory, WalletSessionOptions } from \"./session/operation-types\";\n\n/** Only explicitly supplied records participate. No store or automatic coin selection. */\nexport function explicitPreparation(\n options: WalletSessionOptions,\n data: {\n inputs?: readonly NoteInput[];\n creditInputs?: readonly CreditInput[];\n changeAddress?: string;\n },\n tokenAddress: `0x${string}`\n) {\n if (!options.chainReader) throw new Error(\"chain reader required\");\n const inputs = structuredClone(data.inputs ?? []);\n const credits = structuredClone(data.creditInputs ?? []);\n const inventory: PreparationInventory = { notes: {}, credits: {}, reservations: {} };\n const context = options.protocol.context;\n function position(input: NoteInput | CreditInput) {\n if (\n typeof input.treeId !== \"bigint\" ||\n input.treeId < 0n ||\n input.treeId >= 1n << 256n ||\n !Number.isInteger(input.leafIndex) ||\n input.leafIndex < 0 ||\n input.leafIndex >= 65536\n )\n throw new Error(\"invalid explicit input position\");\n }\n for (const input of inputs) {\n position(input);\n positiveAmount(input.note.amount);\n if (inventory.notes[input.commitment]) throw new Error(\"duplicate explicit note input\");\n if (\n input.note.chainId !== context.chainId ||\n input.note.protocolAddress !== BigInt(context.protocolAddress) ||\n input.note.walletIdentity !== options.wallet.walletIdentity\n )\n throw new Error(\"explicit note identity or deployment mismatch\");\n inventory.notes[input.commitment] = { ...input, spent: \"unspent\" };\n }\n for (const input of credits) {\n position(input);\n if (input.role !== \"owner\" && input.role !== \"spender\")\n throw new Error(\"invalid explicit Credit role\");\n const key = input.commitment + \":\" + input.role;\n if (inventory.credits[key]) throw new Error(\"duplicate explicit Credit input\");\n inventory.credits[key] = { ...input, spent: \"unspent\" };\n }\n const scope = {\n ...context,\n namespace: \"explicit\",\n walletIdentity: options.wallet.walletIdentity,\n };\n const { store: _store, coinSelector: _selector, ...capabilities } = options;\n\n if (inputs.some((input) => input.note.tokenAddress !== BigInt(getAddress(tokenAddress))))\n throw new Error(\"explicit note token mismatch\");\n const runtime = {\n options: { ...capabilities, protocol: options.protocol.forToken(tokenAddress) },\n reader: options.chainReader!,\n scope,\n authorization: () => options.authorization ?? options.wallet.exportAuthorization(),\n };\n return new TransactionPreparation<PreparedTransaction>({\n ...runtime,\n explicitInputs: true,\n ...(data.changeAddress ? { changeAddress: data.changeAddress } : {}),\n readInventory: async () => structuredClone(inventory),\n complete: async (plan) => PreparedTransaction.prepare(runtime, plan),\n });\n}\n","import { estimateGasReference } from \"./gas-estimation\";\nimport {\n authorizeOperation,\n proveOperation,\n signOperationFunding,\n} from \"./session/operation-execution\";\nimport {\n MissingCapabilityError,\n type AuthorizedStatement,\n type WalletAuthorizationProvider,\n} from \"@invisi-labs/core\";\nimport { normalizeFunding, type TransactionCall } from \"@invisi-labs/protocol\";\nimport type { Prover, ProverOptions, ProofBundle } from \"@invisi-labs/prover\";\nimport type {\n FundingSigner,\n OperationPlan,\n OperationRuntime,\n OperationAggregateMember,\n SavedOperation,\n} from \"./session/operation-types\";\nimport type { OperationStatus } from \"./session/state\";\nimport {\n encodeOperation,\n publicProof,\n requiresAuthorization,\n statement,\n} from \"./session/operation-protocol\";\nimport { sameStatement } from \"./session/proof-integrity\";\nimport { operationPreview } from \"./session/operation-preview\";\nfunction check(ok: unknown, message: string): asserts ok {\n if (!ok) throw new Error(message);\n}\n\ntype Runtime = Omit<OperationRuntime, \"store\">;\ntype Lifecycle = { generation: number; busy: boolean };\n/** An immutable, local transaction handle. No wallet inventory, reservations or persistence. */\nexport class PreparedTransaction {\n readonly #runtime: Runtime;\n readonly #saved: SavedOperation;\n readonly #authorization: AuthorizedStatement | undefined;\n readonly #lifecycle: Lifecycle;\n readonly status: OperationStatus;\n private constructor(\n runtime: Runtime,\n saved: SavedOperation,\n status: OperationStatus,\n lifecycle: Lifecycle,\n authorization?: AuthorizedStatement\n ) {\n this.#runtime = runtime;\n this.#saved = structuredClone(saved);\n this.#lifecycle = lifecycle;\n this.#authorization = authorization;\n this.status = status;\n Object.freeze(this);\n }\n static prepare(runtime: Runtime, plan: OperationPlan): PreparedTransaction {\n return new PreparedTransaction(\n runtime,\n { plan: structuredClone(plan), generation: 0 },\n \"prepared\",\n { generation: 0, busy: false }\n );\n }\n get id() {\n return this.#saved.plan.id;\n }\n get kind() {\n return this.#saved.plan.kind;\n }\n estimateGas() {\n return estimateGasReference(\n this.#saved.plan,\n this.#runtime.options.protocol,\n this.#runtime.options.gasBenchmarks\n );\n }\n preview() {\n return operationPreview(this.#saved.plan, this.status);\n }\n private current() {\n check(\n !this.#lifecycle.busy && this.#lifecycle.generation === this.#saved.generation,\n \"stale transaction handle or active worker\"\n );\n }\n private async stage(\n stage: string,\n allowed: OperationStatus[],\n work: (\n saved: SavedOperation\n ) => Promise<{ status: OperationStatus; authorization?: AuthorizedStatement }>,\n signal?: AbortSignal\n ): Promise<PreparedTransaction> {\n signal?.throwIfAborted();\n this.current();\n check(allowed.includes(this.status), `invalid transaction stage for ${stage}`);\n this.#lifecycle.busy = true;\n const saved = structuredClone(this.#saved);\n try {\n const next = await work(saved);\n signal?.throwIfAborted();\n saved.generation++;\n this.#lifecycle.generation = saved.generation;\n return new PreparedTransaction(\n this.#runtime,\n saved,\n next.status,\n this.#lifecycle,\n next.authorization ?? this.#authorization\n );\n } finally {\n this.#lifecycle.busy = false;\n }\n }\n async authorize(options?: { signal?: AbortSignal }): Promise<PreparedTransaction>;\n async authorize(\n provider: WalletAuthorizationProvider,\n options?: { signal?: AbortSignal }\n ): Promise<PreparedTransaction>;\n async authorize(\n providerOrOptions: WalletAuthorizationProvider | { signal?: AbortSignal } = {},\n suppliedOptions: { signal?: AbortSignal } = {}\n ): Promise<PreparedTransaction> {\n const options = \"authorize\" in providerOrOptions ? suppliedOptions : providerOrOptions;\n const provider =\n \"authorize\" in providerOrOptions ? providerOrOptions : this.#runtime.authorization();\n check(\n requiresAuthorization(this.#saved.plan),\n \"operation does not require wallet authorization\"\n );\n const selectedProvider = provider;\n check(\n provider.walletIdentity === this.#runtime.scope.walletIdentity,\n \"wallet authorization capability mismatch\"\n );\n return this.stage(\n \"wallet authorization\",\n [\"prepared\", \"authorized\"],\n async (saved) => {\n const authorization = await authorizeOperation(saved.plan, selectedProvider);\n return { status: \"authorized\", authorization };\n },\n options.signal\n );\n }\n\n async prove(options?: ProverOptions): Promise<PreparedTransaction>;\n async prove(backend: Prover, options?: ProverOptions): Promise<PreparedTransaction>;\n async prove(\n backendOrOptions: Prover | ProverOptions = {},\n suppliedOptions: ProverOptions = {}\n ): Promise<PreparedTransaction> {\n const options = \"prove\" in backendOrOptions ? suppliedOptions : backendOrOptions;\n const plan = this.#saved.plan;\n check(plan.kind !== \"shield\", \"shield requires no proof\");\n if (requiresAuthorization(plan)) {\n check(\n this.#authorization,\n \"local wallet authorization required; authorize again after recovery\"\n );\n }\n const prover =\n \"prove\" in backendOrOptions ? backendOrOptions : this.#runtime.options.prover;\n if (!prover) {\n throw new MissingCapabilityError(\"prover\");\n }\n return this.stage(\n \"proof\",\n requiresAuthorization(plan) ? [\"authorized\"] : [\"prepared\"],\n async (saved) => {\n const p = saved.plan;\n saved.proof = await proveOperation(\n this.#runtime.options.protocol,\n p,\n this.#authorization,\n prover,\n options\n );\n if (p.fundingMode === \"signature\") {\n return { status: \"proved\" };\n }\n if (p.statement?.target !== \"noir-recursive\") {\n saved.call = await this.encode(saved);\n }\n return { status: \"ready\" };\n },\n options.signal\n );\n }\n\n private encode(saved: SavedOperation): Promise<TransactionCall> {\n return encodeOperation(saved);\n }\n\n async authorizeFunding(options?: { signal?: AbortSignal }): Promise<PreparedTransaction>;\n async authorizeFunding(\n signer: FundingSigner,\n options?: { signal?: AbortSignal }\n ): Promise<PreparedTransaction>;\n async authorizeFunding(\n signerOrOptions: FundingSigner | { signal?: AbortSignal } = {},\n suppliedOptions: { signal?: AbortSignal } = {}\n ): Promise<PreparedTransaction> {\n const options = \"signTypedData\" in signerOrOptions ? suppliedOptions : signerOrOptions;\n const suppliedSigner = \"signTypedData\" in signerOrOptions ? signerOrOptions : undefined;\n const p = this.#saved.plan;\n check(p.fundingMode === \"signature\", \"operation does not require a funding signature\");\n check(p.kind === \"shield\" || this.#saved.proof, \"proof must precede funding authorization\");\n const signer = suppliedSigner ?? this.#runtime.options.fundingSigner;\n if (!signer) {\n throw new MissingCapabilityError(\"EVM funding signer\");\n }\n check(\n signer.address.toLowerCase() === p.funding.payer!.toLowerCase(),\n \"funding signer is not the payer\"\n );\n return this.stage(\n \"funding authorization\",\n p.kind === \"shield\" ? [\"prepared\"] : [\"proved\"],\n async (saved) => {\n saved.plan.funding.signature = await signOperationFunding(\n saved,\n signer,\n this.#runtime.options.fundingVerifier\n );\n if (saved.plan.statement?.target !== \"noir-recursive\") {\n saved.call = await this.encode(saved);\n }\n return { status: \"ready\" };\n },\n options.signal\n );\n }\n\n /** Shield caller funding needs no wallet signing or proof; this step only encodes its frozen request. */\n async ready(): Promise<PreparedTransaction> {\n check(\n this.kind === \"shield\" && this.#saved.plan.fundingMode === \"caller\",\n \"operation needs authorization or proof first\"\n );\n return this.stage(\"encoding\", [\"prepared\"], async (saved) => {\n saved.call = await this.encode(saved);\n return { status: \"ready\" };\n });\n }\n\n async exportTransaction(): Promise<TransactionCall> {\n this.current();\n check(\n this.#saved.plan.statement?.target !== \"noir-recursive\",\n \"recursive operations must be exported as aggregate members\"\n );\n check(this.status === \"ready\" && this.#saved.call, \"transaction is not ready\");\n return structuredClone(this.#saved.call);\n }\n exportProof(): ProofBundle {\n this.current();\n check(this.#saved.proof, \"transaction has no proof\");\n return publicProof(this.#saved.proof);\n }\n exportAggregateMember(): OperationAggregateMember {\n this.current();\n const saved = this.#saved,\n plan = saved.plan;\n check(\n this.status === \"ready\" &&\n plan.params &&\n saved.proof &&\n plan.statement?.target === \"noir-recursive\" &&\n plan.statement.circuitName === \"transact_user_slots14\",\n \"ready recursive slots14 transaction required\"\n );\n sameStatement(saved.proof, statement(plan));\n check(\n saved.proof.proofHex.length === 2 + 458 * 64,\n \"recursive member proof must have 458 fields\"\n );\n return {\n bundle: publicProof(saved.proof),\n statement: structuredClone(plan.statement),\n context: { ...plan.context },\n request: {\n params: structuredClone(plan.params),\n deliveries: plan.outputs.map((output) => structuredClone(output.delivery)),\n funding: normalizeFunding(plan.funding),\n },\n };\n }\n toJSON() {\n return { transaction: true, id: this.id, kind: this.kind, status: this.status };\n }\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n return this.toJSON();\n }\n}\n","import { copyGasBenchmarks } from \"./gas-estimation\";\nimport { explicitPreparation } from \"./explicit-preparation\";\nimport type { PreparedTransaction } from \"./PreparedTransaction\";\nimport type {\n ExplicitTransferPreparation,\n ExplicitWithdrawalPreparation,\n ExplicitSweepPreparation,\n ExplicitShieldPreparation,\n ExplicitCreateCreditPreparation,\n ExplicitDrawCreditPreparation,\n ExplicitTopUpCreditPreparation,\n ExplicitCancelCreditPreparation,\n} from \"./explicit-types\";\nimport { ProtocolRpcClient } from \"@invisi-labs/rpc\";\nimport type { Provider, Signer } from \"ethers\";\nimport {\n EthersChainReader,\n EthersFundingSigner,\n EthersFundingVerifier,\n EthersAddressResolver,\n} from \"./integrations/ethers\";\nimport { MissingCapabilityError } from \"@invisi-labs/core\";\nimport { Protocol, type ChainReader } from \"@invisi-labs/protocol\";\nimport { WalletSession, type WalletSessionOptions } from \"./session\";\n\n/** Compose independent Chain RPC and indexed Protocol RPC with local wallet capabilities. */\nexport type InvisiOptions = Omit<\n WalletSessionOptions,\n \"wallet\" | \"protocol\" | \"namespace\" | \"viewing\" | \"authorization\" | \"chainReader\"\n> & {\n provider?: Provider;\n signer?: Signer;\n chainReader?: ChainReader;\n};\n\n/** Wallet identity and session permissions; shared infrastructure belongs to InvisiOptions. */\nexport type ConnectionOptions = Pick<\n WalletSessionOptions,\n \"wallet\" | \"protocol\" | \"namespace\" | \"viewing\" | \"authorization\"\n>;\n\n/** A neutral composition entry point; every resolved instance owns an independent session. */\nexport class Invisi {\n readonly #options: InvisiOptions;\n\n constructor(options: InvisiOptions = {}) {\n this.#options = {\n ...options,\n ...(options.gasBenchmarks\n ? { gasBenchmarks: copyGasBenchmarks(options.gasBenchmarks) }\n : {}),\n };\n Object.freeze(this);\n }\n\n async connect(options: ConnectionOptions): Promise<WalletSession> {\n return new WalletSession(await this.resolve(options));\n }\n private async resolve(options: ConnectionOptions): Promise<WalletSessionOptions> {\n // Snapshot session permissions before the first network request.\n const allowed = [\"wallet\", \"protocol\", \"namespace\", \"viewing\", \"authorization\"];\n for (const key of Object.keys(options)) {\n if (!allowed.includes(key))\n throw new Error(\n `Unknown connection option: ${key}; configure infrastructure on Invisi`\n );\n }\n const selected = { ...options };\n const combined = { ...this.#options, ...selected };\n const { provider, signer, ...runtime } = combined;\n const reader =\n combined.chainReader ?? (provider ? new EthersChainReader(provider) : undefined);\n if (!reader) throw new MissingCapabilityError(\"chain reader\");\n if (provider && (await provider.getNetwork()).chainId !== selected.protocol.context.chainId)\n throw new Error(\"provider deployment chain mismatch\");\n await selected.protocol.validateDeployment(reader);\n if (runtime.protocolRpc instanceof ProtocolRpcClient) {\n runtime.protocolRpc = runtime.protocolRpc.withReader(reader);\n }\n if (signer) {\n if (!provider) throw new MissingCapabilityError(\"provider for signer\");\n if (!signer.provider) throw new Error(\"signer must be connected to a provider\");\n if ((await signer.provider.getNetwork()).chainId !== selected.protocol.context.chainId)\n throw new Error(\"signer-provider deployment chain mismatch\");\n }\n const registry = selected.protocol.deployment.registry;\n const fundingSigner =\n combined.fundingSigner ??\n (signer\n ? await EthersFundingSigner.create(signer, selected.protocol.context.chainId)\n : undefined);\n const fundingVerifier =\n combined.fundingVerifier ??\n (provider\n ? new EthersFundingVerifier(provider, selected.protocol.context.chainId)\n : undefined);\n const addressResolver =\n combined.addressResolver ??\n (provider && registry\n ? new EthersAddressResolver(\n provider,\n {\n chainId: selected.protocol.context.chainId,\n registryAddress: registry.address,\n },\n registry.runtimeCodeHash\n ).lookup\n : undefined);\n return {\n ...runtime,\n chainReader: reader,\n ...(signer ? { signer } : {}),\n ...(fundingSigner ? { fundingSigner } : {}),\n ...(fundingVerifier ? { fundingVerifier } : {}),\n ...(addressResolver ? { addressResolver } : {}),\n protocol: selected.protocol,\n };\n }\n\n async prepareTransfer(options: ExplicitTransferPreparation): Promise<PreparedTransaction> {\n const { wallet, protocol, ...input } = options;\n const request = structuredClone(input);\n const runtime = await this.resolve({ wallet, protocol });\n const preparation = explicitPreparation(runtime, request, request.tokenAddress);\n return preparation.prepareTransfer(request);\n }\n async prepareWithdraw(options: ExplicitWithdrawalPreparation): Promise<PreparedTransaction> {\n const { wallet, protocol, ...input } = options;\n const request = structuredClone(input);\n const runtime = await this.resolve({ wallet, protocol });\n const preparation = explicitPreparation(runtime, request, request.tokenAddress);\n return preparation.prepareWithdraw(request);\n }\n async prepareSweep(options: ExplicitSweepPreparation): Promise<PreparedTransaction> {\n const { wallet, protocol, ...input } = options;\n const request = structuredClone(input);\n const runtime = await this.resolve({ wallet, protocol });\n const preparation = explicitPreparation(runtime, request, request.tokenAddress);\n return preparation.prepareSweep(request);\n }\n async prepareShield(options: ExplicitShieldPreparation): Promise<PreparedTransaction> {\n const { wallet, protocol, ...input } = options;\n const request = structuredClone(input);\n const runtime = await this.resolve({ wallet, protocol });\n const preparation = explicitPreparation(runtime, {}, request.tokenAddress);\n return preparation.prepareShield(request);\n }\n async prepareCreateCredit(\n options: ExplicitCreateCreditPreparation\n ): Promise<PreparedTransaction> {\n const { wallet, protocol, ...input } = options;\n const request = structuredClone(input);\n const runtime = await this.resolve({ wallet, protocol });\n const preparation = explicitPreparation(runtime, request, request.tokenAddress);\n return preparation.prepareCreateCredit(request);\n }\n async prepareDrawCredit(options: ExplicitDrawCreditPreparation): Promise<PreparedTransaction> {\n const { wallet, protocol, ...input } = options;\n const request = structuredClone(input);\n const runtime = await this.resolve({ wallet, protocol });\n const preparation = explicitPreparation(runtime, request, request.tokenAddress);\n return preparation.prepareDrawCredit(request);\n }\n async prepareTopUpCredit(\n options: ExplicitTopUpCreditPreparation\n ): Promise<PreparedTransaction> {\n const { wallet, protocol, ...input } = options;\n const request = structuredClone(input);\n const runtime = await this.resolve({ wallet, protocol });\n const preparation = explicitPreparation(runtime, request, request.tokenAddress);\n return preparation.prepareTopUpCredit(request);\n }\n async prepareCancelCredit(\n options: ExplicitCancelCreditPreparation\n ): Promise<PreparedTransaction> {\n const { wallet, protocol, ...input } = options;\n const request = structuredClone(input);\n const runtime = await this.resolve({ wallet, protocol });\n const preparation = explicitPreparation(runtime, request, request.tokenAddress);\n return preparation.prepareCancelCredit(request);\n }\n\n toJSON() {\n return { invisi: true };\n }\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n return this.toJSON();\n }\n}\n","export { Invisi } from \"./Invisi\";\nexport type { InvisiOptions, ConnectionOptions } from \"./Invisi\";\nexport {\n Wallet,\n ViewingCapability,\n Detector,\n NullifierCapability,\n WalletAuthorization,\n MissingCapabilityError,\n Disclosure,\n encodeMemo,\n decodeMemoText,\n MAX_MEMO_BYTES,\n} from \"@invisi-labs/core\";\nexport type {\n Address,\n Hex,\n Memo,\n Note,\n CreditNote,\n CreditPolicy,\n CreditDeliveryState,\n ReceivingKeys,\n WalletAuthorizationProvider,\n CreditOpening,\n DisclosureOutput,\n DisclosureExport,\n DisclosureResult,\n} from \"@invisi-labs/core\";\nexport { Protocol, RegistrationOperation } from \"@invisi-labs/protocol\";\nexport type {\n ChainReader,\n ProtocolDataProvider,\n ProtocolDataStatus,\n ProtocolUpdates,\n ProtocolUpdateRange,\n TransactionCall,\n CanonicalBlock,\n CanonicalReceipt,\n Membership,\n RegistryReader,\n ProtocolOptions,\n TokenProtocol,\n TokenProtocolOptions,\n FactoryReader,\n AddressRegistryOptions,\n RegistryContext,\n TransactionContext,\n} from \"@invisi-labs/protocol\";\nexport { WalletSession, Operation, walletBalance, DisclosureVerifier } from \"./session\";\nexport type {\n RefreshOptions,\n RefreshResult,\n WalletStore,\n WalletScope,\n WalletState,\n BalanceSnapshot,\n WalletSessionOptions,\n TransferPreparation,\n WithdrawalPreparation,\n SweepPreparation,\n ShieldPreparation,\n CreateCreditPreparation,\n DrawCreditPreparation,\n TopUpCreditPreparation,\n CancelCreditPreparation,\n FundingSigner,\n FundingAuthorizationVerifier,\n FundingTypedData,\n FundingSource,\n CoinSelector,\n OperationStatus,\n OperationAggregateMember,\n DisclosureReference,\n DisclosureReader,\n DisclosureVerifierOptions,\n DisclosureEvidence,\n VerifiedDisclosure,\n} from \"./session\";\nexport type {\n Prover,\n ProverOptions,\n ProofBundle,\n ProofStatement,\n AggregatorCapability,\n AggregateMember,\n} from \"@invisi-labs/prover\";\n\nexport { ProtocolRpcError } from \"@invisi-labs/rpc\";\nexport type { ProtocolDeployment } from \"@invisi-labs/rpc\";\nexport { ProtocolRpcClient } from \"./ProtocolRpcClient\";\nexport { AddressRegistry } from \"./AddressRegistry\";\nexport type {\n ProtocolRpcClientOptions,\n ProtocolRpcReader,\n ProtocolRpcConnectionOptions,\n ProtocolRpcChain,\n} from \"@invisi-labs/rpc\";\n\nexport { EncryptedWalletCodec } from \"./integrations/encrypted-codec\";\n\nexport { PreparedTransaction } from \"./PreparedTransaction\";\nexport type {\n NoteInput,\n CreditInput,\n TransactionIdentity,\n ExplicitTransferPreparation,\n ExplicitWithdrawalPreparation,\n ExplicitSweepPreparation,\n ExplicitShieldPreparation,\n ExplicitCreateCreditPreparation,\n ExplicitDrawCreditPreparation,\n ExplicitTopUpCreditPreparation,\n ExplicitCancelCreditPreparation,\n} from \"./explicit-types\";\n\nexport type { SessionTransactionOptions } from \"./session/WalletSession\";\n\nexport type {\n GasBenchmarkProfile,\n GasBenchmarkShape,\n GasBenchmarkDeployment,\n GasBenchmarkCircuit,\n GasBenchmarkSample,\n GasReference,\n} from \"./gas-estimation\";\n\nexport { defineGasBenchmarks } from \"./gas-estimation\";\n","import type { Provider } from \"ethers\";\nimport { ProtocolRpcClient as RpcClient } from \"@invisi-labs/rpc\";\nimport { EthersChainReader } from \"./integrations/ethers\";\n\n/** Protocol RPC transport with ethers provider integration for independent chain checks. */\nexport class ProtocolRpcClient extends RpcClient {\n withProvider(provider: Provider): RpcClient {\n return this.withReader(new EthersChainReader(provider));\n }\n}\n","import type { Provider } from \"ethers\";\nimport { AddressRegistry as Registry, type RegistrationPreparation } from \"@invisi-labs/protocol\";\nimport { EthersChainReader } from \"./integrations/ethers\";\n\n/** Registry operations accept the application's existing ethers provider. */\nexport class AddressRegistry extends Registry {\n override prepareRegistration(\n options:\n | RegistrationPreparation\n | (Omit<RegistrationPreparation, \"reader\"> & { provider: Provider })\n ) {\n if (\"provider\" in options) {\n const { provider, ...preparation } = options;\n return super.prepareRegistration({\n ...preparation,\n reader: new EthersChainReader(provider),\n });\n }\n return super.prepareRegistration(options);\n }\n}\n","import {\n serializeState,\n deserializeState,\n type WalletState,\n type WalletRecordCodec,\n} from \"../session\";\n/** Caller-owned, nonextractable AES-GCM key. The SDK does not persist the key. */\nexport class EncryptedWalletCodec implements WalletRecordCodec {\n readonly #key: CryptoKey;\n private constructor(key: CryptoKey) {\n this.#key = key;\n }\n static fromKey(key: CryptoKey): EncryptedWalletCodec {\n if (\n key.type !== \"secret\" ||\n key.algorithm.name !== \"AES-GCM\" ||\n (key.algorithm as AesKeyAlgorithm).length !== 256 ||\n !key.usages.includes(\"encrypt\") ||\n !key.usages.includes(\"decrypt\")\n )\n throw new Error(\"wallet record key must support AES-256-GCM encryption and decryption\");\n return new EncryptedWalletCodec(key);\n }\n static async fromBytes(key: Uint8Array): Promise<EncryptedWalletCodec> {\n if (key.length !== 32) throw new Error(\"wallet record encryption requires 32 key bytes\");\n const copy = Uint8Array.from(key);\n try {\n return EncryptedWalletCodec.fromKey(\n await crypto.subtle.importKey(\"raw\", copy, { name: \"AES-GCM\" }, false, [\n \"encrypt\",\n \"decrypt\",\n ])\n );\n } finally {\n copy.fill(0);\n }\n }\n private aad(context: { key: string; revision: number }): Uint8Array<ArrayBuffer> {\n if (!Number.isSafeInteger(context.revision) || context.revision < 1)\n throw new Error(\"invalid encrypted record revision\");\n return new TextEncoder().encode(\n `Invisi.WalletRecord.v1\\0${context.revision}\\0${context.key}`\n );\n }\n async encode(\n state: WalletState,\n context: { key: string; revision: number }\n ): Promise<Uint8Array> {\n const iv = crypto.getRandomValues(new Uint8Array(12)),\n plain = Uint8Array.from(serializeState(state));\n try {\n const encrypted = new Uint8Array(\n await crypto.subtle.encrypt(\n { name: \"AES-GCM\", iv, additionalData: this.aad(context) },\n this.#key,\n plain\n )\n );\n const out = new Uint8Array(13 + encrypted.length);\n out[0] = 1;\n out.set(iv, 1);\n out.set(encrypted, 13);\n return out;\n } finally {\n plain.fill(0);\n }\n }\n async decode(\n data: Uint8Array,\n context: { key: string; revision: number }\n ): Promise<WalletState> {\n if (data.length < 29 || data[0] !== 1)\n throw new Error(\"wallet record authentication failed\");\n let plain: Uint8Array;\n try {\n plain = new Uint8Array(\n await crypto.subtle.decrypt(\n {\n name: \"AES-GCM\",\n iv: Uint8Array.from(data.subarray(1, 13)),\n additionalData: this.aad(context),\n },\n this.#key,\n Uint8Array.from(data.subarray(13))\n )\n );\n } catch {\n throw new Error(\"wallet record authentication failed\");\n }\n try {\n return deserializeState(plain);\n } finally {\n plain.fill(0);\n }\n }\n toJSON() {\n return { walletRecordCodec: \"AES-256-GCM\" };\n }\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n return this.toJSON();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;;;ACM3B;AAAA,EACI;AAAA,OAGG;AACP,SAAS,wBAA8C;AAkBvD,SAAS,MAAM,IAAa,SAA6B;AACrD,MAAI,CAAC,GAAI,OAAM,IAAI,MAAM,OAAO;AACpC;AAKO,IAAM,sBAAN,MAAM,qBAAoB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACD,YACJ,SACA,OACA,Q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