@dexterai/vault 0.3.0 → 0.3.2

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.
@@ -85,6 +85,38 @@ interface BuildSetSwigAtomicParams {
85
85
  authenticatorData: Uint8Array;
86
86
  }
87
87
  declare function buildSetSwigAtomicInstruction(params: BuildSetSwigAtomicParams): TransactionInstruction;
88
+ interface BuildSetSwigAtomicFromIdentityParams {
89
+ /** dexter-vault PDA. */
90
+ vaultPda: PublicKey;
91
+ /** Outer-tx signer + role-0 bootstrap authority. */
92
+ feePayer: PublicKey;
93
+ /** Becomes role-2 (Ed25519Session) authority. */
94
+ dexterMasterPubkey: PublicKey;
95
+ /** Operator identity seed (e.g. 16-byte UUID). */
96
+ identitySeed: Uint8Array;
97
+ /**
98
+ * 32-byte HMAC key for swig_id derivation. MUST match the key
99
+ * buildSwigCreationBundle uses, or the derived swigId will not match
100
+ * the expected on-chain PDA.
101
+ */
102
+ hmacKey: Uint8Array;
103
+ /** WebAuthn ceremony outputs. */
104
+ clientDataJSON: Uint8Array;
105
+ authenticatorData: Uint8Array;
106
+ }
107
+ /**
108
+ * High-level convenience wrapper around buildSetSwigAtomicInstruction.
109
+ *
110
+ * Derives the 32-byte swigId via HMAC(identitySeed, hmacKey) using the
111
+ * SAME deriveSwigId helper as buildSwigCreationBundle, then finds the
112
+ * Swig state PDA and the Swig wallet PDA (with their bumps), then
113
+ * delegates to the low-level builder.
114
+ *
115
+ * Suitable for normal callers. Use the low-level builder directly only
116
+ * when you need to control swigId derivation yourself (e.g., byte-parity
117
+ * snapshot tests).
118
+ */
119
+ declare function buildSetSwigAtomicFromIdentity(params: BuildSetSwigAtomicFromIdentityParams): TransactionInstruction;
88
120
 
