@veridex/sdk 1.0.0-beta.9 → 1.1.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.
Files changed (132) hide show
  1. package/LICENSE +170 -21
  2. package/README.md +574 -117
  3. package/dist/EVMClient-DtqvdfUP.d.mts +376 -0
  4. package/dist/auth/prepareAuth.d.mts +25 -0
  5. package/dist/auth/prepareAuth.js +2406 -0
  6. package/dist/auth/prepareAuth.js.map +1 -0
  7. package/dist/auth/prepareAuth.mjs +151 -0
  8. package/dist/auth/prepareAuth.mjs.map +1 -0
  9. package/dist/chains/aptos/index.d.mts +6 -5
  10. package/dist/chains/aptos/index.js +66 -39
  11. package/dist/chains/aptos/index.js.map +1 -1
  12. package/dist/chains/aptos/index.mjs +5 -547
  13. package/dist/chains/aptos/index.mjs.map +1 -1
  14. package/dist/chains/avalanche/index.d.mts +137 -0
  15. package/dist/chains/avalanche/index.js +1555 -0
  16. package/dist/chains/avalanche/index.js.map +1 -0
  17. package/dist/chains/avalanche/index.mjs +10 -0
  18. package/dist/chains/avalanche/index.mjs.map +1 -0
  19. package/dist/chains/evm/index.d.mts +5 -3
  20. package/dist/chains/evm/index.js +165 -3
  21. package/dist/chains/evm/index.js.map +1 -1
  22. package/dist/chains/evm/index.mjs +8 -1200
  23. package/dist/chains/evm/index.mjs.map +1 -1
  24. package/dist/chains/solana/index.d.mts +1 -1
  25. package/dist/chains/solana/index.js.map +1 -1
  26. package/dist/chains/solana/index.mjs +4 -486
  27. package/dist/chains/solana/index.mjs.map +1 -1
  28. package/dist/chains/stacks/index.d.mts +559 -0
  29. package/dist/chains/stacks/index.js +1207 -0
  30. package/dist/chains/stacks/index.js.map +1 -0
  31. package/dist/chains/stacks/index.mjs +71 -0
  32. package/dist/chains/stacks/index.mjs.map +1 -0
  33. package/dist/chains/starknet/index.d.mts +4 -5
  34. package/dist/chains/starknet/index.js +1 -13
  35. package/dist/chains/starknet/index.js.map +1 -1
  36. package/dist/chains/starknet/index.mjs +5 -503
  37. package/dist/chains/starknet/index.mjs.map +1 -1
  38. package/dist/chains/sui/index.d.mts +4 -4
  39. package/dist/chains/sui/index.js +2 -2
  40. package/dist/chains/sui/index.js.map +1 -1
  41. package/dist/chains/sui/index.mjs +5 -529
  42. package/dist/chains/sui/index.mjs.map +1 -1
  43. package/dist/chunk-5T6KPH7A.mjs +1082 -0
  44. package/dist/chunk-5T6KPH7A.mjs.map +1 -0
  45. package/dist/chunk-72ZA3OYQ.mjs +20 -0
  46. package/dist/chunk-72ZA3OYQ.mjs.map +1 -0
  47. package/dist/chunk-F3YAGZSW.mjs +269 -0
  48. package/dist/chunk-F3YAGZSW.mjs.map +1 -0
  49. package/dist/chunk-GWJRKDSA.mjs +549 -0
  50. package/dist/chunk-GWJRKDSA.mjs.map +1 -0
  51. package/dist/chunk-M3MM4YMF.mjs +417 -0
  52. package/dist/chunk-M3MM4YMF.mjs.map +1 -0
  53. package/dist/chunk-MLXQHIH2.mjs +426 -0
  54. package/dist/chunk-MLXQHIH2.mjs.map +1 -0
  55. package/dist/chunk-N4A2RMUN.mjs +216 -0
  56. package/dist/chunk-N4A2RMUN.mjs.map +1 -0
  57. package/dist/chunk-NUWSMJFJ.mjs +179 -0
  58. package/dist/chunk-NUWSMJFJ.mjs.map +1 -0
  59. package/dist/chunk-OVMMTL6H.mjs +330 -0
  60. package/dist/chunk-OVMMTL6H.mjs.map +1 -0
  61. package/dist/chunk-PDHZ5X5O.mjs +565 -0
  62. package/dist/chunk-PDHZ5X5O.mjs.map +1 -0
  63. package/dist/chunk-Q5O3M5LP.mjs +422 -0
  64. package/dist/chunk-Q5O3M5LP.mjs.map +1 -0
  65. package/dist/chunk-QDO6NQ7P.mjs +840 -0
  66. package/dist/chunk-QDO6NQ7P.mjs.map +1 -0
  67. package/dist/chunk-QT4ZZ4GM.mjs +509 -0
  68. package/dist/chunk-QT4ZZ4GM.mjs.map +1 -0
  69. package/dist/chunk-SXXGTQIR.mjs +464 -0
  70. package/dist/chunk-SXXGTQIR.mjs.map +1 -0
  71. package/dist/chunk-USDA5JTN.mjs +1249 -0
  72. package/dist/chunk-USDA5JTN.mjs.map +1 -0
  73. package/dist/chunk-V636MIV3.mjs +52 -0
  74. package/dist/chunk-V636MIV3.mjs.map +1 -0
  75. package/dist/chunk-X7BZMSPQ.mjs +407 -0
  76. package/dist/chunk-X7BZMSPQ.mjs.map +1 -0
  77. package/dist/chunk-YCUJZ6Z7.mjs +829 -0
  78. package/dist/chunk-YCUJZ6Z7.mjs.map +1 -0
  79. package/dist/constants.d.mts +1 -1
  80. package/dist/constants.js +26 -12
  81. package/dist/constants.js.map +1 -1
  82. package/dist/constants.mjs +16 -375
  83. package/dist/constants.mjs.map +1 -1
  84. package/dist/index-DDalBhAm.d.mts +243 -0
  85. package/dist/index.d.mts +2511 -556
  86. package/dist/index.js +15216 -10262
  87. package/dist/index.js.map +1 -1
  88. package/dist/index.mjs +4125 -7839
  89. package/dist/index.mjs.map +1 -1
  90. package/dist/passkey.d.mts +182 -0
  91. package/dist/passkey.js +914 -0
  92. package/dist/passkey.js.map +1 -0
  93. package/dist/passkey.mjs +15 -0
  94. package/dist/passkey.mjs.map +1 -0
  95. package/dist/payload.js.map +1 -1
  96. package/dist/payload.mjs +25 -244
  97. package/dist/payload.mjs.map +1 -1
  98. package/dist/portfolio-V347KZOL.mjs +13 -0
  99. package/dist/portfolio-V347KZOL.mjs.map +1 -0
  100. package/dist/queries/index.js +145 -12
  101. package/dist/queries/index.js.map +1 -1
  102. package/dist/queries/index.mjs +14 -1496
  103. package/dist/queries/index.mjs.map +1 -1
  104. package/dist/{types-FJL7j6gQ.d.ts → types-B7V5VNbO.d.mts} +6 -2
  105. package/dist/{types-ChIsqCiw.d.mts → types-DP2CQT8p.d.mts} +12 -1
  106. package/dist/types.d.mts +16 -0
  107. package/dist/types.js.map +1 -1
  108. package/dist/utils.js +25 -11
  109. package/dist/utils.js.map +1 -1
  110. package/dist/utils.mjs +19 -371
  111. package/dist/utils.mjs.map +1 -1
  112. package/dist/wormhole.js.map +1 -1
  113. package/dist/wormhole.mjs +25 -397
  114. package/dist/wormhole.mjs.map +1 -1
  115. package/package.json +28 -3
  116. package/scripts/patch-noble-curves.js +78 -0
  117. package/dist/chains/aptos/index.d.ts +0 -145
  118. package/dist/chains/evm/index.d.ts +0 -5
  119. package/dist/chains/solana/index.d.ts +0 -116
  120. package/dist/chains/starknet/index.d.ts +0 -172
  121. package/dist/chains/sui/index.d.ts +0 -182
  122. package/dist/constants.d.ts +0 -150
  123. package/dist/index-0NXfbk0z.d.ts +0 -637
  124. package/dist/index-D0dLVjTA.d.mts +0 -637
  125. package/dist/index.d.ts +0 -3123
  126. package/dist/payload.d.ts +0 -125
  127. package/dist/queries/index.d.ts +0 -148
  128. package/dist/types-ChIsqCiw.d.ts +0 -565
  129. package/dist/types-FJL7j6gQ.d.mts +0 -172
  130. package/dist/types.d.ts +0 -407
  131. package/dist/utils.d.ts +0 -81
  132. package/dist/wormhole.d.ts +0 -167
