ns-auth-sdk 1.14.0 → 1.14.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.
Files changed (153) hide show
  1. package/dist/{cjs-CSUAVztq.cjs → browser-index.cjs} +5476 -296
  2. package/dist/browser-index.cjs.map +1 -0
  3. package/dist/browser-index.d.cts +1998 -0
  4. package/dist/browser-index.d.cts.map +1 -0
  5. package/dist/browser-index.d.mts +1998 -0
  6. package/dist/browser-index.d.mts.map +1 -0
  7. package/dist/{cjs-sm5h7qxv.mjs → browser-index.mjs} +5169 -69
  8. package/dist/browser-index.mjs.map +1 -0
  9. package/dist/{group-coordination-BlFpBVpn.mjs → group-coordination-BV6PKlKp.mjs} +1 -1
  10. package/dist/{group-coordination-BlFpBVpn.mjs.map → group-coordination-BV6PKlKp.mjs.map} +1 -1
  11. package/dist/{group-coordination-ImuoJEoy.mjs → group-coordination-BytkmY9j.mjs} +1 -1
  12. package/dist/{group-coordination-LGIyipaX.cjs → group-coordination-DL39hJ3R.cjs} +1 -1
  13. package/dist/{group-coordination-LGIyipaX.cjs.map → group-coordination-DL39hJ3R.cjs.map} +1 -1
  14. package/dist/{group-coordination-Cf18OjZt.cjs → group-coordination-DLban6a7.cjs} +1 -1
  15. package/dist/index.cjs +8899 -41
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts.map +1 -1
  18. package/dist/index.mjs +9072 -213
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/{prf-handler-D3EqUNWe.cjs → prf-handler-BNd7gmXJ.cjs} +1 -1
  21. package/dist/{prf-handler-D3EqUNWe.cjs.map → prf-handler-BNd7gmXJ.cjs.map} +1 -1
  22. package/dist/prf-handler-CRMgzJG2.cjs +3 -0
  23. package/dist/{prf-handler-Dly_WZGn.mjs → prf-handler-DG99ZkS2.mjs} +1 -1
  24. package/dist/{prf-handler-Db8CsoIP.mjs → prf-handler-Dj2WTO9i.mjs} +1 -1
  25. package/dist/{prf-handler-Db8CsoIP.mjs.map → prf-handler-Dj2WTO9i.mjs.map} +1 -1
  26. package/dist/zkm.service-Bv88tVS5.mjs +3 -0
  27. package/dist/zkm.service-D2BZ_aqA.cjs +3 -0
  28. package/dist/{zkm.service-DfSPbuOl.cjs → zkm.service-DX06sSfB.cjs} +1 -1
  29. package/dist/{zkm.service-DfSPbuOl.cjs.map → zkm.service-DX06sSfB.cjs.map} +1 -1
  30. package/dist/{zkm.service-B24N_0FB.mjs → zkm.service-j0HlN7Oq.mjs} +1 -1
  31. package/dist/{zkm.service-B24N_0FB.mjs.map → zkm.service-j0HlN7Oq.mjs.map} +1 -1
  32. package/package.json +19 -6
  33. package/dist/_esm-C7FRLTj2.cjs +0 -9030
  34. package/dist/_esm-C7FRLTj2.cjs.map +0 -1
  35. package/dist/_esm-D_oMW5T5.mjs +0 -9028
  36. package/dist/_esm-D_oMW5T5.mjs.map +0 -1
  37. package/dist/base64-js-B8y7dH5k.mjs +0 -93
  38. package/dist/base64-js-B8y7dH5k.mjs.map +0 -1
  39. package/dist/base64-js-Tm-kCeud.cjs +0 -98
  40. package/dist/base64-js-Tm-kCeud.cjs.map +0 -1
  41. package/dist/ccip-157tdxqP.cjs +0 -7947
  42. package/dist/ccip-157tdxqP.cjs.map +0 -1
  43. package/dist/ccip-BEMMdVyd.cjs +0 -4
  44. package/dist/ccip-BSmCdJ3K.mjs +0 -3
  45. package/dist/ccip-okqXkslP.mjs +0 -6567
  46. package/dist/ccip-okqXkslP.mjs.map +0 -1
  47. package/dist/chains-CTeD2UcS.mjs +0 -33
  48. package/dist/chains-CTeD2UcS.mjs.map +0 -1
  49. package/dist/chains-Du-lv_5i.cjs +0 -33
  50. package/dist/chains-Du-lv_5i.cjs.map +0 -1
  51. package/dist/chunk-Bnu9O96Y.cjs +0 -60
  52. package/dist/chunk-CVYhg9ik.mjs +0 -45
  53. package/dist/cjs-CSUAVztq.cjs.map +0 -1
  54. package/dist/cjs-sm5h7qxv.mjs.map +0 -1
  55. package/dist/defineChain-7QG67hYU.cjs +0 -30
  56. package/dist/defineChain-7QG67hYU.cjs.map +0 -1
  57. package/dist/defineChain-DBem8ZQY.mjs +0 -24
  58. package/dist/defineChain-DBem8ZQY.mjs.map +0 -1
  59. package/dist/dist-BPmSxkxc.cjs +0 -10676
  60. package/dist/dist-BPmSxkxc.cjs.map +0 -1
  61. package/dist/dist-BSjH4t6s.cjs +0 -12932
  62. package/dist/dist-BSjH4t6s.cjs.map +0 -1
  63. package/dist/dist-C-KjTK4Q.cjs +0 -447
  64. package/dist/dist-C-KjTK4Q.cjs.map +0 -1
  65. package/dist/dist-C2h97xM-.mjs +0 -355
  66. package/dist/dist-C2h97xM-.mjs.map +0 -1
  67. package/dist/dist-CT7grDWb.mjs +0 -12920
  68. package/dist/dist-CT7grDWb.mjs.map +0 -1
  69. package/dist/dist-D7fRmK6G.mjs +0 -10632
  70. package/dist/dist-D7fRmK6G.mjs.map +0 -1
  71. package/dist/dist-DlmcyFmM.mjs +0 -16951
  72. package/dist/dist-DlmcyFmM.mjs.map +0 -1
  73. package/dist/dist-O0uZr5OF.cjs +0 -17122
  74. package/dist/dist-O0uZr5OF.cjs.map +0 -1
  75. package/dist/echo-BB-JgAYZ.cjs +0 -339
  76. package/dist/echo-BB-JgAYZ.cjs.map +0 -1
  77. package/dist/echo-Bwy4_Cvh.mjs +0 -316
  78. package/dist/echo-Bwy4_Cvh.mjs.map +0 -1
  79. package/dist/echo-D6X2IuNW.cjs +0 -9
  80. package/dist/echo-DvfG_heb.mjs +0 -8
  81. package/dist/esm-BcHKCX5i.mjs +0 -569
  82. package/dist/esm-BcHKCX5i.mjs.map +0 -1
  83. package/dist/esm-Bh_YwFIz.cjs +0 -599
  84. package/dist/esm-Bh_YwFIz.cjs.map +0 -1
  85. package/dist/esm-C0XO9TQm.cjs +0 -30449
  86. package/dist/esm-C0XO9TQm.cjs.map +0 -1
  87. package/dist/esm-vMUVj9k4.mjs +0 -30440
  88. package/dist/esm-vMUVj9k4.mjs.map +0 -1
  89. package/dist/keyset-CKMQXvsb.mjs +0 -172
  90. package/dist/keyset-CKMQXvsb.mjs.map +0 -1
  91. package/dist/keyset-Cxdgu110.cjs +0 -237
  92. package/dist/keyset-Cxdgu110.cjs.map +0 -1
  93. package/dist/keyset-DLxpGhdu.cjs +0 -6
  94. package/dist/keyset-IKjlhvqF.mjs +0 -4
  95. package/dist/node-3EUJ4ga9.cjs +0 -9
  96. package/dist/node-C2UpE11T.cjs +0 -444
  97. package/dist/node-C2UpE11T.cjs.map +0 -1
  98. package/dist/node-CHdpTQdN.mjs +0 -8679
  99. package/dist/node-CHdpTQdN.mjs.map +0 -1
  100. package/dist/node-DQt1CVGl.mjs +0 -6
  101. package/dist/node-Dy8ww1LG.cjs +0 -8680
  102. package/dist/node-Dy8ww1LG.cjs.map +0 -1
  103. package/dist/node-IX55IH6z.mjs +0 -397
  104. package/dist/node-IX55IH6z.mjs.map +0 -1
  105. package/dist/nostr-BTOpBN_5.cjs +0 -11
  106. package/dist/nostr-D4E52XRU.mjs +0 -224
  107. package/dist/nostr-D4E52XRU.mjs.map +0 -1
  108. package/dist/nostr-Hv2tsnuI.cjs +0 -272
  109. package/dist/nostr-Hv2tsnuI.cjs.map +0 -1
  110. package/dist/nostr-ZwJe_DlZ.mjs +0 -4
  111. package/dist/pako.esm-DTVnlCJh.cjs +0 -3856
  112. package/dist/pako.esm-DTVnlCJh.cjs.map +0 -1
  113. package/dist/pako.esm-ORhkEHM2.mjs +0 -3838
  114. package/dist/pako.esm-ORhkEHM2.mjs.map +0 -1
  115. package/dist/peer-B9g3OQ5D.cjs +0 -18
  116. package/dist/peer-CptDj7zu.mjs +0 -745
  117. package/dist/peer-CptDj7zu.mjs.map +0 -1
  118. package/dist/peer-CtqL0yiE.mjs +0 -9
  119. package/dist/peer-XrPL0O6z.cjs +0 -822
  120. package/dist/peer-XrPL0O6z.cjs.map +0 -1
  121. package/dist/ping-BXKREIdI.mjs +0 -7
  122. package/dist/ping-BtVhKocl.cjs +0 -379
  123. package/dist/ping-BtVhKocl.cjs.map +0 -1
  124. package/dist/ping-D5fpMhGC.cjs +0 -11
  125. package/dist/ping-DOD50kW_.mjs +0 -332
  126. package/dist/ping-DOD50kW_.mjs.map +0 -1
  127. package/dist/policy-8HcjulLD.cjs +0 -293
  128. package/dist/policy-8HcjulLD.cjs.map +0 -1
  129. package/dist/policy-BA6MEOBY.mjs +0 -5
  130. package/dist/policy-BFNdXvmM.cjs +0 -11
  131. package/dist/policy-D_nFHHjo.mjs +0 -228
  132. package/dist/policy-D_nFHHjo.mjs.map +0 -1
  133. package/dist/prf-handler-BNiyCQMt.cjs +0 -3
  134. package/dist/src-CVfTUJQl.mjs +0 -822
  135. package/dist/src-CVfTUJQl.mjs.map +0 -1
  136. package/dist/src-D5S86Xpf.cjs +0 -827
  137. package/dist/src-D5S86Xpf.cjs.map +0 -1
  138. package/dist/types-B-TLIS13.cjs +0 -212
  139. package/dist/types-B-TLIS13.cjs.map +0 -1
  140. package/dist/types-CTm_FHYD.mjs +0 -111
  141. package/dist/types-CTm_FHYD.mjs.map +0 -1
  142. package/dist/validation-1xwWVXqE.mjs +0 -3
  143. package/dist/validation-DnpurN79.cjs +0 -405
  144. package/dist/validation-DnpurN79.cjs.map +0 -1
  145. package/dist/validation-IsAUvsvy.mjs +0 -334
  146. package/dist/validation-IsAUvsvy.mjs.map +0 -1
  147. package/dist/validation-yCvZCqIs.cjs +0 -6
  148. package/dist/wrapper-C5NpyacC.cjs +0 -3552
  149. package/dist/wrapper-C5NpyacC.cjs.map +0 -1
  150. package/dist/wrapper-CHq_CV4J.mjs +0 -3552
  151. package/dist/wrapper-CHq_CV4J.mjs.map +0 -1
  152. package/dist/zkm.service-BrXyI4BS.mjs +0 -3
  153. package/dist/zkm.service-BvQ01wSH.cjs +0 -3
