@veridex/sdk 1.0.0-beta.1

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 (82) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/LICENSE +21 -0
  3. package/README.md +212 -0
  4. package/dist/chains/aptos/index.d.mts +140 -0
  5. package/dist/chains/aptos/index.d.ts +140 -0
  6. package/dist/chains/aptos/index.js +563 -0
  7. package/dist/chains/aptos/index.js.map +1 -0
  8. package/dist/chains/aptos/index.mjs +536 -0
  9. package/dist/chains/aptos/index.mjs.map +1 -0
  10. package/dist/chains/evm/index.d.mts +5 -0
  11. package/dist/chains/evm/index.d.ts +5 -0
  12. package/dist/chains/evm/index.js +1233 -0
  13. package/dist/chains/evm/index.js.map +1 -0
  14. package/dist/chains/evm/index.mjs +1205 -0
  15. package/dist/chains/evm/index.mjs.map +1 -0
  16. package/dist/chains/solana/index.d.mts +116 -0
  17. package/dist/chains/solana/index.d.ts +116 -0
  18. package/dist/chains/solana/index.js +513 -0
  19. package/dist/chains/solana/index.js.map +1 -0
  20. package/dist/chains/solana/index.mjs +491 -0
  21. package/dist/chains/solana/index.mjs.map +1 -0
  22. package/dist/chains/starknet/index.d.mts +172 -0
  23. package/dist/chains/starknet/index.d.ts +172 -0
  24. package/dist/chains/starknet/index.js +534 -0
  25. package/dist/chains/starknet/index.js.map +1 -0
  26. package/dist/chains/starknet/index.mjs +507 -0
  27. package/dist/chains/starknet/index.mjs.map +1 -0
  28. package/dist/chains/sui/index.d.mts +182 -0
  29. package/dist/chains/sui/index.d.ts +182 -0
  30. package/dist/chains/sui/index.js +560 -0
  31. package/dist/chains/sui/index.js.map +1 -0
  32. package/dist/chains/sui/index.mjs +533 -0
  33. package/dist/chains/sui/index.mjs.map +1 -0
  34. package/dist/constants.d.mts +150 -0
  35. package/dist/constants.d.ts +150 -0
  36. package/dist/constants.js +430 -0
  37. package/dist/constants.js.map +1 -0
  38. package/dist/constants.mjs +392 -0
  39. package/dist/constants.mjs.map +1 -0
  40. package/dist/index-0NXfbk0z.d.ts +637 -0
  41. package/dist/index-D0dLVjTA.d.mts +637 -0
  42. package/dist/index.d.mts +3101 -0
  43. package/dist/index.d.ts +3101 -0
  44. package/dist/index.js +13186 -0
  45. package/dist/index.js.map +1 -0
  46. package/dist/index.mjs +13011 -0
  47. package/dist/index.mjs.map +1 -0
  48. package/dist/payload.d.mts +125 -0
  49. package/dist/payload.d.ts +125 -0
  50. package/dist/payload.js +315 -0
  51. package/dist/payload.js.map +1 -0
  52. package/dist/payload.mjs +269 -0
  53. package/dist/payload.mjs.map +1 -0
  54. package/dist/queries/index.d.mts +148 -0
  55. package/dist/queries/index.d.ts +148 -0
  56. package/dist/queries/index.js +1533 -0
  57. package/dist/queries/index.js.map +1 -0
  58. package/dist/queries/index.mjs +1508 -0
  59. package/dist/queries/index.mjs.map +1 -0
  60. package/dist/types-ChIsqCiw.d.mts +565 -0
  61. package/dist/types-ChIsqCiw.d.ts +565 -0
  62. package/dist/types-FJL7j6gQ.d.mts +172 -0
  63. package/dist/types-FJL7j6gQ.d.ts +172 -0
  64. package/dist/types.d.mts +407 -0
  65. package/dist/types.d.ts +407 -0
  66. package/dist/types.js +19 -0
  67. package/dist/types.js.map +1 -0
  68. package/dist/types.mjs +1 -0
  69. package/dist/types.mjs.map +1 -0
  70. package/dist/utils.d.mts +81 -0
  71. package/dist/utils.d.ts +81 -0
  72. package/dist/utils.js +430 -0
  73. package/dist/utils.js.map +1 -0
  74. package/dist/utils.mjs +390 -0
  75. package/dist/utils.mjs.map +1 -0
  76. package/dist/wormhole.d.mts +167 -0
  77. package/dist/wormhole.d.ts +167 -0
  78. package/dist/wormhole.js +468 -0
  79. package/dist/wormhole.js.map +1 -0
  80. package/dist/wormhole.mjs +422 -0
  81. package/dist/wormhole.mjs.map +1 -0
  82. package/package.json +151 -0
