@bsv/sdk 1.3.4 → 1.3.6

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 (98) hide show
  1. package/dist/cjs/package.json +1 -1
  2. package/dist/cjs/src/auth/Peer.js +1 -1
  3. package/dist/cjs/src/auth/Peer.js.map +1 -1
  4. package/dist/cjs/src/auth/certificates/Certificate.js +25 -6
  5. package/dist/cjs/src/auth/certificates/Certificate.js.map +1 -1
  6. package/dist/cjs/src/auth/certificates/MasterCertificate.js +99 -17
  7. package/dist/cjs/src/auth/certificates/MasterCertificate.js.map +1 -1
  8. package/dist/cjs/src/auth/certificates/VerifiableCertificate.js +3 -4
  9. package/dist/cjs/src/auth/certificates/VerifiableCertificate.js.map +1 -1
  10. package/dist/cjs/src/auth/certificates/__tests/CompletedProtoWallet.js +80 -0
  11. package/dist/cjs/src/auth/certificates/__tests/CompletedProtoWallet.js.map +1 -0
  12. package/dist/cjs/src/auth/certificates/index.js +1 -0
  13. package/dist/cjs/src/auth/certificates/index.js.map +1 -1
  14. package/dist/cjs/src/auth/utils/index.js +0 -1
  15. package/dist/cjs/src/auth/utils/index.js.map +1 -1
  16. package/dist/cjs/src/wallet/CachedKeyDeriver.js.map +1 -1
  17. package/dist/cjs/src/wallet/KeyDeriver.js +3 -2
  18. package/dist/cjs/src/wallet/KeyDeriver.js.map +1 -1
  19. package/dist/cjs/src/wallet/ProtoWallet.js.map +1 -1
  20. package/dist/cjs/src/wallet/WalletClient.js.map +1 -1
  21. package/dist/cjs/src/wallet/index.js +2 -3
  22. package/dist/cjs/src/wallet/index.js.map +1 -1
  23. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  24. package/dist/esm/src/auth/Peer.js +1 -1
  25. package/dist/esm/src/auth/Peer.js.map +1 -1
  26. package/dist/esm/src/auth/certificates/Certificate.js +25 -6
  27. package/dist/esm/src/auth/certificates/Certificate.js.map +1 -1
  28. package/dist/esm/src/auth/certificates/MasterCertificate.js +100 -18
  29. package/dist/esm/src/auth/certificates/MasterCertificate.js.map +1 -1
  30. package/dist/esm/src/auth/certificates/VerifiableCertificate.js +3 -4
  31. package/dist/esm/src/auth/certificates/VerifiableCertificate.js.map +1 -1
  32. package/dist/esm/src/auth/certificates/__tests/CompletedProtoWallet.js +76 -0
  33. package/dist/esm/src/auth/certificates/__tests/CompletedProtoWallet.js.map +1 -0
  34. package/dist/esm/src/auth/certificates/index.js +1 -0
  35. package/dist/esm/src/auth/certificates/index.js.map +1 -1
  36. package/dist/esm/src/auth/utils/index.js +0 -1
  37. package/dist/esm/src/auth/utils/index.js.map +1 -1
  38. package/dist/esm/src/wallet/CachedKeyDeriver.js.map +1 -1
  39. package/dist/esm/src/wallet/KeyDeriver.js +3 -2
  40. package/dist/esm/src/wallet/KeyDeriver.js.map +1 -1
  41. package/dist/esm/src/wallet/ProtoWallet.js.map +1 -1
  42. package/dist/esm/src/wallet/WalletClient.js.map +1 -1
  43. package/dist/esm/src/wallet/index.js +1 -1
  44. package/dist/esm/src/wallet/index.js.map +1 -1
  45. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  46. package/dist/types/src/auth/Peer.d.ts +1 -1
  47. package/dist/types/src/auth/Peer.d.ts.map +1 -1
  48. package/dist/types/src/auth/certificates/Certificate.d.ts +16 -3
  49. package/dist/types/src/auth/certificates/Certificate.d.ts.map +1 -1
  50. package/dist/types/src/auth/certificates/MasterCertificate.d.ts +46 -13
  51. package/dist/types/src/auth/certificates/MasterCertificate.d.ts.map +1 -1
  52. package/dist/types/src/auth/certificates/VerifiableCertificate.d.ts +1 -1
  53. package/dist/types/src/auth/certificates/VerifiableCertificate.d.ts.map +1 -1
  54. package/dist/types/src/auth/certificates/__tests/CompletedProtoWallet.d.ts +24 -0
  55. package/dist/types/src/auth/certificates/__tests/CompletedProtoWallet.d.ts.map +1 -0
  56. package/dist/types/src/auth/certificates/index.d.ts +1 -0
  57. package/dist/types/src/auth/certificates/index.d.ts.map +1 -1
  58. package/dist/types/src/auth/utils/index.d.ts +0 -1
  59. package/dist/types/src/auth/utils/index.d.ts.map +1 -1
  60. package/dist/types/src/wallet/CachedKeyDeriver.d.ts.map +1 -1
  61. package/dist/types/src/wallet/KeyDeriver.d.ts +5 -7
  62. package/dist/types/src/wallet/KeyDeriver.d.ts.map +1 -1
  63. package/dist/types/src/wallet/ProtoWallet.d.ts.map +1 -1
  64. package/dist/types/src/wallet/Wallet.interfaces.d.ts.map +1 -1
  65. package/dist/types/src/wallet/WalletClient.d.ts +1 -2
  66. package/dist/types/src/wallet/WalletClient.d.ts.map +1 -1
  67. package/dist/types/src/wallet/index.d.ts +1 -1
  68. package/dist/types/src/wallet/index.d.ts.map +1 -1
  69. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  70. package/dist/umd/bundle.js +1 -1
  71. package/docs/auth.md +111 -87
  72. package/docs/wallet.md +26 -97
  73. package/package.json +1 -1
  74. package/src/auth/Peer.ts +23 -23
  75. package/src/auth/__tests/Peer.test.ts +19 -27
  76. package/src/auth/certificates/Certificate.ts +31 -8
  77. package/src/auth/certificates/MasterCertificate.ts +134 -23
  78. package/src/auth/certificates/VerifiableCertificate.ts +6 -6
  79. package/src/auth/certificates/__tests/Certificate.test.ts +45 -7
  80. package/src/auth/certificates/__tests/CompletedProtoWallet.ts +101 -0
  81. package/src/auth/certificates/__tests/MasterCertificate.test.ts +273 -0
  82. package/src/auth/certificates/__tests/VerifiableCertificate.test.ts +117 -0
  83. package/src/auth/certificates/index.ts +2 -1
  84. package/src/auth/utils/index.ts +0 -1
  85. package/src/wallet/CachedKeyDeriver.ts +1 -2
  86. package/src/wallet/KeyDeriver.ts +18 -20
  87. package/src/wallet/ProtoWallet.ts +20 -20
  88. package/src/wallet/Wallet.interfaces.ts +8 -9
  89. package/src/wallet/WalletClient.ts +1 -2
  90. package/src/wallet/__tests/KeyDeriver.test.ts +2 -2
  91. package/src/wallet/index.ts +1 -1
  92. package/dist/cjs/src/auth/utils/certificateHelpers.js +0 -51
  93. package/dist/cjs/src/auth/utils/certificateHelpers.js.map +0 -1
  94. package/dist/esm/src/auth/utils/certificateHelpers.js +0 -47
  95. package/dist/esm/src/auth/utils/certificateHelpers.js.map +0 -1
  96. package/dist/types/src/auth/utils/certificateHelpers.d.ts +0 -26
  97. package/dist/types/src/auth/utils/certificateHelpers.d.ts.map +0 -1
  98. package/src/auth/utils/certificateHelpers.ts +0 -86