@@ -0,0 +1,1998 @@
1
+ import { EventStore } from "applesauce-core";
2
+ import { BehaviorSubject } from "rxjs";
3
+ export * from "applesauce-core";
4
+
5
+ //#region src/types/zkm.d.ts
6
+ /**
7
+ * ZK Membership Root of Trust Types
8
+ * Semaphore-style: only root is published, members prove anonymously
9
+ * @packageDocumentation
10
+ */
11
+ interface ZKMGroup {
12
+ id: string;
13
+ root: string;
14
+ members: ZKMIdentity$1[];
15
+ createdAt: string;
16
+ }
17
+ interface ZKMIdentity$1 {
18
+ /** Private key - never exposed */
19
+ privateKey: string;
20
+ /** Public commitment - can be shared */
21
+ commitment: string;
22
+ }
23
+ interface ZKMGroupInfo {
24
+ groupId: string;
25
+ root: string;
26
+ adminCommitment?: string;
27
+ createdAt: string;
28
+ expiresAt?: string;
29
+ }
30
+ interface ZKMMembershipProof {
31
+ groupId: string;
32
+ root: string;
33
+ proof: string;
34
+ nullifier: string;
35
+ scope: string;
36
+ issuedAt: string;
37
+ expiresAt?: string;
38
+ }
39
+ interface ZKMVerifierConfig {
40
+ circuitUrl?: string;
41
+ verificationKey?: any;
42
+ }
43
+ interface ZKMScheme {
44
+ identitySecret: string;
45
+ groupId: string;
46
+ groupRoot: string;
47
+ scope?: string;
48
+ }
49
+ interface ZKMVerificationRequest {
50
+ identity: ZKMIdentity$1;
51
+ group: ZKMGroup;
52
+ scope?: string;
53
+ }
54
+ //#endregion
55
+ //#region src/types/nostr.d.ts
56
+ /**
57
+ * Nostr event types
58
+ */
59
+ interface Event {
60
+ id?: string;
61
+ pubkey?: string;
62
+ created_at?: number;
63
+ kind: number;
64
+ tags?: string[][];
65
+ content: string;
66
+ sig?: string;
67
+ }
68
+ /**
69
+ * Profile metadata (Kind 0)
70
+ */
71
+ interface ProfileMetadata {
72
+ name?: string;
73
+ display_name?: string;
74
+ about?: string;
75
+ picture?: string;
76
+ website?: string;
77
+ [key: string]: unknown;
78
+ }
79
+ /**
80
+ * Follow list entry (from Kind 3 tags)
81
+ */
82
+ interface FollowEntry {
83
+ pubkey: string;
84
+ relay?: string;
85
+ petname?: string;
86
+ }
87
+ //#endregion
88
+ //#region src/types/vlei.d.ts
89
+ type VLEITagData = [string, string, string, string, string, string, string, string, string?];
90
+ interface RootOfTrustInfo {
91
+ aidPrefix: string;
92
+ lei: string;
93
+ legalName: string;
94
+ role: string;
95
+ roleCredentialSaid: string;
96
+ entityCredentialSaid: string;
97
+ verifiedAt: string;
98
+ expiresAt?: string;
99
+ }
100
+ interface KERIAConnection {
101
+ url: string;
102
+ aidName: string;
103
+ aidPrefix: string;
104
+ }
105
+ interface KERIACredential {
106
+ said: string;
107
+ schema: string;
108
+ issuer: string;
109
+ subject: Record<string, unknown>;
110
+ issuanceDate: string;
111
+ raw: unknown;
112
+ }
113
+ interface VLEICredentials {
114
+ entity: KERIACredential;
115
+ role: KERIACredential;
116
+ }
117
+ interface KERISignature {
118
+ signature: string;
119
+ signer: string;
120
+ }
121
+ interface MultisigVLEIConfig {
122
+ requireVLEI: boolean;
123
+ organization?: {
124
+ lei: string;
125
+ legalName: string;
126
+ };
127
+ }
128
+ //#endregion
129
+ //#region src/types/eudi.d.ts
130
+ /**
131
+ * Minimal EUDI claims for publishing - privacy-preserving like ZKPassport
132
+ */
133
+ interface EUDIClaims {
134
+ /** Unique identifier (hashed holderDID, for verification) */
135
+ uniqueIdentifier: string;
136
+ /** Signature from Nostr key proving ownership of holderDID */
137
+ signature?: string;
138
+ /** Age verification status */
139
+ isOver18?: boolean;
140
+ /** Nationality (optional, only if user chooses to reveal) */
141
+ nationality?: string;
142
+ /** Verification timestamp */
143
+ verifiedAt: string;
144
+ /** Expiration timestamp */
145
+ expiresAt?: string;
146
+ }
147
+ interface EUDISession {
148
+ sessionId: string;
149
+ challenge: string;
150
+ verificationUrl: string;
151
+ requestUri: string;
152
+ expiresAt: number;
153
+ }
154
+ interface EUDIVerifierConfig {
155
+ url: string;
156
+ clientId: string;
157
+ clientSecret?: string;
158
+ }
159
+ interface EUDISessionRequest {
160
+ presentation_definition: {
161
+ id: string;
162
+ input_descriptors: Array<{
163
+ id: string;
164
+ constraints: {
165
+ fields: Array<{
166
+ path: string[];
167
+ filter?: {
168
+ type: string;
169
+ const: string;
170
+ };
171
+ }>;
172
+ };
173
+ }>;
174
+ };
175
+ nonce: string;
176
+ state?: string;
177
+ response_uri?: string;
178
+ }
179
+ interface EUDIVerificationResponse {
180
+ vp_token?: string;
181
+ presentation_submission?: {
182
+ id: string;
183
+ definition_id: string;
184
+ descriptor_map: Array<{
185
+ id: string;
186
+ format: string;
187
+ path: string;
188
+ }>;
189
+ };
190
+ error?: string;
191
+ error_description?: string;
192
+ }
193
+ interface EUDILegalClaims {
194
+ holderDID: string;
195
+ legalName: string;
196
+ lei: string;
197
+ legalForm?: string;
198
+ registeredAddress?: string;
199
+ vatNumber?: string;
200
+ taxReference?: string;
201
+ verifiedAt: string;
202
+ expiresAt?: string;
203
+ }
204
+ //#endregion
205
+ //#region src/types/trust.d.ts
206
+ interface VerificationStatus {
207
+ verified: boolean;
208
+ individual?: {
209
+ eudi?: EUDIClaims & {
210
+ expired?: boolean;
211
+ };
212
+ zkp?: ZKPClaims & {
213
+ expired?: boolean;
214
+ };
215
+ };
216
+ organization?: {
217
+ vlei?: RootOfTrustInfo & {
218
+ expired?: boolean;
219
+ };
220
+ eudiLegal?: EUDILegalClaims & {
221
+ expired?: boolean;
222
+ };
223
+ };
224
+ /** ZK Membership proofs - privacy-preserving group membership verification */
225
+ membership?: {
226
+ zkm?: ZKMMembershipProof & {
227
+ expired?: boolean;
228
+ };
229
+ };
230
+ }
231
+ type TrustLevel = 'none' | 'verified';
232
+ declare function isTrustExpired(trust: {
233
+ expiresAt?: string;
234
+ }): boolean;
235
+ declare function getTrustLevelLabel(verified: boolean): string;
236
+ //#endregion
237
+ //#region src/types/zkp.d.ts
238
+ interface ZKPClaims {
239
+ uniqueIdentifier: string;
240
+ proofSaid?: string;
241
+ firstName?: string;
242
+ nationality?: string;
243
+ isOver18?: boolean;
244
+ isEUCitizen?: boolean;
245
+ documentType?: string;
246
+ verifiedAt: string;
247
+ expiresAt?: string;
248
+ }
249
+ interface ZKPVerifierConfig {
250
+ appId: string;
251
+ }
252
+ type ZKPScope = 'eu-adult' | 'global-adult' | 'eu-citizen';
253
+ interface ZKPVerificationRequest {
254
+ name: string;
255
+ logo?: string;
256
+ purpose: string;
257
+ scope: ZKPScope;
258
+ mode?: 'fast' | 'secure';
259
+ devMode?: boolean;
260
+ }
261
+ //#endregion
262
+ //#region src/utils/types.d.ts
263
+ /**
264
+ * Type definitions for Auth SDK (PRF Direct Usage Only)
265
+ * @packageDocumentation
266
+ */
267
+ /**
268
+ * Nostr event JSON
269
+ */
270
+ interface Event$1 {
271
+ id?: string;
272
+ pubkey?: string;
273
+ created_at?: number;
274
+ kind: number;
275
+ tags?: string[][];
276
+ content: string;
277
+ sig?: string;
278
+ }
279
+ /**
280
+ * Password-protected key bundle (stored in KeyInfo when PRF unavailable)
281
+ */
282
+ interface PasswordProtectedBundle$1 {
283
+ publicKeySpkiBase64: string;
284
+ wrappedPrivateKeyBase64: string;
285
+ saltBase64: string;
286
+ ivBase64: string;
287
+ }
288
+ /**
289
+ * Frost multisig configuration for a key
290
+ */
291
+ interface MultisigConfig {
292
+ threshold: number;
293
+ totalMembers: number;
294
+ relays: string[];
295
+ groupCredential: string;
296
+ shareCredential: string;
297
+ shareIndex: number;
298
+ /** vLEI verification requirement */
299
+ requireVLEI?: boolean;
300
+ /** Organization LEI if vLEI required */
301
+ organizationLEI?: string;
302
+ }
303
+ /**
304
+ * Encrypted FROST share credential — stored in KeyInfo
305
+ * The share is encrypted with the passkey-derived secret so it
306
+ * requires authentication to recover
307
+ */
308
+ interface EncryptedMultisigBundle {
309
+ /** Base64 AES-GCM ciphertext */
310
+ ciphertext: string;
311
+ /** Base64 IV */
312
+ iv: string;
313
+ /** Base64 auth tag */
314
+ tag: string;
315
+ /** Group credential (not encrypted, needed for node setup) */
316
+ groupCredential: string;
317
+ /** Public multisig metadata */
318
+ threshold: number;
319
+ totalMembers: number;
320
+ relays: string[];
321
+ shareIndex: number;
322
+ }
323
+ /**
324
+ * Member to invite to a multisig group
325
+ */
326
+ interface MultisigMember {
327
+ /** Member's Nostr pubkey (hex) */
328
+ pubkey: string;
329
+ /** Member's key package event (kind 443) for Marmot invite */
330
+ keyPackageEvent?: any;
331
+ }
332
+ /**
333
+ * Options for enabling multisig on an identity
334
+ */
335
+ interface MultisigSetupOptions {
336
+ threshold: number;
337
+ totalMembers: number;
338
+ relays: string[];
339
+ /** Members to invite. Shares are distributed via Marmot Welcome messages. */
340
+ members?: MultisigMember[];
341
+ /** GroupManager instance for sending Welcome messages. Required if members are provided. */
342
+ groupManager?: any;
343
+ /** Organization info for vLEI verification (optional) */
344
+ organization?: {
345
+ lei: string;
346
+ legalName: string;
347
+ };
348
+ /** Require vLEI verification for all signers (optional, setup-time check) */
349
+ requireVLEI?: boolean;
350
+ }
351
+ /**
352
+ * Peer information in a multisig group
353
+ */
354
+ interface PeerInfo {
355
+ pubkey: string;
356
+ status: 'online' | 'offline' | 'unknown';
357
+ latency?: number;
358
+ }
359
+ /**
360
+ * Result of enabling multisig
361
+ */
362
+ interface MultisigSetupResult {
363
+ keyInfo: KeyInfo;
364
+ groupCredential: string;
365
+ shareCredential: string;
366
+ /** Number of members invited (shares distributed via Welcome messages) */
367
+ membersInvited: number;
368
+ }
369
+ /**
370
+ * Options for importing a FROST share credential into an existing identity
371
+ */
372
+ interface MultisigImportOptions {
373
+ groupCredential: string;
374
+ shareCredential: string;
375
+ relays: string[];
376
+ }
377
+ /**
378
+ * Nostr key information (PRF or password-protected)
379
+ */
380
+ interface KeyInfo {
381
+ credentialId: string;
382
+ pubkey: string;
383
+ salt: string;
384
+ username?: string;
385
+ passwordProtectedBundle?: PasswordProtectedBundle$1;
386
+ recovery?: KeyRecovery;
387
+ multisig?: EncryptedMultisigBundle;
388
+ /** Organization trust - vLEI or EUDI Legal PID */
389
+ organizationTrust?: {
390
+ vlei?: RootOfTrustInfo;
391
+ eudiLegal?: EUDILegalClaims;
392
+ };
393
+ /** Individual trust - EUDI PID and/or ZKPassport */
394
+ individualTrust?: {
395
+ eudi?: EUDIClaims;
396
+ zkp?: ZKPClaims;
397
+ };
398
+ /** ZK Membership proof - group membership */
399
+ membershipTrust?: ZKMMembershipProof;
400
+ /** ZK Membership group - the group root info */
401
+ groupTrust?: ZKMGroupInfo;
402
+ /** Unified trust providers — OAuth, EUDI, vLEI, ZKP, etc. */
403
+ trustProviders?: {
404
+ [provider: string]: TrustProviderEntry;
405
+ };
406
+ }
407
+ interface KeyRecovery {
408
+ recoveryPubkey: string;
409
+ recoverySalt: string;
410
+ createdAt?: number;
411
+ signature?: string;
412
+ }
413
+ interface PasskeyCreationOptions {
414
+ rp?: {
415
+ name?: string;
416
+ id?: string;
417
+ };
418
+ user?: {
419
+ name?: string;
420
+ displayName?: string;
421
+ };
422
+ authenticatorSelection?: AuthenticatorSelectionCriteria;
423
+ pubKeyCredParams?: PublicKeyCredentialParameters[];
424
+ extensions?: Record<string, unknown>;
425
+ }
426
+ /**
427
+ * Key options
428
+ */
429
+ interface KeyOptions {
430
+ username?: string;
431
+ password?: string;
432
+ recoveryPassword?: string;
433
+ }
434
+ /**
435
+ * PRF secret
436
+ */
437
+ interface GetPrfSecretOptions {
438
+ /** Relying Party ID */
439
+ rpId?: string;
440
+ timeout?: number;
441
+ userVerification?: UserVerificationRequirement;
442
+ }
443
+ interface KeyCacheOptions {
444
+ enabled: boolean;
445
+ timeoutMs?: number;
446
+ cacheOnCreation?: boolean;
447
+ }
448
+ /**
449
+ * KeyInfo
450
+ */
451
+ interface NostrKeyStorageOptions {
452
+ /** KeyInfo */
453
+ enabled: boolean;
454
+ /** localStorage */
455
+ storage?: Storage;
456
+ /** keyinfo */
457
+ storageKey?: string;
458
+ }
459
+ /**
460
+ * Signing mode for events
461
+ */
462
+ type SigningMode = 'individual' | 'multisig';
463
+ /**
464
+ * Sign options
465
+ */
466
+ interface SignOptions {
467
+ clearMemory?: boolean;
468
+ tags?: string[][];
469
+ password?: string;
470
+ mode?: SigningMode;
471
+ }
472
+ /**
473
+ * KeyManager
474
+ */
475
+ interface KeyManagerOptions {
476
+ cacheOptions?: Partial<KeyCacheOptions>;
477
+ storageOptions?: Partial<NostrKeyStorageOptions>;
478
+ prfOptions?: GetPrfSecretOptions;
479
+ }
480
+ /**
481
+ * SDK public interface
482
+ */
483
+ interface KeyManagerLike {
484
+ /**
485
+ * NIP-07
486
+ */
487
+ getPublicKey(): Promise<string>;
488
+ /**
489
+ * NIP-07
490
+ * KeyInfo
491
+ * @param event Nostr
492
+ */
493
+ signEvent(event: Event$1): Promise<Event$1>;
494
+ /**
495
+ * KeyInfo
496
+ * @param keyInfo KeyInfo
497
+ */
498
+ setCurrentKeyInfo(keyInfo: KeyInfo): void;
499
+ /**
500
+ * KeyInfo
501
+ */
502
+ getCurrentKeyInfo(): KeyInfo | null;
503
+ /**
504
+ * KeyInfo
505
+ * @returns KeyInfo
506
+ */
507
+ hasKeyInfo(): boolean;
508
+ /**
509
+ * KeyInfo
510
+ * @param options
511
+ */
512
+ setStorageOptions(options: Partial<NostrKeyStorageOptions>): void;
513
+ /**
514
+ * KeyInfo
515
+ */
516
+ getStorageOptions(): NostrKeyStorageOptions;
517
+ /**
518
+ * KeyInfo
519
+ */
520
+ clearStoredKeyInfo(): void;
521
+ /**
522
+ * Check if PRF is supported
523
+ */
524
+ checkPRFSupport(): Promise<boolean>;
525
+ /**
526
+ * @param options
527
+ * @returns Credential
528
+ */
529
+ createPasskey(options?: PasskeyCreationOptions): Promise<Uint8Array>;
530
+ /**
531
+ * Create KeyInfo - auto-detects PRF support and uses password fallback if needed
532
+ * @param credentialId Passkey credential ID
533
+ * @param password Password required if PRF not supported
534
+ * @param options
535
+ */
536
+ createKey(credentialId?: Uint8Array, password?: string, options?: KeyOptions): Promise<KeyInfo>;
537
+ /**
538
+ * @param event Nostr
539
+ * @param keyInfo KeyInfo
540
+ * @param options
541
+ */
542
+ signEventWithKeyInfo(event: Event$1, keyInfo: KeyInfo, options?: SignOptions): Promise<Event$1>;
543
+ /**
544
+ * @param options
545
+ */
546
+ setCacheOptions(options: Partial<KeyCacheOptions>): void;
547
+ getCacheOptions(): KeyCacheOptions;
548
+ /**
549
+ * @param credentialId
550
+ */
551
+ clearCachedKey(credentialId: Uint8Array | string): void;
552
+ clearAllCachedKeys(): void;
553
+ /**
554
+ * Export Nostr private key
555
+ * @param keyInfo KeyInfo
556
+ * @param credentialId Optional credential ID
557
+ * @param options.password Required for password-protected keys
558
+ */
559
+ exportNostrKey(keyInfo: KeyInfo, credentialId?: Uint8Array, options?: KeyOptions): Promise<string>;
560
+ /**
561
+ * Enable FROSTR multisig on the current identity
562
+ * @param options Threshold, total members, and relay configuration
563
+ */
564
+ enableMultisig(options: MultisigSetupOptions): Promise<MultisigSetupResult>;
565
+ /**
566
+ * Check if multisig is enabled on the current key
567
+ */
568
+ isMultisigEnabled(): boolean;
569
+ /**
570
+ * Get peer status for the current multisig group
571
+ */
572
+ getPeerStatus(): Promise<PeerInfo[]>;
573
+ /**
574
+ * Rotate shares — generate a new keyset, invalidating old shares
575
+ * @param newThreshold New threshold (defaults to current)
576
+ * @param newTotal New total members (defaults to current)
577
+ * @param members Members to redistribute shares to via Welcome messages
578
+ * @param groupManager GroupManager for sending Welcome messages
579
+ * @returns Array of new share credentials (only returned if no members provided for Welcome distribution)
580
+ */
581
+ rotateShares(newThreshold?: number, newTotal?: number, members?: MultisigMember[], groupManager?: any): Promise<string[]>;
582
+ /**
583
+ * Import a FROST share credential into the current identity
584
+ * The identity must already exist (created via createKey)
585
+ * @param options Group credential, share credential, and relay URLs
586
+ */
587
+ importMultisigShare(options: MultisigImportOptions): Promise<KeyInfo>;
588
+ }
589
+ /**
590
+ * Options for creating a Marmot group
591
+ */
592
+ interface CreateGroupOptions {
593
+ description?: string;
594
+ adminPubkeys?: string[];
595
+ relays?: string[];
596
+ }
597
+ /**
598
+ * A message received from a Marmot group
599
+ */
600
+ interface GroupMessage {
601
+ groupId: Uint8Array;
602
+ senderPubkey: string;
603
+ content: string;
604
+ kind: number;
605
+ timestamp: number;
606
+ tags: string[][];
607
+ }
608
+ /**
609
+ * A signing request sent via a Marmot group
610
+ */
611
+ interface SigningRequest {
612
+ type: 'signing-request';
613
+ eventId: string;
614
+ description: string;
615
+ timestamp: number;
616
+ }
617
+ /**
618
+ * A share credential message sent via a Marmot group (encrypted in Welcome)
619
+ */
620
+ interface ShareCredentialMessage {
621
+ type: 'share-credential';
622
+ shareCredential: string;
623
+ groupCredential: string;
624
+ relays: string[];
625
+ timestamp: number;
626
+ }
627
+ //#endregion
628
+ //#region src/utils/nosskey.d.ts
629
+ declare function deriveSaltFromUsername(username?: string): string;
630
+ declare function parseRecoveryTag(tags: string[][]): KeyRecovery | null;
631
+ declare function createRecoveryTag(recovery: KeyRecovery): string[];
632
+ declare function getRecoverySignature(kind0: Event$1): string | null;
633
+ declare function verifyRecoverySignature(kind0: Event$1): Promise<boolean>;
634
+ /**
635
+ * Nosskey - Passkey-Derived Nostr Keys
636
+ */
637
+ declare class KeyManager implements KeyManagerLike {
638
+ #private;
639
+ constructor(options?: KeyManagerOptions);
640
+ /**
641
+ * Storage options
642
+ * @param options
643
+ */
644
+ setStorageOptions(options: Partial<NostrKeyStorageOptions>): void;
645
+ /**
646
+ * Storage options
647
+ */
648
+ getStorageOptions(): NostrKeyStorageOptions;
649
+ /**
650
+ * Current KeyInfo
651
+ * @param keyInfo KeyInfo
652
+ */
653
+ setCurrentKeyInfo(keyInfo: KeyInfo): void;
654
+ /**
655
+ * Current KeyInfo
656
+ */
657
+ getCurrentKeyInfo(): KeyInfo | null;
658
+ /**
659
+ * Has KeyInfo
660
+ * @returns true if KeyInfo exists
661
+ */
662
+ hasKeyInfo(): boolean;
663
+ /**
664
+ * Clear stored KeyInfo
665
+ */
666
+ clearStoredKeyInfo(): void;
667
+ /**
668
+ * NIP-07
669
+ * KeyInfo
670
+ */
671
+ getPublicKey(): Promise<string>;
672
+ /**
673
+ * NIP-07
674
+ * KeyInfo
675
+ * @param event Nostr
676
+ */
677
+ signEvent(event: Event$1): Promise<Event$1>;
678
+ /**
679
+ * @param options
680
+ */
681
+ setCacheOptions(options: Partial<KeyCacheOptions>): void;
682
+ getCacheOptions(): KeyCacheOptions;
683
+ getCachedSecretKey(credentialId: Uint8Array | string): Uint8Array | undefined;
684
+ /**
685
+ * @param credentialId
686
+ */
687
+ clearCachedKey(credentialId: Uint8Array | string): void;
688
+ clearAllCachedKeys(): void;
689
+ /**
690
+ * @param options
691
+ * @returns Credential
692
+ */
693
+ createPasskey(options?: PasskeyCreationOptions): Promise<Uint8Array>;
694
+ /**
695
+ * Check if PRF is supported
696
+ */
697
+ checkPRFSupport(): Promise<boolean>;
698
+ /**
699
+ * Create Nostr key - automatically uses password fallback if PRF unavailable
700
+ * @param credentialId Passkey credential ID
701
+ * @param password Password for encryption (required if PRF not supported)
702
+ * @param options
703
+ */
704
+ createKey(credentialId?: Uint8Array, password?: string, options?: KeyOptions): Promise<KeyInfo>;
705
+ /**
706
+ * Create Nostr key using PRF (standard passkey flow)
707
+ */
708
+ createPrfNostrKey(credentialId?: Uint8Array, options?: KeyOptions): Promise<KeyInfo>;
709
+ /**
710
+ * Create Nostr key using password-derived key (fallback when PRF unavailable)
711
+ * @param password Password to derive the private key
712
+ * @param options
713
+ */
714
+ createPasswordProtectedNostrKey(password: string, options?: KeyOptions): Promise<KeyInfo>;
715
+ /**
716
+ * @param event Nostr
717
+ * @param keyInfo KeyInfo
718
+ * @param options
719
+ */
720
+ signEventWithKeyInfo(event: Event$1, keyInfo: KeyInfo, options?: SignOptions): Promise<Event$1>;
721
+ /**
722
+ * @param keyInfo KeyInfo
723
+ * @param credentialId KeyInfoのcredentialId
724
+ * @param options
725
+ * @returns
726
+ */
727
+ exportNostrKey(keyInfo: KeyInfo, credentialId?: Uint8Array, options?: KeyOptions): Promise<string>;
728
+ /**
729
+ * PRF
730
+ */
731
+ isPrfSupported(): Promise<boolean>;
732
+ /**
733
+ * Add password recovery to an existing PRF key
734
+ * @param password Password for recovery key
735
+ * @param currentCredentialId Current passkey credential ID
736
+ */
737
+ addPasswordRecovery(password: string, currentCredentialId?: Uint8Array): Promise<KeyInfo>;
738
+ /**
739
+ * Activate recovery using password
740
+ * Requires new credential ID from new device
741
+ * @param password Password for recovery key
742
+ * @param newCredentialId New passkey credential ID (required)
743
+ */
744
+ activateWithPassword(password: string, newCredentialId: Uint8Array): Promise<KeyInfo>;
745
+ /**
746
+ * Get the recovery data for publishing to kind-0
747
+ */
748
+ getRecoveryForKind0(): {
749
+ recoveryPubkey: string;
750
+ recoverySalt: string;
751
+ createdAt?: number;
752
+ signature?: string;
753
+ } | null;
754
+ /**
755
+ * Enable FROSTR multisig on the current identity
756
+ * Derives the secret key from the passkey, splits it into shares, encrypts the local share, and stores the config
757
+ * If members are provided with a GroupManager, shares are distributed via Marmot Welcome messages.
758
+ * @param options Threshold, total members, relay configuration, and optional members for Welcome-based distribution
759
+ */
760
+ enableMultisig(options: MultisigSetupOptions): Promise<MultisigSetupResult>;
761
+ /**
762
+ * Check if multisig is enabled on the current key
763
+ */
764
+ isMultisigEnabled(): boolean;
765
+ /**
766
+ * Get peer status for the current multisig group
767
+ */
768
+ getPeerStatus(): Promise<PeerInfo[]>;
769
+ /**
770
+ * Rotate shares — generate a new keyset, invalidating old shares
771
+ * If members are provided with a GroupManager, new shares are distributed via Welcome messages.
772
+ * Otherwise, new share credentials are returned for manual distribution.
773
+ * @param newThreshold New threshold (defaults to current)
774
+ * @param newTotal New total members (defaults to current)
775
+ * @param members Members to redistribute shares to via Welcome messages
776
+ * @param groupManager GroupManager for sending Welcome messages
777
+ * @returns Array of new share credentials (only if no members provided for Welcome distribution)
778
+ */
779
+ rotateShares(newThreshold?: number, newTotal?: number, members?: MultisigMember[], groupManager?: any): Promise<string[]>;
780
+ /**
781
+ * Import a FROST share credential into the current identity
782
+ * The identity must already exist (created via createKey)
783
+ * @param options Group credential, share credential, and relay URLs
784
+ */
785
+ importMultisigShare(options: MultisigImportOptions): Promise<KeyInfo>;
786
+ }
787
+ //#endregion
788
+ //#region src/utils/multisig.d.ts
789
+ declare class MultisigManager {
790
+ #private;
791
+ constructor(relays: string[]);
792
+ generateKeyset(threshold: number, totalMembers: number, secretHex: string): Promise<{
793
+ groupCredential: string;
794
+ shareCredentials: string[];
795
+ }>;
796
+ connectNode(config: MultisigConfig): Promise<any>;
797
+ getNode(): any;
798
+ signMessage(message: string): Promise<string>;
799
+ signBatch(messages: string[]): Promise<string[]>;
800
+ getPeers(): Promise<PeerInfo[]>;
801
+ disconnect(): void;
802
+ getConfig(): MultisigConfig | null;
803
+ isConnected(): boolean;
804
+ }
805
+ //#endregion
806
+ //#region src/utils/utils.d.ts
807
+ /**
808
+ * @packageDocumentation
809
+ */
810
+ /**
811
+ * @param bytes
812
+ * @returns
813
+ */
814
+ declare function bytesToHex(bytes: Uint8Array): string;
815
+ /**
816
+ * @param hex
817
+ * @returns
818
+ */
819
+ declare function hexToBytes(hex: string): Uint8Array;
820
+ //#endregion
821
+ //#region src/utils/crypto-utils.d.ts
822
+ /**
823
+ * Cryptographic utilities for Nosskey
824
+ * @packageDocumentation
825
+ */
826
+ /**
827
+ * PRF AES-GCM
828
+ * @param secret PRF
829
+ * @param salt
830
+ * @returns AES-GCM
831
+ */
832
+ declare function deriveAesGcmKey(secret: Uint8Array, salt: Uint8Array): Promise<CryptoKey>;
833
+ /**
834
+ * AES-GCM
835
+ * @param key
836
+ * @param iv
837
+ * @param plaintext
838
+ * @returns
839
+ */
840
+ declare function aesGcmEncrypt(key: CryptoKey, iv: Uint8Array, plaintext: Uint8Array): Promise<{
841
+ ciphertext: Uint8Array<ArrayBuffer>;
842
+ tag: Uint8Array<ArrayBuffer>;
843
+ }>;
844
+ /**
845
+ * AES-GCM
846
+ * @param key
847
+ * @param iv
848
+ * @param ct
849
+ * @param tag
850
+ * @returns
851
+ */
852
+ declare function aesGcmDecrypt(key: CryptoKey, iv: Uint8Array, ct: Uint8Array, tag: Uint8Array): Promise<Uint8Array>;
853
+ //#endregion
854
+ //#region src/utils/prf-handler.d.ts
855
+ /**
856
+ * @returns PRF
857
+ */
858
+ declare function isPrfSupported(): Promise<boolean>;
859
+ /**
860
+ * @param options
861
+ * @returns Credential
862
+ */
863
+ declare function createPasskey(options?: PasskeyCreationOptions): Promise<Uint8Array>;
864
+ /**
865
+ * ID
866
+ * @param credentialId
867
+ * @param options PRF(rpId、timeout、userVerification)
868
+ * @returns PRF credentialID
869
+ */
870
+ declare function getPrfSecret(credentialId?: Uint8Array, options?: GetPrfSecretOptions): Promise<{
871
+ secret: Uint8Array;
872
+ id: Uint8Array;
873
+ }>;
874
+ //#endregion
875
+ //#region src/utils/prf-password-fallback.d.ts
876
+ /**
877
+ * PRF support check with a password-protected-key fallback.
878
+ * If the PRF WebAuthn extension is unavailable, callers can fall back to a
879
+ * password-protected private key. The private key is wrapped with a password-
880
+ * derived AES-GCM key and stored alongside the public key (SPKI).
881
+ *
882
+ * This implementation uses @noble libraries for cryptographic operations,
883
+ * ensuring functionality even when Web Crypto API is unavailable.
884
+ */
885
+ type PasswordProtectedBundle = {
886
+ publicKeySpkiBase64: string;
887
+ wrappedPrivateKeyBase64: string;
888
+ saltBase64: string;
889
+ ivBase64: string;
890
+ };
891
+ declare function checkPRFSupport(): Promise<boolean>;
892
+ declare function generatePasswordProtectedKey(password: string): Promise<PasswordProtectedBundle>;
893
+ declare function unwrapPasswordProtectedPrivateKey(bundle: PasswordProtectedBundle, password: string): Promise<Uint8Array>;
894
+ declare function importPublicKeyFromBundle(bundle: PasswordProtectedBundle): Uint8Array;
895
+ declare function deriveNostrPrivateKey(password: string, salt?: string): Uint8Array;
896
+ declare function getPublicKeyFromPassword(password: string, salt?: string): string;
897
+ //#endregion
898
+ //#region src/utils/test-utils.d.ts
899
+ /**
900
+ * Test utilities for sdk
901
+ * @packageDocumentation
902
+ */
903
+ /**
904
+ * Helper for testing/debugging
905
+ * @param userId - User identifier
906
+ * @returns Promise resolving to the dummy credential
907
+ */
908
+ declare function registerDummyPasskey(userId: string): Promise<PublicKeyCredential>;
909
+ //#endregion
910
+ //#region src/utils/group.d.ts
911
+ declare class GroupManager {
912
+ #private;
913
+ constructor(options: {
914
+ signer: any;
915
+ network: any;
916
+ relays: string[];
917
+ dbName?: string;
918
+ });
919
+ initialize(): Promise<void>;
920
+ getClient(): any;
921
+ getInviteReader(): any;
922
+ /**
923
+ * Observable of unread group IDs.
924
+ * Emits whenever the unread state changes.
925
+ */
926
+ get unreadGroupIds$(): BehaviorSubject<string[]>;
927
+ createGroup(name: string, options?: CreateGroupOptions): Promise<any>;
928
+ onGroupChange(handler: (event: {
929
+ type: 'created' | 'joined';
930
+ group: any;
931
+ }) => void): () => void;
932
+ joinGroupFromWelcome(welcomeRumor: any): Promise<any>;
933
+ inviteMember(group: any, _memberPubkey: string): Promise<void>;
934
+ sendMessage(group: any, content: string, kind?: number): Promise<void>;
935
+ sendShareToMember(group: any, _memberPubkey: string, shareCredential: string, groupCredential: string, relays: string[]): Promise<void>;
936
+ onMessage(handler: (msg: GroupMessage) => void): () => void;
937
+ parseGroupMessage(message: GroupMessage): ShareCredentialMessage | {
938
+ type: 'signing-request';
939
+ description: string;
940
+ } | null;
941
+ getGroups(): Promise<any[]>;
942
+ leaveGroup(groupId: Uint8Array | string): Promise<void>;
943
+ destroyGroup(groupId: Uint8Array | string): Promise<void>;
944
+ /**
945
+ * Mark a group as read — clears the unread state up to the given timestamp.
946
+ * @param groupIdHex Group ID (hex string)
947
+ * @param seenAt Timestamp to mark as seen (seconds since epoch, defaults to now)
948
+ */
949
+ markGroupSeen(groupIdHex: string, seenAt?: number): Promise<void>;
950
+ /**
951
+ * Start the full event pipeline: ingestion, invite sync, and key package tracking.
952
+ * Must be called after initialize() and before any group operations that expect incoming messages.
953
+ */
954
+ start(): Promise<void>;
955
+ /**
956
+ * Stop all subscriptions and clean up resources.
957
+ */
958
+ stop(): void;
959
+ close(): void;
960
+ /**
961
+ * Decrypt pending gift wraps and process invites.
962
+ * Call this after user interaction to trigger decryption prompts.
963
+ */
964
+ processInvites(): Promise<void>;
965
+ }
966
+ //#endregion
967
+ //#region src/utils/group-storage.d.ts
968
+ declare class IndexedDBGroupStateBackend {
969
+ #private;
970
+ constructor(dbName?: string);
971
+ getItem(key: string): Promise<Uint8Array | null>;
972
+ setItem(key: string, value: Uint8Array): Promise<Uint8Array>;
973
+ removeItem(key: string): Promise<void>;
974
+ clear(): Promise<void>;
975
+ keys(): Promise<string[]>;
976
+ }
977
+ declare class IndexedDBKeyPackageStore {
978
+ #private;
979
+ constructor(dbName?: string);
980
+ getItem<T>(key: string): Promise<T | null>;
981
+ setItem<T>(key: string, value: T): Promise<T>;
982
+ removeItem(key: string): Promise<void>;
983
+ clear(): Promise<void>;
984
+ keys(): Promise<string[]>;
985
+ }
986
+ /**
987
+ * Generic IndexedDB key-value store backend.
988
+ * Implements the KeyValueStoreBackend<T> interface expected by Marmot.
989
+ */
990
+ declare class IndexedDBKeyValueBackend {
991
+ #private;
992
+ constructor(dbName: string, storeName: string);
993
+ getItem<T>(key: string): Promise<T | null>;
994
+ setItem<T>(key: string, value: T): Promise<T>;
995
+ removeItem(key: string): Promise<void>;
996
+ clear(): Promise<void>;
997
+ keys(): Promise<string[]>;
998
+ }
999
+ //#endregion
1000
+ //#region src/utils/group-coordination.d.ts
1001
+ declare function createSigningRequest(eventId: string, description: string): string;
1002
+ declare function parseSigningRequest(message: GroupMessage): SigningRequest | null;
1003
+ declare function parseShareMessage(message: GroupMessage): ShareCredentialMessage | null;
1004
+ declare function createShareMessage(shareCredential: string, groupCredential: string, relays: string[]): string;
1005
+ //#endregion
1006
+ //#region src/utils/root-of-trust-verification.d.ts
1007
+ /**
1008
+ * Result of any root of trust verification
1009
+ */
1010
+ interface RootOfTrustVerificationResult {
1011
+ type: 'vlei' | 'eudi' | 'eudil' | 'zkp' | 'zkm';
1012
+ valid: boolean;
1013
+ claims?: any;
1014
+ error?: string;
1015
+ }
1016
+ /**
1017
+ * Verification status for all root of trust types
1018
+ */
1019
+ interface AllVerificationResults {
1020
+ vlei?: RootOfTrustVerificationResult;
1021
+ eudi?: RootOfTrustVerificationResult;
1022
+ eudil?: RootOfTrustVerificationResult;
1023
+ zkp?: RootOfTrustVerificationResult;
1024
+ zkm?: RootOfTrustVerificationResult;
1025
+ }
1026
+ /**
1027
+ * Verify vLEI tag from kind-0 event
1028
+ * vLEI verifies organizational identity via KERIA/ACDC credentials
1029
+ */
1030
+ declare function verifyVLEITag(kind0Event: Event): RootOfTrustVerificationResult;
1031
+ /**
1032
+ * Verify EUDI tag from kind-0 event
1033
+ * EUDI verifies individual identity with signature linking to Nostr key
1034
+ */
1035
+ declare function verifyEUDITag(kind0Event: Event): Promise<RootOfTrustVerificationResult>;
1036
+ /**
1037
+ * Verify EUDI Legal PID tag from kind-0 event
1038
+ * EUDI Legal verifies organizational identity via OpenID4VCI
1039
+ */
1040
+ declare function verifyEUDILegalTag(kind0Event: Event): Promise<RootOfTrustVerificationResult>;
1041
+ /**
1042
+ * Verify ZKPassport tag from kind-0 event
1043
+ * ZKP verifies zero-knowledge proofs without revealing identity
1044
+ */
1045
+ declare function verifyZKPTag(kind0Event: Event): RootOfTrustVerificationResult;
1046
+ /**
1047
+ * Verify ZK Membership tag from kind-0 event
1048
+ * ZKM proves group membership without revealing identity
1049
+ */
1050
+ declare function verifyZKMTag(kind0Event: Event): RootOfTrustVerificationResult;
1051
+ /**
1052
+ * Verify all root of trust tags in a kind-0 event
1053
+ */
1054
+ declare function verifyAllRootOfTrusts(kind0Event: Event): Promise<AllVerificationResults>;
1055
+ /**
1056
+ * Check if any root of trust is verified on a profile
1057
+ */
1058
+ declare function hasAnyVerifiedRootOfTrust(kind0Event: Event): Promise<boolean>;
1059
+ /**
1060
+ * Get a summary of verification status
1061
+ */
1062
+ declare function getVerificationSummary(kind0Event: Event): Promise<{
1063
+ hasAnyTrust: boolean;
1064
+ individualVerified: boolean;
1065
+ organizationVerified: boolean;
1066
+ membershipVerified: boolean;
1067
+ details: string[];
1068
+ }>;
1069
+ //#endregion
1070
+ //#region src/types/auth.d.ts
1071
+ /**
1072
+ * Authentication state interface
1073
+ */
1074
+ interface AuthState {
1075
+ isAuthenticated: boolean;
1076
+ publicKey: string | null;
1077
+ keyInfo: KeyInfo | null;
1078
+ loginError: string | null;
1079
+ setAuthenticated: (keyInfo: KeyInfo | null) => void;
1080
+ setLoginError: (error: string | null) => void;
1081
+ logout: () => void;
1082
+ }
1083
+ /**
1084
+ * Auth service configuration
1085
+ */
1086
+ interface AuthServiceConfig {
1087
+ rpId?: string;
1088
+ rpName?: string;
1089
+ storageKey?: string;
1090
+ cacheTimeoutMs?: number;
1091
+ cacheOnCreation?: boolean;
1092
+ }
1093
+ /**
1094
+ * Relay service configuration
1095
+ */
1096
+ interface RelayServiceConfig {
1097
+ relayUrls: string[];
1098
+ }
1099
+ /**
1100
+ * SIOP v2 client metadata as defined in the spec
1101
+ */
1102
+ interface SiopClientMetadata {
1103
+ subject_syntax_types_supported: string[];
1104
+ id_token_signed_response_alg?: string;
1105
+ }
1106
+ /**
1107
+ * SIOP v2 authorization request configuration
1108
+ */
1109
+ interface SiopConfig {
1110
+ nonce: string;
1111
+ clientId?: string;
1112
+ redirectUri?: string;
1113
+ idTokenType?: 'subject_signed_id_token' | 'attester_signed_id_token';
1114
+ claims?: Record<string, unknown>;
1115
+ clientMetadata?: SiopClientMetadata;
1116
+ }
1117
+ /**
1118
+ * SIOP v2 authorization response
1119
+ */
1120
+ interface SiopAuthResult {
1121
+ idToken: string;
1122
+ pubkey: string;
1123
+ did: string;
1124
+ }
1125
+ /**
1126
+ * DID:nostr verification method (Multikey format)
1127
+ */
1128
+ interface DidNostrVerificationMethod {
1129
+ id: string;
1130
+ type: 'Multikey';
1131
+ controller: string;
1132
+ publicKeyMultibase: string;
1133
+ }
1134
+ /**
1135
+ * DID:nostr service entry
1136
+ */
1137
+ interface DidNostrService {
1138
+ id: string;
1139
+ type: string;
1140
+ serviceEndpoint: string;
1141
+ }
1142
+ /**
1143
+ * Nostr profile embedded in DID document
1144
+ */
1145
+ interface DidNostrProfile {
1146
+ name?: string;
1147
+ about?: string;
1148
+ picture?: string;
1149
+ nip05?: string;
1150
+ lud16?: string;
1151
+ website?: string;
1152
+ timestamp?: number;
1153
+ }
1154
+ /**
1155
+ * DID:nostr document (offline-first resolution)
1156
+ */
1157
+ interface DidNostrDocument {
1158
+ '@context': string[];
1159
+ id: string;
1160
+ type: 'DIDNostr';
1161
+ verificationMethod: DidNostrVerificationMethod[];
1162
+ authentication: string[];
1163
+ assertionMethod: string[];
1164
+ alsoKnownAs?: string[];
1165
+ service?: DidNostrService[];
1166
+ profile?: DidNostrProfile;
1167
+ follows?: string[];
1168
+ }
1169
+ /**
1170
+ * NIP-42 authentication options
1171
+ */
1172
+ interface Nip42AuthOptions {
1173
+ relayUrl: string;
1174
+ jwt?: string;
1175
+ siop?: {
1176
+ nonce: string;
1177
+ };
1178
+ timeoutMs?: number;
1179
+ }
1180
+ /**
1181
+ * NIP-42 authentication result
1182
+ */
1183
+ interface Nip42AuthResult {
1184
+ success: boolean;
1185
+ challenge: string;
1186
+ pubkey: string;
1187
+ websocket: WebSocket;
1188
+ }
1189
+ /**
1190
+ * Built-in OAuth provider preset
1191
+ */
1192
+ interface OAuthProviderPreset {
1193
+ authorizationUrl: string;
1194
+ tokenUrl: string;
1195
+ defaultScope: string;
1196
+ }
1197
+ /**
1198
+ * OAuth provider configuration
1199
+ */
1200
+ interface OAuthProviderConfig {
1201
+ provider: string;
1202
+ clientId: string;
1203
+ redirectUri: string;
1204
+ scope?: string;
1205
+ nostrPubkeyClaim?: string;
1206
+ category?: 'individual' | 'organization' | 'authentication';
1207
+ }
1208
+ /**
1209
+ * Encrypted OAuth bundle stored in TrustProviderEntry
1210
+ */
1211
+ interface EncryptedOAuthBundle {
1212
+ ciphertext: string;
1213
+ iv: string;
1214
+ tag: string;
1215
+ }
1216
+ /**
1217
+ * Trust provider entry — unified store for all identity types
1218
+ */
1219
+ interface TrustProviderEntry {
1220
+ type: 'oauth' | 'eudi' | 'vlei' | 'zkp' | 'eudil' | 'custom';
1221
+ category: 'individual' | 'organization' | 'authentication';
1222
+ sub: string;
1223
+ claims?: Record<string, unknown>;
1224
+ verifiedAt: number;
1225
+ expiresAt?: number;
1226
+ encryptedBundle?: EncryptedOAuthBundle;
1227
+ accessToken?: string;
1228
+ scope?: string;
1229
+ }
1230
+ /**
1231
+ * OAuth authentication result
1232
+ */
1233
+ interface OAuthAuthResult {
1234
+ provider: string;
1235
+ accessToken: string;
1236
+ refreshToken?: string;
1237
+ expiresAt: number;
1238
+ sub: string;
1239
+ scope: string;
1240
+ linked: boolean;
1241
+ }
1242
+ /**
1243
+ * Linked provider status
1244
+ */
1245
+ interface LinkedProviderStatus {
1246
+ provider: string;
1247
+ type: string;
1248
+ category: string;
1249
+ sub: string;
1250
+ expiresAt?: number;
1251
+ }
1252
+ //#endregion
1253
+ //#region src/services/relay.service.d.ts
1254
+ /**
1255
+ * Service for communicating with Nostr relays using applesauce-core
1256
+ */
1257
+ declare class RelayService {
1258
+ #private;
1259
+ private eventStore;
1260
+ private relayUrls;
1261
+ private readonly maxProfileContentSize;
1262
+ private readonly minProfileQueryIntervalMs;
1263
+ private readonly minPublishIntervalMs;
1264
+ private readonly lastActionAt;
1265
+ constructor(config: RelayServiceConfig);
1266
+ /**
1267
+ * Initialize with applesauce EventStore
1268
+ */
1269
+ initialize(eventStore: EventStore): void;
1270
+ /**
1271
+ * Set relay URLs
1272
+ */
1273
+ setRelays(urls: string[]): void;
1274
+ /**
1275
+ * Get current relay URLs
1276
+ */
1277
+ getRelays(): string[];
1278
+ /**
1279
+ * Publish an event to relays
1280
+ */
1281
+ publishEvent(event: Event, timeoutMs?: number): Promise<boolean>;
1282
+ /**
1283
+ * Fetch a profile (Kind 0 event)
1284
+ */
1285
+ fetchProfile(pubkey: string): Promise<ProfileMetadata | null>;
1286
+ /**
1287
+ * Fetch role tag from profile event (Kind 0)
1288
+ */
1289
+ fetchProfileRoleTag(pubkey: string): Promise<string | null>;
1290
+ /**
1291
+ * Fetch a follow list (Kind 3 event)
1292
+ */
1293
+ fetchFollowList(pubkey: string): Promise<FollowEntry[]>;
1294
+ /**
1295
+ * Fetch multiple profiles in batch
1296
+ */
1297
+ fetchMultipleProfiles(pubkeys: string[]): Promise<Map<string, ProfileMetadata>>;
1298
+ /**
1299
+ * Query kind 0 events (profiles) by pubkey
1300
+ * If pubkeys array is empty, fetches recent kind 0 events
1301
+ */
1302
+ queryProfiles(pubkeys?: string[], limit?: number): Promise<Map<string, ProfileMetadata>>;
1303
+ /**
1304
+ * Publish or update a kind 3 event (follow list/contacts)
1305
+ */
1306
+ publishFollowList(_pubkey: string, followList: FollowEntry[], signEvent: (event: Event) => Promise<Event>): Promise<boolean>;
1307
+ /**
1308
+ * Fetch the latest kind 0 event for a pubkey, returning the full event (content + tags)
1309
+ */
1310
+ fetchKind0Event(pubkey: string): Promise<{
1311
+ content: string;
1312
+ tags: string[][];
1313
+ } | null>;
1314
+ /**
1315
+ * Publish or update a kind 0 event with recovery data
1316
+ * Fetches the existing kind-0, preserves all content and tags, and amends the recovery "r" tag
1317
+ * @param pubkey The identity's public key
1318
+ * @param recoveryData Recovery data { recoveryPubkey, recoverySalt, createdAt, signature }
1319
+ * @param signEvent Callback to sign the event
1320
+ * @param content Optional content to use instead of fetching the existing kind-0. If not provided, the existing kind-0 content is preserved. Falls back to "{}" if no existing event.
1321
+ */
1322
+ publishRecoveryToKind0(pubkey: string, recoveryData: {
1323
+ recoveryPubkey: string;
1324
+ recoverySalt: string;
1325
+ createdAt?: number;
1326
+ signature?: string;
1327
+ }, signEvent: (event: Event) => Promise<Event>, content?: string): Promise<boolean>;
1328
+ /**
1329
+ * Publish or update a kind 0 event with vLEI root of trust data
1330
+ * Fetches the existing kind-0, preserves all content and tags, and adds/replaces vLEI tag
1331
+ * Supports multiple roles via multiple vLEI tags
1332
+ * @param pubkey The identity's public key
1333
+ * @param rootOfTrust vLEI root of trust info
1334
+ * @param signEvent Callback to sign the event
1335
+ */
1336
+ publishVLEIToKind0(pubkey: string, rootOfTrust: RootOfTrustInfo, signEvent: (event: Event) => Promise<Event>): Promise<boolean>;
1337
+ /**
1338
+ * Fetch all vLEI tags from a kind-0 event
1339
+ * @param pubkey The identity's public key
1340
+ */
1341
+ fetchVLEITags(pubkey: string): Promise<RootOfTrustInfo[]>;
1342
+ /**
1343
+ * Publish or update a kind-0 event with EUDI root of trust data
1344
+ * Fetches the existing kind-0, preserves all content and tags, and adds/replaces eudi tag
1345
+ * @param pubkey The identity's public key
1346
+ * @param eudiClaims EUDI claims info
1347
+ * @param signEvent Callback to sign the event
1348
+ */
1349
+ publishEUDIToKind0(pubkey: string, eudiClaims: EUDIClaims, signEvent: (event: Event) => Promise<Event>): Promise<boolean>;
1350
+ /**
1351
+ * Fetch all EUDI tags from a kind-0 event
1352
+ * @param pubkey The identity's public key
1353
+ */
1354
+ fetchEUDITags(pubkey: string): Promise<EUDIClaims[]>;
1355
+ private validateRelayUrls;
1356
+ private parseProfileMetadata;
1357
+ private enforceRateLimit;
1358
+ /**
1359
+ * Publish or update a kind-0 event with ZKPassport root of trust data
1360
+ * Fetches the existing kind-0, preserves all content and tags, and adds/replaces zkp tag
1361
+ * @param pubkey The identity's public key
1362
+ * @param zkpClaims ZKPassport claims
1363
+ * @param signEvent Callback to sign the event
1364
+ */
1365
+ publishZKPToKind0(pubkey: string, zkpClaims: ZKPClaims, signEvent: (event: Event) => Promise<Event>): Promise<boolean>;
1366
+ /**
1367
+ * Fetch all ZKP tags from a kind-0 event
1368
+ * @param pubkey The identity's public key
1369
+ */
1370
+ fetchZKPTags(pubkey: string): Promise<ZKPClaims[]>;
1371
+ /**
1372
+ * Publish or update a kind-0 event with EUDI Legal PID root of trust data
1373
+ * Fetches the existing kind-0, preserves all content and tags, and adds/replaces eudil tag
1374
+ * @param pubkey The identity's public key
1375
+ * @param legalClaims EUDI Legal PID claims
1376
+ * @param signEvent Callback to sign the event
1377
+ */
1378
+ publishEUDILegalToKind0(pubkey: string, legalClaims: EUDILegalClaims, signEvent: (event: Event) => Promise<Event>): Promise<boolean>;
1379
+ /**
1380
+ * Fetch all EUDI Legal PID tags from a kind-0 event
1381
+ * @param pubkey The identity's public key
1382
+ */
1383
+ fetchEUDILegalTags(pubkey: string): Promise<EUDILegalClaims[]>;
1384
+ /**
1385
+ * Publish ZK Membership group root to kind-0 profile (Semaphore-style)
1386
+ * Only publishes root, not individual members or proofs
1387
+ * @param pubkey The identity's public key
1388
+ * @param group ZKM Group with root
1389
+ * @param signEvent Callback to sign the event
1390
+ */
1391
+ publishZKMGroupToKind0(pubkey: string, group: ZKMGroupInfo, signEvent: (event: Event) => Promise<Event>): Promise<boolean>;
1392
+ /**
1393
+ * Fetch all ZK Membership group roots from a kind-0 event (Semaphore-style)
1394
+ * @param pubkey The identity's public key
1395
+ */
1396
+ fetchZKMGroups(pubkey: string): Promise<ZKMGroupInfo[]>;
1397
+ }
1398
+ //#endregion
1399
+ //#region src/services/auth.service.d.ts
1400
+ /**
1401
+ * Service wrapper around KeyManager
1402
+ * Handles WebAuthn/Passkey integration with Nostr
1403
+ */
1404
+ declare class AuthService {
1405
+ #private;
1406
+ private manager;
1407
+ private groupManager;
1408
+ private config;
1409
+ constructor(config?: AuthServiceConfig);
1410
+ private getDefaultRpName;
1411
+ /**
1412
+ * Initialize the KeyManager instance
1413
+ */
1414
+ private getManager;
1415
+ /**
1416
+ * Create a new passkey
1417
+ * Uses platform authenticator only (Touch ID, Face ID, Windows Hello)
1418
+ */
1419
+ createPasskey(username?: string): Promise<Uint8Array>;
1420
+ /**
1421
+ * Create a new Nostr key from a credential ID
1422
+ * Automatically uses password fallback if PRF is not supported
1423
+ * @param credentialId Passkey credential ID
1424
+ * @param password Password (required if PRF not supported)
1425
+ * @param options.username Username for the key
1426
+ * @param options.recoveryPassword Password for recovery (enables recovery on new device)
1427
+ */
1428
+ createKey(credentialId?: Uint8Array, password?: string, options?: KeyOptions): Promise<KeyInfo>;
1429
+ /**
1430
+ * Check if PRF is supported, otherwise password fallback is needed
1431
+ */
1432
+ checkPRFSupport(): Promise<boolean>;
1433
+ /**
1434
+ * Get the current public key
1435
+ */
1436
+ getPublicKey(): Promise<string>;
1437
+ /**
1438
+ * Sign a Nostr event
1439
+ * @param event Event to sign
1440
+ * @param options.mode 'individual' for direct signing, 'multisig' for threshold signing. Defaults to multisig if configured.
1441
+ */
1442
+ signEvent(event: Event$1, options?: SignOptions): Promise<Event$1>;
1443
+ /**
1444
+ * Get current key info
1445
+ */
1446
+ getCurrentKeyInfo(): KeyInfo | null;
1447
+ /**
1448
+ * Set current key info
1449
+ */
1450
+ setCurrentKeyInfo(keyInfo: KeyInfo): void;
1451
+ /**
1452
+ * Check if key info exists
1453
+ */
1454
+ hasKeyInfo(): boolean;
1455
+ /**
1456
+ * Clear stored key info
1457
+ */
1458
+ clearStoredKeyInfo(): void;
1459
+ /**
1460
+ * Check if PRF is supported (legacy alias)
1461
+ */
1462
+ isPrfSupported(): Promise<boolean>;
1463
+ /**
1464
+ * Add password recovery to an existing PRF key
1465
+ * @param password Password for recovery key
1466
+ */
1467
+ addPasswordRecovery(password: string): Promise<KeyInfo>;
1468
+ /**
1469
+ * Activate recovery using password
1470
+ * Requires new credential ID from new device
1471
+ * @param password Password for recovery key
1472
+ * @param newCredentialId New passkey credential ID (required)
1473
+ */
1474
+ activateWithPassword(password: string, newCredentialId: Uint8Array): Promise<KeyInfo>;
1475
+ /**
1476
+ * Get recovery data for kind-0
1477
+ */
1478
+ getRecoveryForKind0(): {
1479
+ recoveryPubkey: string;
1480
+ recoverySalt: string;
1481
+ createdAt?: number;
1482
+ signature?: string;
1483
+ } | null;
1484
+ /**
1485
+ * Publish recovery data to a kind-0 event on relays
1486
+ * Fetches the existing kind-0, preserves all content and tags, and amends the recovery "r" tag
1487
+ * @param relayService RelayService instance for publishing
1488
+ * @param content Optional content to use instead of fetching the existing kind-0
1489
+ */
1490
+ publishRecoveryToKind0(relayService: RelayService, content?: string): Promise<boolean>;
1491
+ /**
1492
+ * Enable FROSTR multisig on the current identity
1493
+ * Derives the secret from the passkey, splits into shares, stores config
1494
+ * @param options Threshold, total members, and relay configuration
1495
+ */
1496
+ enableMultisig(options: MultisigSetupOptions): Promise<MultisigSetupResult>;
1497
+ /**
1498
+ * Check if the current identity is multisig-enabled
1499
+ */
1500
+ isMultisig(): boolean;
1501
+ /**
1502
+ * Get the full multisig config (for sharing with other devices)
1503
+ */
1504
+ getMultisigConfig(): MultisigConfig | null;
1505
+ /**
1506
+ * Get peer status — which other signers are online
1507
+ */
1508
+ getPeerStatus(): Promise<PeerInfo[]>;
1509
+ /**
1510
+ * Rotate shares — generate a new keyset, invalidating old shares
1511
+ * If members and groupManager are provided, new shares are distributed via Welcome messages.
1512
+ * Otherwise, returns new share credentials for manual distribution.
1513
+ * @param newThreshold New threshold (defaults to current)
1514
+ * @param newTotal New total members (defaults to current)
1515
+ * @param members Members to redistribute shares to via Welcome messages
1516
+ * @param groupManager GroupManager for sending Welcome messages
1517
+ * @returns Array of new share credentials (empty if distributed via Welcome)
1518
+ */
1519
+ rotateShares(newThreshold?: number, newTotal?: number, members?: any[], groupManager?: any): Promise<string[]>;
1520
+ /**
1521
+ * Import a FROST share credential into the current identity
1522
+ * Used by members who receive a share from the group admin
1523
+ * @param options Group credential, share credential, and relay URLs
1524
+ */
1525
+ importMultisigShare(options: MultisigImportOptions): Promise<KeyInfo>;
1526
+ /**
1527
+ * Get or create the GroupManager instance for Marmot group messaging
1528
+ * @param network Network interface (e.g., RelayService or NostrNetworkInterface)
1529
+ * @param relays Relay URLs for group communication
1530
+ * @param dbName Optional IndexedDB database name (default: 'nosskey')
1531
+ */
1532
+ getGroupManager(network: any, relays: string[], dbName?: string): GroupManager;
1533
+ /**
1534
+ * Create a new Marmot group and optionally enable multisig for it
1535
+ * @param network Network interface
1536
+ * @param relays Relay URLs
1537
+ * @param name Group name
1538
+ * @param options Group creation options
1539
+ */
1540
+ createGroup(network: any, relays: string[], name: string, options?: CreateGroupOptions): Promise<any>;
1541
+ /**
1542
+ * Subscribe to group messages
1543
+ * @param group The Marmot group instance
1544
+ * @param handler Message handler callback
1545
+ * @returns Unsubscribe function
1546
+ */
1547
+ onGroupMessage(group: any, handler: (msg: GroupMessage) => void): () => void;
1548
+ /**
1549
+ * Set ZK Membership trust in KeyInfo
1550
+ * @param proof ZK Membership proof
1551
+ */
1552
+ setMembershipTrust(proof: ZKMMembershipProof): Promise<void>;
1553
+ /**
1554
+ * Set ZK Membership group trust in KeyInfo
1555
+ * @param group ZKM Group info (Semaphore-style - only root published)
1556
+ */
1557
+ setGroupTrust(group: ZKMGroupInfo): Promise<void>;
1558
+ /**
1559
+ * Publish ZK Membership proof to kind-0 profile
1560
+ * Can be called manually or automatically after group join
1561
+ * @param relayService RelayService instance
1562
+ */
1563
+ publishMembershipToProfile(relayService: RelayService): Promise<boolean>;
1564
+ /**
1565
+ * Get membership verification status
1566
+ */
1567
+ getMembershipTrust(): ZKMMembershipProof | undefined;
1568
+ /**
1569
+ * Subscribe to group changes (created/joined) to optionally auto-publish ZK membership
1570
+ * @param relayService RelayService instance
1571
+ * @param zkmService ZKMService for generating proofs
1572
+ * @param groupMembers Array of group member secrets
1573
+ * @returns Unsubscribe function
1574
+ */
1575
+ onGroupChange(relayService: RelayService, _groupMembers: string[]): () => void;
1576
+ /**
1577
+ * Clear membership trust from KeyInfo
1578
+ */
1579
+ clearMembershipTrust(): Promise<void>;
1580
+ /**
1581
+ * Fetch membership tags from a profile
1582
+ * @param relayService RelayService instance
1583
+ * @param pubkey Public key to fetch from
1584
+ */
1585
+ fetchGroupTags(relayService: RelayService, pubkey: string): Promise<ZKMGroupInfo[]>;
1586
+ /**
1587
+ * Parse a group message to check if it's a share credential
1588
+ * @param message The group message to parse
1589
+ */
1590
+ parseShareMessage(message: GroupMessage): Promise<ShareCredentialMessage | null>;
1591
+ /**
1592
+ * Parse a group message to check if it's a signing request
1593
+ * @param message The group message to parse
1594
+ */
1595
+ parseSigningRequest(message: GroupMessage): Promise<{
1596
+ type: 'signing-request';
1597
+ description: string;
1598
+ } | null>;
1599
+ /**
1600
+ * Generate a SIOP v2 Self-Issued ID Token
1601
+ * Auto-generates on demand — signs with the user's Nostr keypair
1602
+ * iss = sub = did:nostr:<hex_pubkey>
1603
+ */
1604
+ generateSiopIdToken(config: SiopConfig): Promise<SiopAuthResult>;
1605
+ /**
1606
+ * Authenticate to a Nostr relay using NIP-42
1607
+ * Auto-generates SIOP ID Token if siop.nonce is provided
1608
+ */
1609
+ authenticateToRelay(options: Nip42AuthOptions): Promise<Nip42AuthResult>;
1610
+ /**
1611
+ * Authenticate with an OAuth provider (Google, GitHub, etc.)
1612
+ * Initiates the OAuth flow — redirects to provider's authorization page
1613
+ * On callback, exchanges code for tokens and automatically links the identity
1614
+ */
1615
+ authenticateWithProvider(config: OAuthProviderConfig): Promise<OAuthAuthResult>;
1616
+ /**
1617
+ * Initiate OAuth flow (redirects to provider)
1618
+ * Call this to start the flow, then handle the callback with completeOAuthCallback
1619
+ */
1620
+ initiateProviderAuth(config: OAuthProviderConfig): Promise<void>;
1621
+ /**
1622
+ * Complete OAuth flow after callback
1623
+ * Exchanges code for tokens and links the identity
1624
+ */
1625
+ completeOAuthCallback(config: OAuthProviderConfig): Promise<OAuthAuthResult>;
1626
+ /**
1627
+ * Link an OAuth identity to the current Nostr key
1628
+ * Stores encrypted refresh token for silent re-auth
1629
+ */
1630
+ linkProvider(config: OAuthProviderConfig): Promise<void>;
1631
+ /**
1632
+ * Unlink a provider from the current Nostr key
1633
+ * Works for all provider types: OAuth, EUDI, vLEI, ZKP
1634
+ */
1635
+ unlinkProvider(provider: string): Promise<void>;
1636
+ /**
1637
+ * Get all linked providers
1638
+ */
1639
+ getLinkedProviders(filter?: {
1640
+ type?: string;
1641
+ category?: string;
1642
+ }): LinkedProviderStatus[];
1643
+ /**
1644
+ * Get an access token for a linked provider
1645
+ * Auto-refreshes if the stored token is expired
1646
+ */
1647
+ getProviderAccessToken(provider: string): Promise<string>;
1648
+ /**
1649
+ * Publish a provider link to kind-0 profile
1650
+ */
1651
+ publishProviderLink(relayService: RelayService, provider: string): Promise<boolean>;
1652
+ /**
1653
+ * Unpublish a provider link from kind-0 profile
1654
+ */
1655
+ unpublishProviderLink(relayService: RelayService, provider: string): Promise<boolean>;
1656
+ }
1657
+ //#endregion
1658
+ //#region src/services/eudi.service.d.ts
1659
+ declare class EUDIService {
1660
+ #private;
1661
+ connect(config: EUDIVerifierConfig): Promise<void>;
1662
+ disconnect(): Promise<void>;
1663
+ isConnected(): boolean;
1664
+ getConfig(): EUDIVerifierConfig | null;
1665
+ /**
1666
+ * Create a new verification session
1667
+ * Returns session info including verification URL and request URI
1668
+ */
1669
+ createVerificationSession(): Promise<EUDISession>;
1670
+ /**
1671
+ * Poll for verification result
1672
+ */
1673
+ pollVerificationResult(sessionId: string): Promise<{
1674
+ status: 'pending' | 'verified' | 'failed';
1675
+ claims?: EUDIClaims;
1676
+ }>;
1677
+ /**
1678
+ * Verify EUDI credentials and return claims
1679
+ * This is the main entry point for verification
1680
+ */
1681
+ verifyEUDI(): Promise<EUDIClaims>;
1682
+ /**
1683
+ * Get active sessions
1684
+ */
1685
+ getActiveSessions(): EUDISession[];
1686
+ /**
1687
+ * Clear expired sessions
1688
+ */
1689
+ clearExpiredSessions(): void;
1690
+ /**
1691
+ * Create a verification session for Legal PID credentials
1692
+ */
1693
+ createLegalPIDVerificationSession(): Promise<EUDISession>;
1694
+ /**
1695
+ * Verify EUDI Legal PID credentials and return claims
1696
+ */
1697
+ verifyEUDILegalPID(): Promise<EUDILegalClaims>;
1698
+ /**
1699
+ * Extract Legal PID claims from a verified VP token
1700
+ */
1701
+ extractLegalPIDClaims(vpToken: string, _challenge: string): Promise<EUDILegalClaims>;
1702
+ }
1703
+ declare function isEUDIAvailable(): Promise<boolean>;
1704
+ //#endregion
1705
+ //#region src/services/zkp.service.d.ts
1706
+ declare class ZKPService {
1707
+ #private;
1708
+ connect(config: ZKPVerifierConfig): Promise<void>;
1709
+ disconnect(): Promise<void>;
1710
+ isConnected(): boolean;
1711
+ getConfig(): ZKPVerifierConfig | null;
1712
+ verifyZKP(options?: Partial<ZKPVerificationRequest>): Promise<ZKPClaims>;
1713
+ getCurrentQueryUrl(): string | null;
1714
+ cancelVerification(): void;
1715
+ }
1716
+ declare function isZKPAvailable(): Promise<boolean>;
1717
+ //#endregion
1718
+ //#region src/services/individual-trust.service.d.ts
1719
+ declare class IndividualTrustService {
1720
+ #private;
1721
+ constructor();
1722
+ get eudi(): EUDIService;
1723
+ get zkp(): ZKPService;
1724
+ connectEUDI(config: EUDIVerifierConfig): Promise<void>;
1725
+ connectZKP(config: ZKPVerifierConfig): Promise<void>;
1726
+ disconnect(): Promise<void>;
1727
+ isConnected(): boolean;
1728
+ verifyEUDI(): Promise<EUDIClaims>;
1729
+ verifyZKP(options?: Partial<ZKPVerificationRequest>): Promise<ZKPClaims>;
1730
+ getVerificationStatus(): {
1731
+ eudi: boolean;
1732
+ zkp: boolean;
1733
+ };
1734
+ }
1735
+ //#endregion
1736
+ //#region src/services/keria.service.d.ts
1737
+ declare class KERIAService {
1738
+ #private;
1739
+ connect(url: string, bran: string): Promise<KERIAConnection>;
1740
+ disconnect(): Promise<void>;
1741
+ isConnected(): boolean;
1742
+ getConnection(): KERIAConnection | null;
1743
+ fetchCredentials(): Promise<KERIACredential[]>;
1744
+ findVLEICredentials(): Promise<VLEICredentials | null>;
1745
+ verifyCredentials(): Promise<RootOfTrustInfo>;
1746
+ signChallenge(challenge: string): Promise<KERISignature>;
1747
+ getCachedCredentials(): KERIACredential[];
1748
+ clearCache(): void;
1749
+ }
1750
+ declare function isKERIAAvailable(): Promise<boolean>;
1751
+ //#endregion
1752
+ //#region src/services/organization-trust.service.d.ts
1753
+ declare class OrganizationTrustService {
1754
+ #private;
1755
+ constructor();
1756
+ get keria(): KERIAService;
1757
+ get eudi(): EUDIService;
1758
+ connectKERIA(url: string, bran: string): Promise<KERIAConnection>;
1759
+ connectEUDI(config: EUDIVerifierConfig): Promise<void>;
1760
+ disconnect(): Promise<void>;
1761
+ isConnected(): boolean;
1762
+ verifyVLEI(): Promise<RootOfTrustInfo>;
1763
+ verifyEUDILegal(): Promise<EUDILegalClaims>;
1764
+ getVerificationStatus(): {
1765
+ vlei: boolean;
1766
+ eudiLegal: boolean;
1767
+ };
1768
+ }
1769
+ //#endregion
1770
+ //#region src/services/zkm.service.d.ts
1771
+ interface ZKMIdentity {
1772
+ privateKey: string;
1773
+ commitment: string;
1774
+ }
1775
+ declare function isZKMAvailable(): boolean;
1776
+ declare class ZKMService {
1777
+ #private;
1778
+ connect(config: ZKMVerifierConfig): Promise<void>;
1779
+ disconnect(): Promise<void>;
1780
+ isConnected(): boolean;
1781
+ generateIdentity(): Promise<ZKMIdentity>;
1782
+ createGroup(groupId: string): Promise<any>;
1783
+ addMember(identity: ZKMIdentity): Promise<any>;
1784
+ generateProof(scope?: string): Promise<any>;
1785
+ verifyProof(proof: any, root: string): Promise<boolean>;
1786
+ getIdentity(): ZKMIdentity | null;
1787
+ getGroup(): any | null;
1788
+ getConfig(): ZKMVerifierConfig | null;
1789
+ }
1790
+ //#endregion
1791
+ //#region src/services/siop.d.ts
1792
+ /**
1793
+ * Build a SIOP v2 authorization request URL
1794
+ * Used by RPs to invoke the Self-Issued OP
1795
+ */
1796
+ declare function buildSiopAuthorizationUrl(config: {
1797
+ clientId: string;
1798
+ redirectUri: string;
1799
+ nonce: string;
1800
+ authorizationEndpoint?: string;
1801
+ scope?: string;
1802
+ idTokenType?: string;
1803
+ clientMetadata?: SiopClientMetadata;
1804
+ requestUri?: string;
1805
+ }): string;
1806
+ /**
1807
+ * Parse a SIOP v2 authorization request URL
1808
+ * Used by the Self-Issued OP to extract the RP's request parameters
1809
+ */
1810
+ declare function parseSiopAuthorizationRequest(url: string): SiopConfig & {
1811
+ clientId: string;
1812
+ redirectUri: string;
1813
+ };
1814
+ /**
1815
+ * Generate a SIOP v2 Self-Issued ID Token
1816
+ * Signs with ES256K using the user's Nostr secp256k1 private key
1817
+ * iss = sub = did:nostr:<hex_pubkey>
1818
+ *
1819
+ * Note: Uses @noble/secp256k1 directly because Web Crypto (which jose relies on)
1820
+ * does not support the P-256K (secp256k1) curve in most environments.
1821
+ */
1822
+ declare function generateSiopIdToken(config: SiopConfig & {
1823
+ secretKey: Uint8Array;
1824
+ }): Promise<string>;
1825
+ /**
1826
+ * Verify a SIOP v2 Self-Issued ID Token
1827
+ * Validates signature using the pubkey from the did:nostr sub claim
1828
+ */
1829
+ declare function verifySiopIdToken(token: string): Promise<{
1830
+ valid: boolean;
1831
+ payload: Record<string, unknown>;
1832
+ error?: string;
1833
+ }>;
1834
+ /**
1835
+ * Generate a SIOP v2 authorization response (redirect back to RP)
1836
+ */
1837
+ declare function buildSiopAuthorizationResponse(redirectUri: string, idToken: string, state?: string): string;
1838
+ //#endregion
1839
+ //#region src/services/nip42.d.ts
1840
+ /**
1841
+ * Normalize a relay URL per NIP-42 conventions
1842
+ */
1843
+ declare function normalizeRelayUrl(url: string): string;
1844
+ /**
1845
+ * Build a NIP-42 AUTH event (kind 22242)
1846
+ */
1847
+ declare function buildAuthEvent(challenge: string, relayUrl: string, secretKey: Uint8Array, jwt?: string): Promise<Event$1>;
1848
+ /**
1849
+ * Authenticate to a Nostr relay using NIP-42
1850
+ * Full WebSocket handshake: connect → receive challenge → sign → send → await OK
1851
+ */
1852
+ declare function authenticateToRelay(options: Nip42AuthOptions & {
1853
+ secretKey: Uint8Array;
1854
+ }): Promise<Nip42AuthResult>;
1855
+ /**
1856
+ * Wait for AUTH challenge from relay
1857
+ * Returns the challenge string
1858
+ */
1859
+ declare function waitForAuthChallenge(websocket: WebSocket, timeoutMs?: number): Promise<string>;
1860
+ /**
1861
+ * Send AUTH event to relay and wait for OK response
1862
+ */
1863
+ declare function sendAuthEvent(websocket: WebSocket, authEvent: Event$1, timeoutMs?: number): Promise<boolean>;
1864
+ //#endregion
1865
+ //#region src/services/did-nostr.d.ts
1866
+ /**
1867
+ * Generate a did:nostr identifier from a hex pubkey
1868
+ */
1869
+ declare function pubkeyToDid(pubkey: string): string;
1870
+ /**
1871
+ * Extract the hex pubkey from a did:nostr identifier
1872
+ */
1873
+ declare function didToPubkey(did: string): string;
1874
+ /**
1875
+ * Convert a hex pubkey to a Multikey publicKeyMultibase value
1876
+ * per the did:nostr spec: prepend 0x02 (even y), then multicodec varint, then multibase base16-lower
1877
+ */
1878
+ declare function pubkeyToMultikey(pubkey: string): string;
1879
+ /**
1880
+ * Generate a minimal DID:nostr document from a pubkey alone (offline, no network)
1881
+ */
1882
+ declare function generateMinimalDidDocument(pubkey: string): DidNostrDocument;
1883
+ /**
1884
+ * Generate an enhanced DID:nostr document with relay services
1885
+ */
1886
+ declare function generateEnhancedDidDocument(pubkey: string, options?: {
1887
+ relays?: string[];
1888
+ alsoKnownAs?: string[];
1889
+ profile?: DidNostrProfile;
1890
+ follows?: string[];
1891
+ }): DidNostrDocument;
1892
+ /**
1893
+ * Resolve a did:nostr identifier to a DID document
1894
+ * This is offline-first — generates the minimal document from the pubkey alone
1895
+ */
1896
+ declare function resolveDidNostr(did: string): DidNostrDocument;
1897
+ /**
1898
+ * Validate a did:nostr identifier
1899
+ */
1900
+ declare function isValidDidNostr(did: string): boolean;
1901
+ //#endregion
1902
+ //#region src/services/oauth.d.ts
1903
+ /**
1904
+ * Built-in OAuth provider presets
1905
+ */
1906
+ declare const BUILTIN_PROVIDERS: Record<string, OAuthProviderPreset>;
1907
+ /**
1908
+ * Build OAuth authorization URL with PKCE
1909
+ */
1910
+ declare function buildAuthorizationUrl(config: {
1911
+ authorizationUrl: string;
1912
+ clientId: string;
1913
+ redirectUri: string;
1914
+ scope: string;
1915
+ codeChallenge: string;
1916
+ state?: string;
1917
+ }): string;
1918
+ /**
1919
+ * Exchange authorization code for tokens
1920
+ */
1921
+ declare function exchangeCodeForTokens(config: {
1922
+ tokenUrl: string;
1923
+ clientId: string;
1924
+ redirectUri: string;
1925
+ code: string;
1926
+ codeVerifier: string;
1927
+ }): Promise<{
1928
+ accessToken: string;
1929
+ refreshToken?: string;
1930
+ expiresIn: number;
1931
+ scope: string;
1932
+ idToken?: string;
1933
+ }>;
1934
+ /**
1935
+ * Decode a JWT payload (no signature verification)
1936
+ */
1937
+ declare function decodeJwtPayload(token: string): Record<string, unknown>;
1938
+ /**
1939
+ * Extract pubkey from JWT claims
1940
+ */
1941
+ declare function getPubkeyFromJwt(token: string, claimName?: string): string;
1942
+ /**
1943
+ * Encrypt a refresh token with AES-GCM using a PRF-derived key
1944
+ */
1945
+ declare function encryptRefreshToken(refreshToken: string, secretKey: Uint8Array): Promise<EncryptedOAuthBundle>;
1946
+ /**
1947
+ * Decrypt a refresh token with AES-GCM using a PRF-derived key
1948
+ */
1949
+ declare function decryptRefreshToken(bundle: EncryptedOAuthBundle, secretKey: Uint8Array): Promise<string>;
1950
+ /**
1951
+ * Refresh an access token using a stored refresh token
1952
+ */
1953
+ declare function refreshAccessToken(config: {
1954
+ tokenUrl: string;
1955
+ clientId: string;
1956
+ refreshToken: string;
1957
+ }): Promise<{
1958
+ accessToken: string;
1959
+ refreshToken?: string;
1960
+ expiresIn: number;
1961
+ scope: string;
1962
+ }>;
1963
+ /**
1964
+ * Initiate OAuth flow — redirects to provider's authorization page
1965
+ */
1966
+ declare function initiateOAuthFlow(config: {
1967
+ provider: string;
1968
+ clientId: string;
1969
+ redirectUri: string;
1970
+ scope: string;
1971
+ authorizationUrl?: string;
1972
+ state?: string;
1973
+ }): Promise<{
1974
+ codeVerifier: string;
1975
+ state: string;
1976
+ }>;
1977
+ /**
1978
+ * Handle OAuth callback — extract code, exchange for tokens
1979
+ */
1980
+ declare function handleOAuthCallback(currentUrl?: string): Promise<{
1981
+ code: string;
1982
+ state: string;
1983
+ pkceState: {
1984
+ codeVerifier: string;
1985
+ provider: string;
1986
+ clientId: string;
1987
+ redirectUri: string;
1988
+ scope: string;
1989
+ tokenUrl?: string;
1990
+ };
1991
+ }>;
1992
+ /**
1993
+ * Complete OAuth flow — exchange code for tokens and return result
1994
+ */
1995
+ declare function completeOAuthFlow(currentUrl?: string): Promise<OAuthAuthResult>;
1996
+ //#endregion
1997
+ export { AllVerificationResults, AuthService, type AuthServiceConfig, type AuthState, BUILTIN_PROVIDERS, CreateGroupOptions, type DidNostrDocument, type DidNostrProfile, type DidNostrService, type DidNostrVerificationMethod, type EUDIClaims, type EUDILegalClaims, EUDIService, type EUDISession, type EUDISessionRequest, type EUDIVerificationResponse, type EUDIVerifierConfig, EncryptedMultisigBundle, type EncryptedOAuthBundle, type Event, type FollowEntry, GetPrfSecretOptions, GroupManager, GroupMessage, IndexedDBGroupStateBackend, IndexedDBKeyPackageStore, IndexedDBKeyValueBackend, IndividualTrustService, type KERIAConnection, type KERIACredential, KERIAService, type KERISignature, KeyCacheOptions, KeyInfo, KeyManager, KeyManagerLike, KeyManagerOptions, KeyOptions, KeyRecovery, type LinkedProviderStatus, MultisigConfig, MultisigImportOptions, MultisigManager, MultisigMember, MultisigSetupOptions, MultisigSetupResult, type MultisigVLEIConfig, type Nip42AuthOptions, type Nip42AuthResult, NostrKeyStorageOptions, type OAuthAuthResult, type OAuthProviderConfig, type OAuthProviderPreset, OrganizationTrustService, PasskeyCreationOptions, PasswordProtectedBundle, PeerInfo, type ProfileMetadata, RelayService, type RelayServiceConfig, type RootOfTrustInfo, RootOfTrustVerificationResult, ShareCredentialMessage, SignOptions, SigningMode, SigningRequest, type SiopAuthResult, type SiopClientMetadata, type SiopConfig, type TrustLevel, type TrustProviderEntry, type VLEICredentials, type VLEITagData, type VerificationStatus, type ZKMMembershipProof, type ZKMScheme, ZKMService, type ZKMVerificationRequest, type ZKMVerifierConfig, type ZKPClaims, type ZKPScope, ZKPService, type ZKPVerifierConfig, aesGcmDecrypt, aesGcmEncrypt, buildAuthEvent, buildAuthorizationUrl, buildSiopAuthorizationResponse, buildSiopAuthorizationUrl, bytesToHex, checkPRFSupport, completeOAuthFlow, createPasskey, createRecoveryTag, createShareMessage, createSigningRequest, decodeJwtPayload, decryptRefreshToken, deriveAesGcmKey, deriveNostrPrivateKey, deriveSaltFromUsername, didToPubkey, encryptRefreshToken, exchangeCodeForTokens, generateEnhancedDidDocument, generateMinimalDidDocument, generatePasswordProtectedKey, generateSiopIdToken, getPrfSecret, getPubkeyFromJwt, getPublicKeyFromPassword, getRecoverySignature, getTrustLevelLabel, getVerificationSummary, handleOAuthCallback, hasAnyVerifiedRootOfTrust, hexToBytes, importPublicKeyFromBundle, initiateOAuthFlow, isEUDIAvailable, isKERIAAvailable, isPrfSupported, isTrustExpired, isValidDidNostr, isZKMAvailable, isZKPAvailable, authenticateToRelay as nip42Authenticate, normalizeRelayUrl, parseRecoveryTag, parseShareMessage, parseSigningRequest, parseSiopAuthorizationRequest, pubkeyToDid, pubkeyToMultikey, refreshAccessToken, registerDummyPasskey, resolveDidNostr, sendAuthEvent, unwrapPasswordProtectedPrivateKey, verifyAllRootOfTrusts, verifyEUDILegalTag, verifyEUDITag, verifyRecoverySignature, verifySiopIdToken, verifyVLEITag, verifyZKMTag, verifyZKPTag, waitForAuthChallenge };
1998
+ //# sourceMappingURL=browser-index.d.cts.map