@did-btcr2/method 0.20.0 → 0.23.0

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 (113) hide show
  1. package/README.md +223 -1
  2. package/dist/browser.js +2566 -3507
  3. package/dist/browser.mjs +2566 -3507
  4. package/dist/cjs/core/beacon/aggregation/cohort/index.js +13 -2
  5. package/dist/cjs/core/beacon/aggregation/cohort/index.js.map +1 -1
  6. package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js +7 -2
  7. package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js.map +1 -1
  8. package/dist/cjs/core/beacon/aggregation/communication/adapter/did-comm.js +5 -10
  9. package/dist/cjs/core/beacon/aggregation/communication/adapter/did-comm.js.map +1 -1
  10. package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js +4 -7
  11. package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -1
  12. package/dist/cjs/core/beacon/aggregation/session/index.js +15 -3
  13. package/dist/cjs/core/beacon/aggregation/session/index.js.map +1 -1
  14. package/dist/cjs/core/beacon/cas-beacon.js +1 -1
  15. package/dist/cjs/core/beacon/cas-beacon.js.map +1 -1
  16. package/dist/cjs/core/beacon/signal-discovery.js +6 -6
  17. package/dist/cjs/core/beacon/signal-discovery.js.map +1 -1
  18. package/dist/cjs/core/beacon/singleton.js +18 -20
  19. package/dist/cjs/core/beacon/singleton.js.map +1 -1
  20. package/dist/cjs/core/beacon/smt-beacon.js +1 -1
  21. package/dist/cjs/core/beacon/smt-beacon.js.map +1 -1
  22. package/dist/cjs/core/identifier.js +11 -13
  23. package/dist/cjs/core/identifier.js.map +1 -1
  24. package/dist/cjs/core/resolve.js +52 -49
  25. package/dist/cjs/core/resolve.js.map +1 -1
  26. package/dist/cjs/core/update.js +3 -4
  27. package/dist/cjs/core/update.js.map +1 -1
  28. package/dist/cjs/did-btcr2.js +36 -35
  29. package/dist/cjs/did-btcr2.js.map +1 -1
  30. package/dist/cjs/utils/did-document-builder.js +0 -6
  31. package/dist/cjs/utils/did-document-builder.js.map +1 -1
  32. package/dist/cjs/utils/did-document.js +44 -26
  33. package/dist/cjs/utils/did-document.js.map +1 -1
  34. package/dist/esm/core/beacon/aggregation/cohort/index.js +13 -2
  35. package/dist/esm/core/beacon/aggregation/cohort/index.js.map +1 -1
  36. package/dist/esm/core/beacon/aggregation/cohort/messages/base.js +7 -2
  37. package/dist/esm/core/beacon/aggregation/cohort/messages/base.js.map +1 -1
  38. package/dist/esm/core/beacon/aggregation/communication/adapter/did-comm.js +5 -10
  39. package/dist/esm/core/beacon/aggregation/communication/adapter/did-comm.js.map +1 -1
  40. package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js +4 -7
  41. package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -1
  42. package/dist/esm/core/beacon/aggregation/session/index.js +15 -3
  43. package/dist/esm/core/beacon/aggregation/session/index.js.map +1 -1
  44. package/dist/esm/core/beacon/cas-beacon.js +1 -1
  45. package/dist/esm/core/beacon/cas-beacon.js.map +1 -1
  46. package/dist/esm/core/beacon/signal-discovery.js +6 -6
  47. package/dist/esm/core/beacon/signal-discovery.js.map +1 -1
  48. package/dist/esm/core/beacon/singleton.js +18 -20
  49. package/dist/esm/core/beacon/singleton.js.map +1 -1
  50. package/dist/esm/core/beacon/smt-beacon.js +1 -1
  51. package/dist/esm/core/beacon/smt-beacon.js.map +1 -1
  52. package/dist/esm/core/identifier.js +11 -13
  53. package/dist/esm/core/identifier.js.map +1 -1
  54. package/dist/esm/core/resolve.js +52 -49
  55. package/dist/esm/core/resolve.js.map +1 -1
  56. package/dist/esm/core/update.js +3 -4
  57. package/dist/esm/core/update.js.map +1 -1
  58. package/dist/esm/did-btcr2.js +36 -35
  59. package/dist/esm/did-btcr2.js.map +1 -1
  60. package/dist/esm/utils/did-document-builder.js +0 -6
  61. package/dist/esm/utils/did-document-builder.js.map +1 -1
  62. package/dist/esm/utils/did-document.js +44 -26
  63. package/dist/esm/utils/did-document.js.map +1 -1
  64. package/dist/types/core/beacon/aggregation/cohort/index.d.ts +1 -1
  65. package/dist/types/core/beacon/aggregation/cohort/index.d.ts.map +1 -1
  66. package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts +1 -1
  67. package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts.map +1 -1
  68. package/dist/types/core/beacon/aggregation/communication/adapter/did-comm.d.ts.map +1 -1
  69. package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts.map +1 -1
  70. package/dist/types/core/beacon/aggregation/session/index.d.ts +1 -1
  71. package/dist/types/core/beacon/aggregation/session/index.d.ts.map +1 -1
  72. package/dist/types/core/beacon/beacon.d.ts +3 -3
  73. package/dist/types/core/beacon/beacon.d.ts.map +1 -1
  74. package/dist/types/core/beacon/cas-beacon.d.ts +3 -3
  75. package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -1
  76. package/dist/types/core/beacon/signal-discovery.d.ts +5 -5
  77. package/dist/types/core/beacon/signal-discovery.d.ts.map +1 -1
  78. package/dist/types/core/beacon/singleton.d.ts +4 -4
  79. package/dist/types/core/beacon/singleton.d.ts.map +1 -1
  80. package/dist/types/core/beacon/smt-beacon.d.ts +3 -3
  81. package/dist/types/core/beacon/smt-beacon.d.ts.map +1 -1
  82. package/dist/types/core/identifier.d.ts +17 -21
  83. package/dist/types/core/identifier.d.ts.map +1 -1
  84. package/dist/types/core/interfaces.d.ts +2 -2
  85. package/dist/types/core/interfaces.d.ts.map +1 -1
  86. package/dist/types/core/resolve.d.ts +10 -7
  87. package/dist/types/core/resolve.d.ts.map +1 -1
  88. package/dist/types/core/update.d.ts +2 -2
  89. package/dist/types/core/update.d.ts.map +1 -1
  90. package/dist/types/did-btcr2.d.ts +12 -8
  91. package/dist/types/did-btcr2.d.ts.map +1 -1
  92. package/dist/types/utils/did-document-builder.d.ts +0 -1
  93. package/dist/types/utils/did-document-builder.d.ts.map +1 -1
  94. package/dist/types/utils/did-document.d.ts +14 -9
  95. package/dist/types/utils/did-document.d.ts.map +1 -1
  96. package/package.json +8 -8
  97. package/src/core/beacon/aggregation/cohort/index.ts +13 -2
  98. package/src/core/beacon/aggregation/cohort/messages/base.ts +7 -2
  99. package/src/core/beacon/aggregation/communication/adapter/did-comm.ts +5 -12
  100. package/src/core/beacon/aggregation/communication/adapter/nostr.ts +5 -8
  101. package/src/core/beacon/aggregation/session/index.ts +15 -3
  102. package/src/core/beacon/beacon.ts +3 -3
  103. package/src/core/beacon/cas-beacon.ts +3 -3
  104. package/src/core/beacon/signal-discovery.ts +9 -9
  105. package/src/core/beacon/singleton.ts +21 -23
  106. package/src/core/beacon/smt-beacon.ts +3 -3
  107. package/src/core/identifier.ts +31 -28
  108. package/src/core/interfaces.ts +2 -2
  109. package/src/core/resolve.ts +73 -62
  110. package/src/core/update.ts +5 -5
  111. package/src/did-btcr2.ts +47 -43
  112. package/src/utils/did-document-builder.ts +0 -7
  113. package/src/utils/did-document.ts +54 -31
