@did-btcr2/method 0.18.0 → 0.18.1

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.
package/dist/browser.js CHANGED
@@ -61089,11 +61089,11 @@ var BTCR2 = (() => {
61089
61089
  var tinysecp = __toESM(require_dist2(), 1);
61090
61090
  var Secp256k1SecretKey = class _Secp256k1SecretKey {
61091
61091
  /** @type {KeyBytes} The entropy for the secret key as a byte array */
61092
- _bytes;
61092
+ #bytes;
61093
61093
  /** @type {bigint} The entropy for the secret key as a bigint */
61094
- _seed;
61094
+ #seed;
61095
61095
  /** @type {string} The secret key as a secretKeyMultibase */
61096
- _multibase;
61096
+ #multibase;
61097
61097
  /**
61098
61098
  * Instantiates an instance of Secp256k1SecretKey.
61099
61099
  * @param {Entropy} entropy bytes (Uint8Array) or secret (bigint)
@@ -61106,27 +61106,27 @@ var BTCR2 = (() => {
61106
61106
  throw new SecretKeyError("Invalid entropy: must be a valid byte array (32) or bigint", "CONSTRUCTOR_ERROR");
61107
61107
  }
61108
61108
  if (isBytes13 && entropy.length === 32) {
61109
- this._bytes = entropy;
61110
- this._seed = _Secp256k1SecretKey.toSecret(entropy);
61109
+ this.#bytes = entropy;
61110
+ this.#seed = _Secp256k1SecretKey.toSecret(entropy);
61111
61111
  }
61112
61112
  if (isSecret && !(entropy < 1n || entropy >= CURVE.n)) {
61113
- this._bytes = _Secp256k1SecretKey.toBytes(entropy);
61114
- this._seed = entropy;
61113
+ this.#bytes = _Secp256k1SecretKey.toBytes(entropy);
61114
+ this.#seed = entropy;
61115
61115
  }
61116
- if (!this._bytes || this._bytes.length !== 32) {
61116
+ if (!this.#bytes || this.#bytes.length !== 32) {
61117
61117
  throw new SecretKeyError("Invalid bytes: must be a valid 32-byte secret key", "CONSTRUCTOR_ERROR");
61118
61118
  }
61119
- if (!this._seed || (this._seed < 1n || this._seed >= CURVE.n)) {
61119
+ if (!this.#seed || (this.#seed < 1n || this.#seed >= CURVE.n)) {
61120
61120
  throw new SecretKeyError("Invalid seed: must must be valid bigint", "CONSTRUCTOR_ERROR");
61121
61121
  }
61122
- this._multibase = this.encode();
61122
+ this.#multibase = this.encode();
61123
61123
  }
61124
61124
  /**
61125
61125
  * Get the secret key entropy as a byte array.
61126
61126
  * @returns {KeyBytes} The secret key bytes as a Uint8Array
61127
61127
  */
61128
61128
  get bytes() {
61129
- const bytes6 = new Uint8Array(this._bytes);
61129
+ const bytes6 = new Uint8Array(this.#bytes);
61130
61130
  return bytes6;
61131
61131
  }
61132
61132
  /**
@@ -61134,7 +61134,7 @@ var BTCR2 = (() => {
61134
61134
  * @returns {bigint} The secret key as a bigint
61135
61135
  */
61136
61136
  get seed() {
61137
- const seed = BigInt(this._seed);
61137
+ const seed = BigInt(this.#seed);
61138
61138
  return seed;
61139
61139
  }
61140
61140
  /**
@@ -61149,7 +61149,7 @@ var BTCR2 = (() => {
61149
61149
  * @returns {string} The secret key in base58btc multibase format
61150
61150
  */
61151
61151
  get multibase() {
61152
- const multibase = this._multibase;
61152
+ const multibase = this.#multibase;
61153
61153
  return multibase;
61154
61154
  }
61155
61155
  /**
@@ -61329,35 +61329,36 @@ var BTCR2 = (() => {
61329
61329
  // ../keypair/dist/esm/public.js
61330
61330
  var CompressedSecp256k1PublicKey = class _CompressedSecp256k1PublicKey {
61331
61331
  /** @type {KeyBytes} The public key bytes */
61332
- _bytes;
61332
+ #bytes;
61333
61333
  /** @type {MultibaseObject} The public key as a MultibaseObject */
61334
- _multibase = {
61334
+ #multibase = {
61335
61335
  prefix: BIP340_PUBLIC_KEY_MULTIBASE_PREFIX,
61336
61336
  key: [],
61337
61337
  encoded: ""
61338
61338
  };
61339
61339
  /**
61340
61340
  * Creates a CompressedSecp256k1PublicKey instance.
61341
- * @param {KeyBytes} bytes The public key byte array.
61341
+ * @param {Hex} pk The public key byte array.
61342
61342
  * @throws {PublicKeyError} if the byte length is not 32 (x-only) or 33 (compressed)
61343
61343
  */
61344
- constructor(bytes6) {
61345
- if (!bytes6 || bytes6.length !== 33) {
61346
- throw new PublicKeyError("Invalid argument: byte length must be 33 (compressed)", "CONSTRUCTOR_ERROR", { bytes: bytes6 });
61344
+ constructor(pk) {
61345
+ pk = pk instanceof Uint8Array ? pk : import_buffer.Buffer.fromHex(pk);
61346
+ if (!pk || pk.length !== 33) {
61347
+ throw new PublicKeyError("Invalid argument: byte length must be 33 (compressed)", "CONSTRUCTOR_ERROR", { pk });
61347
61348
  }
61348
- if (!tinysecp2.isPoint(bytes6)) {
61349
- throw new PublicKeyError("Invalid argument: bytes are not a valid secp256k1 compressed point", "CONSTRUCTOR_ERROR", { bytes: bytes6 });
61349
+ if (!tinysecp2.isPoint(pk)) {
61350
+ throw new PublicKeyError("Invalid argument: not a valid secp256k1 compressed point", "CONSTRUCTOR_ERROR", { pk });
61350
61351
  }
61351
- this._bytes = bytes6;
61352
- this._multibase.encoded = this.encode();
61353
- this._multibase.key = [...this._multibase.prefix, ...this.compressed];
61352
+ this.#bytes = pk;
61353
+ this.#multibase.encoded = this.encode();
61354
+ this.#multibase.key = [...this.#multibase.prefix, ...this.compressed];
61354
61355
  }
61355
61356
  /**
61356
61357
  * Get the compressed public key.
61357
61358
  * @returns {KeyBytes} The 33-byte compressed public key (0x02 or 0x03, x).
61358
61359
  */
61359
61360
  get compressed() {
61360
- const bytes6 = new Uint8Array(this._bytes);
61361
+ const bytes6 = new Uint8Array(this.#bytes);
61361
61362
  return bytes6;
61362
61363
  }
61363
61364
  /**
@@ -61415,7 +61416,7 @@ var BTCR2 = (() => {
61415
61416
  * @returns {MultibaseObject} An object containing the multibase bytes, address and prefix.
61416
61417
  */
61417
61418
  get multibase() {
61418
- const multibase = this._multibase;
61419
+ const multibase = this.#multibase;
61419
61420
  return multibase;
61420
61421
  }
61421
61422
  /**
@@ -70568,19 +70569,19 @@ var BTCR2 = (() => {
70568
70569
  var DEFAULT_BITCOIN_NETWORK_CONFIG = {
70569
70570
  bitcoin: {
70570
70571
  rpc: void 0,
70571
- rest: { host: "https://mempool.holdings/api" }
70572
+ rest: { host: "https://mempool.space/api" }
70572
70573
  },
70573
70574
  testnet3: {
70574
70575
  rpc: void 0,
70575
- rest: { host: "https://mempool.holdings/testnet/api" }
70576
+ rest: { host: "https://mempool.space/testnet/api" }
70576
70577
  },
70577
70578
  testnet4: {
70578
70579
  rpc: void 0,
70579
- rest: { host: "https://mempool.holdings/testnet4/api" }
70580
+ rest: { host: "https://mempool.space/testnet4/api" }
70580
70581
  },
70581
70582
  signet: {
70582
70583
  rpc: void 0,
70583
- rest: { host: "https://mempool.holdings/signet/api" }
70584
+ rest: { host: "https://mempool.space/signet/api" }
70584
70585
  },
70585
70586
  mutinynet: {
70586
70587
  rpc: void 0,
package/dist/browser.mjs CHANGED
@@ -61018,11 +61018,11 @@ var import_crypto3 = __toESM(require_crypto_browserify(), 1);
61018
61018
  var tinysecp = __toESM(require_dist2(), 1);
61019
61019
  var Secp256k1SecretKey = class _Secp256k1SecretKey {
61020
61020
  /** @type {KeyBytes} The entropy for the secret key as a byte array */
61021
- _bytes;
61021
+ #bytes;
61022
61022
  /** @type {bigint} The entropy for the secret key as a bigint */
61023
- _seed;
61023
+ #seed;
61024
61024
  /** @type {string} The secret key as a secretKeyMultibase */
61025
- _multibase;
61025
+ #multibase;
61026
61026
  /**
61027
61027
  * Instantiates an instance of Secp256k1SecretKey.
61028
61028
  * @param {Entropy} entropy bytes (Uint8Array) or secret (bigint)
@@ -61035,27 +61035,27 @@ var Secp256k1SecretKey = class _Secp256k1SecretKey {
61035
61035
  throw new SecretKeyError("Invalid entropy: must be a valid byte array (32) or bigint", "CONSTRUCTOR_ERROR");
61036
61036
  }
61037
61037
  if (isBytes13 && entropy.length === 32) {
61038
- this._bytes = entropy;
61039
- this._seed = _Secp256k1SecretKey.toSecret(entropy);
61038
+ this.#bytes = entropy;
61039
+ this.#seed = _Secp256k1SecretKey.toSecret(entropy);
61040
61040
  }
61041
61041
  if (isSecret && !(entropy < 1n || entropy >= CURVE.n)) {
61042
- this._bytes = _Secp256k1SecretKey.toBytes(entropy);
61043
- this._seed = entropy;
61042
+ this.#bytes = _Secp256k1SecretKey.toBytes(entropy);
61043
+ this.#seed = entropy;
61044
61044
  }
61045
- if (!this._bytes || this._bytes.length !== 32) {
61045
+ if (!this.#bytes || this.#bytes.length !== 32) {
61046
61046
  throw new SecretKeyError("Invalid bytes: must be a valid 32-byte secret key", "CONSTRUCTOR_ERROR");
61047
61047
  }
61048
- if (!this._seed || (this._seed < 1n || this._seed >= CURVE.n)) {
61048
+ if (!this.#seed || (this.#seed < 1n || this.#seed >= CURVE.n)) {
61049
61049
  throw new SecretKeyError("Invalid seed: must must be valid bigint", "CONSTRUCTOR_ERROR");
61050
61050
  }
61051
- this._multibase = this.encode();
61051
+ this.#multibase = this.encode();
61052
61052
  }
61053
61053
  /**
61054
61054
  * Get the secret key entropy as a byte array.
61055
61055
  * @returns {KeyBytes} The secret key bytes as a Uint8Array
61056
61056
  */
61057
61057
  get bytes() {
61058
- const bytes6 = new Uint8Array(this._bytes);
61058
+ const bytes6 = new Uint8Array(this.#bytes);
61059
61059
  return bytes6;
61060
61060
  }
61061
61061
  /**
@@ -61063,7 +61063,7 @@ var Secp256k1SecretKey = class _Secp256k1SecretKey {
61063
61063
  * @returns {bigint} The secret key as a bigint
61064
61064
  */
61065
61065
  get seed() {
61066
- const seed = BigInt(this._seed);
61066
+ const seed = BigInt(this.#seed);
61067
61067
  return seed;
61068
61068
  }
61069
61069
  /**
@@ -61078,7 +61078,7 @@ var Secp256k1SecretKey = class _Secp256k1SecretKey {
61078
61078
  * @returns {string} The secret key in base58btc multibase format
61079
61079
  */
61080
61080
  get multibase() {
61081
- const multibase = this._multibase;
61081
+ const multibase = this.#multibase;
61082
61082
  return multibase;
61083
61083
  }
61084
61084
  /**
@@ -61258,35 +61258,36 @@ var Secp256k1SecretKey = class _Secp256k1SecretKey {
61258
61258
  // ../keypair/dist/esm/public.js
61259
61259
  var CompressedSecp256k1PublicKey = class _CompressedSecp256k1PublicKey {
61260
61260
  /** @type {KeyBytes} The public key bytes */
61261
- _bytes;
61261
+ #bytes;
61262
61262
  /** @type {MultibaseObject} The public key as a MultibaseObject */
61263
- _multibase = {
61263
+ #multibase = {
61264
61264
  prefix: BIP340_PUBLIC_KEY_MULTIBASE_PREFIX,
61265
61265
  key: [],
61266
61266
  encoded: ""
61267
61267
  };
61268
61268
  /**
61269
61269
  * Creates a CompressedSecp256k1PublicKey instance.
61270
- * @param {KeyBytes} bytes The public key byte array.
61270
+ * @param {Hex} pk The public key byte array.
61271
61271
  * @throws {PublicKeyError} if the byte length is not 32 (x-only) or 33 (compressed)
61272
61272
  */
61273
- constructor(bytes6) {
61274
- if (!bytes6 || bytes6.length !== 33) {
61275
- throw new PublicKeyError("Invalid argument: byte length must be 33 (compressed)", "CONSTRUCTOR_ERROR", { bytes: bytes6 });
61273
+ constructor(pk) {
61274
+ pk = pk instanceof Uint8Array ? pk : import_buffer.Buffer.fromHex(pk);
61275
+ if (!pk || pk.length !== 33) {
61276
+ throw new PublicKeyError("Invalid argument: byte length must be 33 (compressed)", "CONSTRUCTOR_ERROR", { pk });
61276
61277
  }
61277
- if (!tinysecp2.isPoint(bytes6)) {
61278
- throw new PublicKeyError("Invalid argument: bytes are not a valid secp256k1 compressed point", "CONSTRUCTOR_ERROR", { bytes: bytes6 });
61278
+ if (!tinysecp2.isPoint(pk)) {
61279
+ throw new PublicKeyError("Invalid argument: not a valid secp256k1 compressed point", "CONSTRUCTOR_ERROR", { pk });
61279
61280
  }
61280
- this._bytes = bytes6;
61281
- this._multibase.encoded = this.encode();
61282
- this._multibase.key = [...this._multibase.prefix, ...this.compressed];
61281
+ this.#bytes = pk;
61282
+ this.#multibase.encoded = this.encode();
61283
+ this.#multibase.key = [...this.#multibase.prefix, ...this.compressed];
61283
61284
  }
61284
61285
  /**
61285
61286
  * Get the compressed public key.
61286
61287
  * @returns {KeyBytes} The 33-byte compressed public key (0x02 or 0x03, x).
61287
61288
  */
61288
61289
  get compressed() {
61289
- const bytes6 = new Uint8Array(this._bytes);
61290
+ const bytes6 = new Uint8Array(this.#bytes);
61290
61291
  return bytes6;
61291
61292
  }
61292
61293
  /**
@@ -61344,7 +61345,7 @@ var CompressedSecp256k1PublicKey = class _CompressedSecp256k1PublicKey {
61344
61345
  * @returns {MultibaseObject} An object containing the multibase bytes, address and prefix.
61345
61346
  */
61346
61347
  get multibase() {
61347
- const multibase = this._multibase;
61348
+ const multibase = this.#multibase;
61348
61349
  return multibase;
61349
61350
  }
61350
61351
  /**
@@ -70497,19 +70498,19 @@ var GENESIS_TX_ID = "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afde
70497
70498
  var DEFAULT_BITCOIN_NETWORK_CONFIG = {
70498
70499
  bitcoin: {
70499
70500
  rpc: void 0,
70500
- rest: { host: "https://mempool.holdings/api" }
70501
+ rest: { host: "https://mempool.space/api" }
70501
70502
  },
70502
70503
  testnet3: {
70503
70504
  rpc: void 0,
70504
- rest: { host: "https://mempool.holdings/testnet/api" }
70505
+ rest: { host: "https://mempool.space/testnet/api" }
70505
70506
  },
70506
70507
  testnet4: {
70507
70508
  rpc: void 0,
70508
- rest: { host: "https://mempool.holdings/testnet4/api" }
70509
+ rest: { host: "https://mempool.space/testnet4/api" }
70509
70510
  },
70510
70511
  signet: {
70511
70512
  rpc: void 0,
70512
- rest: { host: "https://mempool.holdings/signet/api" }
70513
+ rest: { host: "https://mempool.space/signet/api" }
70513
70514
  },
70514
70515
  mutinynet: {
70515
70516
  rpc: void 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@did-btcr2/method",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
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",
@@ -85,9 +85,9 @@
85
85
  "tiny-secp256k1": "^2.2.3",
86
86
  "@did-btcr2/bitcoin": "0.3.2",
87
87
  "@did-btcr2/common": "2.2.2",
88
- "@did-btcr2/kms": "0.1.1",
88
+ "@did-btcr2/keypair": "0.7.2",
89
89
  "@did-btcr2/cryptosuite": "3.2.1",
90
- "@did-btcr2/keypair": "0.7.1"
90
+ "@did-btcr2/kms": "0.1.1"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@eslint/js": "^9.22.0",