@@ -1,172 +0,0 @@
1
- /**
2
- * Veridex Protocol SDK - Session Key Management Types
3
- *
4
- * Type definitions for ephemeral session keys that enable
5
- * native L1-speed transactions after initial biometric auth.
6
- */
7
- /**
8
- * Ephemeral session key for fast software-backed signing
9
- *
10
- * Security model:
11
- * - Private key encrypted at rest (AES-GCM)
12
- * - Max 24-hour duration enforced on-chain
13
- * - Value limits prevent unlimited spending
14
- * - Chain scopes restrict cross-chain usage
15
- */
16
- interface SessionKey {
17
- /** Public key of the session (secp256k1) */
18
- publicKey: Uint8Array;
19
- /** Private key (MUST be encrypted before storage) */
20
- privateKey: Uint8Array;
21
- /** Keccak256 hash of public key (on-chain identifier) */
22
- keyHash: string;
23
- /** Unix timestamp when session expires (milliseconds) */
24
- expiry: number;
25
- /** Maximum transaction value allowed (in token's base units) */
26
- maxValue: bigint;
27
- /** Wormhole chain IDs where this session is valid */
28
- chainScopes: number[];
29
- /** User's Passkey key hash (binds session to user) */
30
- userKeyHash: string;
31
- }
32
- /**
33
- * Configuration for session creation and lifecycle
34
- */
35
- interface SessionConfig {
36
- /** Session duration in seconds (default: 3600 = 1 hour, max: 86400 = 24 hours) */
37
- duration: number;
38
- /** Maximum transaction value in base units (0 = unlimited, but NOT RECOMMENDED) */
39
- maxValue: bigint;
40
- /** Auto-refresh session before expiry (default: true) */
41
- autoRefresh: boolean;
42
- /** Refresh buffer time in seconds (refresh this many seconds before expiry, default: 300 = 5 min) */
43
- refreshBuffer?: number;
44
- /** Chain scopes - which Wormhole chain IDs can use this session (empty = all chains) */
45
- chainScopes?: number[];
46
- }
47
- /**
48
- * Signature produced by signing with a session key
49
- *
50
- * This is a lightweight software signature (secp256k1) that can be
51
- * validated on-chain via CCQ to Hub's isSessionActive() state.
52
- */
53
- interface SessionSignature {
54
- /** ECDSA signature (r, s, v) from session private key */
55
- signature: Uint8Array;
56
- /** Session key hash (links signature to registered session) */
57
- sessionKeyHash: string;
58
- /** User's Passkey key hash (for Hub state query) */
59
- userKeyHash: string;
60
- /** Timestamp when signature was created (for replay prevention) */
61
- timestamp: number;
62
- /** Optional nonce for additional replay protection */
63
- nonce?: number;
64
- }
65
- /**
66
- * Configuration for SessionManager initialization
67
- */
68
- interface SessionManagerConfig {
69
- /** Default session configuration */
70
- defaultSessionConfig: SessionConfig;
71
- /** Storage backend ('indexeddb' or 'localstorage', default: 'indexeddb') */
72
- storageBackend?: 'indexeddb' | 'localstorage';
73
- /** Enable debug logging */
74
- debug?: boolean;
75
- /** Custom encryption key derivation (for testing only) */
76
- encryptionKey?: CryptoKey;
77
- }
78
- /**
79
- * Events emitted during session lifecycle
80
- */
81
- type SessionEvent = {
82
- type: 'session-created';
83
- session: SessionKey;
84
- } | {
85
- type: 'session-loaded';
86
- session: SessionKey;
87
- } | {
88
- type: 'session-expired';
89
- keyHash: string;
90
- } | {
91
- type: 'session-refreshed';
92
- session: SessionKey;
93
- } | {
94
- type: 'session-revoked';
95
- keyHash: string;
96
- } | {
97
- type: 'session-error';
98
- error: Error;
99
- };
100
- type SessionEventCallback = (event: SessionEvent) => void;
101
- /**
102
- * Interface for session storage implementations
103
- *
104
- * Implementations MUST:
105
- * - Encrypt private keys before storage
106
- * - Use secure key derivation (e.g., PBKDF2 or similar)
107
- * - Provide atomic read/write/delete operations
108
- */
109
- interface SessionStorage {
110
- /**
111
- * Save a session (private key will be encrypted)
112
- */
113
- save(session: SessionKey): Promise<void>;
114
- /**
115
- * Load the active session (private key will be decrypted)
116
- */
117
- load(): Promise<SessionKey | null>;
118
- /**
119
- * Clear all stored sessions
120
- */
121
- clear(): Promise<void>;
122
- /**
123
- * Check if a session exists
124
- */
125
- exists(): Promise<boolean>;
126
- }
127
- /**
128
- * Parameters for an action to be signed with a session key
129
- */
130
- interface ActionParams {
131
- /** Action type (transfer, execute, bridge, etc.) */
132
- action: string;
133
- /** Target chain (Wormhole chain ID) */
134
- targetChain: number;
135
- /** Transaction value in base units */
136
- value: bigint;
137
- /** Action-specific payload */
138
- payload: Uint8Array;
139
- /** Nonce for replay prevention */
140
- nonce: number;
141
- /** Optional deadline timestamp */
142
- deadline?: number;
143
- }
144
- /**
145
- * Result of session-signed action
146
- */
147
- interface SessionSignedAction {
148
- /** Original action parameters */
149
- action: ActionParams;
150
- /** Session signature */
151
- signature: SessionSignature;
152
- /** Ready to submit to relayer or on-chain */
153
- readyToSubmit: boolean;
154
- }
155
- declare class SessionError extends Error {
156
- code: SessionErrorCode;
157
- details?: unknown | undefined;
158
- constructor(message: string, code: SessionErrorCode, details?: unknown | undefined);
159
- }
160
- declare enum SessionErrorCode {
161
- NO_ACTIVE_SESSION = "NO_ACTIVE_SESSION",
162
- SESSION_EXPIRED = "SESSION_EXPIRED",
163
- VALUE_EXCEEDS_LIMIT = "VALUE_EXCEEDS_LIMIT",
164
- CHAIN_NOT_ALLOWED = "CHAIN_NOT_ALLOWED",
165
- STORAGE_ERROR = "STORAGE_ERROR",
166
- ENCRYPTION_ERROR = "ENCRYPTION_ERROR",
167
- INVALID_CONFIG = "INVALID_CONFIG",
168
- REGISTRATION_FAILED = "REGISTRATION_FAILED",
169
- REVOCATION_FAILED = "REVOCATION_FAILED"
170
- }
171
-
172
- export { type ActionParams as A, type SessionKey as S, type SessionStorage as a, type SessionConfig as b, type SessionSignature as c, type SessionManagerConfig as d, type SessionEvent as e, type SessionEventCallback as f, type SessionSignedAction as g, SessionErrorCode as h, SessionError as i };
package/dist/types.d.ts DELETED
@@ -1,407 +0,0 @@
1
- /**
2
- * Veridex Protocol SDK - Type Definitions
3
- */
4
- interface VeridexConfig {
5
- hubChainId: number;
6
- hubRpcUrl: string;
7
- hubContractAddress: string;
8
- relayerUrl?: string;
9
- }
10
- interface ChainConfig {
11
- name: string;
12
- chainId: number;
13
- wormholeChainId: number;
14
- hubChainId?: number;
15
- rpcUrl: string;
16
- explorerUrl: string;
17
- isEvm: boolean;
18
- contracts: {
19
- hub?: string;
20
- vaultFactory?: string;
21
- vaultImplementation?: string;
22
- wormholeCoreBridge: string;
23
- tokenBridge?: string;
24
- };
25
- }
26
- interface PasskeyCredential {
27
- credentialId: string;
28
- publicKeyX: bigint;
29
- publicKeyY: bigint;
30
- keyHash: string;
31
- }
32
- interface WebAuthnSignature {
33
- authenticatorData: string;
34
- clientDataJSON: string;
35
- challengeIndex: number;
36
- typeIndex: number;
37
- r: bigint;
38
- s: bigint;
39
- }
40
- interface TransferParams {
41
- targetChain: number;
42
- token: string;
43
- recipient: string;
44
- amount: bigint;
45
- }
46
- interface ExecuteParams {
47
- targetChain: number;
48
- target: string;
49
- value: bigint;
50
- data: string;
51
- }
52
- interface BridgeParams {
53
- sourceChain: number;
54
- token: string;
55
- amount: bigint;
56
- destinationChain: number;
57
- recipient: string;
58
- }
59
- interface DispatchResult {
60
- transactionHash: string;
61
- sequence: bigint;
62
- userKeyHash: string;
63
- targetChain: number;
64
- }
65
- interface TransferAction {
66
- type: 'transfer';
67
- token: string;
68
- recipient: string;
69
- amount: bigint;
70
- }
71
- interface BridgeAction {
72
- type: 'bridge';
73
- token: string;
74
- amount: bigint;
75
- targetChain: number;
76
- recipient: string;
77
- }
78
- /**
79
- * Wormhole Query proof for optimistic execution
80
- * Allows ~5-7 second latency vs ~120+ seconds for VAA
81
- */
82
- interface QueryProof {
83
- /** Raw query response bytes from Wormhole Guardians */
84
- queryResponse: string;
85
- /** Guardian signatures (13/19 quorum) */
86
- signatures: string;
87
- }
88
- /**
89
- * User preference for execution path
90
- */
91
- type ExecutionPath = 'query' | 'vaa' | 'auto';
92
- /**
93
- * Result from query-based submission
94
- */
95
- interface QuerySubmissionResult {
96
- /** Whether submission succeeded */
97
- success: boolean;
98
- /** Transaction hash on spoke chain */
99
- txHash?: string;
100
- /** Execution path used ('query' or 'vaa') */
101
- path: ExecutionPath;
102
- /** Latency in milliseconds */
103
- latencyMs?: number;
104
- /** Error message if failed */
105
- error?: string;
106
- /** Whether fallback to VAA was triggered */
107
- fellBack?: boolean;
108
- }
109
- /**
110
- * Session key structure for temporary authentication
111
- * Enables native L1 speed for repeat transactions without biometric auth
112
- */
113
- interface SessionKey {
114
- /** Hash of the temporary session public key */
115
- sessionKeyHash: string;
116
- /** Unix timestamp when session expires */
117
- expiry: number;
118
- /** Maximum transaction value for this session (0 = unlimited) */
119
- maxValue: bigint;
120
- /** Whether session was manually revoked */
121
- revoked: boolean;
122
- }
123
- /**
124
- * Result from session validation query
125
- */
126
- interface SessionValidationResult {
127
- /** Whether session is currently active */
128
- active: boolean;
129
- /** Session expiry timestamp (0 if inactive) */
130
- expiry: number;
131
- /** Maximum transaction value (0 if inactive) */
132
- maxValue: bigint;
133
- /** Index in sessions array */
134
- sessionIndex: number;
135
- }
136
- /**
137
- * Parameters for registering a new session
138
- */
139
- interface RegisterSessionParams {
140
- /** Signature for Passkey authentication */
141
- signature: WebAuthnSignature;
142
- /** User's Passkey public key X coordinate */
143
- publicKeyX: bigint;
144
- /** User's Passkey public key Y coordinate */
145
- publicKeyY: bigint;
146
- /** Hash of the temporary session public key */
147
- sessionKeyHash: string;
148
- /** Session duration in seconds (max 24 hours) */
149
- duration: number;
150
- /** Maximum transaction value (0 = unlimited) */
151
- maxValue: bigint;
152
- /** Whether to require user verification */
153
- requireUV: boolean;
154
- }
155
- /**
156
- * Parameters for revoking a session
157
- */
158
- interface RevokeSessionParams {
159
- /** Signature for Passkey authentication */
160
- signature: WebAuthnSignature;
161
- /** User's Passkey public key X coordinate */
162
- publicKeyX: bigint;
163
- /** User's Passkey public key Y coordinate */
164
- publicKeyY: bigint;
165
- /** Hash of the session key to revoke */
166
- sessionKeyHash: string;
167
- /** Whether to require user verification */
168
- requireUV: boolean;
169
- }
170
- /**
171
- * Identity state for multi-key management
172
- * First passkey registered becomes the immutable identity root
173
- */
174
- interface IdentityState {
175
- /** Identity key hash (first passkey's keyHash) */
176
- identity: string;
177
- /** Number of authorized keys */
178
- keyCount: number;
179
- /** Maximum allowed keys per identity */
180
- maxKeys: number;
181
- /** Whether the specified key is the root identity */
182
- isRoot: boolean;
183
- }
184
- /**
185
- * Result from registering a backup passkey
186
- */
187
- interface AddBackupKeyResult {
188
- /** Transaction hash on Hub chain */
189
- transactionHash: string;
190
- /** Wormhole sequence number for cross-chain sync */
191
- sequence: bigint;
192
- /** The identity the key was added to */
193
- identity: string;
194
- /** The new key hash that was added */
195
- newKeyHash: string;
196
- /** Total number of keys after addition */
197
- keyCount: number;
198
- }
199
- /**
200
- * Result from removing a passkey
201
- */
202
- interface RemoveKeyResult {
203
- /** Transaction hash on Hub chain */
204
- transactionHash: string;
205
- /** Wormhole sequence number for cross-chain sync */
206
- sequence: bigint;
207
- /** The identity the key was removed from */
208
- identity: string;
209
- /** The key hash that was removed */
210
- removedKeyHash: string;
211
- /** Remaining number of keys after removal */
212
- keyCount: number;
213
- }
214
- /**
215
- * Authorized key information
216
- */
217
- interface AuthorizedKey {
218
- /** Key hash of the authorized passkey */
219
- keyHash: string;
220
- /** Whether this key is the root identity key */
221
- isRoot: boolean;
222
- }
223
- /**
224
- * Guardian configuration for an identity
225
- */
226
- interface GuardianConfig {
227
- /** Array of guardian key hashes */
228
- guardians: string[];
229
- /** Required approvals for recovery (M-of-N) */
230
- threshold: bigint;
231
- /** Whether guardians have been configured */
232
- isConfigured: boolean;
233
- }
234
- /**
235
- * Recovery status for an identity
236
- */
237
- interface RecoveryStatus {
238
- /** Whether a recovery is currently active */
239
- isActive: boolean;
240
- /** Proposed new owner key hash */
241
- newOwnerKeyHash: string;
242
- /** Timestamp when recovery was initiated */
243
- initiatedAt: bigint;
244
- /** Current number of guardian approvals */
245
- approvalCount: bigint;
246
- /** Required approvals for recovery */
247
- threshold: bigint;
248
- /** Timestamp when recovery can be executed (after timelock) */
249
- canExecuteAt: bigint;
250
- /** Timestamp when recovery expires */
251
- expiresAt: bigint;
252
- }
253
- /**
254
- * Result from setting up guardians
255
- */
256
- interface SetupGuardiansResult {
257
- /** Transaction hash on Hub chain */
258
- transactionHash: string;
259
- /** Wormhole sequence number for cross-chain sync */
260
- sequence: bigint;
261
- /** The identity guardians were set up for */
262
- identity: string;
263
- /** Array of guardian key hashes */
264
- guardians: string[];
265
- /** Required approvals for recovery */
266
- threshold: bigint;
267
- }
268
- /**
269
- * Result from adding a guardian
270
- */
271
- interface AddGuardianResult {
272
- /** Transaction hash on Hub chain */
273
- transactionHash: string;
274
- /** Wormhole sequence number for cross-chain sync */
275
- sequence: bigint;
276
- /** The identity the guardian was added to */
277
- identity: string;
278
- /** The guardian key hash that was added */
279
- guardianKeyHash: string;
280
- }
281
- /**
282
- * Result from removing a guardian
283
- */
284
- interface RemoveGuardianResult {
285
- /** Transaction hash on Hub chain */
286
- transactionHash: string;
287
- /** Wormhole sequence number for cross-chain sync */
288
- sequence: bigint;
289
- /** The identity the guardian was removed from */
290
- identity: string;
291
- /** The guardian key hash that was removed */
292
- guardianKeyHash: string;
293
- }
294
- /**
295
- * Result from initiating recovery
296
- */
297
- interface InitiateRecoveryResult {
298
- /** Transaction hash on Hub chain */
299
- transactionHash: string;
300
- /** Wormhole sequence number for cross-chain sync */
301
- sequence: bigint;
302
- /** The identity being recovered */
303
- identity: string;
304
- /** Proposed new owner key hash */
305
- newOwnerKeyHash: string;
306
- /** Timestamp when recovery can be executed */
307
- canExecuteAt: bigint;
308
- }
309
- /**
310
- * Result from approving recovery
311
- */
312
- interface ApproveRecoveryResult {
313
- /** Transaction hash on Hub chain */
314
- transactionHash: string;
315
- /** Wormhole sequence number for cross-chain sync */
316
- sequence: bigint;
317
- /** The identity being recovered */
318
- identity: string;
319
- /** The guardian who approved */
320
- guardianKeyHash: string;
321
- /** Current approval count */
322
- approvalCount: bigint;
323
- /** Required approvals */
324
- threshold: bigint;
325
- }
326
- /**
327
- * Result from executing recovery
328
- */
329
- interface ExecuteRecoveryResult {
330
- /** Transaction hash on Hub chain */
331
- transactionHash: string;
332
- /** Wormhole sequence number for cross-chain sync */
333
- sequence: bigint;
334
- /** The identity that was recovered */
335
- identity: string;
336
- /** The new owner key hash */
337
- newOwnerKeyHash: string;
338
- }
339
- /**
340
- * Result from cancelling recovery
341
- */
342
- interface CancelRecoveryResult {
343
- /** Transaction hash on Hub chain */
344
- transactionHash: string;
345
- /** Wormhole sequence number for cross-chain sync */
346
- sequence: bigint;
347
- /** The identity whose recovery was cancelled */
348
- identity: string;
349
- }
350
- interface ExecuteAction {
351
- type: 'execute';
352
- target: string;
353
- value: bigint;
354
- data: string;
355
- }
356
- interface ConfigAction {
357
- type: 'config';
358
- configType: number;
359
- configData: string;
360
- }
361
- type ActionPayload = TransferAction | BridgeAction | ExecuteAction | ConfigAction | {
362
- type: string;
363
- raw: string;
364
- };
365
- interface VAA {
366
- version: number;
367
- guardianSetIndex: number;
368
- signatures: VAASignature[];
369
- timestamp: number;
370
- nonce: number;
371
- emitterChain: number;
372
- emitterAddress: string;
373
- sequence: bigint;
374
- consistencyLevel: number;
375
- payload: string;
376
- hash: string;
377
- }
378
- interface VAASignature {
379
- guardianIndex: number;
380
- signature: string;
381
- }
382
- interface VeridexPayload {
383
- version: number;
384
- userKeyHash: string;
385
- targetChain: number;
386
- nonce: bigint;
387
- publicKeyX: bigint;
388
- publicKeyY: bigint;
389
- actionPayload: string;
390
- }
391
- interface VaultInfo {
392
- address: string;
393
- ownerKeyHash: string;
394
- chain: string;
395
- wormholeChainId: number;
396
- }
397
- interface TestResult {
398
- success: boolean;
399
- sourceChain: string;
400
- targetChain: string;
401
- txHash?: string;
402
- vaaSequence?: bigint;
403
- error?: string;
404
- duration?: number;
405
- }
406
-
407
- export type { ActionPayload, AddBackupKeyResult, AddGuardianResult, ApproveRecoveryResult, AuthorizedKey, BridgeAction, BridgeParams, CancelRecoveryResult, ChainConfig, ConfigAction, DispatchResult, ExecuteAction, ExecuteParams, ExecuteRecoveryResult, ExecutionPath, GuardianConfig, IdentityState, InitiateRecoveryResult, PasskeyCredential, QueryProof, QuerySubmissionResult, RecoveryStatus, RegisterSessionParams, RemoveGuardianResult, RemoveKeyResult, RevokeSessionParams, SessionKey, SessionValidationResult, SetupGuardiansResult, TestResult, TransferAction, TransferParams, VAA, VAASignature, VaultInfo, VeridexConfig, VeridexPayload, WebAuthnSignature };
package/dist/utils.d.ts DELETED
@@ -1,81 +0,0 @@
1
- import { ChainConfig } from './types.js';
2
-
3
- /**
4
- * Veridex Protocol SDK - Utility Functions
5
- */
6
-
7
- /**
8
- * Base64URL encode a buffer
9
- */
10
- declare function base64URLEncode(buffer: Uint8Array): string;
11
- /**
12
- * Base64URL decode a string
13
- */
14
- declare function base64URLDecode(str: string): Uint8Array;
15
- /**
16
- * Parse DER-encoded ECDSA signature to r and s values
17
- */
18
- declare function parseDERSignature(signature: Uint8Array): {
19
- r: Uint8Array;
20
- s: Uint8Array;
21
- };
22
- /**
23
- * Encode signature for Solidity verification
24
- */
25
- declare function encodeSignatureForSolidity(r: bigint, s: bigint): string;
26
- /**
27
- * Compute key hash from public key coordinates
28
- */
29
- declare function computeKeyHash(publicKeyX: bigint, publicKeyY: bigint): string;
30
- /**
31
- * Get chain config by name
32
- */
33
- declare function getChainConfig(chainName: string, testnet?: boolean): ChainConfig | undefined;
34
- /**
35
- * Get chain config by Wormhole chain ID
36
- */
37
- declare function getChainByWormholeId(wormholeChainId: number, testnet?: boolean): ChainConfig | undefined;
38
- /**
39
- * Get chain config by EVM chain ID
40
- */
41
- declare function getChainByEvmId(evmChainId: number, testnet?: boolean): ChainConfig | undefined;
42
- /**
43
- * Check if a chain is EVM-compatible
44
- */
45
- declare function isEvmChain(wormholeChainId: number): boolean;
46
- /**
47
- * Get all supported chains
48
- */
49
- declare function getSupportedChains(testnet?: boolean): ChainConfig[];
50
- /**
51
- * Get transaction explorer URL
52
- */
53
- declare function getTxExplorerUrl(chain: ChainConfig, txHash: string): string;
54
- /**
55
- * Get address explorer URL
56
- */
57
- declare function getAddressExplorerUrl(chain: ChainConfig, address: string): string;
58
- /**
59
- * Validate an EVM address
60
- */
61
- declare function isValidEvmAddress(address: string): boolean;
62
- /**
63
- * Validate a bytes32 hex string
64
- */
65
- declare function isValidBytes32(hex: string): boolean;
66
- /**
67
- * Validate a Wormhole chain ID
68
- */
69
- declare function isValidWormholeChainId(chainId: number): boolean;
70
- /**
71
- * Retry a function with exponential backoff
72
- */
73
- declare function retryWithBackoff<T>(fn: () => Promise<T>, options?: {
74
- maxRetries?: number;
75
- initialDelayMs?: number;
76
- maxDelayMs?: number;
77
- backoffMultiplier?: number;
78
- onRetry?: (attempt: number, error: Error) => void;
79
- }): Promise<T>;
80
-
81
- export { base64URLDecode, base64URLEncode, computeKeyHash, encodeSignatureForSolidity, getAddressExplorerUrl, getChainByEvmId, getChainByWormholeId, getChainConfig, getSupportedChains, getTxExplorerUrl, isEvmChain, isValidBytes32, isValidEvmAddress, isValidWormholeChainId, parseDERSignature, retryWithBackoff };