@veridex/sdk 1.0.0-beta.22 → 1.0.0-beta.23

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 (112) hide show
  1. package/dist/EVMClient-CoOR_ywD.d.mts +332 -0
  2. package/dist/auth/prepareAuth.d.mts +1 -1
  3. package/dist/auth/prepareAuth.js +749 -3
  4. package/dist/auth/prepareAuth.js.map +1 -1
  5. package/dist/auth/prepareAuth.mjs +25 -1404
  6. package/dist/auth/prepareAuth.mjs.map +1 -1
  7. package/dist/chains/aptos/index.d.mts +1 -1
  8. package/dist/chains/aptos/index.mjs +5 -574
  9. package/dist/chains/aptos/index.mjs.map +1 -1
  10. package/dist/chains/avalanche/index.d.mts +137 -0
  11. package/dist/chains/avalanche/index.js +1407 -0
  12. package/dist/chains/avalanche/index.js.map +1 -0
  13. package/dist/chains/avalanche/index.mjs +10 -0
  14. package/dist/chains/avalanche/index.mjs.map +1 -0
  15. package/dist/chains/evm/index.d.mts +4 -2
  16. package/dist/chains/evm/index.mjs +8 -1200
  17. package/dist/chains/evm/index.mjs.map +1 -1
  18. package/dist/chains/solana/index.d.mts +1 -1
  19. package/dist/chains/solana/index.mjs +4 -486
  20. package/dist/chains/solana/index.mjs.map +1 -1
  21. package/dist/chains/stacks/index.d.mts +1 -1
  22. package/dist/chains/stacks/index.mjs +36 -1114
  23. package/dist/chains/stacks/index.mjs.map +1 -1
  24. package/dist/chains/starknet/index.d.mts +1 -1
  25. package/dist/chains/starknet/index.mjs +5 -503
  26. package/dist/chains/starknet/index.mjs.map +1 -1
  27. package/dist/chains/sui/index.d.mts +1 -1
  28. package/dist/chains/sui/index.mjs +5 -529
  29. package/dist/chains/sui/index.mjs.map +1 -1
  30. package/dist/chunk-3Q34PMHU.mjs +840 -0
  31. package/dist/chunk-3Q34PMHU.mjs.map +1 -0
  32. package/dist/chunk-72ZA3OYQ.mjs +20 -0
  33. package/dist/chunk-72ZA3OYQ.mjs.map +1 -0
  34. package/dist/chunk-7IEUU6LD.mjs +549 -0
  35. package/dist/chunk-7IEUU6LD.mjs.map +1 -0
  36. package/dist/chunk-ABLEEC5N.mjs +38 -0
  37. package/dist/chunk-ABLEEC5N.mjs.map +1 -0
  38. package/dist/chunk-AORSW75A.mjs +1101 -0
  39. package/dist/chunk-AORSW75A.mjs.map +1 -0
  40. package/dist/chunk-BKTCPT7P.mjs +269 -0
  41. package/dist/chunk-BKTCPT7P.mjs.map +1 -0
  42. package/dist/chunk-CCHASDAI.mjs +330 -0
  43. package/dist/chunk-CCHASDAI.mjs.map +1 -0
  44. package/dist/chunk-FQ2WU7PX.mjs +509 -0
  45. package/dist/chunk-FQ2WU7PX.mjs.map +1 -0
  46. package/dist/chunk-JO74ENTF.mjs +417 -0
  47. package/dist/chunk-JO74ENTF.mjs.map +1 -0
  48. package/dist/chunk-K73Y36KS.mjs +407 -0
  49. package/dist/chunk-K73Y36KS.mjs.map +1 -0
  50. package/dist/chunk-KHV3EP3I.mjs +179 -0
  51. package/dist/chunk-KHV3EP3I.mjs.map +1 -0
  52. package/dist/chunk-MMSTOW4F.mjs +722 -0
  53. package/dist/chunk-MMSTOW4F.mjs.map +1 -0
  54. package/dist/chunk-MWZ5UHCF.mjs +1082 -0
  55. package/dist/chunk-MWZ5UHCF.mjs.map +1 -0
  56. package/dist/chunk-NU6JGI7L.mjs +565 -0
  57. package/dist/chunk-NU6JGI7L.mjs.map +1 -0
  58. package/dist/chunk-PIC2Y5DF.mjs +422 -0
  59. package/dist/chunk-PIC2Y5DF.mjs.map +1 -0
  60. package/dist/chunk-PPN7BG3A.mjs +464 -0
  61. package/dist/chunk-PPN7BG3A.mjs.map +1 -0
  62. package/dist/chunk-RSV7J43V.mjs +438 -0
  63. package/dist/chunk-RSV7J43V.mjs.map +1 -0
  64. package/dist/chunk-UTT6KI7N.mjs +216 -0
  65. package/dist/chunk-UTT6KI7N.mjs.map +1 -0
  66. package/dist/constants.mjs +16 -389
  67. package/dist/constants.mjs.map +1 -1
  68. package/dist/index-Du1PoZqu.d.mts +216 -0
  69. package/dist/index.d.mts +131 -9
  70. package/dist/index.js +12064 -11594
  71. package/dist/index.js.map +1 -1
  72. package/dist/index.mjs +4407 -12273
  73. package/dist/index.mjs.map +1 -1
  74. package/dist/passkey.d.mts +142 -0
  75. package/dist/passkey.js +807 -0
  76. package/dist/passkey.js.map +1 -0
  77. package/dist/passkey.mjs +15 -0
  78. package/dist/passkey.mjs.map +1 -0
  79. package/dist/payload.mjs +25 -244
  80. package/dist/payload.mjs.map +1 -1
  81. package/dist/portfolio-UV3LLWKI.mjs +13 -0
  82. package/dist/portfolio-UV3LLWKI.mjs.map +1 -0
  83. package/dist/queries/index.js +39 -1
  84. package/dist/queries/index.js.map +1 -1
  85. package/dist/queries/index.mjs +14 -1591
  86. package/dist/queries/index.mjs.map +1 -1
  87. package/dist/{types-DakHNZIP.d.ts → types-Bmk689Lw.d.mts} +1 -1
  88. package/dist/types.d.mts +10 -0
  89. package/dist/types.js.map +1 -1
  90. package/dist/utils.mjs +19 -385
  91. package/dist/utils.mjs.map +1 -1
  92. package/dist/wormhole.mjs +25 -397
  93. package/dist/wormhole.mjs.map +1 -1
  94. package/package.json +11 -1
  95. package/dist/auth/prepareAuth.d.ts +0 -25
  96. package/dist/chains/aptos/index.d.ts +0 -146
  97. package/dist/chains/evm/index.d.ts +0 -5
  98. package/dist/chains/solana/index.d.ts +0 -116
  99. package/dist/chains/stacks/index.d.ts +0 -559
  100. package/dist/chains/starknet/index.d.ts +0 -172
  101. package/dist/chains/sui/index.d.ts +0 -182
  102. package/dist/constants.d.ts +0 -150
  103. package/dist/index-Dy29mvBf.d.mts +0 -683
  104. package/dist/index-eXXqodd0.d.ts +0 -683
  105. package/dist/index.d.ts +0 -3442
  106. package/dist/payload.d.ts +0 -125
  107. package/dist/queries/index.d.ts +0 -148
  108. package/dist/types-DakHNZIP.d.mts +0 -571
  109. package/dist/types-DvFRnIBd.d.ts +0 -172
  110. package/dist/types.d.ts +0 -413
  111. package/dist/utils.d.ts +0 -81
  112. package/dist/wormhole.d.ts +0 -167
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Veridex Protocol SDK - Passkey Manager
3
+ *
4
+ * Chain-agnostic WebAuthn/Passkey credential management
5
+ */
6
+ interface PasskeyCredential {
7
+ credentialId: string;
8
+ publicKeyX: bigint;
9
+ publicKeyY: bigint;
10
+ keyHash: string;
11
+ }
12
+ interface WebAuthnSignature {
13
+ authenticatorData: string;
14
+ clientDataJSON: string;
15
+ challengeIndex: number;
16
+ typeIndex: number;
17
+ r: bigint;
18
+ s: bigint;
19
+ }
20
+ interface PasskeyManagerConfig {
21
+ rpName?: string;
22
+ rpId?: string;
23
+ timeout?: number;
24
+ userVerification?: 'required' | 'preferred' | 'discouraged';
25
+ authenticatorAttachment?: 'platform' | 'cross-platform';
26
+ /** Relayer API URL for cross-device credential recovery */
27
+ relayerUrl?: string;
28
+ }
29
+ /**
30
+ * The canonical Veridex RP ID for cross-domain passkey sharing.
31
+ * All Veridex SDK instances should use this RP ID to enable passkey
32
+ * portability across different applications and domains.
33
+ *
34
+ * This works via W3C Related Origin Requests (ROR) - veridex.network
35
+ * hosts a .well-known/webauthn file that lists allowed origins.
36
+ */
37
+ declare const VERIDEX_RP_ID = "veridex.network";
38
+ /**
39
+ * Detects the appropriate RP ID for passkey sharing.
40
+ *
41
+ * For production: Returns VERIDEX_RP_ID ('veridex.network') to enable
42
+ * cross-domain passkey sharing via Related Origin Requests (ROR).
43
+ *
44
+ * For local development:
45
+ * - localhost/127.0.0.1 → returns as-is
46
+ * - IP addresses → returns as-is
47
+ *
48
+ * @param forceLocal - If true, uses local domain detection instead of canonical RP ID
49
+ */
50
+ declare function detectRpId(forceLocal?: boolean): string;
51
+ /**
52
+ * Check if the browser supports Related Origin Requests (ROR).
53
+ * This is a WebAuthn Level 3 feature that allows using passkeys
54
+ * across different domains listed in the RP's .well-known/webauthn file.
55
+ *
56
+ * @returns true if ROR is supported, false otherwise
57
+ */
58
+ declare function supportsRelatedOrigins(): Promise<boolean>;
59
+
60
+ /**
61
+ * Manages WebAuthn passkey credentials for Veridex Protocol
62
+ */
63
+ declare class PasskeyManager {
64
+ private config;
65
+ private credential;
66
+ constructor(config?: PasskeyManagerConfig);
67
+ static isSupported(): boolean;
68
+ static isPlatformAuthenticatorAvailable(): Promise<boolean>;
69
+ register(username: string, displayName: string): Promise<PasskeyCredential>;
70
+ sign(challenge: Uint8Array): Promise<WebAuthnSignature>;
71
+ /**
72
+ * Authenticate using a discoverable credential (passkey)
73
+ * This allows sign-in without knowing the credential ID ahead of time.
74
+ * The authenticator will show all available passkeys for this RP.
75
+ *
76
+ * @param challenge - Optional challenge bytes. If not provided, a random challenge is used.
77
+ * @returns The credential that was used to authenticate, along with the signature
78
+ */
79
+ authenticate(challenge?: Uint8Array): Promise<{
80
+ credential: PasskeyCredential;
81
+ signature: WebAuthnSignature;
82
+ }>;
83
+ /**
84
+ * Find a credential by ID in the list of stored credentials
85
+ */
86
+ private findCredentialById;
87
+ /**
88
+ * Get all credentials stored in localStorage
89
+ */
90
+ getAllStoredCredentials(key?: string): PasskeyCredential[];
91
+ private parseStoredCredential;
92
+ /**
93
+ * Save a list of credentials to localStorage
94
+ */
95
+ saveCredentials(credentials: PasskeyCredential[], key?: string): void;
96
+ /**
97
+ * Add a single credential to storage (append or update)
98
+ */
99
+ addCredentialToStorage(credential: PasskeyCredential, key?: string): void;
100
+ /**
101
+ * Check if there's ANY stored credential for this RP
102
+ */
103
+ hasStoredCredential(): boolean;
104
+ getCredential(): PasskeyCredential | null;
105
+ setCredential(credential: PasskeyCredential): void;
106
+ createCredentialFromPublicKey(credentialId: string, publicKeyX: bigint, publicKeyY: bigint): PasskeyCredential;
107
+ clearCredential(): void;
108
+ /**
109
+ * Save the current credential to localStorage (appends to list)
110
+ */
111
+ saveToLocalStorage(key?: string): void;
112
+ loadFromLocalStorage(key?: string): PasskeyCredential | null;
113
+ removeFromLocalStorage(key?: string): void;
114
+ /**
115
+ * Save the current credential to the relayer for cross-device recovery.
116
+ * This should be called after registration.
117
+ */
118
+ saveCredentialToRelayer(): Promise<boolean>;
119
+ /**
120
+ * Load a credential from the relayer by credential ID.
121
+ * Used during discoverable credential authentication when localStorage is empty.
122
+ */
123
+ loadCredentialFromRelayer(credentialId: string): Promise<PasskeyCredential | null>;
124
+ /**
125
+ * Load a credential from the relayer by keyHash.
126
+ * Useful when you know the user's keyHash but not their credential ID.
127
+ */
128
+ loadCredentialFromRelayerByKeyHash(keyHash: string): Promise<PasskeyCredential | null>;
129
+ private extractPublicKeyFromAttestation;
130
+ private parseCOSEKey;
131
+ private tryParseCOSEKeyStrategies;
132
+ private parseCOSEKeyWithCBORStructure;
133
+ private tryParseASN1Structure;
134
+ private find32ByteSequences;
135
+ private isValidCoordinate;
136
+ private bytesToBigInt;
137
+ private bytesToHex;
138
+ private analyzeCOSEStructure;
139
+ private parseAuthenticationResponse;
140
+ }
141
+
142
+ export { type PasskeyCredential, PasskeyManager, type PasskeyManagerConfig, VERIDEX_RP_ID, type WebAuthnSignature, detectRpId, supportsRelatedOrigins };