@did-btcr2/method 0.15.0 → 0.16.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 (90) hide show
  1. package/dist/browser.js +228 -206
  2. package/dist/browser.mjs +228 -206
  3. package/dist/cjs/core/beacon/aggregation/protocol/nostr.js +4 -4
  4. package/dist/cjs/core/beacon/aggregation/protocol/nostr.js.map +1 -1
  5. package/dist/cjs/core/beacon/cid-aggregate.js +2 -2
  6. package/dist/cjs/core/beacon/singleton.js +2 -2
  7. package/dist/cjs/core/beacon/singleton.js.map +1 -1
  8. package/dist/cjs/core/crud/create.js +4 -4
  9. package/dist/cjs/core/crud/create.js.map +1 -1
  10. package/dist/cjs/core/crud/deactivate.js +4 -4
  11. package/dist/cjs/core/crud/deactivate.js.map +1 -1
  12. package/dist/cjs/core/crud/read.js +20 -20
  13. package/dist/cjs/core/crud/read.js.map +1 -1
  14. package/dist/cjs/core/crud/update.js +2 -2
  15. package/dist/cjs/core/crud/update.js.map +1 -1
  16. package/dist/cjs/core/key-manager/index.js +5 -5
  17. package/dist/cjs/core/key-manager/index.js.map +1 -1
  18. package/dist/cjs/did-btcr2.js +1 -1
  19. package/dist/cjs/utils/appendix.js +4 -4
  20. package/dist/cjs/utils/appendix.js.map +1 -1
  21. package/dist/cjs/utils/did-document-builder.js +1 -1
  22. package/dist/cjs/utils/did-document-builder.js.map +1 -1
  23. package/dist/cjs/utils/did-document.js +2 -2
  24. package/dist/cjs/utils/did-document.js.map +1 -1
  25. package/dist/cjs/utils/identifier.js +5 -5
  26. package/dist/cjs/utils/identifier.js.map +1 -1
  27. package/dist/esm/core/beacon/aggregation/protocol/nostr.js +4 -4
  28. package/dist/esm/core/beacon/aggregation/protocol/nostr.js.map +1 -1
  29. package/dist/esm/core/beacon/cid-aggregate.js +2 -2
  30. package/dist/esm/core/beacon/singleton.js +2 -2
  31. package/dist/esm/core/beacon/singleton.js.map +1 -1
  32. package/dist/esm/core/crud/create.js +4 -4
  33. package/dist/esm/core/crud/create.js.map +1 -1
  34. package/dist/esm/core/crud/deactivate.js +4 -4
  35. package/dist/esm/core/crud/deactivate.js.map +1 -1
  36. package/dist/esm/core/crud/read.js +20 -20
  37. package/dist/esm/core/crud/read.js.map +1 -1
  38. package/dist/esm/core/crud/update.js +2 -2
  39. package/dist/esm/core/crud/update.js.map +1 -1
  40. package/dist/esm/core/key-manager/index.js +5 -5
  41. package/dist/esm/core/key-manager/index.js.map +1 -1
  42. package/dist/esm/did-btcr2.js +1 -1
  43. package/dist/esm/utils/appendix.js +4 -4
  44. package/dist/esm/utils/appendix.js.map +1 -1
  45. package/dist/esm/utils/did-document-builder.js +1 -1
  46. package/dist/esm/utils/did-document-builder.js.map +1 -1
  47. package/dist/esm/utils/did-document.js +2 -2
  48. package/dist/esm/utils/did-document.js.map +1 -1
  49. package/dist/esm/utils/identifier.js +5 -5
  50. package/dist/esm/utils/identifier.js.map +1 -1
  51. package/dist/types/core/beacon/aggregation/protocol/nostr.d.ts +1 -1
  52. package/dist/types/core/beacon/cid-aggregate.d.ts +2 -2
  53. package/dist/types/core/crud/deactivate.d.ts +4 -4
  54. package/dist/types/core/crud/deactivate.d.ts.map +1 -1
  55. package/dist/types/core/crud/read.d.ts +4 -4
  56. package/dist/types/core/crud/read.d.ts.map +1 -1
  57. package/dist/types/core/key-manager/index.d.ts +6 -6
  58. package/dist/types/core/key-manager/index.d.ts.map +1 -1
  59. package/dist/types/core/key-manager/interface.d.ts +3 -3
  60. package/dist/types/core/key-manager/interface.d.ts.map +1 -1
  61. package/dist/types/did-btcr2.d.ts +1 -1
  62. package/dist/types/interfaces/crud.d.ts +1 -4
  63. package/dist/types/interfaces/crud.d.ts.map +1 -1
  64. package/dist/types/types/crud.d.ts +5 -5
  65. package/dist/types/types/crud.d.ts.map +1 -1
  66. package/dist/types/utils/appendix.d.ts +7 -7
  67. package/dist/types/utils/appendix.d.ts.map +1 -1
  68. package/dist/types/utils/did-document-builder.d.ts +1 -1
  69. package/dist/types/utils/did-document-builder.d.ts.map +1 -1
  70. package/dist/types/utils/did-document.d.ts +1 -1
  71. package/dist/types/utils/did-document.d.ts.map +1 -1
  72. package/dist/types/utils/identifier.d.ts +2 -2
  73. package/dist/types/utils/identifier.d.ts.map +1 -1
  74. package/package.json +7 -6
  75. package/src/core/beacon/aggregation/protocol/nostr.ts +4 -4
  76. package/src/core/beacon/cid-aggregate.ts +2 -2
  77. package/src/core/beacon/singleton.ts +2 -2
  78. package/src/core/crud/create.ts +4 -4
  79. package/src/core/crud/deactivate.ts +4 -4
  80. package/src/core/crud/read.ts +21 -21
  81. package/src/core/crud/update.ts +2 -2
  82. package/src/core/key-manager/index.ts +7 -7
  83. package/src/core/key-manager/interface.ts +3 -3
  84. package/src/did-btcr2.ts +1 -1
  85. package/src/interfaces/crud.ts +1 -4
  86. package/src/types/crud.ts +5 -5
  87. package/src/utils/appendix.ts +9 -9
  88. package/src/utils/did-document-builder.ts +1 -1
  89. package/src/utils/did-document.ts +2 -2
  90. package/src/utils/identifier.ts +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"did-document.d.ts","sourceRoot":"","sources":["../../../src/utils/did-document.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,UAAU,EAEX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAc,qBAAqB,IAAI,uBAAuB,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,YAAY,CAAC;AACxH,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD,eAAO,MAAM,aAAa,KAAK,CAAC;AAChC,eAAO,MAAM,cAAc,QAAuD,CAAC;AAEnF,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACjD,cAAc,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,CAAC;IACvD,eAAe,CAAC,EAAE,KAAK,CAAC,MAA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gBAC1C,QAAQ,EAAE,YAAY;IAKlC;;;;;;OAMG;WACW,MAAM,CAClB,kBAAkB,EAAE,KAAK,CAAC,qBAAqB,CAAC,EAChD,aAAa,EAAE,yBAAyB,EACxC,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,GAC5B,uBAAuB;IAK1B;;;;OAIG;IACI,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW;IAM9C;;;;OAIG;WACW,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,WAAW;CAGpD"}
