@bsv/sdk 1.6.11 → 1.6.14

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 (88) hide show
  1. package/README.md +4 -4
  2. package/dist/cjs/package.json +1 -1
  3. package/dist/cjs/src/transaction/broadcasters/DefaultBroadcaster.js +1 -1
  4. package/dist/cjs/src/transaction/broadcasters/DefaultBroadcaster.js.map +1 -1
  5. package/dist/cjs/src/wallet/WalletClient.js +1 -0
  6. package/dist/cjs/src/wallet/WalletClient.js.map +1 -1
  7. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  8. package/dist/esm/src/transaction/broadcasters/DefaultBroadcaster.js +1 -1
  9. package/dist/esm/src/transaction/broadcasters/DefaultBroadcaster.js.map +1 -1
  10. package/dist/esm/src/wallet/WalletClient.js +1 -0
  11. package/dist/esm/src/wallet/WalletClient.js.map +1 -1
  12. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  13. package/dist/types/src/wallet/WalletClient.d.ts.map +1 -1
  14. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  15. package/dist/umd/bundle.js +1 -1
  16. package/docs/MARKDOWN_VALIDATION_GUIDE.md +175 -0
  17. package/docs/concepts/beef.md +8 -0
  18. package/docs/concepts/chain-tracking.md +12 -0
  19. package/docs/concepts/decentralized-identity.md +37 -0
  20. package/docs/concepts/fees.md +32 -0
  21. package/docs/concepts/identity-certificates.md +53 -1
  22. package/docs/concepts/index.md +15 -0
  23. package/docs/concepts/key-management.md +9 -0
  24. package/docs/concepts/script-templates.md +13 -0
  25. package/docs/concepts/sdk-philosophy.md +8 -0
  26. package/docs/concepts/signatures.md +15 -0
  27. package/docs/concepts/spv-verification.md +12 -0
  28. package/docs/concepts/transaction-encoding.md +19 -0
  29. package/docs/concepts/transaction-structure.md +4 -0
  30. package/docs/concepts/trust-model.md +16 -0
  31. package/docs/concepts/verification.md +31 -0
  32. package/docs/concepts/wallet-integration.md +6 -0
  33. package/docs/guides/development-wallet-setup.md +374 -0
  34. package/docs/guides/direct-transaction-creation.md +12 -2
  35. package/docs/guides/http-client-configuration.md +122 -48
  36. package/docs/guides/index.md +117 -9
  37. package/docs/guides/large-transactions.md +448 -0
  38. package/docs/guides/multisig-transactions.md +792 -0
  39. package/docs/guides/security-best-practices.md +494 -0
  40. package/docs/guides/transaction-batching.md +132 -0
  41. package/docs/guides/transaction-signing-methods.md +230 -79
  42. package/docs/index.md +0 -2
  43. package/docs/reference/auth.md +212 -159
  44. package/docs/reference/compat.md +120 -96
  45. package/docs/reference/configuration.md +6 -0
  46. package/docs/reference/debugging.md +5 -0
  47. package/docs/reference/errors.md +50 -0
  48. package/docs/reference/identity.md +21 -12
  49. package/docs/reference/index.md +14 -1
  50. package/docs/reference/kvstore.md +21 -19
  51. package/docs/reference/messages.md +3 -0
  52. package/docs/reference/op-codes.md +20 -1
  53. package/docs/reference/overlay-tools.md +46 -18
  54. package/docs/reference/primitives.md +571 -390
  55. package/docs/reference/registry.md +43 -20
  56. package/docs/reference/script.md +140 -105
  57. package/docs/reference/storage.md +32 -12
  58. package/docs/reference/totp.md +16 -11
  59. package/docs/reference/transaction-signatures.md +2 -1
  60. package/docs/reference/transaction.md +201 -120
  61. package/docs/reference/wallet.md +241 -64
  62. package/docs/tutorials/advanced-transaction.md +1 -4
  63. package/docs/tutorials/aes-encryption.md +3 -1
  64. package/docs/tutorials/authfetch-tutorial.md +29 -0
  65. package/docs/tutorials/ecdh-key-exchange.md +2 -0
  66. package/docs/tutorials/elliptic-curve-fundamentals.md +3 -0
  67. package/docs/tutorials/error-handling.md +1 -0
  68. package/docs/tutorials/first-transaction-low-level.md +1 -0
  69. package/docs/tutorials/first-transaction.md +5 -8
  70. package/docs/tutorials/hashes-and-hmacs.md +5 -31
  71. package/docs/tutorials/identity-management.md +27 -0
  72. package/docs/tutorials/index.md +114 -77
  73. package/docs/tutorials/key-management.md +5 -3
  74. package/docs/tutorials/protowallet-development.md +27 -0
  75. package/docs/tutorials/spv-merkle-proofs.md +9 -6
  76. package/docs/tutorials/testnet-transactions-low-level.md +25 -18
  77. package/docs/tutorials/transaction-broadcasting.md +10 -7
  78. package/docs/tutorials/transaction-types.md +5 -4
  79. package/docs/tutorials/type-42.md +0 -14
  80. package/docs/tutorials/uhrp-storage.md +23 -3
  81. package/package.json +1 -1
  82. package/src/identity/README.md +0 -1
  83. package/src/primitives/__tests/SymmetricKey.test.ts +45 -0
  84. package/src/primitives/__tests/SymmetricKeyCompatibility.test.ts +150 -0
  85. package/src/transaction/__tests/Transaction.test.ts +1 -1
  86. package/src/transaction/broadcasters/DefaultBroadcaster.ts +1 -1
  87. package/src/transaction/broadcasters/__tests/ARC.test.ts +1 -1
  88. package/src/wallet/WalletClient.ts +1 -0