89
121
  /**
90
122
  * register_session_key — authorize a session ed25519 key under a vault.
@@ -298,6 +330,15 @@ declare function buildProvePasskeyInstruction(p: ProvePasskeyParams): Transactio
298
330
  declare const SWIG_PROGRAM_EXEC_PREFIX: Uint8Array<ArrayBuffer>;
299
331
  declare const SWIG_PROGRAM_EXEC_PREFIX_SETTLE_TAB: Uint8Array<ArrayBuffer>;
300
332
  declare const SWIG_PROGRAM_EXEC_MARKERS: readonly Uint8Array[];
333
+ /**
334
+ * HMAC-derive the 32-byte swigId used as the Swig state PDA seed.
335
+ *
336
+ * Exported so the high-level buildSetSwigAtomicFromIdentity wrapper in
337
+ * setSwigAtomic.ts can share the SAME derivation function — keeping a
338
+ * single source of truth and avoiding silent drift between the two
339
+ * paths that produce the same on-chain seed.
340
+ */
341
+ declare function deriveSwigId(identitySeed: Uint8Array, hmacKey: Uint8Array): Buffer;
301
342
  interface BuildSwigCreationBundleParams {
302
343
  feePayer: string;
303
344
  dexterMasterPubkey: string;
@@ -335,4 +376,4 @@ declare function deriveVaultPda(supabaseUserId: Uint8Array): {
335
376
  bump: number;
336
377
  };
337
378
 
338
- export { type BuildRegisterSessionKeyArgs, type BuildRevokeSessionKeyArgs, type BuildSetSwigAtomicParams, type BuildSwigCreationBundleParams, type FinalizeWithdrawalParams, type ForceReleaseParams, type InitializeVaultParams, type ProvePasskeyParams, type RequestWithdrawalParams, type RotateDexterAuthorityParams, type RotatePasskeyParams, SET_SWIG_ATOMIC_DISCRIMINATOR, SWIG_PROGRAM_EXEC_MARKERS, SWIG_PROGRAM_EXEC_PREFIX, SWIG_PROGRAM_EXEC_PREFIX_SETTLE_TAB, type SetSwigParams, type SettleTabVoucherParams, type SettleVoucherParams, type SwigCreationBundleOutput, type SwigOwnershipCheck, buildFinalizeWithdrawalInstruction, buildForceReleaseInstruction, buildInitializeVaultInstruction, buildProvePasskeyInstruction, buildRegisterSessionKeyInstruction, buildRequestWithdrawalInstruction, buildRevokeSessionKeyInstruction, buildRotateDexterAuthorityInstruction, buildRotatePasskeyInstruction, buildSetSwigAtomicInstruction, buildSetSwigInstruction, buildSettleTabVoucherInstruction, buildSettleVoucherInstruction, buildSwigCreationBundle, deriveSwigWalletAddress, deriveVaultPda, expectedSwigAddressFor, verifySwigIsOurs };
379
+ export { type BuildRegisterSessionKeyArgs, type BuildRevokeSessionKeyArgs, type BuildSetSwigAtomicFromIdentityParams, type BuildSetSwigAtomicParams, type BuildSwigCreationBundleParams, type FinalizeWithdrawalParams, type ForceReleaseParams, type InitializeVaultParams, type ProvePasskeyParams, type RequestWithdrawalParams, type RotateDexterAuthorityParams, type RotatePasskeyParams, SET_SWIG_ATOMIC_DISCRIMINATOR, SWIG_PROGRAM_EXEC_MARKERS, SWIG_PROGRAM_EXEC_PREFIX, SWIG_PROGRAM_EXEC_PREFIX_SETTLE_TAB, type SetSwigParams, type SettleTabVoucherParams, type SettleVoucherParams, type SwigCreationBundleOutput, type SwigOwnershipCheck, buildFinalizeWithdrawalInstruction, buildForceReleaseInstruction, buildInitializeVaultInstruction, buildProvePasskeyInstruction, buildRegisterSessionKeyInstruction, buildRequestWithdrawalInstruction, buildRevokeSessionKeyInstruction, buildRotateDexterAuthorityInstruction, buildRotatePasskeyInstruction, buildSetSwigAtomicFromIdentity, buildSetSwigAtomicInstruction, buildSetSwigInstruction, buildSettleTabVoucherInstruction, buildSettleVoucherInstruction, buildSwigCreationBundle, deriveSwigId, deriveSwigWalletAddress, deriveVaultPda, expectedSwigAddressFor, verifySwigIsOurs };
@@ -85,6 +85,38 @@ interface BuildSetSwigAtomicParams {
85
85
  authenticatorData: Uint8Array;
86
86
  }
87
87
  declare function buildSetSwigAtomicInstruction(params: BuildSetSwigAtomicParams): TransactionInstruction;
88
+ interface BuildSetSwigAtomicFromIdentityParams {
89
+ /** dexter-vault PDA. */
90
+ vaultPda: PublicKey;
91
+ /** Outer-tx signer + role-0 bootstrap authority. */
92
+ feePayer: PublicKey;
93
+ /** Becomes role-2 (Ed25519Session) authority. */
94
+ dexterMasterPubkey: PublicKey;
95
+ /** Operator identity seed (e.g. 16-byte UUID). */
96
+ identitySeed: Uint8Array;
97
+ /**
98
+ * 32-byte HMAC key for swig_id derivation. MUST match the key
99
+ * buildSwigCreationBundle uses, or the derived swigId will not match
100
+ * the expected on-chain PDA.
101
+ */
102
+ hmacKey: Uint8Array;
103
+ /** WebAuthn ceremony outputs. */
104
+ clientDataJSON: Uint8Array;
105
+ authenticatorData: Uint8Array;
106
+ }
107
+ /**
108
+ * High-level convenience wrapper around buildSetSwigAtomicInstruction.
109
+ *
110
+ * Derives the 32-byte swigId via HMAC(identitySeed, hmacKey) using the
111
+ * SAME deriveSwigId helper as buildSwigCreationBundle, then finds the
112
+ * Swig state PDA and the Swig wallet PDA (with their bumps), then
113
+ * delegates to the low-level builder.
114
+ *
115
+ * Suitable for normal callers. Use the low-level builder directly only
116
+ * when you need to control swigId derivation yourself (e.g., byte-parity
117
+ * snapshot tests).
118
+ */
119
+ declare function buildSetSwigAtomicFromIdentity(params: BuildSetSwigAtomicFromIdentityParams): TransactionInstruction;
88
120
 
89
121
  /**
90
122
  * register_session_key — authorize a session ed25519 key under a vault.
@@ -298,6 +330,15 @@ declare function buildProvePasskeyInstruction(p: ProvePasskeyParams): Transactio
298
330
  declare const SWIG_PROGRAM_EXEC_PREFIX: Uint8Array<ArrayBuffer>;
299
331
  declare const SWIG_PROGRAM_EXEC_PREFIX_SETTLE_TAB: Uint8Array<ArrayBuffer>;
300
332
  declare const SWIG_PROGRAM_EXEC_MARKERS: readonly Uint8Array[];
333
+ /**
334
+ * HMAC-derive the 32-byte swigId used as the Swig state PDA seed.
335
+ *
336
+ * Exported so the high-level buildSetSwigAtomicFromIdentity wrapper in
337
+ * setSwigAtomic.ts can share the SAME derivation function — keeping a
338
+ * single source of truth and avoiding silent drift between the two
339
+ * paths that produce the same on-chain seed.
340
+ */
341
+ declare function deriveSwigId(identitySeed: Uint8Array, hmacKey: Uint8Array): Buffer;
301
342
  interface BuildSwigCreationBundleParams {
302
343
  feePayer: string;
303
344
  dexterMasterPubkey: string;
@@ -335,4 +376,4 @@ declare function deriveVaultPda(supabaseUserId: Uint8Array): {
335
376
  bump: number;
336
377
  };
337
378
 
338
- export { type BuildRegisterSessionKeyArgs, type BuildRevokeSessionKeyArgs, type BuildSetSwigAtomicParams, type BuildSwigCreationBundleParams, type FinalizeWithdrawalParams, type ForceReleaseParams, type InitializeVaultParams, type ProvePasskeyParams, type RequestWithdrawalParams, type RotateDexterAuthorityParams, type RotatePasskeyParams, SET_SWIG_ATOMIC_DISCRIMINATOR, SWIG_PROGRAM_EXEC_MARKERS, SWIG_PROGRAM_EXEC_PREFIX, SWIG_PROGRAM_EXEC_PREFIX_SETTLE_TAB, type SetSwigParams, type SettleTabVoucherParams, type SettleVoucherParams, type SwigCreationBundleOutput, type SwigOwnershipCheck, buildFinalizeWithdrawalInstruction, buildForceReleaseInstruction, buildInitializeVaultInstruction, buildProvePasskeyInstruction, buildRegisterSessionKeyInstruction, buildRequestWithdrawalInstruction, buildRevokeSessionKeyInstruction, buildRotateDexterAuthorityInstruction, buildRotatePasskeyInstruction, buildSetSwigAtomicInstruction, buildSetSwigInstruction, buildSettleTabVoucherInstruction, buildSettleVoucherInstruction, buildSwigCreationBundle, deriveSwigWalletAddress, deriveVaultPda, expectedSwigAddressFor, verifySwigIsOurs };
379
+ export { type BuildRegisterSessionKeyArgs, type BuildRevokeSessionKeyArgs, type BuildSetSwigAtomicFromIdentityParams, type BuildSetSwigAtomicParams, type BuildSwigCreationBundleParams, type FinalizeWithdrawalParams, type ForceReleaseParams, type InitializeVaultParams, type ProvePasskeyParams, type RequestWithdrawalParams, type RotateDexterAuthorityParams, type RotatePasskeyParams, SET_SWIG_ATOMIC_DISCRIMINATOR, SWIG_PROGRAM_EXEC_MARKERS, SWIG_PROGRAM_EXEC_PREFIX, SWIG_PROGRAM_EXEC_PREFIX_SETTLE_TAB, type SetSwigParams, type SettleTabVoucherParams, type SettleVoucherParams, type SwigCreationBundleOutput, type SwigOwnershipCheck, buildFinalizeWithdrawalInstruction, buildForceReleaseInstruction, buildInitializeVaultInstruction, buildProvePasskeyInstruction, buildRegisterSessionKeyInstruction, buildRequestWithdrawalInstruction, buildRevokeSessionKeyInstruction, buildRotateDexterAuthorityInstruction, buildRotatePasskeyInstruction, buildSetSwigAtomicFromIdentity, buildSetSwigAtomicInstruction, buildSetSwigInstruction, buildSettleTabVoucherInstruction, buildSettleVoucherInstruction, buildSwigCreationBundle, deriveSwigId, deriveSwigWalletAddress, deriveVaultPda, expectedSwigAddressFor, verifySwigIsOurs };