@@ -14,7 +14,7 @@ import { DidComponents } from './appendix.js';
14
14
  */
15
15
  export declare class Identifier {
16
16
  /**
17
- * Implements {@link https://dcdpr.github.io/did-btcr2/#didbtc1-identifier-encoding | 3.2 did:btcr2 Identifier Encoding}.
17
+ * Implements {@link https://dcdpr.github.io/did-btcr2/#didbtcr2-identifier-encoding | 3.2 did:btcr2 Identifier Encoding}.
18
18
  *
19
19
  * A did:btcr2 DID consists of a did:btcr2 prefix, followed by an id-bech32 value, which is a Bech32m encoding of:
20
20
  * - the specification version;
@@ -37,7 +37,7 @@ export declare class Identifier {
37
37
  genesisBytes: Bytes;
38
38
  }): string;
39
39
  /**
40
- * Implements {@link https://dcdpr.github.io/did-btcr2/#didbtc1-identifier-decoding | 3.3 did:btcr2 Identifier Decoding}.
40
+ * Implements {@link https://dcdpr.github.io/did-btcr2/#didbtcr2-identifier-decoding | 3.3 did:btcr2 Identifier Decoding}.
41
41
  * @param {string} identifier The BTCR2 DID to be parsed
42
42
  * @returns {DidComponents} The parsed identifier components. See {@link DidComponents} for details.
43
43
  * @throws {DidError} if an error occurs while parsing the identifier
@@ -1 +1 @@
1
- {"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../../../src/utils/identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqD,KAAK,EAAqC,MAAM,mBAAmB,CAAC;AAChI,OAAO,EAAa,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,aAAa,E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AU,EAAE;YAAE,UAAU,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE;CAWnG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@did-btcr2/method",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "type": "module",
5
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.",
6
6
  "main": "./dist/cjs/index.js",
@@ -83,10 +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/bitcoin": "0.2.0",
87
- "@did-btcr2/common": "2.1.0",
88
- "@did-btcr2/cryptosuite": "3.1.0",
89
- "@did-btcr2/keypair": "0.5.1"
86
+ "@did-btcr2/bitcoin": "0.3.0",
87
+ "@did-btcr2/common": "2.2.0",
88
+ "@did-btcr2/cryptosuite": "3.2.0",
89
+ "@did-btcr2/keypair": "0.6.0"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@eslint/js": "^9.22.0",
@@ -140,6 +140,7 @@
140
140
  "do": "pnpm tsx",
141
141
  "do:lib": "${PWD}/lib/run-lib.sh",
142
142
  "do:lib:btc": "${PWD}/lib/do-lib.sh bitcoin",
143
- "do:lib:btcr2": "${PWD}/lib/do-lib.sh btcr2"
143
+ "do:lib:btcr2": "${PWD}/lib/do-lib.sh btcr2",
144
+ "pack:local": "pnpm pack && mv *.tgz ./release"
144
145
  }
145
146
  }
@@ -1,4 +1,4 @@
1
- import { SchnorrKeyPair, SecretKey } from '@did-btcr2/keypair';
1
+ import { SchnorrKeyPair, Secp256k1SecretKey } from '@did-btcr2/keypair';
2
2
  import { Filter } from 'nostr-tools';
3
3
  import { SimplePool, } from 'nostr-tools/pool';
4
4
  import { Identifier } from '../../../../utils/identifier.js';
@@ -62,12 +62,12 @@ export class NostrAdapter implements ProtocolService {
62
62
  }
63
63
 
64
64
  /**
65
- * Generates a Nostr identity using the SecretKey and Identifier classes.
65
+ * Generates a Nostr identity using the Secp256k1SecretKey and Identifier classes.
66
66
  * @returns {string} A BTCR2 DID used for communication over the nostr protocol
67
67
  */
68
68
  public generateIdentity(): string {
69
- this.config.keys.secret = SecretKey.random();
70
- this.config.keys.public = SecretKey.getPublicKey(this.config.keys.secret);
69
+ this.config.keys.secret = Secp256k1SecretKey.random();
70
+ this.config.keys.public = Secp256k1SecretKey.getPublicKey(this.config.keys.secret);
71
71
  this.config.did = Identifier.encode(
72
72
  {
73
73
  idType : this.config.components.idType || 'KEY',
@@ -111,8 +111,8 @@ export class CIDAggregateBeacon extends Beacon {
111
111
  *
112
112
  * The Broadcast CIDAggregate Beacon Signal algorithm involving two roles: a set of cohort participants and a Beacon
113
113
  * coordinator. The Beacon coordinator collects individual DID Update Payload Content Identifiers (CIDs) for specific
114
- * did:btc1s and aggregates them into a DID Update Bundle, which is then published to a Content Addressable Storage
115
- * (CAS). The CID for the DID Update Bundle is included in a Partially Signed Bitcoin Transaction (PSBT) transaction
114
+ * did:btcr2 idntifiers and aggregates them into a DID Update Bundle, which is then published to a Content Addressable
115
+ * Storage (CAS). The CID for the DID Update Bundle is included in a Partially Signed Bitcoin Transaction (PSBT) transaction
116
116
  * output spent from the Beacon’s n-of-n address. Each of the n cohort participants in the Beacon MUST sign the
117
117
  * transaction before it can be broadcast to the network. It is RECOMMENDED that cohort participants keep a copy of
118
118
  * the DID Update Bundle and separately pin it to the CAS.
@@ -119,7 +119,7 @@ export class SingletonBeacon extends Beacon {
119
119
  // 5. If signalsMetadata:
120
120
  if (signalsMetadata) {
121
121
  // 5.1 Set didUpdatePayload to signalsMetadata.updatePayload
122
- didUpdatePayload = signalsMetadataMap.get(signal.txid)?.btc1Update;
122
+ didUpdatePayload = signalsMetadataMap.get(signal.txid)?.didUpdate;
123
123
 
124
124
  if(!didUpdatePayload) {
125
125
  throw new SingletonBeaconError('Update Payload not found in signal metadata.', 'PROCESS_SIGNAL_ERROR');
@@ -246,6 +246,6 @@ export class SingletonBeacon extends Beacon {
246
246
  // 10. Initialize signalMetadata to an empty object.
247
247
  // 11. Set signalMetadata.updatePayload to didUpdatePayload.
248
248
  // 12. Return the object {<signalId>: { updatePayload: DidUpdatePayload; proofs?: any; }}.
249
- return { [spentTx]: { btc1Update: didUpdatePayload } };
249
+ return { [spentTx]: { didUpdate: didUpdatePayload } };
250
250
  }
251
251
  }
@@ -1,5 +1,5 @@
1
1
  import { IdentifierTypes, KeyBytes, PatchOperation } from '@did-btcr2/common';
2
- import { PublicKey } from '@did-btcr2/keypair';
2
+ import { CompressedSecp256k1PublicKey } from '@did-btcr2/keypair';
3
3
  import { DidCreateOptions as IDidCreateOptions } from '@web5/dids';
4
4
  import { getNetwork } from '@did-btcr2/bitcoin';
5
5
  import { BeaconUtils } from '../../utils/beacons.js';
@@ -82,8 +82,8 @@ export class Create {
82
82
  // Call the the did:btcr2 Identifier Encoding algorithm
83
83
  const identifier = Identifier.encode({ version, network, idType, genesisBytes: pubKeyBytes });
84
84
 
85
- // Instantiate PublicKey object and get the multibase formatted publicKey
86
- const { compressed: publicKey, multibase: publicKeyMultibase } = new PublicKey(pubKeyBytes);
85
+ // Instantiate CompressedSecp256k1PublicKey object and get the multibase formatted publicKey
86
+ const { compressed: publicKey, multibase: publicKeyMultibase } = new CompressedSecp256k1PublicKey(pubKeyBytes);
87
87
 
88
88
  // Generate the service field for the DID Document
89
89
  const service = BeaconUtils.generateBeaconServices({
@@ -101,7 +101,7 @@ export class Create {
101
101
  id : `${identifier}#initialKey`,
102
102
  type : 'Multikey',
103
103
  controller : identifier,
104
- publicKeyMultibase : publicKeyMultibase.address,
104
+ publicKeyMultibase : publicKeyMultibase.encoded,
105
105
  }],
106
106
  service,
107
107
  });
@@ -6,8 +6,8 @@ import { DidBtcr2 } from '../../did-btcr2.js';
6
6
  * document. To do this, the DID controller constructs a valid DID Update Payload with a JSON patch that adds this
7
7
  * property and announces the payload through a Beacon in their current DID document following the algorithm in Update.
8
8
  * Once a did:btcr2 has been deactivated this state is considered permanent and resolution MUST terminate.
9
- * @class Btc1Deactivate
10
- * @type {Btc1Deactivate}
11
- * @extends {DidBtc1}
9
+ * @class Deactivate
10
+ * @type {Deactivate}
11
+ * @extends {DidBtcr2}
12
12
  */
13
- export class Btc1Deactivate extends DidBtcr2 {}
13
+ export class Deactivate extends DidBtcr2 {}
@@ -24,7 +24,7 @@ import {
24
24
  UnixTimestamp
25
25
  } from '@did-btcr2/common';
26
26
  import { Cryptosuite, DataIntegrityProof, SchnorrMultikey } from '@did-btcr2/cryptosuite';
27
- import { PublicKey } from '@did-btcr2/keypair';
27
+ import { CompressedSecp256k1PublicKey } from '@did-btcr2/keypair';
28
28
  import { bytesToHex } from '@noble/hashes/utils';
29
29
  import { DidBtcr2 } from '../../did-btcr2.js';
30
30
  import { DidResolutionOptions } from '../../interfaces/crud.js';
@@ -136,8 +136,8 @@ export class Resolve {
136
136
  // Deconstruct the components
137
137
  const { network, genesisBytes } = identifierComponents;
138
138
 
139
- // Construct a new PublicKey and deconstruct the publicKey and publicKeyMultibase
140
- const { compressed: publicKey, multibase: publicKeyMultibase } = new PublicKey(genesisBytes);
139
+ // Construct a new CompressedSecp256k1PublicKey and deconstruct the publicKey and publicKeyMultibase
140
+ const { compressed: publicKey, multibase: publicKeyMultibase } = new CompressedSecp256k1PublicKey(genesisBytes);
141
141
 
142
142
  // Generate the service field for the DID Document
143
143
  const service = BeaconUtils.generateBeaconServices({
@@ -154,7 +154,7 @@ export class Resolve {
154
154
  id : `${identifier}#initialKey`,
155
155
  type : 'Multikey',
156
156
  controller : identifier,
157
- publicKeyMultibase : publicKeyMultibase.address
157
+ publicKeyMultibase : publicKeyMultibase.encoded
158
158
  }],
159
159
  service
160
160
  });
@@ -353,7 +353,7 @@ export class Resolve {
353
353
 
354
354
  // 10. Set targetDocument to the result of calling the Traverse Bitcoin Blockchain History algorithm
355
355
  // passing in contemporaryDIDDocument, contemporaryBlockheight, currentVersionId, targetVersionId,
356
- // targetTime, didDocumentHistory, btc1UpdateHashHistory, signalsMetadata, and network.
356
+ // targetTime, didDocumentHistory, updateHashHistory, signalsMetadata, and network.
357
357
  const targetDocument = this.traverseBlockchainHistory({
358
358
  contemporaryDidDocument : initialDocument,
359
359
  contemporaryBlockHeight : 0,
@@ -361,7 +361,7 @@ export class Resolve {
361
361
  targetVersionId,
362
362
  targetTime,
363
363
  didDocumentHistory : new Array(),
364
- btc1UpdateHashHistory : new Array(),
364
+ updateHashHistory : new Array(),
365
365
  signalsMetadata,
366
366
  network
367
367
  });
@@ -396,7 +396,7 @@ export class Resolve {
396
396
  * @param {UnixTimestamp} params.targetTime The timestamp used to target specific historical states of a DID document.
397
397
  * Only Beacon Signals included in the Bitcoin blockchain before the targetTime are processed.
398
398
  * @param {boolean} params.didDocumentHistory An array of DID documents ordered ascensing by version (1...N).
399
- * @param {boolean} params.btc1UpdateHashHistory An array of SHA256 hashes of BTCR2 Updates ordered by version that are
399
+ * @param {boolean} params.updateHashHistory An array of SHA256 hashes of BTCR2 Updates ordered by version that are
400
400
  * applied to the DID document in order to construct the contemporaryDIDDocument.
401
401
  * @param {SignalsMetadata} params.signalsMetadata See {@link SignalsMetadata} for details.
402
402
  * @param {string} params.network The bitcoin network to connect to (mainnet, signet, testnet, regtest).
@@ -409,7 +409,7 @@ export class Resolve {
409
409
  targetVersionId,
410
410
  targetTime,
411
411
  didDocumentHistory,
412
- btc1UpdateHashHistory,
412
+ updateHashHistory,
413
413
  signalsMetadata,
414
414
  network
415
415
  }: {
@@ -419,7 +419,7 @@ export class Resolve {
419
419
  targetVersionId?: number;
420
420
  targetTime: number;
421
421
  didDocumentHistory: DidDocument[];
422
- btc1UpdateHashHistory: string[];
422
+ updateHashHistory: string[];
423
423
  signalsMetadata: SignalsMetadata;
424
424
  network: string;
425
425
  }): Promise<DidDocument> {
@@ -463,8 +463,8 @@ export class Resolve {
463
463
  // 10.1. If update.targetVersionId is less than or equal to currentVersionId, run Algorithm Confirm Duplicate
464
464
  // Update passing in update, documentHistory, and contemporaryHash.
465
465
  if (updateTargetVersionId <= currentVersionId) {
466
- btc1UpdateHashHistory.push(contemporaryHash);
467
- await this.confirmDuplicateUpdate({ update, updateHashHistory: btc1UpdateHashHistory });
466
+ updateHashHistory.push(contemporaryHash);
467
+ await this.confirmDuplicateUpdate({ update, updateHashHistory: updateHashHistory });
468
468
 
469
469
  // 10.2. If update.targetVersionId equals currentVersionId + 1:
470
470
  } else if (updateTargetVersionId === currentVersionId + 1) {
@@ -498,8 +498,8 @@ export class Resolve {
498
498
  // 10.2.7 Set updateHash to the result of passing unsecuredUpdate into the JSON Canonicalization and Hash algorithm.
499
499
  const updateHash = await JSON.canonicalization.process(update, 'base58');
500
500
 
501
- // 10.2.8. Push updateHash onto btc1UpdateHashHistory.
502
- btc1UpdateHashHistory.push(updateHash as string);
501
+ // 10.2.8. Push updateHash onto updateHashHistory.
502
+ updateHashHistory.push(updateHash as string);
503
503
 
504
504
  // 10.2.9. Set contemporaryHash to result of passing contemporaryDIDDocument into the JSON Canonicalization and Hash algorithm.
505
505
  contemporaryHash = await JSON.canonicalization.process(contemporaryDidDocument, 'base58');
@@ -796,19 +796,19 @@ export class Resolve {
796
796
  // Establish a Beacon instance using the service and sidecar
797
797
  const beacon = BeaconFactory.establish(service, sidecar);
798
798
 
799
- // 2.5 Set btc1Update to null.
800
- const btc1Update = await beacon.processSignal(signalTx, signalsMetadata) ?? null;
799
+ // 2.5 Set didUpdate to null.
800
+ const didUpdate = await beacon.processSignal(signalTx, signalsMetadata) ?? null;
801
801
 
802
802
  // If the updates is null, throw an error
803
- if (!btc1Update) {
804
- throw new MethodError('No btc1Update for beacon', 'PROCESS_BEACON_SIGNALS_ERROR', { tx, signalsMetadata });
803
+ if (!didUpdate) {
804
+ throw new MethodError('No didUpdate for beacon', 'PROCESS_BEACON_SIGNALS_ERROR', { tx, signalsMetadata });
805
805
  }
806
806
 
807
- // 2.9 If btc1Update is not null, push btc1Update to updates.
808
- updates.push(btc1Update);
807
+ // 2.9 If didUpdate is not null, push didUpdate to updates.
808
+ updates.push(didUpdate);
809
809
 
810
810
  // 3. Return updates.
811
- return btc1Update;
811
+ return didUpdate;
812
812
  }
813
813
 
814
814
  /**
@@ -824,7 +824,7 @@ export class Resolve {
824
824
  * @param {DidUpdatePayload} params.update The DID Update Payload to confirm.
825
825
  * @param {Array<string>} params.updateHashHistory The history of hashes for previously applied updates.
826
826
  * @returns {Promise<void>} A promise that resolves if the update is a duplicate, otherwise throws an error.
827
- * @throws {DidBtc1Error} if the update hash does not match the historical hash.
827
+ * @throws {ResolveError} if the update hash does not match the historical hash.
828
828
  */
829
829
  public static async confirmDuplicateUpdate({ update, updateHashHistory }: {
830
830
  update: DidUpdatePayload;
@@ -12,7 +12,7 @@ import {
12
12
  ProofOptions
13
13
  } from '@did-btcr2/common';
14
14
  import { SchnorrMultikey } from '@did-btcr2/cryptosuite';
15
- import { SchnorrKeyPair, SecretKey } from '@did-btcr2/keypair';
15
+ import { SchnorrKeyPair, Secp256k1SecretKey } from '@did-btcr2/keypair';
16
16
  import type { DidService } from '@web5/dids';
17
17
  import { BeaconService } from '../../interfaces/ibeacon.js';
18
18
  import { SignalsMetadata } from '../../types/crud.js';
@@ -158,7 +158,7 @@ export class Update {
158
158
  id,
159
159
  controller,
160
160
  keys : new SchnorrKeyPair({
161
- secretKey : SecretKey.decode(secretKeyMultibase)
161
+ secretKey : Secp256k1SecretKey.decode(secretKeyMultibase)
162
162
  })
163
163
  });
164
164
 
@@ -10,7 +10,7 @@ import {
10
10
  SignatureBytes
11
11
  } from '@did-btcr2/common';
12
12
  import { SchnorrMultikey } from '@did-btcr2/cryptosuite';
13
- import { PublicKey, SchnorrKeyPair } from '@did-btcr2/keypair';
13
+ import { CompressedSecp256k1PublicKey, SchnorrKeyPair } from '@did-btcr2/keypair';
14
14
  import { sha256 } from '@noble/hashes/sha2';
15
15
  import { KeyValueStore, MemoryStore } from '@web5/common';
16
16
  import { KeyIdentifier } from '@web5/crypto';
@@ -104,11 +104,11 @@ export class KeyManager implements IKeyManager, CryptoSigner, BitcoinSigner {
104
104
  }
105
105
 
106
106
  /**
107
- * Gets the key pair from the key store and returns a PublicKey.
107
+ * Gets the key pair from the key store and returns a CompressedSecp256k1PublicKey.
108
108
  * @param {KeyIdentifier} keyUri The URI of the key to get the public key for.
109
- * @returns {Promise<PublicKey>} The public key associated with the key URI.
109
+ * @returns {Promise<CompressedSecp256k1PublicKey>} The public key associated with the key URI.
110
110
  */
111
- public async getPublicKey(keyUri?: KeyIdentifier): Promise<PublicKey> {
111
+ public async getPublicKey(keyUri?: KeyIdentifier): Promise<CompressedSecp256k1PublicKey> {
112
112
  // Use the active key URI if not provided
113
113
  const key = await this.getKey(keyUri);
114
114
 
@@ -264,13 +264,13 @@ export class KeyManager implements IKeyManager, CryptoSigner, BitcoinSigner {
264
264
 
265
265
  /**
266
266
  * Computes a multibase-compliant URI from a key.
267
- * @param key A SchnorrKeyPair, PublicKey, or multibase string
267
+ * @param key A SchnorrKeyPair, CompressedSecp256k1PublicKey, or multibase string
268
268
  * @returns {string} A multibase URI (e.g. 'urn:mb:zQ3s...')
269
269
  */
270
- public static toMultibaseUri(data: SchnorrKeyPair | PublicKey | Multibase<'zQ3s'>): string {
270
+ public static toMultibaseUri(data: SchnorrKeyPair | CompressedSecp256k1PublicKey | Multibase<'zQ3s'>): string {
271
271
  const multibase = data instanceof SchnorrKeyPair
272
272
  ? data.publicKey.multibase
273
- : data instanceof PublicKey
273
+ : data instanceof CompressedSecp256k1PublicKey
274
274
  ? data.multibase
275
275
  : data;
276
276
 
@@ -1,6 +1,6 @@
1
1
  import { HashBytes, Hex, SignatureBytes } from '@did-btcr2/common';
2
2
  import { Multikey, SchnorrMultikey } from '@did-btcr2/cryptosuite';
3
- import { SchnorrKeyPair, PublicKey } from '@did-btcr2/keypair';
3
+ import { SchnorrKeyPair, CompressedSecp256k1PublicKey } from '@did-btcr2/keypair';
4
4
  import { KeyValueStore } from '@web5/common';
5
5
 
6
6
  export type KeyManagerOptions = {
@@ -77,9 +77,9 @@ export interface IKeyManager {
77
77
  /**
78
78
  * Gets the public key of a key pair.
79
79
  * @param {KeyIdentifier} keyUri The URI of the key to get the public key for.
80
- * @returns {Promise<PublicKey>} The public key of the key pair.
80
+ * @returns {Promise<CompressedSecp256k1PublicKey>} The public key of the key pair.
81
81
  */
82
- getPublicKey(keyUri: KeyIdentifier): Promise<PublicKey>;
82
+ getPublicKey(keyUri: KeyIdentifier): Promise<CompressedSecp256k1PublicKey>;
83
83
 
84
84
  /**
85
85
  * Imports a key pair into the key store.
package/src/did-btcr2.ts CHANGED
@@ -176,7 +176,7 @@ export class DidBtcr2 implements DidMethod {
176
176
  * @param {string} params.identifier The btcr2 identifier to be updated.
177
177
  * @param {DidDocument} params.sourceDocument The DID document being updated.
178
178
  * @param {string} params.sourceVersionId The versionId of the source document.
179
- * @param {Btc1DocumentPatch} params.documentPatch The JSON patch to be applied to the source document.
179
+ * @param {PatchOperation} params.documentPatch The JSON patch to be applied to the source document.
180
180
  * @param {string} params.verificationMethodId The verificationMethod ID to sign the update
181
181
  * @param {string[]} params.beaconIds The beacon IDs to announce the update
182
182
  * @returns {Promise<void>} Promise resolving to void
@@ -1,4 +1,3 @@
1
- import { BitcoinCoreRpcClient } from '@did-btcr2/bitcoin';
2
1
  import { UnixTimestamp } from '@did-btcr2/common';
3
2
  import { DidResolutionOptions as IDidResolutionOptions } from '@web5/dids';
4
3
  import { SidecarData } from '../types/crud.js';
@@ -8,7 +7,6 @@ import { DidDocument } from '../utils/did-document.js';
8
7
  * Options for resolving a DID Document
9
8
  * @param {?number} versionId The versionId for resolving the DID Document
10
9
  * @param {?UnixTimestamp} versionTime The versionTime for resolving the DID Document
11
- * @param {?BitcoinCoreRpcClient} rpc BitcoinCoreRpcClient client connection
12
10
  * @param {?SidecarData} sidecarData The sidecar data for resolving the DID Document
13
11
  */
14
12
  export interface DidResolutionOptions extends IDidResolutionOptions {
@@ -16,9 +14,8 @@ export interface DidResolutionOptions extends IDidResolutionOptions {
16
14
  versionTime?: UnixTimestamp;
17
15
  sidecarData?: SidecarData;
18
16
  network?: string;
19
- rpc?: BitcoinCoreRpcClient;
20
17
  }
21
- export interface Btc1RootCapability {
18
+ export interface RootCapability {
22
19
  '@context': string;
23
20
  id: string;
24
21
  controller: string;
package/src/types/crud.ts CHANGED
@@ -8,23 +8,23 @@ export type FindNextSignals = {
8
8
  beacons: BeaconService[]
9
9
  };
10
10
  export type Metadata = {
11
- btc1Update: DidUpdatePayload;
11
+ didUpdate: DidUpdatePayload;
12
12
  proofs?: string;
13
13
  };
14
14
  export type SignalSidecarData = Metadata;
15
- export interface Btc1SidecarData {
15
+ export interface Sidecar {
16
16
  did: string;
17
17
  }
18
18
  export type SignalsMetadata = { [signalId: string]: Metadata; };
19
- export interface SingletonSidecar extends Btc1SidecarData {
19
+ export interface SingletonSidecar extends Sidecar {
20
20
  signalsMetadata: SignalsMetadata;
21
21
  }
22
- export interface CIDAggregateSidecar extends Btc1SidecarData {
22
+ export interface CIDAggregateSidecar extends Sidecar {
23
23
  initialDocument: DidDocument;
24
24
  signalsMetadata: SignalsMetadata;
25
25
  cidUpdates: Array<string>;
26
26
  }
27
- export interface SMTAggregateSidecar extends Btc1SidecarData {
27
+ export interface SMTAggregateSidecar extends Sidecar {
28
28
  initialDocument: DidDocument;
29
29
  signalsMetadata: SignalsMetadata;
30
30
  smtProof: ProofBytes;
@@ -10,7 +10,7 @@ import {
10
10
  import { createHelia } from 'helia';
11
11
  import { CID } from 'multiformats';
12
12
  import { create as createDigest } from 'multiformats/hashes/digest';
13
- import { Btc1RootCapability } from '../interfaces/crud.js';
13
+ import { RootCapability } from '../interfaces/crud.js';
14
14
  import { DidVerificationMethod } from './did-document.js';
15
15
 
16
16
  export interface DidComponents {
@@ -97,7 +97,7 @@ export class Appendix {
97
97
 
98
98
 
99
99
  /**
100
- * Implements {@link https://dcdpr.github.io/did-btcr2/#derive-root-capability-from-didbtc1-identifier | 9.4.1 Derive Root Capability from did:btcr2 Identifier}.
100
+ * Implements {@link https://dcdpr.github.io/did-btcr2/#derive-root-capability-from-didbtcr2-identifier | 9.4.1 Derive Root Capability from did:btcr2 Identifier }.
101
101
  *
102
102
  * The Derive Root Capability algorithm deterministically generates a ZCAP-LD root capability from a given did:btcr2
103
103
  * identifier. Each root capability is unique to the identifier. This root capability is defined and understood by the
@@ -105,7 +105,7 @@ export class Appendix {
105
105
  * document. It takes in a did:btcr2 identifier and returns a rootCapability object. It returns the root capability.
106
106
  *
107
107
  * @param {string} identifier The did-btcr2 identifier to derive the root capability from
108
- * @returns {Btc1RootCapability} The root capability object
108
+ * @returns {RootCapability} The root capability object
109
109
  * @example Root capability for updating the DID document for
110
110
  * did:btcr2:k1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u
111
111
  * ```
@@ -117,9 +117,9 @@ export class Appendix {
117
117
  * }
118
118
  * ```
119
119
  */
120
- public static deriveRootCapability(identifier: string): Btc1RootCapability {
120
+ public static deriveRootCapability(identifier: string): RootCapability {
121
121
  // 1. Define rootCapability as an empty object.
122
- const rootCapability = {} as Btc1RootCapability;
122
+ const rootCapability = {} as RootCapability;
123
123
 
124
124
  // 2. Set rootCapability.@context to ‘https://w3id.org/zcap/v1’.
125
125
  rootCapability['@context'] = W3C_ZCAP_V1;
@@ -148,7 +148,7 @@ export class Appendix {
148
148
  * capability object.
149
149
  *
150
150
  * @param {string} capabilityId The root capability identifier to dereference.
151
- * @returns {Btc1RootCapability} The root capability object.
151
+ * @returns {RootCapability} The root capability object.
152
152
  * @example a didUpdatePayload with an invoked ZCAP-LD capability containing a patch defining how the DID document
153
153
  * for did:btcr2:k1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u SHOULD be mutated.
154
154
  * ```
@@ -174,16 +174,16 @@ export class Appendix {
174
174
  * "cryptosuite": "schnorr-secp256k1-jcs-2025",
175
175
  * "verificationMethod": "did:btcr2:k1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u#initialKey",
176
176
  * "invocationTarget": "did:btcr2:k1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u",
177
- * "capability": "urn:zcap:root:did%3Abtc1%3Ak1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u",
177
+ * "capability": "urn:zcap:root:did%3Abtcr2%3Ak1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u",
178
178
  * "capabilityAction": "Write",
179
179
  * "proofPurpose": "assertionMethod",
180
180
  * "proofValue": "z381yXYmxU8NudZ4HXY56DfMN6zfD8syvWcRXzT9xD9uYoQToo8QsXD7ahM3gXTzuay5WJbqTswt2BKaGWYn2hHhVFKJLXaDz"
181
181
  * }
182
182
  * }
183
183
  */
184
- public static derefernceRootCapabilityIdentifier(capabilityId: string): Btc1RootCapability {
184
+ public static derefernceRootCapabilityIdentifier(capabilityId: string): RootCapability {
185
185
  // 1. Set rootCapability to an empty object.
186
- const rootCapability = {} as Btc1RootCapability;
186
+ const rootCapability = {} as RootCapability;
187
187
 
188
188
  // 2. Set components to the result of capabilityId.split(":").
189
189
  const [urn, zcap, root, did] = capabilityId.split(':') ?? [];
@@ -2,7 +2,7 @@ import { DidDocumentError, INVALID_DID_DOCUMENT } from '@did-btcr2/common';
2
2
  import { BeaconService } from '../interfaces/ibeacon.js';
3
3
  import { DidDocument, DidVerificationMethod } from './did-document.js';
4
4
 
5
- export class Btc1DidDocumentBuilder {
5
+ export class DidDocumentBuilder {
6
6
  private document: Partial<DidDocument> = {};
7
7
 
8
8
  constructor(initialDocument: Partial<DidDocument>) {
@@ -14,7 +14,7 @@ import { BeaconUtils } from './beacons.js';
14
14
  import { Identifier } from './identifier.js';
15
15
 
16
16
  export const BECH32M_CHARS = '';
17
- export const BTC1_DID_REGEX = /did:btcr2:(x1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]*)/g;
17
+ export const DID_REGEX = /did:btcr2:(x1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]*)/g;
18
18
 
19
19
  export type ExternalData = {
20
20
  id: string,
@@ -432,7 +432,7 @@ export class DidDocument implements IDidDocument {
432
432
  */
433
433
  export class IntermediateDidDocument extends DidDocument {
434
434
  constructor(document: IDidDocument) {
435
- const intermediateDocument = JSON.cloneReplace(document, BTC1_DID_REGEX, ID_PLACEHOLDER_VALUE) as IDidDocument;
435
+ const intermediateDocument = JSON.cloneReplace(document, DID_REGEX, ID_PLACEHOLDER_VALUE) as IDidDocument;
436
436
  super(intermediateDocument);
437
437
  }
438
438
 
@@ -1,5 +1,5 @@
1
1
  import { BitcoinNetworkNames, MethodError, IdentifierTypes, Bytes, INVALID_DID, METHOD_NOT_SUPPORTED } from '@did-btcr2/common';
2
- import { PublicKey, SchnorrKeyPair } from '@did-btcr2/keypair';
2
+ import { CompressedSecp256k1PublicKey, SchnorrKeyPair } from '@did-btcr2/keypair';
3
3
  import { bech32m } from '@scure/base';
4
4
  import { DidComponents } from './appendix.js';
5
5
 
@@ -16,7 +16,7 @@ import { DidComponents } from './appendix.js';
16
16
  */
17
17
  export class Identifier {
18
18
  /**
19
- * Implements {@link https://dcdpr.github.io/did-btcr2/#didbtc1-identifier-encoding | 3.2 did:btcr2 Identifier Encoding}.
19
+ * Implements {@link https://dcdpr.github.io/did-btcr2/#didbtcr2-identifier-encoding | 3.2 did:btcr2 Identifier Encoding}.
20
20
  *
21
21
  * A did:btcr2 DID consists of a did:btcr2 prefix, followed by an id-bech32 value, which is a Bech32m encoding of:
22
22
  * - the specification version;
@@ -61,7 +61,7 @@ export class Identifier {
61
61
  // 5. If idType is “key” and genesisBytes is not a valid compressed secp256k1 public key, raise invalidDid error.
62
62
  if (idType === 'KEY') {
63
63
  try {
64
- new PublicKey(genesisBytes);
64
+ new CompressedSecp256k1PublicKey(genesisBytes);
65
65
  } catch {
66
66
  throw new MethodError(
67
67
  'Expected "genesisBytes" to be a valid compressed secp256k1 public key',
@@ -125,7 +125,7 @@ export class Identifier {
125
125
  }
126
126
 
127
127
  /**
128
- * Implements {@link https://dcdpr.github.io/did-btcr2/#didbtc1-identifier-decoding | 3.3 did:btcr2 Identifier Decoding}.
128
+ * Implements {@link https://dcdpr.github.io/did-btcr2/#didbtcr2-identifier-decoding | 3.3 did:btcr2 Identifier Decoding}.
129
129
  * @param {string} identifier The BTCR2 DID to be parsed
130
130
  * @returns {DidComponents} The parsed identifier components. See {@link DidComponents} for details.
131
131
  * @throws {DidError} if an error occurs while parsing the identifier
@@ -248,7 +248,7 @@ export class Identifier {
248
248
  // 19. If idType is “key” and genesisBytes is not a valid compressed secp256k1 public key, raise invalidDid error.
249
249
  if (idType === 'KEY') {
250
250
  try {
251
- new PublicKey(genesisBytes);
251
+ new CompressedSecp256k1PublicKey(genesisBytes);
252
252
  } catch {
253
253
  throw new MethodError(`Invalid genesisBytes: ${genesisBytes}`, INVALID_DID, { identifier });
254
254
  }