@@ -1,4 +1,4 @@
1
- import { BitcoinNetworkConnection } from '@did-btcr2/bitcoin';
1
+ import { BitcoinConnection } from '@did-btcr2/bitcoin';
2
2
  import { KeyBytes } from '@did-btcr2/common';
3
3
  import { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
4
4
  import { SidecarData } from '../types.js';
@@ -8,7 +8,7 @@ import { BeaconService, BeaconSignal, BlockMetadata } from './interfaces.js';
8
8
  * Implements {@link https://dcdpr.github.io/did-btcr2/terminology.html#singleton-beacon | Singleton Beacon}.
9
9
  * @class SingletonBeacon
10
10
  * @type {SingletonBeacon}
11
- * @extends {AggregateBeacon}
11
+ * @extends {Beacon}
12
12
  */
13
13
  export declare class SingletonBeacon extends Beacon {
14
14
  /**
@@ -27,9 +27,9 @@ export declare class SingletonBeacon extends Beacon {
27
27
  * Broadcasts a SingletonBeacon signal to the Bitcoin network.
28
28
  * @param {SignedBTCR2Update} signedUpdate The signed BTCR2 update to broadcast.
29
29
  * @param {KeyBytes} secretKey The secret key for signing the Bitcoin transaction.
30
- * @param {BitcoinNetworkConnection} bitcoin The Bitcoin network connection.
30
+ * @param {BitcoinConnection} bitcoin The Bitcoin network connection.
31
31
  * @returns {Promise<SignedBTCR2Update>} The signed update that was broadcast.
32
32
  * @throws {SingletonBeaconError} if the bitcoin address is invalid or unfunded.
33
33
  */
34
- broadcastSignal(signedUpdate: SignedBTCR2Update, secretKey: KeyBytes, bitcoin: BitcoinNetworkConnection): Promise<SignedBTCR2Update>;
34
+ broadcastSignal(signedUpdate: SignedBTCR2Update, secretKey: KeyBytes, bitcoin: BitcoinConnection): Promise<SignedBTCR2Update>;
35
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"singleton.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/singleton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAwB,QAAQ,EAAuB,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAM3D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7E;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,MAAM;IAEzC;;;;OAIG;gBACS,OAAO,EAAE,aAAa;IAIlC;;;;OAIG;IACG,cAAc,CAClB,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC;IA0CrD;;;;;;;OAOG;IACG,eAAe,CACnB,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,iBAAiB,CAAC;CAsE9B"}
1
+ {"version":3,"file":"singleton.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/singleton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAA0C,QAAQ,EAAuB,MAAM,mBAAmB,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAI3D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7E;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,MAAM;IAEzC;;;;OAIG;gBACS,OAAO,EAAE,aAAa;IAIlC;;;;OAIG;IACG,cAAc,CAClB,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC;IA0CrD;;;;;;;OAOG;IACG,eAAe,CACnB,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,iBAAiB,CAAC;CAsE9B"}
@@ -1,4 +1,4 @@
1
- import { BitcoinNetworkConnection } from '@did-btcr2/bitcoin';
1
+ import { BitcoinConnection } from '@did-btcr2/bitcoin';
2
2
  import { KeyBytes } from '@did-btcr2/common';
3
3
  import { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
4
4
  import { SidecarData } from '../types.js';
@@ -28,9 +28,9 @@ export declare class SMTBeacon extends Beacon {
28
28
  * Broadcast CAS Beacon signal to the Bitcoin network.
29
29
  * @param {SignedBTCR2Update} signedUpdate The signed BTCR2 update to broadcast.
30
30
  * @param {KeyBytes} secretKey The secret key for signing the Bitcoin transaction.
31
- * @param {BitcoinNetworkConnection} bitcoin The Bitcoin network connection.
31
+ * @param {BitcoinConnection} bitcoin The Bitcoin network connection.
32
32
  * @return {Promise<SignedBTCR2Update>} The signed update that was broadcasted.
33
33
  * @throws {SMTBeaconError} if broadcasting fails.
34
34
  */
35
- broadcastSignal(signedUpdate: SignedBTCR2Update, secretKey: KeyBytes, bitcoin: BitcoinNetworkConnection): Promise<SignedBTCR2Update>;
35
+ broadcastSignal(signedUpdate: SignedBTCR2Update, secretKey: KeyBytes, bitcoin: BitcoinConnection): Promise<SignedBTCR2Update>;
36
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"smt-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/smt-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7E;;;;;GAKG;AACH,qBAAa,SAAU,SAAQ,MAAM;IACnC;;;OAGG;gBACS,OAAO,EAAE,aAAa;IAIlC;;;;;;OAMG;IACH,cAAc,CACZ,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC;IAIrD;;;;;;;OAOG;IACG,eAAe,CACnB,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,iBAAiB,CAAC;CAG9B"}
1
+ {"version":3,"file":"smt-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/smt-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7E;;;;;GAKG;AACH,qBAAa,SAAU,SAAQ,MAAM;IACnC;;;OAGG;gBACS,OAAO,EAAE,aAAa;IAIlC;;;;;;OAMG;IACH,cAAc,CACZ,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC;IAIrD;;;;;;;OAOG;IACG,eAAe,CACnB,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,iBAAiB,CAAC;CAG9B"}
@@ -1,16 +1,23 @@
1
- import { Bytes } from '@did-btcr2/common';
2
- import { SchnorrKeyPair } from '@did-btcr2/keypair';
1
+ import { Bytes, DocumentBytes, KeyBytes, SchnorrKeyPairObject } from '@did-btcr2/common';
2
+ import { DidCreateOptions } from '../did-btcr2.js';
3
3
  /**
4
4
  * Components of a did:btcr2 identifier.
5
5
  * @interface DidComponents
6
+ * @extends {IdentifierComponents}
6
7
  * @property {string} hrp The human-readable part of the Bech32m encoding.
8
+ */
9
+ export interface DidComponents extends IdentifierComponents {
10
+ hrp: string;
11
+ }
12
+ /**
13
+ * Components of a did:btcr2 identifier.
14
+ * @interface IdentifierComponents
7
15
  * @property {string} idType Identifier type (key or external).
8
16
  * @property {number} version Identifier version.
9
- * @property {string | number} network Bitcoin network name or number.
17
+ * @property {string} network Bitcoin network name or number.
10
18
  * @property {Bytes} genesisBytes Public key or an intermediate document bytes.
11
19
  */
12
- export interface DidComponents {
13
- hrp: string;
20
+ export interface IdentifierComponents {
14
21
  idType: string;
15
22
  version: number;
16
23
  network: string;
@@ -38,19 +45,11 @@ export declare class Identifier {
38
45
  * - a key-value representing a secp256k1 public key; or
39
46
  * - a hash-value representing the hash of an initiating external DID document.
40
47
  *
41
- * @param {DidComponents} params See {@link DidComponents} for details.
42
- * @param {IdentifierTypes} params.idType Identifier type (key or external).
43
- * @param {string} params.network Bitcoin network name.
44
- * @param {number} params.version Identifier version.
45
- * @param {KeyBytes | DocumentBytes} params.genesisBytes Public key or an intermediate document bytes.
48
+ * @param {KeyBytes | DocumentBytes} genesisBytes The genesis bytes (public key or document bytes).
49
+ * @param {DidCreateOptions} options The DID creation options.
46
50
  * @returns {string} The new did:btcr2 identifier.
47
51
  */
48
- static encode({ idType, version, network, genesisBytes }: {
49
- idType: string;
50
- version: number;
51
- network: string;
52
- genesisBytes: Bytes;
53
- }): string;
52
+ static encode(genesisBytes: KeyBytes | DocumentBytes, options: DidCreateOptions): string;
54
53
  /**
55
54
  * Implements {@link https://dcdpr.github.io/did-btcr2/#didbtcr2-identifier-decoding | 3.3 did:btcr2 Identifier Decoding}.
56
55
  * @param {string} identifier The BTCR2 DID to be parsed
@@ -65,11 +64,8 @@ export declare class Identifier {
65
64
  * @returns {string} The new did:btcr2 identifier.
66
65
  */
67
66
  static generate(): {
68
- keys: SchnorrKeyPair;
69
- identifier: {
70
- controller: string;
71
- id: string;
72
- };
67
+ keyPair: SchnorrKeyPairObject;
68
+ did: string;
73
69
  };
74
70
  /**
75
71
  * Validates a did:btcr2 identifier.
@@ -1 +1 @@
1
- {"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../../../src/core/identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,K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ACf;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,KAAK,CAAC;CACvB;AACD;;;;;;;;;;GAUG;AACH,qBAAa,UAAU;IACrB;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,QAAQ,GAAG,aAAa,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM;IAuFxF;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa;IA8HhD;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI;QAAE,OAAO,EAAE,oBAAoB,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;IAYjE;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;CAQ5C"}
@@ -1,4 +1,4 @@
1
- import { BitcoinNetworkConnection } from '@did-btcr2/bitcoin';
1
+ import { BitcoinConnection } from '@did-btcr2/bitcoin';
2
2
  import { DidResolutionOptions } from '@web5/dids';
3
3
  import { Sidecar } from './types.js';
4
4
  export interface RootCapability {
@@ -39,7 +39,7 @@ export interface ResolutionOptions extends ResolutionOptionsCore {
39
39
  * Drivers for interacting with external systems, such as the Bitcoin network.
40
40
  */
41
41
  drivers?: {
42
- bitcoin?: BitcoinNetworkConnection;
42
+ bitcoin?: BitcoinConnection;
43
43
  };
44
44
  }
45
45
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/core/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEr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AAoB;IACjE;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D;;OAEG;IACH,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,iBAAiB,CAAC;KAC7B,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB"}
@@ -1,4 +1,4 @@
1
- import { BitcoinNetworkConnection } from '@did-btcr2/bitcoin';
1
+ import { BitcoinConnection } from '@did-btcr2/bitcoin';
2
2
  import { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
3
3
  import { DidDocument } from '../utils/did-document.js';
4
4
  import { BeaconService, BlockMetadata } from './beacon/interfaces.js';
@@ -8,10 +8,13 @@ import { Sidecar, SidecarData } from './types.js';
8
8
  * The response object for DID Resolution.
9
9
  */
10
10
  export interface DidResolutionResponse {
11
- currentDocument: DidDocument;
12
- confirmations: number;
13
- versionId: string;
14
- updated: string;
11
+ didDocument: DidDocument;
12
+ metadata: {
13
+ confirmations?: number;
14
+ versionId: string;
15
+ updated?: string;
16
+ deactivated?: boolean;
17
+ };
15
18
  }
16
19
  /**
17
20
  * Implements {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html | 7.2 Resolve}.
@@ -58,10 +61,10 @@ export declare class Resolve {
58
61
  * Signal Bytes (last output in OP_RETURN transaction).
59
62
  * @param {Array<BeaconService>} beaconServices The array of BeaconService objects to search for signals.
60
63
  * @param {SidecarData} sidecarData The sidecar data containing maps of updates, CAS announcements, and SMT proofs.
61
- * @param {BitcoinNetworkConnection} bitcoin The bitcoin network connection used to fetch beacon signals
64
+ * @param {BitcoinConnection} bitcoin The bitcoin network connection used to fetch beacon signals
62
65
  * @returns {Promise<Array<[SignedBTCR2Update, BlockMetadata]>>} The array of BTCR2 Signed Updates announced by the Beacon Signals.
63
66
  */
64
- static beaconSignals(beaconServices: Array<BeaconService>, sidecarData: SidecarData, bitcoin: BitcoinNetworkConnection): Promise<Array<[SignedBTCR2Update, BlockMetadata]>>;
67
+ static beaconSignals(beaconServices: Array<BeaconService>, sidecarData: SidecarData, bitcoin: BitcoinConnection): Promise<Array<[SignedBTCR2Update, BlockMetadata]>>;
65
68
  /**
66
69
  * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process-updates | 7.2.f Process updates Array}.
67
70
  * @param {DidDocument} currentDocument The current DID Document to apply the updates to.
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/core/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EAEzB,MAAM,oBAAoB,CAAC;AAa5B,OAAO,EAIL,iBAAiB,EAElB,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EAAE,WAAW,EAAwB,MAAM,0BAA0B,CAAC;AAE7E,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGtE,OAAO,EAAE,aAAa,EAAc,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EAAmB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,eAAe,EAAE,WAAW,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;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,CAAC,CAAC,EAC1D,WAAW,CAAC,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,qBAAqB,CAAC;IA0GjC;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,IAAI;IAmBrF;;;;;;OAMG;WACU,WAAW,CACtB,eAAe,EAAE,WAAW,EAC5B,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,WAAW,CAAC;CAiFxB"}
@@ -2,7 +2,7 @@ import { KeyBytes, PatchOperation } from '@did-btcr2/common';
2
2
  import { SignedBTCR2Update, UnsignedBTCR2Update } from '@did-btcr2/cryptosuite';
3
3
  import { Btcr2DidDocument, DidVerificationMethod } from '../utils/did-document.js';
4
4
  import { BeaconService } from './beacon/interfaces.js';
5
- import { BitcoinNetworkConnection } from '@did-btcr2/bitcoin';
5
+ import { BitcoinConnection } from '@did-btcr2/bitcoin';
6
6
  /**
7
7
  * Implements {@link https://dcdpr.github.io/did-btcr2/operations/update.html | 7.3 Update}.
8
8
  *
@@ -47,5 +47,5 @@ export declare class Update {
47
47
  * @returns {SignedBTCR2Update} The SignedBTCR2Update object containing data to validate the Beacon Signal
48
48
  * @throws {UpdateError} if the beaconService type is invalid
49
49
  */
50
- static announce(beaconService: BeaconService, update: SignedBTCR2Update, secretKey: KeyBytes, bitcoin: BitcoinNetworkConnection): Promise<SignedBTCR2Update>;
50
+ static announce(beaconService: BeaconService, update: SignedBTCR2Update, secretKey: KeyBytes, bitcoin: BitcoinConnection): Promise<SignedBTCR2Update>;
51
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/core/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,QAAQ,EACR,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAGL,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,wBAAwB,CA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AE,MAAM,GACtB,OAAO,CAAC,mBAAmB,CAAC;IAoC/B;;;;;;;;;OASG;WACU,IAAI,CACf,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,mBAAmB,EACnC,kBAAkB,EAAE,qBAAqB,EACzC,SAAS,EAAE,QAAQ,GAClB,OAAO,CAAC,iBAAiB,CAAC;IAgC7B;;;;;;;;OAQG;WACU,QAAQ,CACnB,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,iBAAiB,EACzB,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,iBAAiB,CAAC;CAU9B"}
@@ -1,14 +1,13 @@
1
- import { BitcoinNetworkConnection } from '@did-btcr2/bitcoin';
2
- import { Canonicalization, DocumentBytes, HexString, KeyBytes, PatchOperation } from '@did-btcr2/common';
1
+ import { BitcoinConnection } from '@did-btcr2/bitcoin';
2
+ import { DocumentBytes, HexString, KeyBytes, PatchOperation } from '@did-btcr2/common';
3
3
  import { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
4
4
  import { DidMethod, DidResolutionResult } from '@web5/dids';
5
5
  import { ResolutionOptions } from './core/interfaces.js';
6
6
  import { Btcr2DidDocument, DidVerificationMethod } from './utils/did-document.js';
7
- export declare const canonicalization: Canonicalization;
8
7
  export type Btcr2Identifier = string;
9
8
  export interface DidCreateOptions {
10
9
  /** Type of identifier to create (key or external) */
11
- idType: 'KEY' | 'EXTERNAL';
10
+ idType: string;
12
11
  /** DID BTCR2 Version Number */
13
12
  version?: number;
14
13
  /** Bitcoin Network */
@@ -42,8 +41,13 @@ export declare class DidBtcr2 implements DidMethod {
42
41
  * @param {string} options.network The Bitcoin network to use for the identifier, e.g. 'bitcoin', 'testnet', etc. Defaults to 'bitcoin'.
43
42
  * @returns {Promise<Btcr2Identifier>} Promise resolving to a Btcr2Identifier string.
44
43
  * @throws {MethodError} if any of the checks fail
44
+ * @example
45
+ * ```ts
46
+ * const genesisBytes = SchnorrKeyPair.generate().publicKey.compressed;
47
+ * const did = DidBtcr2.create(genesisBytes, { idType: 'KEY', network: 'regtest' });
48
+ * ```
45
49
  */
46
- static create(genesisBytes: KeyBytes | DocumentBytes, options?: DidCreateOptions): Promise<Btcr2Identifier>;
50
+ static create(genesisBytes: KeyBytes | DocumentBytes, options?: DidCreateOptions): Btcr2Identifier;
47
51
  /**
48
52
  * Entry point for section {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html | 7.2 Resolve}.
49
53
  * See specification for the {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process | Resolve Process}.
@@ -61,7 +65,7 @@ export declare class DidBtcr2 implements DidMethod {
61
65
  * @example
62
66
  * ```ts
63
67
  * const resolution = await DidBtcr2.resolve(
64
- * 'did:btcr2:k1q0dygyp3gz969tp46dychzy4q78c2k3js68kvyr0shanzg67jnuez2cfplh'
68
+ * 'did:btcr2:k1qgpr45cheptyjekl3cex80xfnkwhxnlclecwwf92gvdjrszm2uwhzlcxu5xte'
65
69
  * )
66
70
  * ```
67
71
  */
@@ -81,7 +85,7 @@ export declare class DidBtcr2 implements DidMethod {
81
85
  * @param {string} params.verificationMethodId The verificationMethod ID to sign the update with.
82
86
  * @param {string} params.beaconId The beacon ID associated with the update.
83
87
  * @param {KeyBytes | HexString} [params.signingMaterial] Optional signing material (key bytes or hex string).
84
- * @param {BitcoinNetworkConnection} [params.bitcoin] Optional Bitcoin network connection for announcing the update. If not provided, a default connection will be initialized.
88
+ * @param {BitcoinConnection} [params.bitcoin] Optional Bitcoin network connection for announcing the update. If not provided, a default connection will be initialized.
85
89
  * @return {Promise<SignedBTCR2Update>} Promise resolving to the signed BTCR2 update.
86
90
  * @throws {UpdateError} if no verificationMethod, verificationMethod type is not `Multikey` or the publicKeyMultibase
87
91
  * header is not `zQ3s`
@@ -93,7 +97,7 @@ export declare class DidBtcr2 implements DidMethod {
93
97
  verificationMethodId: string;
94
98
  beaconId: string;
95
99
  signingMaterial?: KeyBytes | HexString;
96
- bitcoin?: BitcoinNetworkConnection;
100
+ bitcoin?: BitcoinConnection;
97
101
  }): Promise<SignedBTCR2Update>;
98
102
  /**
99
103
  * Given the W3C DID Document of a `did:btcr2` identifier, return the signing verification method that will be used
@@ -1 +1 @@
1
- {"version":3,"file":"did-btcr2.d.ts","sourceRoot":"","sources":["../../src/did-btcr2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,SAAS,EAIT,QAAQ,EAIR,cAAc,EAGf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAIL,SAAS,EACT,mBAAmB,EAEpB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGlF,eAAO,MAAM,gBAAgB,kBAAyB,CAAC;AAEvD,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AAErC,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,MAAM,EAAE,KAAK,GAAG,UAAU,CAAC;IAC3B,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAMD;;;;;;;;;;;;GAYG;AACH,qBAAa,QAAS,YAAW,SAAS;IACxC;;OAEG;IACH,MAAM,CAAC,UAAU,EAAE,MAAM,CAAW;IAEpC;;;;;;;;;;OAUG;WACU,MAAM,CACjB,YAAY,EAAE,QAAQ,GAAG,aAAa,EACtC,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,eAAe,CAAC;IAe3B;;;;;;;;;;;;;;;;;;;;OAoBG;WACU,OAAO,CAClB,GAAG,EAAE,MAAM,EACX,iBAAiB,GAAE,iBAAmC,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AsB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAMD;;;;;;;;;;;;GAYG;AACH,qBAAa,QAAS,YAAW,SAAS;IACxC;;OAEG;IACH,MAAM,CAAC,UAAU,EAAE,MAAM,CAAW;IAEpC;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,QAAQ,GAAG,aAAa,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,eAAe;IAelG;;;;;;;;;;;;;;;;;;;;OAoBG;WACU,OAAO,CAClB,GAAG,EAAE,MAAM,EACX,iBAAiB,GAAE,iBAAsB,GACxC,OAAO,CAAC,mBAAmB,CAAC;IAyG/B;;;;;;;;;;;;;;;;;;;OAmBG;WACU,MAAM,CAAC,EAClB,cAAc,EACd,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,eAAe,EACf,OAAO,GACR,EAAE;QACD,cAAc,EAAE,gBAAgB,CAAC;QACjC,OAAO,EAAE,cAAc,EAAE,CAAC;QAC1B,eAAe,EAAE,MAAM,CAAC;QACxB,oBAAoB,EAAE,MAAM,CAAC;QAC7B,QAAQ,EAAE,MAAM,CAAC;QACjB,eAAe,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;QACvC,OAAO,CAAC,EAAE,iBAAiB,CAAC;KAC7B,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAqF9B;;;;;;;;;OASG;IACH,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,gBAAgB,EAAG,QAAQ,CAAC,EAAE,MAAM,GAAG,qBAAqB;CA0BlG"}
@@ -8,7 +8,6 @@ import { DidDocument, DidVerificationMethod } from './did-document.js';
8
8
  export declare class DidDocumentBuilder {
9
9
  private document;
10
10
  constructor(initialDocument: Partial<DidDocument>);
11
- withController(controller?: Array<string>): this;
12
11
  withAuthentication(authentication: Array<string | DidVerificationMethod>): this;
13
12
  withAssertionMethod(assertionMethod: Array<string | DidVerificationMethod>): this;
14
13
  withCapabilityInvocation(capabilityInvocation: Array<string | DidVerificationMethod>): this;
@@ -1 +1 @@
1
- {"version":3,"file":"did-document-builder.d.ts","sourceRoot":"","sources":["../../../src/utils/did-document-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAEvE;;;;GAIG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAA4B;gBAEhC,eAAe,EAAE,OAAO,CAAC,WAAW,CAAC;IAYjD,cAAc,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI;IAOhD,kBAAkB,CAAC,cAAc,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,GAAG,IAAI;IAO/E,mBAAmB,CAAC,eAAe,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,GAAG,IAAI;IAOjF,wBAAwB,CAAC,oBAAoB,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,GAAG,IAAI;IAO3F,wBAAwB,CAAC,oBAAoB,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,GAAG,IAAI;IAO3F,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,IAAI;IAOhD,KAAK,IAAI,WAAW;CAWrB"}
1
+ {"version":3,"file":"did-document-builder.d.ts","sourceRoot":"","sources":["../../../src/utils/did-document-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAEvE;;;;GAIG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAA4B;gBAEhC,eAAe,EAAE,OAAO,CAAC,WAAW,CAAC;IAYjD,kBAAkB,CAAC,cAAc,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,GAAG,IAAI;IAO/E,mBAAmB,CAAC,eAAe,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,GAAG,IAAI;IAOjF,wBAAwB,CAAC,oBAAoB,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,GAAG,IAAI;IAO3F,wBAAwB,CAAC,oBAAoB,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,GAAG,IAAI;IAO3F,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,IAAI;IAOhD,KAAK,IAAI,WAAW;CAWrB"}
@@ -1,4 +1,4 @@
1
- import { JSONObject, KeyBytes } from '@did-btcr2/common';
1
+ import { HashBytes, JSONObject, KeyBytes } from '@did-btcr2/common';
2
2
  import { DidDocument as W3CDidDocument, DidVerificationMethod as W3CDidVerificationMethod } from '@web5/dids';
3
3
  import { BeaconService } from '../core/beacon/interfaces.js';
4
4
  export declare const ID_PLACEHOLDER_VALUE = "did:btcr2:_";
@@ -19,8 +19,9 @@ export type VerificationRelationships = {
19
19
  capabilityInvocation?: Array<string | DidVerificationMethod>;
20
20
  capabilityDelegation?: Array<string | DidVerificationMethod>;
21
21
  };
22
- /** Loose type for unvalidated DID document-like input objects. */
22
+ /** Loose type for unvalidated DID / Genesis document-like input objects. */
23
23
  export type DidDocumentLike = Partial<Btcr2DidDocument>;
24
+ export type GenesisDocumentLike = Partial<Btcr2DidDocument>;
24
25
  export interface Btcr2VerificationMethod extends W3CDidVerificationMethod {
25
26
  id: string;
26
27
  type: string;
@@ -48,7 +49,6 @@ export declare class DidVerificationMethod implements Btcr2VerificationMethod {
48
49
  * @type {Btcr2DidDocument}
49
50
  * @extends {W3CDidDocument}
50
51
  * @property {string} id - The identifier of the DID Document.
51
- * @property {Array<string>} [controller] - The controller of the DID Document.
52
52
  * @property {Array<string | JSONObject>} ['@context'] - The context of the DID Document.
53
53
  * @property {Array<DidVerificationMethod>} verificationMethod - The verification methods of the DID Document.
54
54
  * @property {Array<string | DidVerificationMethod>} [authentication] - The authentication methods of the DID Document.
@@ -59,7 +59,6 @@ export declare class DidVerificationMethod implements Btcr2VerificationMethod {
59
59
  */
60
60
  export interface Btcr2DidDocument extends W3CDidDocument {
61
61
  id: string;
62
- controller?: Array<string>;
63
62
  '@context'?: Array<string | JSONObject>;
64
63
  verificationMethod: Array<DidVerificationMethod>;
65
64
  authentication?: Array<string | DidVerificationMethod>;
@@ -67,6 +66,7 @@ export interface Btcr2DidDocument extends W3CDidDocument {
67
66
  capabilityInvocation?: Array<string | DidVerificationMethod>;
68
67
  capabilityDelegation?: Array<string | DidVerificationMethod>;
69
68
  service: Array<BeaconService>;
69
+ deactivated?: boolean;
70
70
  }
71
71
  /**
72
72
  * BTCR2 DID Document extends the DidDocument class adding helper methods and properties
@@ -74,7 +74,6 @@ export interface Btcr2DidDocument extends W3CDidDocument {
74
74
  * @type {DidDocument}
75
75
  * @implements {Btcr2DidDocument}
76
76
  * @property {string} id - The identifier of the DID Document.
77
- * @property {Array<string>} [controller] - The controller of the DID Document.
78
77
  * @property {Array<string | JSONObject>} ['@context'] - The context of the DID Document.
79
78
  * @property {Array<DidVerificationMethod>} verificationMethod - The verification methods of the DID Document.
80
79
  * @property {Array<string | DidVerificationMethod>} [authentication] - The authentication methods of the DID Document.
@@ -82,10 +81,10 @@ export interface Btcr2DidDocument extends W3CDidDocument {
82
81
  * @property {Array<string | DidVerificationMethod>} [capabilityInvocation] - The capability invocation methods of the DID Document.
83
82
  * @property {Array<string | DidVerificationMethod>} [capabilityDelegation] - The capability delegation methods of the DID Document.
84
83
  * @property {Array<BeaconService>} service - The services of the DID Document.
84
+ * @property {boolean} [deactivated] - Indicates if the DID Document is deactivated.
85
85
  */
86
86
  export declare class DidDocument implements Btcr2DidDocument {
87
87
  id: string;
88
- controller?: Array<string>;
89
88
  '@context'?: Array<string | JSONObject>;
90
89
  verificationMethod: Array<DidVerificationMethod>;
91
90
  authentication?: Array<string | DidVerificationMethod>;
@@ -94,12 +93,12 @@ export declare class DidDocument implements Btcr2DidDocument {
94
93
  capabilityDelegation?: Array<string | DidVerificationMethod>;
95
94
  service: Array<BeaconService>;
96
95
  deactivated?: boolean;
97
- constructor(document: Btcr2DidDocument);
96
+ constructor(document: DidDocumentLike);
98
97
  /**
99
98
  * Convert the DidDocument to a JSON object.
100
99
  * @returns {DidDocument} The JSON representation of the DidDocument.
101
100
  */
102
- json(): DidDocument;
101
+ toJSON(): DidDocumentLike;
103
102
  /**
104
103
  * Create a minimal DidDocument from "k1" btcr2 identifier.
105
104
  * @param {string} publicKeyMultibase The public key in multibase format.
@@ -194,7 +193,7 @@ export declare class Document {
194
193
  * @extends {DidDocument}
195
194
  */
196
195
  export declare class GenesisDocument extends DidDocument {
197
- constructor(document: object | DidDocument);
196
+ constructor(document: DidDocumentLike);
198
197
  /**
199
198
  * Convert the GenesisDocument to a DidDocument by replacing the placeholder value with the provided DID.
200
199
  * @param did The DID to replace the placeholder value in the document.
@@ -227,4 +226,10 @@ export declare class GenesisDocument extends DidDocument {
227
226
  * @returns {DidDocument} The created DidDocument.
228
227
  */
229
228
  static fromJSON(object: object | DidDocument): GenesisDocument;
229
+ /**
230
+ * Convert a GenesisDocument to genesis bytes.
231
+ * @param {GenesisDocument} genesisDocument The GenesisDocument to convert.
232
+ * @returns {Bytes} The genesis bytes.
233
+ */
234
+ static toGenesisBytes(genesisDocument: GenesisDocumentLike): HashBytes;
230
235
  }
@@ -1 +1 @@
1
- {"version":3,"file":"did-document.d.ts","sourceRoot":"","sources":["../../../src/utils/did-document.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,UAAU,EAEV,QAAQ,EACT,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,IAAI,cAAc,EAAE,qBAAqB,IAAI,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAC9G,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AA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AAC,GAC5B,eAAe;IAIlB;;;;OAIG;WACW,aAAa,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,eAAe;IA4BlF;;;;OAIG;WACW,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,eAAe;IAIrE;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,eAAe,EAAE,mBAAmB,GAAG,SAAS;CAGvE"}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@did-btcr2/method",
3
- "version": "0.20.0",
3
+ "version": "0.23.0",
4
4
  "type": "module",
5
- "description": "Javascript/TypeScript reference implementation of did:btcr2 method, a censorship resistant DID Method using the Bitcoin blockchain as a Verifiable Data Registry to announce changes to the DID document. Core package of the did-btcr2-js monorepo.",
5
+ "description": "Reference implementation for the did:btcr2 DID method written in TypeScript and JavaScript. did:btcr2 is a censorship resistant DID Method using the Bitcoin blockchain as a Verifiable Data Registry to announce changes to the DID document. This is the core method implementation for the did-btcr2-js monorepo.",
6
6
  "main": "./dist/cjs/index.js",
7
7
  "module": "./dist/esm/index.js",
8
8
  "types": "./dist/types/index.d.ts",
@@ -83,11 +83,10 @@
83
83
  "multiformats": "^13.3.1",
84
84
  "nostr-tools": "^2.15.0",
85
85
  "tiny-secp256k1": "^2.2.3",
86
- "@did-btcr2/cryptosuite": "5.0.0",
87
- "@did-btcr2/bitcoin": "0.3.4",
88
- "@did-btcr2/kms": "0.2.0",
89
- "@did-btcr2/common": "3.1.0",
90
- "@did-btcr2/keypair": "0.9.0"
86
+ "@did-btcr2/bitcoin": "0.4.0",
87
+ "@did-btcr2/cryptosuite": "6.0.0",
88
+ "@did-btcr2/keypair": "0.10.0",
89
+ "@did-btcr2/common": "5.0.0"
91
90
  },
92
91
  "devDependencies": {
93
92
  "@eslint/js": "^9.22.0",
@@ -95,7 +94,7 @@
95
94
  "@types/chai-as-promised": "^8.0.1",
96
95
  "@types/eslint": "^9.6.1",
97
96
  "@types/mocha": "^10.0.9",
98
- "@types/node": "^22.5.4",
97
+ "@types/node": "^25.3.0",
99
98
  "@typescript-eslint/eslint-plugin": "^8.5.0",
100
99
  "@typescript-eslint/parser": "^8.5.0",
101
100
  "c8": "^10.1.2",
@@ -138,6 +137,7 @@
138
137
  "build:test": "pnpm build && pnpm build:tests && pnpm c8 mocha",
139
138
  "build:lint:test": "pnpm build && pnpm build:tests && pnpm lint:fix",
140
139
  "prepublish": "pnpm build",
140
+ "generate:vector": "pnpm tsx lib/generate-vector.ts",
141
141
  "do": "pnpm tsx",
142
142
  "do:lib": "${PWD}/lib/run-lib.sh",
143
143
  "pack:local": "pnpm pack && mv *.tgz ./release"
@@ -286,7 +286,18 @@ export class AggregateBeaconCohort implements BeaconCohort {
286
286
  * Converts the cohort instance to a JSON object representation.
287
287
  * @returns {BeaconCohort} The JSON object representation of the cohort.
288
288
  */
289
- public json(): BeaconCohort {
290
- return Object.fromEntries(Object.entries(this)) as BeaconCohort;
289
+ public toJSON(): BeaconCohort {
290
+ return {
291
+ id : this.id,
292
+ coordinatorDid : this.coordinatorDid,
293
+ minParticipants : this.minParticipants,
294
+ status : this.status,
295
+ network : this.network,
296
+ pendingSignatureRequests : this.pendingSignatureRequests,
297
+ participants : this.participants,
298
+ cohortKeys : this.cohortKeys,
299
+ trMerkleRoot : this.trMerkleRoot,
300
+ beaconAddress : this.beaconAddress,
301
+ };
291
302
  }
292
303
  }
@@ -40,7 +40,12 @@ export class BaseMessage {
40
40
  * Converts a BaseMessage to a JSON object.
41
41
  * @returns {Base} The JSON representation of the BaseMessage.
42
42
  */
43
- public json(): Base {
44
- return Object.fromEntries(Object.entries(this)) as Base;
43
+ public toJSON(): Base {
44
+ return {
45
+ type : this.type,
46
+ to : this.to,
47
+ from : this.from,
48
+ body : this.body
49
+ };
45
50
  }
46
51
  }
@@ -34,12 +34,7 @@ export class DidCommAdapterConfig implements ServiceAdapterConfig {
34
34
  idType : 'KEY',
35
35
  network : 'mutinynet'
36
36
  };
37
- this.did = config?.did || Identifier.encode(
38
- {
39
- ...this.components,
40
- genesisBytes : this.keys.public
41
- }
42
- );
37
+ this.did = config?.did || Identifier.encode(this.keys.public, this.components);
43
38
  this.coordinatorDids = config?.coordinatorDids || [];
44
39
  }
45
40
  }
@@ -128,24 +123,22 @@ export class DidCommAdapter implements CommunicationService {
128
123
  if(!keys) {
129
124
  this.config.keys.secret = Secp256k1SecretKey.random();
130
125
  this.config.keys.public = Secp256k1SecretKey.getPublicKey(this.config.keys.secret).compressed;
131
- this.config.did = Identifier.encode(
126
+ this.config.did = Identifier.encode(this.config.keys.public,
132
127
  {
133
128
  idType : this.config.components.idType || 'KEY',
134
129
  version : this.config.components.version || 1,
135
- network : this.config.components.network || 'signet',
136
- genesisBytes : this.config.keys.public
130
+ network : this.config.components.network || 'regtest',
137
131
  }
138
132
  );
139
133
  return this.config as ServiceAdapterConfig;
140
134
  }
141
135
 
142
136
  this.config.keys = keys;
143
- this.config.did = Identifier.encode(
137
+ this.config.did = Identifier.encode(this.config.keys.public,
144
138
  {
145
139
  idType : this.config.components.idType || 'KEY',
146
140
  version : this.config.components.version || 1,
147
- network : this.config.components.network || 'signet',
148
- genesisBytes : this.config.keys.public
141
+ network : this.config.components.network || 'regtest',
149
142
  }
150
143
  );
151
144
  return this.config as ServiceAdapterConfig;
@@ -93,11 +93,10 @@ export class NostrAdapter implements CommunicationService {
93
93
  constructor(config: NostrAdapterConfig = { keys: {} as RawSchnorrKeyPair, components: {}, relays: DEFAULT_NOSTR_RELAYS }) {
94
94
  this.config = config;
95
95
  this.config.keys = this.config.keys || SchnorrKeyPair.generate().raw;
96
- this.config.did = config.did || Identifier.encode({
97
- idType : config.components.idType || 'KEY',
96
+ this.config.did = config.did || Identifier.encode(this.config.keys.public!, {
97
+ idType : config.components.idType || 'KEY',
98
98
  version : config.components.version || 1,
99
- network : config.components.network || 'signet',
100
- genesisBytes : this.config.keys.public!
99
+ network : config.components.network || 'signet'
101
100
  });
102
101
  }
103
102
 
@@ -297,24 +296,22 @@ export class NostrAdapter implements CommunicationService {
297
296
  if(!keys) {
298
297
  this.config.keys.secret = Secp256k1SecretKey.random();
299
298
  this.config.keys.public = Secp256k1SecretKey.getPublicKey(this.config.keys.secret).compressed;
300
- this.config.did = Identifier.encode(
299
+ this.config.did = Identifier.encode(this.config.keys.public,
301
300
  {
302
301
  idType : this.config.components.idType || 'KEY',
303
302
  version : this.config.components.version || 1,
304
303
  network : this.config.components.network || 'signet',
305
- genesisBytes : this.config.keys.public
306
304
  }
307
305
  );
308
306
  return this.config as ServiceAdapterConfig;
309
307
  }
310
308
 
311
309
  this.config.keys = keys;
312
- this.config.did = Identifier.encode(
310
+ this.config.did = Identifier.encode(this.config.keys.public,
313
311
  {
314
312
  idType : this.config.components.idType || 'KEY',
315
313
  version : this.config.components.version || 1,
316
314
  network : this.config.components.network || 'signet',
317
- genesisBytes : this.config.keys.public
318
315
  }
319
316
  );
320
317
  return this.config as ServiceAdapterConfig;