@@ -38,6 +38,7 @@ See also: [RequestedCertificateSet](./auth.md#interface-requestedcertificateset)
38
38
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
39
39
 
40
40
  ---
41
+
41
42
  ### Interface: PeerSession
42
43
 
43
44
  ```ts
@@ -53,6 +54,7 @@ export interface PeerSession {
53
54
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
54
55
 
55
56
  ---
57
+
56
58
  ### Interface: RequestedCertificateSet
57
59
 
58
60
  ```ts
@@ -67,6 +69,7 @@ See also: [RequestedCertificateTypeIDAndFieldList](./auth.md#interface-requested
67
69
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
68
70
 
69
71
  ---
72
+
70
73
  ### Interface: RequestedCertificateTypeIDAndFieldList
71
74
 
72
75
  ```ts
@@ -78,6 +81,7 @@ export interface RequestedCertificateTypeIDAndFieldList {
78
81
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
79
82
 
80
83
  ---
84
+
81
85
  ### Interface: Transport
82
86
 
83
87
  ```ts
@@ -92,6 +96,7 @@ See also: [AuthMessage](./auth.md#interface-authmessage)
92
96
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
93
97
 
94
98
  ---
99
+
95
100
  ## Classes
96
101
 
97
102
  | |
@@ -137,14 +142,15 @@ Constructs a new AuthFetch instance.
137
142
  ```ts
138
143
  constructor(wallet: WalletInterface, requestedCertificates?: RequestedCertificateSet, sessionManager?: SessionManager)
139
144
  ```
145
+
140
146
  See also: [RequestedCertificateSet](./auth.md#interface-requestedcertificateset), [SessionManager](./auth.md#class-sessionmanager), [WalletInterface](./wallet.md#interface-walletinterface)
141
147
 
142
148
  Argument Details
143
149
 
144
- + **wallet**
145
- + The wallet instance for signing and authentication.
146
- + **requestedCertificates**
147
- + Optional set of certificates to request from peers.
150
+ - **wallet**
151
+ - The wallet instance for signing and authentication.
152
+ - **requestedCertificates**
153
+ - Optional set of certificates to request from peers.
148
154
 
149
155
  #### Method consumeReceivedCertificates
150
156
 
@@ -153,6 +159,7 @@ Return any certificates we've collected thus far, then clear them out.
153
159
  ```ts
154
160
  public consumeReceivedCertificates(): VerifiableCertificate[]
155
161
  ```
162
+
156
163
  See also: [VerifiableCertificate](./auth.md#class-verifiablecertificate)
157
164
 
158
165
  #### Method fetch
@@ -173,10 +180,10 @@ A promise that resolves with the server's response, structured as a Response-lik
173
180
 
174
181
  Argument Details
175
182
 
176
- + **url**
177
- + The URL to send the request to.
178
- + **config**
179
- + Configuration options for the request, including method, headers, and body.
183
+ - **url**
184
+ - The URL to send the request to.
185
+ - **config**
186
+ - Configuration options for the request, including method, headers, and body.
180
187
 
181
188
  Throws
182
189
 
@@ -189,11 +196,13 @@ Request Certificates from a Peer
189
196
  ```ts
190
197
  async sendCertificateRequest(baseUrl: string, certificatesToRequest: RequestedCertificateSet): Promise<VerifiableCertificate[]>
191
198
  ```
199
+
192
200
  See also: [RequestedCertificateSet](./auth.md#interface-requestedcertificateset), [VerifiableCertificate](./auth.md#class-verifiablecertificate)
193
201
 
194
202
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
195
203
 
196
204
  ---
205
+
197
206
  ### Class: Certificate
198
207
 
199
208
  Represents an Identity Certificate as per the Wallet interface specifications.
@@ -230,24 +239,25 @@ Constructs a new Certificate.
230
239
  ```ts
231
240
  constructor(type: Base64String, serialNumber: Base64String, subject: PubKeyHex, certifier: PubKeyHex, revocationOutpoint: OutpointString, fields: Record<CertificateFieldNameUnder50Bytes, string>, signature?: HexString)
232
241
  ```
242
+
233
243
  See also: [Base64String](./wallet.md#type-base64string), [CertificateFieldNameUnder50Bytes](./wallet.md#type-certificatefieldnameunder50bytes), [HexString](./wallet.md#type-hexstring), [OutpointString](./wallet.md#type-outpointstring), [PubKeyHex](./wallet.md#type-pubkeyhex)
234
244
 
235
245
  Argument Details
236
246
 
237
- + **type**
238
- + Type identifier for the certificate, base64 encoded string, 32 bytes.
239
- + **serialNumber**
240
- + Unique serial number of the certificate, base64 encoded string, 32 bytes.
241
- + **subject**
242
- + The public key belonging to the certificate's subject, compressed public key hex string.
243
- + **certifier**
244
- + Public key of the certifier who issued the certificate, compressed public key hex string.
245
- + **revocationOutpoint**
246
- + The outpoint used to confirm that the certificate has not been revoked (TXID.OutputIndex), as a string.
247
- + **fields**
248
- + All the fields present in the certificate.
249
- + **signature**
250
- + Certificate signature by the certifier's private key, DER encoded hex string.
247
+ - **type**
248
+ - Type identifier for the certificate, base64 encoded string, 32 bytes.
249
+ - **serialNumber**
250
+ - Unique serial number of the certificate, base64 encoded string, 32 bytes.
251
+ - **subject**
252
+ - The public key belonging to the certificate's subject, compressed public key hex string.
253
+ - **certifier**
254
+ - Public key of the certifier who issued the certificate, compressed public key hex string.
255
+ - **revocationOutpoint**
256
+ - The outpoint used to confirm that the certificate has not been revoked (TXID.OutputIndex), as a string.
257
+ - **fields**
258
+ - All the fields present in the certificate.
259
+ - **signature**
260
+ - Certificate signature by the certifier's private key, DER encoded hex string.
251
261
 
252
262
  #### Property certifier
253
263
 
@@ -256,6 +266,7 @@ Public key of the certifier who issued the certificate, compressed public key he
256
266
  ```ts
257
267
  certifier: PubKeyHex
258
268
  ```
269
+
259
270
  See also: [PubKeyHex](./wallet.md#type-pubkeyhex)
260
271
 
261
272
  #### Property fields
@@ -265,6 +276,7 @@ All the fields present in the certificate, with field names as keys and encrypte
265
276
  ```ts
266
277
  fields: Record<CertificateFieldNameUnder50Bytes, Base64String>
267
278
  ```
279
+
268
280
  See also: [Base64String](./wallet.md#type-base64string), [CertificateFieldNameUnder50Bytes](./wallet.md#type-certificatefieldnameunder50bytes)
269
281
 
270
282
  #### Property revocationOutpoint
@@ -274,6 +286,7 @@ The outpoint used to confirm that the certificate has not been revoked (TXID.Out
274
286
  ```ts
275
287
  revocationOutpoint: OutpointString
276
288
  ```
289
+
277
290
  See also: [OutpointString](./wallet.md#type-outpointstring)
278
291
 
279
292
  #### Property serialNumber
@@ -283,6 +296,7 @@ Unique serial number of the certificate, base64 encoded string, 32 bytes.
283
296
  ```ts
284
297
  serialNumber: Base64String
285
298
  ```
299
+
286
300
  See also: [Base64String](./wallet.md#type-base64string)
287
301
 
288
302
  #### Property signature
@@ -292,6 +306,7 @@ Certificate signature by the certifier's private key, DER encoded hex string.
292
306
  ```ts
293
307
  signature?: HexString
294
308
  ```
309
+
295
310
  See also: [HexString](./wallet.md#type-hexstring)
296
311
 
297
312
  #### Property subject
@@ -301,6 +316,7 @@ The public key belonging to the certificate's subject, compressed public key hex
301
316
  ```ts
302
317
  subject: PubKeyHex
303
318
  ```
319
+
304
320
  See also: [PubKeyHex](./wallet.md#type-pubkeyhex)
305
321
 
306
322
  #### Property type
@@ -310,6 +326,7 @@ Type identifier for the certificate, base64 encoded string, 32 bytes.
310
326
  ```ts
311
327
  type: Base64String
312
328
  ```
329
+
313
330
  See also: [Base64String](./wallet.md#type-base64string)
314
331
 
315
332
  #### Method fromBinary
@@ -319,6 +336,7 @@ Deserializes a certificate from binary format.
319
336
  ```ts
320
337
  static fromBinary(bin: number[]): Certificate
321
338
  ```
339
+
322
340
  See also: [Certificate](./auth.md#class-certificate)
323
341
 
324
342
  Returns
@@ -327,8 +345,8 @@ Returns
327
345
 
328
346
  Argument Details
329
347
 
330
- + **bin**
331
- + The binary data representing the certificate.
348
+ - **bin**
349
+ - The binary data representing the certificate.
332
350
 
333
351
  #### Method getCertificateFieldEncryptionDetails
334
352
 
@@ -346,21 +364,23 @@ static getCertificateFieldEncryptionDetails(fieldName: string, serialNumber?: st
346
364
  keyID: string;
347
365
  }
348
366
  ```
367
+
349
368
  See also: [WalletProtocol](./wallet.md#type-walletprotocol)
350
369
 
351
370
  Returns
352
371
 
353
372
  An object containing:
373
+
354
374
  - `protocolID` (WalletProtocol): The protocol ID for certificate field encryption.
355
375
  - `keyID` (string): A unique key identifier. It is the `fieldName` if `serialNumber` is undefined,
356
376
  otherwise it is a combination of `serialNumber` and `fieldName`.
357
377
 
358
378
  Argument Details
359
379
 
360
- + **fieldName**
361
- + The name of the field within the certificate to be encrypted.
362
- + **serialNumber**
363
- + (Optional) The serial number of the certificate.
380
+ - **fieldName**
381
+ - The name of the field within the certificate to be encrypted.
382
+ - **serialNumber**
383
+ - (Optional) The serial number of the certificate.
364
384
 
365
385
  #### Method sign
366
386
 
@@ -369,12 +389,13 @@ Signs the certificate using the provided certifier wallet.
369
389
  ```ts
370
390
  async sign(certifierWallet: ProtoWallet): Promise<void>
371
391
  ```
392
+
372
393
  See also: [ProtoWallet](./wallet.md#class-protowallet)
373
394
 
374
395
  Argument Details
375
396
 
376
- + **certifierWallet**
377
- + The wallet representing the certifier.
397
+ - **certifierWallet**
398
+ - The wallet representing the certifier.
378
399
 
379
400
  #### Method toBinary
380
401
 
@@ -390,8 +411,8 @@ Returns
390
411
 
391
412
  Argument Details
392
413
 
393
- + **includeSignature**
394
- + Whether to include the signature in the serialization.
414
+ - **includeSignature**
415
+ - Whether to include the signature in the serialization.
395
416
 
396
417
  #### Method verify
397
418
 
@@ -408,6 +429,7 @@ Returns
408
429
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
409
430
 
410
431
  ---
432
+
411
433
  ### Class: CompletedProtoWallet
412
434
 
413
435
  ```ts
@@ -444,6 +466,7 @@ See also: [AbortActionResult](./wallet.md#interface-abortactionresult), [Acquire
444
466
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
445
467
 
446
468
  ---
469
+
447
470
  ### Class: MasterCertificate
448
471
 
449
472
  MasterCertificate extends the base Certificate class to manage a master keyring, enabling the creation of verifiable certificates.
@@ -488,11 +511,13 @@ and sign off on the fields, along with the encrypted certificate fields.
488
511
  ```ts
489
512
  static async createCertificateFields(creatorWallet: ProtoWallet, certifierOrSubject: WalletCounterparty, fields: Record<CertificateFieldNameUnder50Bytes, string>, privileged?: boolean, privilegedReason?: string): Promise<CreateCertificateFieldsResult>
490
513
  ```
514
+
491
515
  See also: [CertificateFieldNameUnder50Bytes](./wallet.md#type-certificatefieldnameunder50bytes), [ProtoWallet](./wallet.md#class-protowallet), [WalletCounterparty](./wallet.md#type-walletcounterparty)
492
516
 
493
517
  Returns
494
518
 
495
519
  A promise resolving to an object containing:
520
+
496
521
  - `certificateFields` {Record<CertificateFieldNameUnder50Bytes, Base64String>}:
497
522
  The encrypted certificate fields.
498
523
  - `masterKeyring` {Record<CertificateFieldNameUnder50Bytes, Base64String>}:
@@ -500,16 +525,16 @@ The master keyring containing encrypted revelation keys for each field.
500
525
 
501
526
  Argument Details
502
527
 
503
- + **creatorWallet**
504
- + The wallet of the creator responsible for encrypting the fields.
505
- + **certifierOrSubject**
506
- + The certifier or subject who will validate the certificate fields.
507
- + **fields**
508
- + A record of certificate field names (under 50 bytes) mapped to their values.
509
- + **privileged**
510
- + Whether this is a privileged request.
511
- + **privilegedReason**
512
- + Reason provided for privileged access, required if this is a privileged operation. *
528
+ - **creatorWallet**
529
+ - The wallet of the creator responsible for encrypting the fields.
530
+ - **certifierOrSubject**
531
+ - The certifier or subject who will validate the certificate fields.
532
+ - **fields**
533
+ - A record of certificate field names (under 50 bytes) mapped to their values.
534
+ - **privileged**
535
+ - Whether this is a privileged request.
536
+ - **privilegedReason**
537
+ - Reason provided for privileged access, required if this is a privileged operation. *
513
538
 
514
539
  #### Method createKeyringForVerifier
515
540
 
@@ -521,6 +546,7 @@ for the verifier to access the designated fields.
521
546
  ```ts
522
547
  static async createKeyringForVerifier(subjectWallet: ProtoWallet, certifier: WalletCounterparty, verifier: WalletCounterparty, fields: Record<CertificateFieldNameUnder50Bytes, Base64String>, fieldsToReveal: string[], masterKeyring: Record<CertificateFieldNameUnder50Bytes, Base64String>, serialNumber: Base64String, privileged?: boolean, privilegedReason?: string): Promise<Record<CertificateFieldNameUnder50Bytes, string>>
523
548
  ```
549
+
524
550
  See also: [Base64String](./wallet.md#type-base64string), [CertificateFieldNameUnder50Bytes](./wallet.md#type-certificatefieldnameunder50bytes), [ProtoWallet](./wallet.md#class-protowallet), [WalletCounterparty](./wallet.md#type-walletcounterparty)
525
551
 
526
552
  Returns
@@ -529,22 +555,23 @@ Returns
529
555
 
530
556
  Argument Details
531
557
 
532
- + **subjectWallet**
533
- + The wallet instance of the subject, used to decrypt and re-encrypt field keys.
534
- + **verifier**
535
- + The verifier who will receive access to the selectively revealed fields. Can be an identity key as hex, 'anyone', or 'self'.
536
- + **fieldsToReveal**
537
- + An array of field names to be revealed to the verifier. Must be a subset of the certificate's fields.
538
- + **originator**
539
- + Optional originator identifier, used if additional context is needed for decryption and encryption operations.
540
- + **privileged**
541
- + Whether this is a privileged request.
542
- + **privilegedReason**
543
- + Reason provided for privileged access, required if this is a privileged operation. *
558
+ - **subjectWallet**
559
+ - The wallet instance of the subject, used to decrypt and re-encrypt field keys.
560
+ - **verifier**
561
+ - The verifier who will receive access to the selectively revealed fields. Can be an identity key as hex, 'anyone', or 'self'.
562
+ - **fieldsToReveal**
563
+ - An array of field names to be revealed to the verifier. Must be a subset of the certificate's fields.
564
+ - **originator**
565
+ - Optional originator identifier, used if additional context is needed for decryption and encryption operations.
566
+ - **privileged**
567
+ - Whether this is a privileged request.
568
+ - **privilegedReason**
569
+ - Reason provided for privileged access, required if this is a privileged operation. *
544
570
 
545
571
  Throws
546
572
 
547
573
  Throws an error if:
574
+
548
575
  - fieldsToReveal is not an array of strings.
549
576
  - A field in `fieldsToReveal` does not exist in the certificate.
550
577
  - The decrypted master field key fails to decrypt the corresponding field (indicating an invalid key).
@@ -556,12 +583,14 @@ Decrypts all fields in the MasterCertificate using the subject's or certifier's
556
583
  This method allows the subject or certifier to decrypt the `masterKeyring` and retrieve
557
584
  the encryption keys for each field, which are then used to decrypt the corresponding field values.
558
585
  The counterparty used for decryption depends on how the certificate fields were created:
586
+
559
587
  - If the certificate is self-signed, the counterparty should be set to 'self'.
560
588
  - Otherwise, the counterparty should always be the other party involved in the certificate issuance process (the subject or certifier).
561
589
 
562
590
  ```ts
563
591
  static async decryptFields(subjectOrCertifierWallet: ProtoWallet, masterKeyring: Record<CertificateFieldNameUnder50Bytes, Base64String>, fields: Record<CertificateFieldNameUnder50Bytes, Base64String>, counterparty: WalletCounterparty, privileged?: boolean, privilegedReason?: string): Promise<Record<CertificateFieldNameUnder50Bytes, string>>
564
592
  ```
593
+
565
594
  See also: [Base64String](./wallet.md#type-base64string), [CertificateFieldNameUnder50Bytes](./wallet.md#type-certificatefieldnameunder50bytes), [ProtoWallet](./wallet.md#class-protowallet), [WalletCounterparty](./wallet.md#type-walletcounterparty)
566
595
 
567
596
  Returns
@@ -570,18 +599,18 @@ A promise resolving to a record of field names and their decrypted values in pla
570
599
 
571
600
  Argument Details
572
601
 
573
- + **subjectOrCertifierWallet**
574
- + The wallet of the subject or certifier, used to decrypt the master keyring and field values.
575
- + **masterKeyring**
576
- + A record containing encrypted keys for each field.
577
- + **fields**
578
- + A record of encrypted field names and their values.
579
- + **counterparty**
580
- + The counterparty responsible for creating or signing the certificate. For self-signed certificates, use 'self'.
581
- + **privileged**
582
- + Whether this is a privileged request.
583
- + **privilegedReason**
584
- + Reason provided for privileged access, required if this is a privileged operation.
602
+ - **subjectOrCertifierWallet**
603
+ - The wallet of the subject or certifier, used to decrypt the master keyring and field values.
604
+ - **masterKeyring**
605
+ - A record containing encrypted keys for each field.
606
+ - **fields**
607
+ - A record of encrypted field names and their values.
608
+ - **counterparty**
609
+ - The counterparty responsible for creating or signing the certificate. For self-signed certificates, use 'self'.
610
+ - **privileged**
611
+ - Whether this is a privileged request.
612
+ - **privilegedReason**
613
+ - Reason provided for privileged access, required if this is a privileged operation.
585
614
 
586
615
  Throws
587
616
 
@@ -602,6 +631,7 @@ static async issueCertificateForSubject(certifierWallet: ProtoWallet, subject: W
602
631
  return "Certificate revocation not tracked.";
603
632
  }, serialNumber?: string): Promise<MasterCertificate>
604
633
  ```
634
+
605
635
  See also: [CertificateFieldNameUnder50Bytes](./wallet.md#type-certificatefieldnameunder50bytes), [MasterCertificate](./auth.md#class-mastercertificate), [ProtoWallet](./wallet.md#class-protowallet), [WalletCounterparty](./wallet.md#type-walletcounterparty)
606
636
 
607
637
  Returns
@@ -610,19 +640,19 @@ Returns
610
640
 
611
641
  Argument Details
612
642
 
613
- + **certifierWallet**
614
- + The wallet of the certifier, used to sign the certificate and encrypt field keys.
615
- + **subject**
616
- + The subject for whom the certificate is issued.
617
- + **fields**
618
- + Unencrypted certificate fields to include, with their names and values.
619
- + **certificateType**
620
- + The type of certificate being issued.
621
- + **getRevocationOutpoint**
622
- + -
643
+ - **certifierWallet**
644
+ - The wallet of the certifier, used to sign the certificate and encrypt field keys.
645
+ - **subject**
646
+ - The subject for whom the certificate is issued.
647
+ - **fields**
648
+ - Unencrypted certificate fields to include, with their names and values.
649
+ - **certificateType**
650
+ - The type of certificate being issued.
651
+ - **getRevocationOutpoint**
652
+ - -
623
653
  Optional function to obtain a revocation outpoint for the certificate. Defaults to a placeholder.
624
- + **updateProgress**
625
- + Optional callback for reporting progress updates during the operation. Defaults to a no-op.
654
+ - **updateProgress**
655
+ - Optional callback for reporting progress updates during the operation. Defaults to a no-op.
626
656
 
627
657
  Throws
628
658
 
@@ -631,6 +661,7 @@ Throws an error if any operation (e.g., encryption, signing) fails during certif
631
661
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
632
662
 
633
663
  ---
664
+
634
665
  ### Class: Peer
635
666
 
636
667
  Represents a peer capable of performing mutual authentication.
@@ -666,20 +697,21 @@ Creates a new Peer instance
666
697
  ```ts
667
698
  constructor(wallet: WalletInterface, transport: Transport, certificatesToRequest?: RequestedCertificateSet, sessionManager?: SessionManager, autoPersistLastSession?: boolean)
668
699
  ```
700
+
669
701
  See also: [RequestedCertificateSet](./auth.md#interface-requestedcertificateset), [SessionManager](./auth.md#class-sessionmanager), [Transport](./auth.md#interface-transport), [WalletInterface](./wallet.md#interface-walletinterface)
670
702
 
671
703
  Argument Details
672
704
 
673
- + **wallet**
674
- + The wallet instance used for cryptographic operations.
675
- + **transport**
676
- + The transport mechanism used for sending and receiving messages.
677
- + **certificatesToRequest**
678
- + Optional set of certificates to request from a peer during the initial handshake.
679
- + **sessionManager**
680
- + Optional SessionManager to be used for managing peer sessions.
681
- + **autoPersistLastSession**
682
- + Whether to auto-persist the session with the last-interacted-with peer. Defaults to true.
705
+ - **wallet**
706
+ - The wallet instance used for cryptographic operations.
707
+ - **transport**
708
+ - The transport mechanism used for sending and receiving messages.
709
+ - **certificatesToRequest**
710
+ - Optional set of certificates to request from a peer during the initial handshake.
711
+ - **sessionManager**
712
+ - Optional SessionManager to be used for managing peer sessions.
713
+ - **autoPersistLastSession**
714
+ - Whether to auto-persist the session with the last-interacted-with peer. Defaults to true.
683
715
 
684
716
  #### Method getAuthenticatedSession
685
717
 
@@ -693,6 +725,7 @@ or the session is not authenticated, initiates a handshake to create or authenti
693
725
  ```ts
694
726
  async getAuthenticatedSession(identityKey?: string, maxWaitTime?: number): Promise<PeerSession>
695
727
  ```
728
+
696
729
  See also: [PeerSession](./auth.md#interface-peersession)
697
730
 
698
731
  Returns
@@ -701,10 +734,10 @@ Returns
701
734
 
702
735
  Argument Details
703
736
 
704
- + **identityKey**
705
- + The identity public key of the peer.
706
- + **maxWaitTime**
707
- + The maximum time in milliseconds to wait for the handshake.
737
+ - **identityKey**
738
+ - The identity public key of the peer.
739
+ - **maxWaitTime**
740
+ - The maximum time in milliseconds to wait for the handshake.
708
741
 
709
742
  #### Method listenForCertificatesReceived
710
743
 
@@ -713,6 +746,7 @@ Registers a callback to listen for certificates received from peers.
713
746
  ```ts
714
747
  listenForCertificatesReceived(callback: (senderPublicKey: string, certs: VerifiableCertificate[]) => void): number
715
748
  ```
749
+
716
750
  See also: [VerifiableCertificate](./auth.md#class-verifiablecertificate)
717
751
 
718
752
  Returns
@@ -721,8 +755,8 @@ The ID of the callback listener.
721
755
 
722
756
  Argument Details
723
757
 
724
- + **callback**
725
- + The function to call when certificates are received.
758
+ - **callback**
759
+ - The function to call when certificates are received.
726
760
 
727
761
  #### Method listenForCertificatesRequested
728
762
 
@@ -731,6 +765,7 @@ Registers a callback to listen for certificates requested from peers.
731
765
  ```ts
732
766
  listenForCertificatesRequested(callback: (senderPublicKey: string, requestedCertificates: RequestedCertificateSet) => void): number
733
767
  ```
768
+
734
769
  See also: [RequestedCertificateSet](./auth.md#interface-requestedcertificateset)
735
770
 
736
771
  Returns
@@ -739,8 +774,8 @@ The ID of the callback listener.
739
774
 
740
775
  Argument Details
741
776
 
742
- + **callback**
743
- + The function to call when a certificate request is received
777
+ - **callback**
778
+ - The function to call when a certificate request is received
744
779
 
745
780
  #### Method listenForGeneralMessages
746
781
 
@@ -756,8 +791,8 @@ The ID of the callback listener.
756
791
 
757
792
  Argument Details
758
793
 
759
- + **callback**
760
- + The function to call when a general message is received.
794
+ - **callback**
795
+ - The function to call when a general message is received.
761
796
 
762
797
  #### Method requestCertificates
763
798
 
@@ -768,6 +803,7 @@ an initial handshake or message has been exchanged.
768
803
  ```ts
769
804
  async requestCertificates(certificatesToRequest: RequestedCertificateSet, identityKey?: string, maxWaitTime = 10000): Promise<void>
770
805
  ```
806
+
771
807
  See also: [RequestedCertificateSet](./auth.md#interface-requestedcertificateset)
772
808
 
773
809
  Returns
@@ -776,12 +812,12 @@ Resolves if the certificate request message is successfully sent.
776
812
 
777
813
  Argument Details
778
814
 
779
- + **certificatesToRequest**
780
- + Specifies the certifiers and types of certificates required from the peer.
781
- + **identityKey**
782
- + The identity public key of the peer. If not provided, the current or last session identity is used.
783
- + **maxWaitTime**
784
- + Maximum time in milliseconds to wait for the peer session to be authenticated.
815
+ - **certificatesToRequest**
816
+ - Specifies the certifiers and types of certificates required from the peer.
817
+ - **identityKey**
818
+ - The identity public key of the peer. If not provided, the current or last session identity is used.
819
+ - **maxWaitTime**
820
+ - Maximum time in milliseconds to wait for the peer session to be authenticated.
785
821
 
786
822
  Throws
787
823
 
@@ -794,14 +830,15 @@ Sends a certificate response message containing the specified certificates to a
794
830
  ```ts
795
831
  async sendCertificateResponse(verifierIdentityKey: string, certificates: VerifiableCertificate[]): Promise<void>
796
832
  ```
833
+
797
834
  See also: [VerifiableCertificate](./auth.md#class-verifiablecertificate)
798
835
 
799
836
  Argument Details
800
837
 
801
- + **verifierIdentityKey**
802
- + The identity key of the peer requesting the certificates.
803
- + **certificates**
804
- + The list of certificates to include in the response.
838
+ - **verifierIdentityKey**
839
+ - The identity key of the peer requesting the certificates.
840
+ - **certificates**
841
+ - The list of certificates to include in the response.
805
842
 
806
843
  Throws
807
844
 
@@ -817,8 +854,8 @@ stopListeningForCertificatesReceived(callbackID: number): void
817
854
 
818
855
  Argument Details
819
856
 
820
- + **callbackID**
821
- + The ID of the certificates received callback to cancel.
857
+ - **callbackID**
858
+ - The ID of the certificates received callback to cancel.
822
859
 
823
860
  #### Method stopListeningForCertificatesRequested
824
861
 
@@ -830,8 +867,8 @@ stopListeningForCertificatesRequested(callbackID: number): void
830
867
 
831
868
  Argument Details
832
869
 
833
- + **callbackID**
834
- + The ID of the requested certificates callback to cancel.
870
+ - **callbackID**
871
+ - The ID of the requested certificates callback to cancel.
835
872
 
836
873
  #### Method stopListeningForGeneralMessages
837
874
 
@@ -843,8 +880,8 @@ stopListeningForGeneralMessages(callbackID: number): void
843
880
 
844
881
  Argument Details
845
882
 
846
- + **callbackID**
847
- + The ID of the callback to remove.
883
+ - **callbackID**
884
+ - The ID of the callback to remove.
848
885
 
849
886
  #### Method toPeer
850
887
 
@@ -856,12 +893,12 @@ async toPeer(message: number[], identityKey?: string, maxWaitTime?: number): Pro
856
893
 
857
894
  Argument Details
858
895
 
859
- + **message**
860
- + The message payload to send.
861
- + **identityKey**
862
- + The identity public key of the peer. If not provided, uses lastInteractedWithPeer (if any).
863
- + **maxWaitTime**
864
- + optional max wait time in ms
896
+ - **message**
897
+ - The message payload to send.
898
+ - **identityKey**
899
+ - The identity public key of the peer. If not provided, uses lastInteractedWithPeer (if any).
900
+ - **maxWaitTime**
901
+ - optional max wait time in ms
865
902
 
866
903
  Throws
867
904
 
@@ -870,6 +907,7 @@ Will throw an error if the message fails to send.
870
907
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
871
908
 
872
909
  ---
910
+
873
911
  ### Class: SessionManager
874
912
 
875
913
  Manages sessions for peers, allowing multiple concurrent sessions
@@ -899,18 +937,20 @@ allowing multiple concurrent sessions for the same peer.
899
937
  ```ts
900
938
  addSession(session: PeerSession): void
901
939
  ```
940
+
902
941
  See also: [PeerSession](./auth.md#interface-peersession)
903
942
 
904
943
  Argument Details
905
944
 
906
- + **session**
907
- + The peer session to add.
945
+ - **session**
946
+ - The peer session to add.
908
947
 
909
948
  #### Method getSession
910
949
 
911
950
  Retrieves a session based on a given identifier, which can be:
912
- - A sessionNonce, or
913
- - A peerIdentityKey.
951
+
952
+ - A sessionNonce, or
953
+ - A peerIdentityKey.
914
954
 
915
955
  If it is a `sessionNonce`, returns that exact session.
916
956
  If it is a `peerIdentityKey`, returns the "best" (e.g. most recently updated,
@@ -919,6 +959,7 @@ authenticated) session associated with that peer, if any.
919
959
  ```ts
920
960
  getSession(identifier: string): PeerSession | undefined
921
961
  ```
962
+
922
963
  See also: [PeerSession](./auth.md#interface-peersession)
923
964
 
924
965
  Returns
@@ -927,8 +968,8 @@ Returns
927
968
 
928
969
  Argument Details
929
970
 
930
- + **identifier**
931
- + The identifier for the session (sessionNonce or peerIdentityKey).
971
+ - **identifier**
972
+ - The identifier for the session (sessionNonce or peerIdentityKey).
932
973
 
933
974
  #### Method hasSession
934
975
 
@@ -944,8 +985,8 @@ Returns
944
985
 
945
986
  Argument Details
946
987
 
947
- + **identifier**
948
- + The identifier to check.
988
+ - **identifier**
989
+ - The identifier to check.
949
990
 
950
991
  #### Method removeSession
951
992
 
@@ -954,12 +995,13 @@ Removes a session from the manager by clearing all associated identifiers.
954
995
  ```ts
955
996
  removeSession(session: PeerSession): void
956
997
  ```
998
+
957
999
  See also: [PeerSession](./auth.md#interface-peersession)
958
1000
 
959
1001
  Argument Details
960
1002
 
961
- + **session**
962
- + The peer session to remove.
1003
+ - **session**
1004
+ - The peer session to remove.
963
1005
 
964
1006
  #### Method updateSession
965
1007
 
@@ -969,16 +1011,18 @@ ensuring we record the latest data (e.g., isAuthenticated, lastUpdate, etc.).
969
1011
  ```ts
970
1012
  updateSession(session: PeerSession): void
971
1013
  ```
1014
+
972
1015
  See also: [PeerSession](./auth.md#interface-peersession)
973
1016
 
974
1017
  Argument Details
975
1018
 
976
- + **session**
977
- + The peer session to update.
1019
+ - **session**
1020
+ - The peer session to update.
978
1021
 
979
1022
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
980
1023
 
981
1024
  ---
1025
+
982
1026
  ### Class: SimplifiedFetchTransport
983
1027
 
984
1028
  Implements an HTTP-specific transport for handling Peer mutual authentication messages.
@@ -1013,10 +1057,10 @@ constructor(baseUrl: string, fetchClient = defaultFetch)
1013
1057
 
1014
1058
  Argument Details
1015
1059
 
1016
- + **baseUrl**
1017
- + The base URL for all HTTP requests made by this transport.
1018
- + **fetchClient**
1019
- + A fetch implementation to use for HTTP requests (default: global fetch).
1060
+ - **baseUrl**
1061
+ - The base URL for all HTTP requests made by this transport.
1062
+ - **fetchClient**
1063
+ - A fetch implementation to use for HTTP requests (default: global fetch).
1020
1064
 
1021
1065
  #### Method deserializeRequestPayload
1022
1066
 
@@ -1039,17 +1083,18 @@ URL postfix (path and query string), headers, body, and request ID.
1039
1083
 
1040
1084
  Argument Details
1041
1085
 
1042
- + **payload**
1043
- + The serialized payload to deserialize.
1086
+ - **payload**
1087
+ - The serialized payload to deserialize.
1044
1088
 
1045
1089
  #### Method onData
1046
1090
 
1047
- Registers a callback to handle incoming messages.
1091
+ Registers a callback to handle incoming messages.
1048
1092
  This must be called before sending any messages to ensure responses can be processed.
1049
1093
 
1050
1094
  ```ts
1051
1095
  async onData(callback: (message: AuthMessage) => Promise<void>): Promise<void>
1052
1096
  ```
1097
+
1053
1098
  See also: [AuthMessage](./auth.md#interface-authmessage)
1054
1099
 
1055
1100
  Returns
@@ -1058,8 +1103,8 @@ A promise that resolves once the callback is set.
1058
1103
 
1059
1104
  Argument Details
1060
1105
 
1061
- + **callback**
1062
- + A function to invoke when an incoming AuthMessage is received.
1106
+ - **callback**
1107
+ - A function to invoke when an incoming AuthMessage is received.
1063
1108
 
1064
1109
  #### Method send
1065
1110
 
@@ -1071,6 +1116,7 @@ the message is sent as a POST request to the `/auth` endpoint.
1071
1116
  ```ts
1072
1117
  async send(message: AuthMessage): Promise<void>
1073
1118
  ```
1119
+
1074
1120
  See also: [AuthMessage](./auth.md#interface-authmessage)
1075
1121
 
1076
1122
  Returns
@@ -1079,8 +1125,8 @@ A promise that resolves when the message is successfully sent.
1079
1125
 
1080
1126
  Argument Details
1081
1127
 
1082
- + **message**
1083
- + The AuthMessage to send.
1128
+ - **message**
1129
+ - The AuthMessage to send.
1084
1130
 
1085
1131
  Throws
1086
1132
 
@@ -1089,6 +1135,7 @@ Will throw an error if no listener has been registered via `onData`.
1089
1135
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
1090
1136
 
1091
1137
  ---
1138
+
1092
1139
  ### Class: VerifiableCertificate
1093
1140
 
1094
1141
  VerifiableCertificate extends the Certificate class, adding functionality to manage a verifier-specific keyring.
@@ -1120,6 +1167,7 @@ Decrypts selectively revealed certificate fields using the provided keyring and
1120
1167
  ```ts
1121
1168
  async decryptFields(verifierWallet: ProtoWallet, privileged?: boolean, privilegedReason?: string): Promise<Record<CertificateFieldNameUnder50Bytes, string>>
1122
1169
  ```
1170
+
1123
1171
  See also: [CertificateFieldNameUnder50Bytes](./wallet.md#type-certificatefieldnameunder50bytes), [ProtoWallet](./wallet.md#class-protowallet)
1124
1172
 
1125
1173
  Returns
@@ -1128,12 +1176,12 @@ Returns
1128
1176
 
1129
1177
  Argument Details
1130
1178
 
1131
- + **verifierWallet**
1132
- + The wallet instance of the certificate's verifier, used to decrypt field keys.
1133
- + **privileged**
1134
- + Whether this is a privileged request.
1135
- + **privilegedReason**
1136
- + Reason provided for privileged access, required if this is a privileged operation.
1179
+ - **verifierWallet**
1180
+ - The wallet instance of the certificate's verifier, used to decrypt field keys.
1181
+ - **privileged**
1182
+ - Whether this is a privileged request.
1183
+ - **privilegedReason**
1184
+ - Reason provided for privileged access, required if this is a privileged operation.
1137
1185
 
1138
1186
  Throws
1139
1187
 
@@ -1144,6 +1192,7 @@ Throws an error if any of the decryption operations fail, with a message indicat
1144
1192
  ```ts
1145
1193
  static fromCertificate(certificate: WalletCertificate, keyring: Record<CertificateFieldNameUnder50Bytes, string>): VerifiableCertificate
1146
1194
  ```
1195
+
1147
1196
  See also: [CertificateFieldNameUnder50Bytes](./wallet.md#type-certificatefieldnameunder50bytes), [VerifiableCertificate](./auth.md#class-verifiablecertificate), [WalletCertificate](./wallet.md#interface-walletcertificate)
1148
1197
 
1149
1198
  Returns
@@ -1153,14 +1202,15 @@ original certificate data plus the supplied keyring.
1153
1202
 
1154
1203
  Argument Details
1155
1204
 
1156
- + **certificate**
1157
- + – The source certificate that was issued and signed by the certifier.
1158
- + **keyring**
1159
- + – A allows the verifier to decrypt selected certificate fields.
1205
+ - **certificate**
1206
+ - – The source certificate that was issued and signed by the certifier.
1207
+ - **keyring**
1208
+ - – A allows the verifier to decrypt selected certificate fields.
1160
1209
 
1161
1210
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
1162
1211
 
1163
1212
  ---
1213
+
1164
1214
  ## Functions
1165
1215
 
1166
1216
  | |
@@ -1188,12 +1238,13 @@ A random nonce derived with a wallet
1188
1238
 
1189
1239
  Argument Details
1190
1240
 
1191
- + **counterparty**
1192
- + The counterparty to the nonce creation. Defaults to 'self'.
1241
+ - **counterparty**
1242
+ - The counterparty to the nonce creation. Defaults to 'self'.
1193
1243
 
1194
1244
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
1195
1245
 
1196
1246
  ---
1247
+
1197
1248
  ### Function: verifyNonce
1198
1249
 
1199
1250
  Verifies a nonce derived from a wallet
@@ -1210,14 +1261,15 @@ The status of the validation
1210
1261
 
1211
1262
  Argument Details
1212
1263
 
1213
- + **nonce**
1214
- + A nonce to verify as a base64 string.
1215
- + **counterparty**
1216
- + The counterparty to the nonce creation. Defaults to 'self'.
1264
+ - **nonce**
1265
+ - A nonce to verify as a base64 string.
1266
+ - **counterparty**
1267
+ - The counterparty to the nonce creation. Defaults to 'self'.
1217
1268
 
1218
1269
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
1219
1270
 
1220
1271
  ---
1272
+
1221
1273
  ## Types
1222
1274
 
1223
1275
  ## Enums
@@ -1257,6 +1309,7 @@ See also: [RequestedCertificateSet](./auth.md#interface-requestedcertificateset)
1257
1309
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
1258
1310
 
1259
1311
  ---
1312
+
1260
1313
  ### Variable: validateCertificates
1261
1314
 
1262
1315
  ```ts