@@ -0,0 +1,407 @@
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/types.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/types.ts
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
19
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["/**\n * Veridex Protocol SDK - Type Definitions\n */\n\n// ============================================================================\n// Configuration Types\n// ============================================================================\n\nexport interface VeridexConfig {\n hubChainId: number;\n hubRpcUrl: string;\n hubContractAddress: string;\n relayerUrl?: string;\n}\n\nexport interface ChainConfig {\n name: string;\n chainId: number;\n wormholeChainId: number;\n hubChainId?: number; // Wormhole chain ID of the Hub (for cross-chain auth)\n rpcUrl: string;\n explorerUrl: string;\n isEvm: boolean;\n contracts: {\n hub?: string;\n vaultFactory?: string;\n vaultImplementation?: string;\n wormholeCoreBridge: string;\n tokenBridge?: string;\n };\n}\n\n// ============================================================================\n// Credential Types\n// ============================================================================\n\nexport interface PasskeyCredential {\n credentialId: string;\n publicKeyX: bigint;\n publicKeyY: bigint;\n keyHash: string;\n}\n\nexport interface WebAuthnSignature {\n authenticatorData: string;\n clientDataJSON: string;\n challengeIndex: number;\n typeIndex: number;\n r: bigint;\n s: bigint;\n}\n\n// ============================================================================\n// Action Types\n// ============================================================================\n\nexport interface TransferParams {\n targetChain: number;\n token: string; // address or \"native\"\n recipient: string;\n amount: bigint;\n}\n\nexport interface ExecuteParams {\n targetChain: number;\n target: string;\n value: bigint;\n data: string;\n}\n\nexport interface BridgeParams {\n sourceChain: number; // Chain where vault holds the tokens\n token: string; // Token address (or \"native\" for native token)\n amount: bigint;\n destinationChain: number; // Wormhole chain ID of destination\n recipient: string; // Recipient address on destination chain (hex string)\n}\n\nexport interface DispatchResult {\n transactionHash: string;\n sequence: bigint;\n userKeyHash: string;\n targetChain: number;\n}\n\n// ============================================================================\n// Action Payload Types\n// ============================================================================\n\nexport interface TransferAction {\n type: 'transfer';\n token: string;\n recipient: string;\n amount: bigint;\n}\n\nexport interface BridgeAction {\n type: 'bridge';\n token: string;\n amount: bigint;\n targetChain: number;\n recipient: string;\n}\n\n// ============================================================================\n// Query Types (Issue #9/#10/#11/#12)\n// ============================================================================\n\n/**\n * Wormhole Query proof for optimistic execution\n * Allows ~5-7 second latency vs ~120+ seconds for VAA\n */\nexport interface QueryProof {\n /** Raw query response bytes from Wormhole Guardians */\n queryResponse: string; // hex\n /** Guardian signatures (13/19 quorum) */\n signatures: string; // hex\n}\n\n/**\n * User preference for execution path\n */\nexport type ExecutionPath = 'query' | 'vaa' | 'auto';\n\n/**\n * Result from query-based submission\n */\nexport interface QuerySubmissionResult {\n /** Whether submission succeeded */\n success: boolean;\n /** Transaction hash on spoke chain */\n txHash?: string;\n /** Execution path used ('query' or 'vaa') */\n path: ExecutionPath;\n /** Latency in milliseconds */\n latencyMs?: number;\n /** Error message if failed */\n error?: string;\n /** Whether fallback to VAA was triggered */\n fellBack?: boolean;\n}\n\n// ============================================================================\n// Session Key Types (Issue #13)\n// ============================================================================\n\n/**\n * Session key structure for temporary authentication\n * Enables native L1 speed for repeat transactions without biometric auth\n */\nexport interface SessionKey {\n /** Hash of the temporary session public key */\n sessionKeyHash: string;\n /** Unix timestamp when session expires */\n expiry: number;\n /** Maximum transaction value for this session (0 = unlimited) */\n maxValue: bigint;\n /** Whether session was manually revoked */\n revoked: boolean;\n}\n\n/**\n * Result from session validation query\n */\nexport interface SessionValidationResult {\n /** Whether session is currently active */\n active: boolean;\n /** Session expiry timestamp (0 if inactive) */\n expiry: number;\n /** Maximum transaction value (0 if inactive) */\n maxValue: bigint;\n /** Index in sessions array */\n sessionIndex: number;\n}\n\n/**\n * Parameters for registering a new session\n */\nexport interface RegisterSessionParams {\n /** Signature for Passkey authentication */\n signature: WebAuthnSignature;\n /** User's Passkey public key X coordinate */\n publicKeyX: bigint;\n /** User's Passkey public key Y coordinate */\n publicKeyY: bigint;\n /** Hash of the temporary session public key */\n sessionKeyHash: string;\n /** Session duration in seconds (max 24 hours) */\n duration: number;\n /** Maximum transaction value (0 = unlimited) */\n maxValue: bigint;\n /** Whether to require user verification */\n requireUV: boolean;\n}\n\n/**\n * Parameters for revoking a session\n */\nexport interface RevokeSessionParams {\n /** Signature for Passkey authentication */\n signature: WebAuthnSignature;\n /** User's Passkey public key X coordinate */\n publicKeyX: bigint;\n /** User's Passkey public key Y coordinate */\n publicKeyY: bigint;\n /** Hash of the session key to revoke */\n sessionKeyHash: string;\n /** Whether to require user verification */\n requireUV: boolean;\n}\n\n// ============================================================================\n// Backup Passkey / Multi-Key Identity Types (Issue #22)\n// ============================================================================\n\n/**\n * Identity state for multi-key management\n * First passkey registered becomes the immutable identity root\n */\nexport interface IdentityState {\n /** Identity key hash (first passkey's keyHash) */\n identity: string;\n /** Number of authorized keys */\n keyCount: number;\n /** Maximum allowed keys per identity */\n maxKeys: number;\n /** Whether the specified key is the root identity */\n isRoot: boolean;\n}\n\n/**\n * Result from registering a backup passkey\n */\nexport interface AddBackupKeyResult {\n /** Transaction hash on Hub chain */\n transactionHash: string;\n /** Wormhole sequence number for cross-chain sync */\n sequence: bigint;\n /** The identity the key was added to */\n identity: string;\n /** The new key hash that was added */\n newKeyHash: string;\n /** Total number of keys after addition */\n keyCount: number;\n}\n\n/**\n * Result from removing a passkey\n */\nexport interface RemoveKeyResult {\n /** Transaction hash on Hub chain */\n transactionHash: string;\n /** Wormhole sequence number for cross-chain sync */\n sequence: bigint;\n /** The identity the key was removed from */\n identity: string;\n /** The key hash that was removed */\n removedKeyHash: string;\n /** Remaining number of keys after removal */\n keyCount: number;\n}\n\n/**\n * Authorized key information\n */\nexport interface AuthorizedKey {\n /** Key hash of the authorized passkey */\n keyHash: string;\n /** Whether this key is the root identity key */\n isRoot: boolean;\n}\n\n// =============================================================================\n// SOCIAL RECOVERY TYPES (Issue #23)\n// =============================================================================\n\n/**\n * Guardian configuration for an identity\n */\nexport interface GuardianConfig {\n /** Array of guardian key hashes */\n guardians: string[];\n /** Required approvals for recovery (M-of-N) */\n threshold: bigint;\n /** Whether guardians have been configured */\n isConfigured: boolean;\n}\n\n/**\n * Recovery status for an identity\n */\nexport interface RecoveryStatus {\n /** Whether a recovery is currently active */\n isActive: boolean;\n /** Proposed new owner key hash */\n newOwnerKeyHash: string;\n /** Timestamp when recovery was initiated */\n initiatedAt: bigint;\n /** Current number of guardian approvals */\n approvalCount: bigint;\n /** Required approvals for recovery */\n threshold: bigint;\n /** Timestamp when recovery can be executed (after timelock) */\n canExecuteAt: bigint;\n /** Timestamp when recovery expires */\n expiresAt: bigint;\n}\n\n/**\n * Result from setting up guardians\n */\nexport interface SetupGuardiansResult {\n /** Transaction hash on Hub chain */\n transactionHash: string;\n /** Wormhole sequence number for cross-chain sync */\n sequence: bigint;\n /** The identity guardians were set up for */\n identity: string;\n /** Array of guardian key hashes */\n guardians: string[];\n /** Required approvals for recovery */\n threshold: bigint;\n}\n\n/**\n * Result from adding a guardian\n */\nexport interface AddGuardianResult {\n /** Transaction hash on Hub chain */\n transactionHash: string;\n /** Wormhole sequence number for cross-chain sync */\n sequence: bigint;\n /** The identity the guardian was added to */\n identity: string;\n /** The guardian key hash that was added */\n guardianKeyHash: string;\n}\n\n/**\n * Result from removing a guardian\n */\nexport interface RemoveGuardianResult {\n /** Transaction hash on Hub chain */\n transactionHash: string;\n /** Wormhole sequence number for cross-chain sync */\n sequence: bigint;\n /** The identity the guardian was removed from */\n identity: string;\n /** The guardian key hash that was removed */\n guardianKeyHash: string;\n}\n\n/**\n * Result from initiating recovery\n */\nexport interface InitiateRecoveryResult {\n /** Transaction hash on Hub chain */\n transactionHash: string;\n /** Wormhole sequence number for cross-chain sync */\n sequence: bigint;\n /** The identity being recovered */\n identity: string;\n /** Proposed new owner key hash */\n newOwnerKeyHash: string;\n /** Timestamp when recovery can be executed */\n canExecuteAt: bigint;\n}\n\n/**\n * Result from approving recovery\n */\nexport interface ApproveRecoveryResult {\n /** Transaction hash on Hub chain */\n transactionHash: string;\n /** Wormhole sequence number for cross-chain sync */\n sequence: bigint;\n /** The identity being recovered */\n identity: string;\n /** The guardian who approved */\n guardianKeyHash: string;\n /** Current approval count */\n approvalCount: bigint;\n /** Required approvals */\n threshold: bigint;\n}\n\n/**\n * Result from executing recovery\n */\nexport interface ExecuteRecoveryResult {\n /** Transaction hash on Hub chain */\n transactionHash: string;\n /** Wormhole sequence number for cross-chain sync */\n sequence: bigint;\n /** The identity that was recovered */\n identity: string;\n /** The new owner key hash */\n newOwnerKeyHash: string;\n}\n\n/**\n * Result from cancelling recovery\n */\nexport interface CancelRecoveryResult {\n /** Transaction hash on Hub chain */\n transactionHash: string;\n /** Wormhole sequence number for cross-chain sync */\n sequence: bigint;\n /** The identity whose recovery was cancelled */\n identity: string;\n}\n\nexport interface ExecuteAction {\n type: 'execute';\n target: string;\n value: bigint;\n data: string;\n}\n\nexport interface ConfigAction {\n type: 'config';\n configType: number;\n configData: string;\n}\n\nexport type ActionPayload = TransferAction | BridgeAction | ExecuteAction | ConfigAction | { type: string; raw: string };\n\n// ============================================================================\n// VAA Types\n// ============================================================================\n\nexport interface VAA {\n version: number;\n guardianSetIndex: number;\n signatures: VAASignature[];\n timestamp: number;\n nonce: number;\n emitterChain: number;\n emitterAddress: string;\n sequence: bigint;\n consistencyLevel: number;\n payload: string;\n hash: string; // keccak256 of the body (for verification)\n}\n\nexport interface VAASignature {\n guardianIndex: number;\n signature: string;\n}\n\nexport interface VeridexPayload {\n version: number;\n userKeyHash: string;\n targetChain: number;\n nonce: bigint;\n publicKeyX: bigint;\n publicKeyY: bigint;\n actionPayload: string;\n}\n\n// ============================================================================\n// Vault Types\n// ============================================================================\n\nexport interface VaultInfo {\n address: string;\n ownerKeyHash: string;\n chain: string;\n wormholeChainId: number;\n}\n\n// ============================================================================\n// Test Result Types\n// ============================================================================\n\nexport interface TestResult {\n success: boolean;\n sourceChain: string;\n targetChain: string;\n txHash?: string;\n vaaSequence?: bigint;\n error?: string;\n duration?: number;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
package/dist/types.mjs ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,81 @@
1
+ import { ChainConfig } from './types.mjs';
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 };
@@ -0,0 +1,81 @@
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 };