package/docs/auth.md CHANGED
@@ -97,6 +97,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
97
97
  | --- |
98
98
  | [AuthFetch](#class-authfetch) |
99
99
  | [Certificate](#class-certificate) |
100
+ | [CompletedProtoWallet](#class-completedprotowallet) |
100
101
  | [MasterCertificate](#class-mastercertificate) |
101
102
  | [Peer](#class-peer) |
102
103
  | [SessionManager](#class-sessionmanager) |
@@ -217,7 +218,7 @@ export default class Certificate {
217
218
  toBinary(includeSignature: boolean = true): number[]
218
219
  static fromBinary(bin: number[]): Certificate
219
220
  async verify(): Promise<boolean>
220
- async sign(certifier: ProtoWallet): Promise<void>
221
+ async sign(certifierWallet: ProtoWallet): Promise<void>
221
222
  }
222
223
  ```
223
224
 
@@ -339,13 +340,13 @@ Argument Details
339
340
  Signs the certificate using the provided certifier wallet.
340
341
 
341
342
  ```ts
342
- async sign(certifier: ProtoWallet): Promise<void>
343
+ async sign(certifierWallet: ProtoWallet): Promise<void>
343
344
  ```
344
345
  See also: [ProtoWallet](#class-protowallet)
345
346
 
346
347
  Argument Details
347
348
 
348
- + **certifier**
349
+ + **certifierWallet**
349
350
  + The wallet representing the certifier.
350
351
 
351
352
  #### Method toBinary
@@ -381,6 +382,37 @@ Returns
381
382
 
382
383
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
383
384
 
385
+ ---
386
+ ### Class: CompletedProtoWallet
387
+
388
+ ```ts
389
+ export class CompletedProtoWallet extends ProtoWallet implements Wallet {
390
+ constructor(rootKeyOrKeyDeriver: PrivateKey | "anyone" | KeyDeriverApi)
391
+ async getPublicKey(args: GetPublicKeyArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<{
392
+ publicKey: PubKeyHex;
393
+ }>
394
+ async createAction(args: CreateActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<CreateActionResult>
395
+ async signAction(args: SignActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<SignActionResult>
396
+ async abortAction(args: AbortActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<AbortActionResult>
397
+ async listActions(args: ListActionsArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<ListActionsResult>
398
+ async internalizeAction(args: InternalizeActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<InternalizeActionResult>
399
+ async listOutputs(args: ListOutputsArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<ListOutputsResult>
400
+ async relinquishOutput(args: RelinquishOutputArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<RelinquishOutputResult>
401
+ async acquireCertificate(args: AcquireCertificateArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<AcquireCertificateResult>
402
+ async listCertificates(args: ListCertificatesArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<ListCertificatesResult>
403
+ async proveCertificate(args: ProveCertificateArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<ProveCertificateResult>
404
+ async relinquishCertificate(args: RelinquishCertificateArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<RelinquishCertificateResult>
405
+ async discoverByIdentityKey(args: DiscoverByIdentityKeyArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<DiscoverCertificatesResult>
406
+ async discoverByAttributes(args: DiscoverByAttributesArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<DiscoverCertificatesResult>
407
+ async getHeight(args: {}, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<GetHeightResult>
408
+ async getHeaderForHeight(args: GetHeaderArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<GetHeaderResult>
409
+ }
410
+ ```
411
+
412
+ See also: [AbortActionArgs](#interface-abortactionargs), [AbortActionResult](#interface-abortactionresult), [AcquireCertificateArgs](#interface-acquirecertificateargs), [AcquireCertificateResult](#interface-acquirecertificateresult), [CreateActionArgs](#interface-createactionargs), [CreateActionResult](#interface-createactionresult), [DiscoverByAttributesArgs](#interface-discoverbyattributesargs), [DiscoverByIdentityKeyArgs](#interface-discoverbyidentitykeyargs), [DiscoverCertificatesResult](#interface-discovercertificatesresult), [GetHeaderArgs](#interface-getheaderargs), [GetHeaderResult](#interface-getheaderresult), [GetHeightResult](#interface-getheightresult), [GetPublicKeyArgs](#interface-getpublickeyargs), [InternalizeActionArgs](#interface-internalizeactionargs), [InternalizeActionResult](#interface-internalizeactionresult), [KeyDeriverApi](#interface-keyderiverapi), [ListActionsArgs](#interface-listactionsargs), [ListActionsResult](#interface-listactionsresult), [ListCertificatesArgs](#interface-listcertificatesargs), [ListCertificatesResult](#interface-listcertificatesresult), [ListOutputsArgs](#interface-listoutputsargs), [ListOutputsResult](#interface-listoutputsresult), [OriginatorDomainNameStringUnder250Bytes](#type-originatordomainnamestringunder250bytes), [PrivateKey](#class-privatekey), [ProtoWallet](#class-protowallet), [ProveCertificateArgs](#interface-provecertificateargs), [ProveCertificateResult](#interface-provecertificateresult), [PubKeyHex](#type-pubkeyhex), [RelinquishCertificateArgs](#interface-relinquishcertificateargs), [RelinquishCertificateResult](#interface-relinquishcertificateresult), [RelinquishOutputArgs](#interface-relinquishoutputargs), [RelinquishOutputResult](#interface-relinquishoutputresult), [SignActionArgs](#interface-signactionargs), [SignActionResult](#interface-signactionresult), [Wallet](#interface-wallet)
413
+
414
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
415
+
384
416
  ---
385
417
  ### Class: MasterCertificate
386
418
 
@@ -397,11 +429,13 @@ export class MasterCertificate extends Certificate {
397
429
  declare subject: PubKeyHex;
398
430
  declare certifier: PubKeyHex;
399
431
  declare revocationOutpoint: OutpointString;
400
- declare fields: Record<CertificateFieldNameUnder50Bytes, string>;
432
+ declare fields: Record<CertificateFieldNameUnder50Bytes, Base64String>;
401
433
  declare signature?: HexString;
402
- masterKeyring: Record<CertificateFieldNameUnder50Bytes, string>;
403
- constructor(type: Base64String, serialNumber: Base64String, subject: PubKeyHex, certifier: PubKeyHex, revocationOutpoint: OutpointString, fields: Record<CertificateFieldNameUnder50Bytes, string>, masterKeyring: Record<CertificateFieldNameUnder50Bytes, string>, signature?: HexString)
434
+ masterKeyring: Record<CertificateFieldNameUnder50Bytes, Base64String>;
435
+ constructor(type: Base64String, serialNumber: Base64String, subject: PubKeyHex, certifier: PubKeyHex, revocationOutpoint: OutpointString, fields: Record<CertificateFieldNameUnder50Bytes, Base64String>, masterKeyring: Record<CertificateFieldNameUnder50Bytes, Base64String>, signature?: HexString)
436
+ async decryptFields(subjectWallet: ProtoWallet): Promise<Record<CertificateFieldNameUnder50Bytes, string>>
404
437
  async createKeyringForVerifier(subjectWallet: ProtoWallet, verifierIdentityKey: string, fieldsToReveal: string[], originator?: string): Promise<Record<CertificateFieldNameUnder50Bytes, string>>
438
+ static async issueCertificateForSubject(certifierWallet: ProtoWallet, subject: string, fields: Record<CertificateFieldNameUnder50Bytes, string>, certificateType: string, getRevocationOutpoint = async (serialNumber: string): Promise<string> => { return "Certificate revocation not tracked."; }): Promise<MasterCertificate>
405
439
  }
406
440
  ```
407
441
 
@@ -413,10 +447,10 @@ See also: [Base64String](#type-base64string), [Certificate](#class-certificate),
413
447
 
414
448
  #### Method createKeyringForVerifier
415
449
 
416
- Creates a verifiable certificate structure for a specific verifier, allowing them access to specified fields.
417
- This method decrypts the master field keys for each field specified in `fieldsToReveal` and re-encrypts them
418
- for the verifier's identity key. The resulting certificate structure includes only the fields intended to be
419
- revealed and a verifier-specific keyring for field decryption.
450
+ Creates a keyring for a verifier, enabling them to decrypt specific certificate fields.
451
+ This method decrypts the master field keys for the specified fields and re-encrypts them
452
+ for the verifier's identity key. The result is a keyring containing the keys necessary
453
+ for the verifier to access the designated fields.
420
454
 
421
455
  ```ts
422
456
  async createKeyringForVerifier(subjectWallet: ProtoWallet, verifierIdentityKey: string, fieldsToReveal: string[], originator?: string): Promise<Record<CertificateFieldNameUnder50Bytes, string>>
@@ -425,7 +459,7 @@ See also: [CertificateFieldNameUnder50Bytes](#type-certificatefieldnameunder50by
425
459
 
426
460
  Returns
427
461
 
428
- - A new certificate structure containing the original encrypted fields, the verifier-specific field decryption keyring, and essential certificate metadata.
462
+ - A keyring mapping field names to encrypted field revelation keys, allowing the verifier to decrypt specified fields.
429
463
 
430
464
  Argument Details
431
465
 
@@ -441,9 +475,73 @@ Argument Details
441
475
  Throws
442
476
 
443
477
  Throws an error if:
444
- - fieldsToReveal is empty or a field in `fieldsToReveal` does not exist in the certificate.
478
+ - fieldsToReveal is not an array of strings.
479
+ - A field in `fieldsToReveal` does not exist in the certificate.
445
480
  - The decrypted master field key fails to decrypt the corresponding field (indicating an invalid key).
446
481
 
482
+ #### Method decryptFields
483
+
484
+ Decrypts all fields in the MasterCertificate using the subject's wallet.
485
+
486
+ This method uses the `masterKeyring` to decrypt each field's encryption key and then
487
+ decrypts the field values. The result is a record of plaintext field names and values.
488
+
489
+ ```ts
490
+ async decryptFields(subjectWallet: ProtoWallet): Promise<Record<CertificateFieldNameUnder50Bytes, string>>
491
+ ```
492
+ See also: [CertificateFieldNameUnder50Bytes](#type-certificatefieldnameunder50bytes), [ProtoWallet](#class-protowallet)
493
+
494
+ Returns
495
+
496
+ - A record of field names and their decrypted values in plaintext.
497
+
498
+ Argument Details
499
+
500
+ + **subjectWallet**
501
+ + The wallet of the subject, used to decrypt the master keyring and field values.
502
+
503
+ Throws
504
+
505
+ Throws an error if the `masterKeyring` is invalid or if decryption fails for any field.
506
+
507
+ #### Method issueCertificateForSubject
508
+
509
+ Issues a new MasterCertificate for a specified subject.
510
+
511
+ This method generates a certificate containing encrypted fields and a keyring
512
+ for the subject to decrypt all fields. Each field is encrypted with a randomly
513
+ generated symmetric key, which is then encrypted for the subject. The certificate
514
+ can also includes a revocation outpoint to manage potential revocation.
515
+
516
+ ```ts
517
+ static async issueCertificateForSubject(certifierWallet: ProtoWallet, subject: string, fields: Record<CertificateFieldNameUnder50Bytes, string>, certificateType: string, getRevocationOutpoint = async (serialNumber: string): Promise<string> => { return "Certificate revocation not tracked."; }): Promise<MasterCertificate>
518
+ ```
519
+ See also: [CertificateFieldNameUnder50Bytes](#type-certificatefieldnameunder50bytes), [MasterCertificate](#class-mastercertificate), [ProtoWallet](#class-protowallet)
520
+
521
+ Returns
522
+
523
+ - A signed MasterCertificate instance containing the encrypted fields and subject specific keyring.
524
+
525
+ Argument Details
526
+
527
+ + **certifierWallet**
528
+ + The wallet of the certifier, used to sign the certificate and encrypt field keys.
529
+ + **subject**
530
+ + The public identity key of the subject for whom the certificate is issued.
531
+ + **fields**
532
+ + Unencrypted certificate fields to include, with their names and values.
533
+ + **certificateType**
534
+ + The type of certificate being issued.
535
+ + **getRevocationOutpoint**
536
+ +
537
+ Optional function to obtain a revocation outpoint for the certificate. Defaults to a placeholder.
538
+ + **updateProgress**
539
+ + Optional callback for reporting progress updates during the operation. Defaults to a no-op.
540
+
541
+ Throws
542
+
543
+ Throws an error if any operation (e.g., encryption, signing) fails during certificate issuance.
544
+
447
545
  </details>
448
546
 
449
547
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
@@ -960,7 +1058,7 @@ See also: [Base64String](#type-base64string), [Certificate](#class-certificate),
960
1058
 
961
1059
  #### Method decryptFields
962
1060
 
963
- Decrypts certificate fields using the provided keyring and verifier wallet
1061
+ Decrypts selectively revealed certificate fields using the provided keyring and verifier wallet
964
1062
 
965
1063
  ```ts
966
1064
  async decryptFields(verifierWallet: Wallet): Promise<Record<CertificateFieldNameUnder50Bytes, string>>
@@ -989,51 +1087,13 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
989
1087
 
990
1088
  | |
991
1089
  | --- |
992
- | [createMasterCertificate](#function-createmastercertificate) |
993
1090
  | [createNonce](#function-createnonce) |
994
- | [createVerifiableCertificate](#function-createverifiablecertificate) |
995
1091
  | [verifyNonce](#function-verifynonce) |
996
1092
 
997
1093
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
998
1094
 
999
1095
  ---
1000
1096
 
1001
- ### Function: createMasterCertificate
1002
-
1003
- Creates a Master Certificate by encrypting provided fields and generating a master keyring.
1004
-
1005
- ```ts
1006
- export async function createMasterCertificate(wallet: ProtoWallet, fields: Record<string, string>, certificateType: string, certificateSerialNumber: string, certifierPublicKey: string): Promise<MasterCertificate>
1007
- ```
1008
-
1009
- See also: [MasterCertificate](#class-mastercertificate), [ProtoWallet](#class-protowallet)
1010
-
1011
- <details>
1012
-
1013
- <summary>Function createMasterCertificate Details</summary>
1014
-
1015
- Returns
1016
-
1017
- A promise resolving to the created Master Certificate.
1018
-
1019
- Argument Details
1020
-
1021
- + **wallet**
1022
- + The wallet instance used for encryption and public key retrieval.
1023
- + **fields**
1024
- + The certificate fields to encrypt.
1025
- + **certificateType**
1026
- + The type of the certificate being created.
1027
- + **certificateSerialNumber**
1028
- + The serial number of the certificate.
1029
- + **certifierPublicKey**
1030
- + The public key of the certifier.
1031
-
1032
- </details>
1033
-
1034
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
1035
-
1036
- ---
1037
1097
  ### Function: createNonce
1038
1098
 
1039
1099
  Creates a nonce derived from a privateKey
@@ -1056,42 +1116,6 @@ A random nonce derived with a wallet
1056
1116
 
1057
1117
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
1058
1118
 
1059
- ---
1060
- ### Function: createVerifiableCertificate
1061
-
1062
- Creates a Verifiable Certificate by signing a Master Certificate and generating a keyring for a verifier.
1063
-
1064
- ```ts
1065
- export async function createVerifiableCertificate(masterCertificate: MasterCertificate, wallet: ProtoWallet, verifierIdentityKey: string, fieldsToReveal: string[], certifierPrivateKey: PrivateKey): Promise<VerifiableCertificate>
1066
- ```
1067
-
1068
- See also: [MasterCertificate](#class-mastercertificate), [PrivateKey](#class-privatekey), [ProtoWallet](#class-protowallet), [VerifiableCertificate](#class-verifiablecertificate)
1069
-
1070
- <details>
1071
-
1072
- <summary>Function createVerifiableCertificate Details</summary>
1073
-
1074
- Returns
1075
-
1076
- A promise resolving to the created Verifiable Certificate.
1077
-
1078
- Argument Details
1079
-
1080
- + **masterCertificate**
1081
- + The master certificate to convert into a verifiable certificate.
1082
- + **wallet**
1083
- + The wallet instance used for generating a keyring for the verifier.
1084
- + **verifierIdentityKey**
1085
- + The identity key of the verifier.
1086
- + **fieldsToReveal**
1087
- + The list of fields to reveal to the verifier.
1088
- + **certifierPrivateKey**
1089
- + The private key of the certifier for signing the certificate.
1090
-
1091
- </details>
1092
-
1093
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
1094
-
1095
1119
  ---
1096
1120
  ### Function: verifyNonce
1097
1121
 
package/docs/wallet.md CHANGED
@@ -505,11 +505,11 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
505
505
  export interface KeyDeriverApi {
506
506
  rootKey: PrivateKey;
507
507
  identityKey: string;
508
- derivePublicKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty, forSelf?: boolean): PublicKey;
509
- derivePrivateKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty): PrivateKey;
510
- deriveSymmetricKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty): SymmetricKey;
511
- revealCounterpartySecret(counterparty: Counterparty): number[];
512
- revealSpecificSecret(counterparty: Counterparty, protocolID: WalletProtocol, keyID: string): number[];
508
+ derivePublicKey: (protocolID: WalletProtocol, keyID: string, counterparty: Counterparty, forSelf?: boolean) => PublicKey;
509
+ derivePrivateKey: (protocolID: WalletProtocol, keyID: string, counterparty: Counterparty) => PrivateKey;
510
+ deriveSymmetricKey: (protocolID: WalletProtocol, keyID: string, counterparty: Counterparty) => SymmetricKey;
511
+ revealCounterpartySecret: (counterparty: Counterparty) => number[];
512
+ revealSpecificSecret: (counterparty: Counterparty, protocolID: WalletProtocol, keyID: string) => number[];
513
513
  }
514
514
  ```
515
515
 
@@ -519,140 +519,69 @@ See also: [Counterparty](#type-counterparty), [PrivateKey](#class-privatekey), [
519
519
 
520
520
  <summary>Interface KeyDeriverApi Details</summary>
521
521
 
522
- #### Property identityKey
523
-
524
- The identity of this key deriver which is normally the public key associated with the `rootKey`
525
-
526
- ```ts
527
- identityKey: string
528
- ```
529
-
530
- #### Property rootKey
531
-
532
- The root key from which all other keys are derived.
533
-
534
- ```ts
535
- rootKey: PrivateKey
536
- ```
537
- See also: [PrivateKey](#class-privatekey)
538
-
539
- #### Method derivePrivateKey
522
+ #### Property derivePrivateKey
540
523
 
541
524
  Derives a private key based on protocol ID, key ID, and counterparty.
542
525
 
543
526
  ```ts
544
- derivePrivateKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty): PrivateKey
527
+ derivePrivateKey: (protocolID: WalletProtocol, keyID: string, counterparty: Counterparty) => PrivateKey
545
528
  ```
546
529
  See also: [Counterparty](#type-counterparty), [PrivateKey](#class-privatekey), [WalletProtocol](#type-walletprotocol)
547
530
 
548
- Returns
549
-
550
- - The derived private key.
551
-
552
- Argument Details
553
-
554
- + **protocolID**
555
- + The protocol ID including a security level and protocol name.
556
- + **keyID**
557
- + The key identifier.
558
- + **counterparty**
559
- + The counterparty's public key or a predefined value ('self' or 'anyone').
560
-
561
- #### Method derivePublicKey
531
+ #### Property derivePublicKey
562
532
 
563
533
  Derives a public key based on protocol ID, key ID, and counterparty.
564
534
 
565
535
  ```ts
566
- derivePublicKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty, forSelf?: boolean): PublicKey
536
+ derivePublicKey: (protocolID: WalletProtocol, keyID: string, counterparty: Counterparty, forSelf?: boolean) => PublicKey
567
537
  ```
568
538
  See also: [Counterparty](#type-counterparty), [PublicKey](#class-publickey), [WalletProtocol](#type-walletprotocol)
569
539
 
570
- Returns
571
-
572
- - The derived public key.
573
-
574
- Argument Details
575
-
576
- + **protocolID**
577
- + The protocol ID including a security level and protocol name.
578
- + **keyID**
579
- + The key identifier.
580
- + **counterparty**
581
- + The counterparty's public key or a predefined value ('self' or 'anyone').
582
- + **forSelf**
583
- + Optional. false if undefined. Whether deriving for self.
584
-
585
- #### Method deriveSymmetricKey
540
+ #### Property deriveSymmetricKey
586
541
 
587
542
  Derives a symmetric key based on protocol ID, key ID, and counterparty.
588
543
  Note: Symmetric keys should not be derivable by everyone due to security risks.
589
544
 
590
545
  ```ts
591
- deriveSymmetricKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty): SymmetricKey
546
+ deriveSymmetricKey: (protocolID: WalletProtocol, keyID: string, counterparty: Counterparty) => SymmetricKey
592
547
  ```
593
548
  See also: [Counterparty](#type-counterparty), [SymmetricKey](#class-symmetrickey), [WalletProtocol](#type-walletprotocol)
594
549
 
595
- Returns
596
-
597
- - The derived symmetric key.
598
-
599
- Argument Details
600
-
601
- + **protocolID**
602
- + The protocol ID including a security level and protocol name.
603
- + **keyID**
604
- + The key identifier.
605
- + **counterparty**
606
- + The counterparty's public key or a predefined value ('self' or 'anyone').
550
+ #### Property identityKey
607
551
 
608
- Throws
552
+ The identity of this key deriver which is normally the public key associated with the `rootKey`
609
553
 
610
- - Throws an error if attempting to derive a symmetric key for 'anyone'.
554
+ ```ts
555
+ identityKey: string
556
+ ```
611
557
 
612
- #### Method revealCounterpartySecret
558
+ #### Property revealCounterpartySecret
613
559
 
614
560
  Reveals the shared secret between the root key and the counterparty.
615
561
  Note: This should not be used for 'self'.
616
562
 
617
563
  ```ts
618
- revealCounterpartySecret(counterparty: Counterparty): number[]
564
+ revealCounterpartySecret: (counterparty: Counterparty) => number[]
619
565
  ```
620
566
  See also: [Counterparty](#type-counterparty)
621
567
 
622
- Returns
623
-
624
- - The shared secret as a number array.
625
-
626
- Argument Details
627
-
628
- + **counterparty**
629
- + The counterparty's public key or a predefined value ('self' or 'anyone').
630
-
631
- Throws
632
-
633
- - Throws an error if attempting to reveal a shared secret for 'self'.
634
-
635
- #### Method revealSpecificSecret
568
+ #### Property revealSpecificSecret
636
569
 
637
570
  Reveals the specific key association for a given protocol ID, key ID, and counterparty.
638
571
 
639
572
  ```ts
640
- revealSpecificSecret(counterparty: Counterparty, protocolID: WalletProtocol, keyID: string): number[]
573
+ revealSpecificSecret: (counterparty: Counterparty, protocolID: WalletProtocol, keyID: string) => number[]
641
574
  ```
642
575
  See also: [Counterparty](#type-counterparty), [WalletProtocol](#type-walletprotocol)
643
576
 
644
- Returns
645
-
646
- - The specific key association as a number array.
577
+ #### Property rootKey
647
578
 
648
- Argument Details
579
+ The root key from which all other keys are derived.
649
580
 
650
- + **counterparty**
651
- + The counterparty's public key or a predefined value ('self' or 'anyone').
652
- + **protocolID**
653
- + The protocol ID including a security level and protocol name.
654
- + **keyID**
655
- + The key identifier.
581
+ ```ts
582
+ rootKey: PrivateKey
583
+ ```
584
+ See also: [PrivateKey](#class-privatekey)
656
585
 
657
586
  </details>
658
587
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/sdk",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "type": "module",
5
5
  "description": "BSV Blockchain Software Development Kit",
6
6
  "main": "dist/cjs/mod.js",