utxo-lib 1.0.8 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. package/README.md +19 -16
  2. package/dist/src/address.d.ts.map +1 -1
  3. package/dist/src/address.js +11 -1
  4. package/dist/src/addressFormat.d.ts +1 -1
  5. package/dist/src/addressFormat.d.ts.map +1 -1
  6. package/dist/src/addressFormat.js +1 -1
  7. package/dist/src/base_crypto.d.ts +14 -0
  8. package/dist/src/base_crypto.d.ts.map +1 -0
  9. package/dist/src/base_crypto.js +215 -0
  10. package/dist/src/bitgo/Musig2.d.ts +115 -17
  11. package/dist/src/bitgo/Musig2.d.ts.map +1 -1
  12. package/dist/src/bitgo/Musig2.js +283 -101
  13. package/dist/src/bitgo/PsbtUtil.d.ts +59 -0
  14. package/dist/src/bitgo/PsbtUtil.d.ts.map +1 -0
  15. package/dist/src/bitgo/PsbtUtil.js +91 -0
  16. package/dist/src/bitgo/UtxoPsbt.d.ts +180 -47
  17. package/dist/src/bitgo/UtxoPsbt.d.ts.map +1 -1
  18. package/dist/src/bitgo/UtxoPsbt.js +657 -121
  19. package/dist/src/bitgo/UtxoTransaction.js +2 -2
  20. package/dist/src/bitgo/bitcoincash/address.js +2 -2
  21. package/dist/src/bitgo/index.d.ts +11 -0
  22. package/dist/src/bitgo/index.d.ts.map +1 -1
  23. package/dist/src/bitgo/index.js +6 -2
  24. package/dist/src/bitgo/legacysafe/index.d.ts +15 -0
  25. package/dist/src/bitgo/legacysafe/index.d.ts.map +1 -0
  26. package/dist/src/bitgo/legacysafe/index.js +61 -0
  27. package/dist/src/bitgo/litecoin/LitecoinPsbt.d.ts +10 -0
  28. package/dist/src/bitgo/litecoin/LitecoinPsbt.d.ts.map +1 -0
  29. package/dist/src/bitgo/litecoin/LitecoinPsbt.js +17 -0
  30. package/dist/src/bitgo/litecoin/LitecoinTransaction.d.ts +16 -0
  31. package/dist/src/bitgo/litecoin/LitecoinTransaction.d.ts.map +1 -0
  32. package/dist/src/bitgo/litecoin/LitecoinTransaction.js +46 -0
  33. package/dist/src/bitgo/litecoin/LitecoinTransactionBuilder.d.ts +10 -0
  34. package/dist/src/bitgo/litecoin/LitecoinTransactionBuilder.d.ts.map +1 -0
  35. package/dist/src/bitgo/litecoin/LitecoinTransactionBuilder.js +15 -0
  36. package/dist/src/bitgo/litecoin/index.d.ts +4 -0
  37. package/dist/src/bitgo/litecoin/index.d.ts.map +1 -0
  38. package/dist/src/bitgo/litecoin/index.js +16 -0
  39. package/dist/src/bitgo/outputScripts.d.ts +3 -1
  40. package/dist/src/bitgo/outputScripts.d.ts.map +1 -1
  41. package/dist/src/bitgo/outputScripts.js +20 -12
  42. package/dist/src/bitgo/parseInput.d.ts +49 -20
  43. package/dist/src/bitgo/parseInput.d.ts.map +1 -1
  44. package/dist/src/bitgo/parseInput.js +110 -26
  45. package/dist/src/bitgo/psbt/fromHalfSigned.d.ts.map +1 -1
  46. package/dist/src/bitgo/psbt/fromHalfSigned.js +9 -6
  47. package/dist/src/bitgo/psbt/scriptTypes.js +3 -3
  48. package/dist/src/bitgo/signature.d.ts +3 -3
  49. package/dist/src/bitgo/signature.d.ts.map +1 -1
  50. package/dist/src/bitgo/signature.js +48 -16
  51. package/dist/src/bitgo/transaction.d.ts +18 -3
  52. package/dist/src/bitgo/transaction.d.ts.map +1 -1
  53. package/dist/src/bitgo/transaction.js +28 -15
  54. package/dist/src/bitgo/types.d.ts +2 -0
  55. package/dist/src/bitgo/types.d.ts.map +1 -1
  56. package/dist/src/bitgo/types.js +1 -1
  57. package/dist/src/bitgo/wallet/Psbt.d.ts +104 -12
  58. package/dist/src/bitgo/wallet/Psbt.d.ts.map +1 -1
  59. package/dist/src/bitgo/wallet/Psbt.js +285 -70
  60. package/dist/src/bitgo/wallet/Unspent.d.ts +28 -0
  61. package/dist/src/bitgo/wallet/Unspent.d.ts.map +1 -1
  62. package/dist/src/bitgo/wallet/Unspent.js +172 -68
  63. package/dist/src/bitgo/wallet/WalletOutput.d.ts +17 -1
  64. package/dist/src/bitgo/wallet/WalletOutput.d.ts.map +1 -1
  65. package/dist/src/bitgo/wallet/WalletOutput.js +64 -23
  66. package/dist/src/bitgo/wallet/chains.d.ts +2 -2
  67. package/dist/src/bitgo/wallet/chains.d.ts.map +1 -1
  68. package/dist/src/bitgo/wallet/chains.js +1 -1
  69. package/dist/src/bitgo/zcash/ZcashPsbt.d.ts +0 -1
  70. package/dist/src/bitgo/zcash/ZcashPsbt.d.ts.map +1 -1
  71. package/dist/src/bitgo/zcash/ZcashPsbt.js +7 -16
  72. package/dist/src/bitgo/zcash/ZcashTransaction.js +2 -2
  73. package/dist/src/musig.d.ts +390 -0
  74. package/dist/src/musig.d.ts.map +1 -0
  75. package/dist/src/musig.js +447 -0
  76. package/dist/src/networks.d.ts +1 -2
  77. package/dist/src/networks.d.ts.map +1 -1
  78. package/dist/src/networks.js +22 -29
  79. package/dist/src/noble_ecc.d.ts +1 -1
  80. package/dist/src/noble_ecc.d.ts.map +1 -1
  81. package/dist/src/noble_ecc.js +11 -7
  82. package/dist/src/payments/p2tr.d.ts.map +1 -1
  83. package/dist/src/payments/p2tr.js +21 -19
  84. package/dist/src/payments/p2tr_ns.js +2 -3
  85. package/dist/src/taproot.d.ts +16 -0
  86. package/dist/src/taproot.d.ts.map +1 -1
  87. package/dist/src/taproot.js +45 -4
  88. package/dist/src/testutil/index.d.ts +2 -0
  89. package/dist/src/testutil/index.d.ts.map +1 -1
  90. package/dist/src/testutil/index.js +3 -1
  91. package/dist/src/testutil/keys.d.ts +3 -0
  92. package/dist/src/testutil/keys.d.ts.map +1 -1
  93. package/dist/src/testutil/keys.js +17 -2
  94. package/dist/src/testutil/mock.d.ts +1 -1
  95. package/dist/src/testutil/mock.d.ts.map +1 -1
  96. package/dist/src/testutil/mock.js +12 -4
  97. package/dist/src/testutil/psbt.d.ts +89 -0
  98. package/dist/src/testutil/psbt.d.ts.map +1 -0
  99. package/dist/src/testutil/psbt.js +150 -0
  100. package/dist/src/testutil/transaction.d.ts +70 -0
  101. package/dist/src/testutil/transaction.d.ts.map +1 -0
  102. package/dist/src/testutil/transaction.js +107 -0
  103. package/dist/src/transaction_builder.js +2 -2
  104. package/package.json +6 -7
package/README.md CHANGED
@@ -3,12 +3,13 @@
3
3
  This library is a wrapper around [bitcoinjs-lib](https://github.com/bitcoinjs/bitcoinjs-lib) adding altcoin support.
4
4
 
5
5
  ## Features
6
+
6
7
  - Multicoin support: Configurable behaviour based on [network](https://github.com/BitGo/bitgo-utxo-lib/blob/master/src/networks.js) objects.
7
8
  - Backed by [BitGo](https://www.bitgo.com/info/)
8
9
 
9
10
  ## Installation
10
11
 
11
- ``` bash
12
+ ```bash
12
13
  # using npm
13
14
  npm install @bitgo/utxo-lib
14
15
 
@@ -19,20 +20,22 @@ yarn add @bitgo/utxo-lib
19
20
  ## Setup
20
21
 
21
22
  JavaScript (ESM)
22
- ``` javascript
23
- import * as utxolib from '@bitgo/utxo-lib'
23
+
24
+ ```javascript
25
+ import * as utxolib from '@bitgo/utxo-lib';
24
26
  ```
25
27
 
26
28
  NodeJS (CJS)
27
- ``` javascript
28
- const utxolib = require('@bitgo/utxo-lib')
29
+
30
+ ```javascript
31
+ const utxolib = require('@bitgo/utxo-lib');
29
32
  ```
30
33
 
31
34
  ## Usage
32
35
 
33
36
  Support for parsing and building altcoin transactions is provided by the following methods
34
37
 
35
- ``` typescript
38
+ ```typescript
36
39
  utxolib.bitgo.createTransactionFromBuffer(buffer, network): UtxoTransaction
37
40
  // (similarly `createTransactionFromHex(string, network)`)
38
41
 
@@ -45,15 +48,15 @@ The `UtxoTransaction(Builder)` classes have the same interface as the `Transacti
45
48
 
46
49
  ## Supported coins
47
50
 
48
- |Network|Mainnet|Testnet|
49
- |---|---|---|
50
- |Bitcoin|`utxolib.networks.bitcoin`|`utxolib.networks.testnet`|
51
- |Bitcoin Cash|`utxolib.networks.bitcoincash`|`utxolib.networks.bitcoincashTestnet`|
52
- |Bitcoin Gold|`utxolib.networks.bitcoingold`|`utxolib.networks.bitcoingoldTestnet`|
53
- |Bitcoin SV (Satoshi Vision)|`utxolib.networks.bitcoinsv`|`utxolib.networks.bitcoinsvTestnet`|
54
- |Dash|`utxolib.networks.dash`|`utxolib.networks.dash`|
55
- |eCash|`utxolib.networks.ecash`|`utxolib.networks.ecashTestnet`|
56
- |Litecoin|`utxolib.networks.litecoin`|`utxolib.networks.litecoinTest`|
57
- |Zcash|`utxolib.networks.zcash`|`utxolib.networks.zcashTest`|
51
+ | Network | Mainnet | Testnet |
52
+ | --------------------------- | ------------------------------ | ------------------------------------- |
53
+ | Bitcoin | `utxolib.networks.bitcoin` | `utxolib.networks.testnet` |
54
+ | Bitcoin Cash | `utxolib.networks.bitcoincash` | `utxolib.networks.bitcoincashTestnet` |
55
+ | Bitcoin Gold | `utxolib.networks.bitcoingold` | `utxolib.networks.bitcoingoldTestnet` |
56
+ | Bitcoin SV (Satoshi Vision) | `utxolib.networks.bitcoinsv` | `utxolib.networks.bitcoinsvTestnet` |
57
+ | Dash | `utxolib.networks.dash` | `utxolib.networks.dash` |
58
+ | eCash | `utxolib.networks.ecash` | `utxolib.networks.ecashTestnet` |
59
+ | Litecoin | `utxolib.networks.litecoin` | `utxolib.networks.litecoinTest` |
60
+ | Zcash | `utxolib.networks.zcash` | `utxolib.networks.zcashTest` |
58
61
 
59
62
  > [Bitcoin SV](https://blog.bitgo.com/bsv-deprecation-6b3fff4df34c) no longer supports sending funds to BitGo wallets. Existing customers with Bitcoin SV in BitGo wallets will still be able to access and sweep funds to an external Bitcoin SV wallet.
@@ -1 +1 @@
1
- {"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src/address.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG5E,OAAO,EAA2B,OAAO,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAK/E;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAKxE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAKrF;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAKpF;AAED,eAAO,MAAQ,UAAU,uCAAE,QAAQ,mCAAsB,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src/address.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG5E,OAAO,EAA2B,OAAO,EAAE,MAAM,YAAY,CAAC;AAG9D,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAe/E;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAKxE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAKrF;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAKpF;AAED,eAAO,MAAQ,UAAU,uCAAE,QAAQ,mCAAsB,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC"}
@@ -5,10 +5,20 @@ exports.toBech32 = exports.fromBech32 = exports.fromBase58Check = exports.toBase
5
5
  const bitcoinjs = require("bitcoinjs-lib");
6
6
  const zcashAddress = require("../src/bitgo/zcash/address");
7
7
  const networks_1 = require("./networks");
8
+ const index_1 = require("./index");
8
9
  function fromOutputScript(outputScript, network) {
9
10
  if (networks_1.isValidNetwork(network) && networks_1.isZcash(network)) {
10
11
  return zcashAddress.fromOutputScript(outputScript, network);
11
12
  }
13
+ // We added p2tr payments from our forked bitcoinjs-lib to utxo-lib instead. Our bitcoinjs fork will no longer have
14
+ // p2tr support so utxo-lib should take care of retrieving a p2tr address from outputScript and bitcoinjs-lib can
15
+ // handle the other type of payments.
16
+ try {
17
+ return index_1.p2trPayments.p2tr({ output: outputScript, network }).address;
18
+ }
19
+ catch (e) {
20
+ // noop. try the bitcoinjs method
21
+ }
12
22
  return bitcoinjs.address.fromOutputScript(outputScript, network);
13
23
  }
14
24
  exports.fromOutputScript = fromOutputScript;
@@ -34,4 +44,4 @@ function fromBase58Check(address, network) {
34
44
  }
35
45
  exports.fromBase58Check = fromBase58Check;
36
46
  _a = bitcoinjs.address, exports.fromBech32 = _a.fromBech32, exports.toBech32 = _a.toBech32;
37
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRkcmVzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9hZGRyZXNzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFBQSwyQ0FBMkM7QUFHM0MsMkRBQTJEO0FBQzNELHlDQUE4RDtBQUU5RCxTQUFnQixnQkFBZ0IsQ0FBQyxZQUFvQixFQUFFLE9BQWdCO0lBQ3JFLElBQUkseUJBQWMsQ0FBQyxPQUFPLENBQUMsSUFBSSxrQkFBTyxDQUFDLE9BQU8sQ0FBQyxFQUFFO1FBQy9DLE9BQU8sWUFBWSxDQUFDLGdCQUFnQixDQUFDLFlBQVksRUFBRSxPQUFPLENBQUMsQ0FBQztLQUM3RDtJQUNELE9BQU8sU0FBUyxDQUFDLE9BQU8s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hc2U1OENoZWNrKGFkZHJlc3MpO1xufVxuXG5leHBvcnQgY29uc3QgeyBmcm9tQmVjaDMyLCB0b0JlY2gzMiB9ID0gYml0Y29pbmpzLmFkZHJlc3M7XG5cbmV4cG9ydCB7IEJhc2U1OENoZWNrUmVzdWx0LCBCZWNoMzJSZXN1bHQgfTtcbiJdfQ==
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { Network } from './networks';
9
9
  export declare const addressFormats: readonly ["default", "cashaddr"];
10
- export declare type AddressFormat = typeof addressFormats[number];
10
+ export declare type AddressFormat = (typeof addressFormats)[number];
11
11
  /**
12
12
  * @param format
13
13
  * @param network
@@ -1 +1 @@
1
- {"version":3,"file":"addressFormat.d.ts","sourceRoot":"","sources":["../../src/addressFormat.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,OAAO,EAA8B,OAAO,EAAY,MAAM,YAAY,CAAC;AAK3E,eAAO,MAAM,cAAc,kCAAmC,CAAC;AAE/D,oBAAY,aAAa,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAE1D;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAQzF;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAYhH;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAYzG;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,aAAa,EAAE,GACxB,CAAC,aAAa,EAAE,MAAM,CAAC,CAczB;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,OAA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 -107,4 +107,4 @@ function toCanonicalFormat(address, network) {
107
107
  return address_1.fromOutputScript(toOutputScriptTryFormats(address, network), network);
108
108
  }
109
109
  exports.toCanonicalFormat = toCanonicalFormat;
110
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRkcmVzc0Zvcm1hdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9hZGRyZXNzRm9ybWF0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBOzs7OztHQUtHO0FBQ0gseUNBQTJFO0FBQzNFLHVDQUE2RDtBQUU3RCxtQ0FBdUM7QUFFMUIsUUFBQSxjQUFjLEdBQUcsQ0FBQyxTQUFTLEVBQUUsVUFBVSxDQUFVLENBQUM7QUFJL0Q7Ozs7R0FJRztBQUNILFNBQWdCLHdCQUF3QixDQUFDLE1BQXFCLEVBQUUsT0FBZ0I7SUFDOUUsUUFBUSxNQUFNLEVBQUU7UUFDZCxLQUFLLFNBQVM7WUFDWixPQUFPLElBQUksQ0FBQztRQUNkLEtBQUssVUFBVTtZQUNiLE9BQU8sQ0FBQyxtQkFBUSxDQUFDLFdBQVcsRUFBRSxtQkFBUSxDQUFDLEtBQUssQ0FBQyxDQUFDLFFBQVEsQ0FBQyxxQkFBVSxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUM7S0FDL0U7SUFDRCxNQUFNLElBQUksS0FBSyxDQUFDLDBCQUEwQixNQUFNLEVBQUUsQ0FBQyxDQUFDO0FBQ3RELENBQUM7QUFSRCw0REFRQztBQUVEOzs7OztHQUtHO0FBQ0gsU0FBZ0IsMEJBQTBCLENBQUMsWUFBb0IsRUFBRSxNQUFxQixFQUFFLE9BQWdCO0lBQ3RHLElBQUksQ0FBQyx3QkFBd0IsQ0FBQyxNQUFNLEVBQUUsT0FBTyxDQUFDLEVBQUU7UUFDOUMsTUFBTSxJQUFJLEtBQUssQ0FBQyw4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0d29yaywgZm9ybWF0cyk7XG4gIHJldHVybiBvdXRwdXRTY3JpcHQ7XG59XG5cbi8qKlxuICogQHBhcmFtIGFkZHJlc3NcbiAqIEBwYXJhbSBuZXR3b3JrXG4gKiBAcmV0dXJuIGFkZHJlc3MgaW4gY2Fub25pY2FsIGZvcm1hdFxuICovXG5leHBvcnQgZnVuY3Rpb24gdG9DYW5vbmljYWxGb3JtYXQoYWRkcmVzczogc3RyaW5nLCBuZXR3b3JrOiBOZXR3b3JrKTogc3RyaW5nIHtcbiAgcmV0dXJuIGZyb21PdXRwdXRTY3JpcHQodG9PdXRwdXRTY3JpcHRUcnlGb3JtYXRzKGFkZHJlc3MsIG5ldHdvcmspLCBuZXR3b3JrKTtcbn1cbiJdfQ==
@@ -0,0 +1,14 @@
1
+ export declare function readScalar(bytes: Uint8Array): bigint;
2
+ export declare function readSecret(bytes: Uint8Array): bigint;
3
+ export declare function isPoint(p: Uint8Array): boolean;
4
+ export declare function isXOnlyPoint(p: Uint8Array): boolean;
5
+ export declare function scalarAdd(a: Uint8Array, b: Uint8Array): Uint8Array;
6
+ export declare function scalarMultiply(a: Uint8Array, b: Uint8Array): Uint8Array;
7
+ export declare function scalarNegate(a: Uint8Array): Uint8Array;
8
+ export declare function scalarMod(a: Uint8Array): Uint8Array;
9
+ export declare function isScalar(t: Uint8Array): boolean;
10
+ export declare function isSecret(s: Uint8Array): boolean;
11
+ export declare function pointNegate(p: Uint8Array): Uint8Array;
12
+ export declare function pointX(p: Uint8Array): Uint8Array;
13
+ export declare function hasEvenY(p: Uint8Array): boolean;
14
+ //# sourceMappingURL=base_crypto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base_crypto.d.ts","sourceRoot":"","sources":["../../src/base_crypto.ts"],"names":[],"mappings":"AA4CA,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIpD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIpD;AAkCD,wBAAgB,OAAO,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,CAqB9C;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,CAOnD;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,UAAU,CAKlE;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,UAAU,CAKvE;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,UAAU,CAItD;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,GAAG,UAAU,CAInD;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,CAO/C;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,CAO/C;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,UAAU,GAAG,UAAU,CAcrD;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,UAAU,GAAG,UAAU,CAIhD;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,CAW/C"}
@@ -0,0 +1,215 @@
1
+ "use strict";
2
+ // BigInt / Uint8Array versions of Crypto functions that do not require point
3
+ // math. If your JS interpreter has BigInt, you can use all of these. If not,
4
+ // you'll need to either shim it in or override more of these functions.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.hasEvenY = exports.pointX = exports.pointNegate = exports.isSecret = exports.isScalar = exports.scalarMod = exports.scalarNegate = exports.scalarMultiply = exports.scalarAdd = exports.isXOnlyPoint = exports.isPoint = exports.readSecret = exports.readScalar = void 0;
7
+ // Idea from noble-secp256k1, be nice to bad JS parsers
8
+ const _0n = BigInt(0);
9
+ const _1n = BigInt(1);
10
+ const _2n = BigInt(2);
11
+ const _3n = BigInt(3);
12
+ const _5n = BigInt(5);
13
+ const _7n = BigInt(7);
14
+ const _64n = BigInt(64);
15
+ const _64mask = BigInt('0xFFFFFFFFFFFFFFFF');
16
+ const MAX_INT = BigInt('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF');
17
+ const CURVE = {
18
+ b: BigInt(7),
19
+ P: BigInt('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F'),
20
+ n: BigInt('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141'),
21
+ };
22
+ // Big Endian
23
+ function read32b(bytes) {
24
+ if (bytes.length !== 32)
25
+ throw new Error(`Expected 32-bytes, not ${bytes.length}`);
26
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
27
+ let b = view.getBigUint64(0);
28
+ for (let offs = 8; offs < bytes.length; offs += 8) {
29
+ b <<= _64n;
30
+ b += view.getBigUint64(offs);
31
+ }
32
+ return b;
33
+ }
34
+ function write32b(num, dest = new Uint8Array(32)) {
35
+ // All input values are modulo P or n, so no bounds checking needed
36
+ const view = new DataView(dest.buffer, dest.byteOffset, dest.length);
37
+ for (let offs = 24; offs >= 0; offs -= 8) {
38
+ view.setBigUint64(offs, num & _64mask);
39
+ num >>= _64n;
40
+ }
41
+ return dest;
42
+ }
43
+ function readScalar(bytes) {
44
+ const a = read32b(bytes);
45
+ if (a >= CURVE.n)
46
+ throw new Error('Expected value mod n');
47
+ return a;
48
+ }
49
+ exports.readScalar = readScalar;
50
+ function readSecret(bytes) {
51
+ const a = readScalar(bytes);
52
+ if (a === 0n)
53
+ throw new Error('Expected non-zero');
54
+ return a;
55
+ }
56
+ exports.readSecret = readSecret;
57
+ // The short Weierstrass form curve equation simplifes to y^2 = x^3 + 7.
58
+ function secp256k1Right(x) {
59
+ const x2 = (x * x) % CURVE.P;
60
+ const x3 = (x2 * x) % CURVE.P;
61
+ return (x3 + CURVE.b) % CURVE.P;
62
+ }
63
+ // For prime P, the Jacobi Symbol of 'a' is 1 if and only if 'a' is a quadratic
64
+ // residue mod P, ie. there exists a value 'x' for whom x^2 = a.
65
+ function jacobiSymbol(a) {
66
+ if (a === _0n)
67
+ return 0; // Vanishingly improbable
68
+ let p = CURVE.P;
69
+ let sign = 1;
70
+ // This algorithm is fairly heavily optimized, so don't simplify it w/o benchmarking
71
+ for (;;) {
72
+ let and3;
73
+ // Handle runs of zeros efficiently w/o flipping sign each time
74
+ for (and3 = a & _3n; and3 === _0n; a >>= _2n, and3 = a & _3n)
75
+ ;
76
+ // If there's one more zero, shift it off and flip the sign
77
+ if (and3 === _2n) {
78
+ a >>= _1n;
79
+ const pand7 = p & _7n;
80
+ if (pand7 === _3n || pand7 === _5n)
81
+ sign = -sign;
82
+ }
83
+ if (a === _1n)
84
+ break;
85
+ if ((_3n & a) === _3n && (_3n & p) === _3n)
86
+ sign = -sign;
87
+ [a, p] = [p % a, a];
88
+ }
89
+ return sign > 0 ? 1 : -1;
90
+ }
91
+ function isPoint(p) {
92
+ if (p.length < 33)
93
+ return false;
94
+ const t = p[0];
95
+ if (p.length === 33) {
96
+ return (t === 0x02 || t === 0x03) && isXOnlyPoint(p.subarray(1));
97
+ }
98
+ if (t !== 0x04 || p.length !== 65)
99
+ return false;
100
+ const x = read32b(p.subarray(1, 33));
101
+ if (x === _0n)
102
+ return false;
103
+ if (x >= CURVE.P)
104
+ return false;
105
+ const y = read32b(p.subarray(33));
106
+ if (y === _0n)
107
+ return false;
108
+ if (y >= CURVE.P)
109
+ return false;
110
+ const left = (y * y) % CURVE.P;
111
+ const right = secp256k1Right(x);
112
+ return left === right;
113
+ }
114
+ exports.isPoint = isPoint;
115
+ function isXOnlyPoint(p) {
116
+ if (p.length !== 32)
117
+ return false;
118
+ const x = read32b(p);
119
+ if (x === _0n)
120
+ return false;
121
+ if (x >= CURVE.P)
122
+ return false;
123
+ const y2 = secp256k1Right(x);
124
+ return jacobiSymbol(y2) === 1; // If sqrt(y^2) exists, x is on the curve.
125
+ }
126
+ exports.isXOnlyPoint = isXOnlyPoint;
127
+ function scalarAdd(a, b) {
128
+ const aN = readScalar(a);
129
+ const bN = readScalar(b);
130
+ const sum = (aN + bN) % CURVE.n;
131
+ return write32b(sum);
132
+ }
133
+ exports.scalarAdd = scalarAdd;
134
+ function scalarMultiply(a, b) {
135
+ const aN = readScalar(a);
136
+ const bN = readScalar(b);
137
+ const product = (aN * bN) % CURVE.n;
138
+ return write32b(product);
139
+ }
140
+ exports.scalarMultiply = scalarMultiply;
141
+ function scalarNegate(a) {
142
+ const aN = readScalar(a);
143
+ const negated = aN === _0n ? _0n : CURVE.n - aN;
144
+ return write32b(negated);
145
+ }
146
+ exports.scalarNegate = scalarNegate;
147
+ function scalarMod(a) {
148
+ const aN = read32b(a);
149
+ const remainder = aN % CURVE.n;
150
+ return write32b(remainder);
151
+ }
152
+ exports.scalarMod = scalarMod;
153
+ function isScalar(t) {
154
+ try {
155
+ readScalar(t);
156
+ return true;
157
+ }
158
+ catch {
159
+ return false;
160
+ }
161
+ }
162
+ exports.isScalar = isScalar;
163
+ function isSecret(s) {
164
+ try {
165
+ readSecret(s);
166
+ return true;
167
+ }
168
+ catch {
169
+ return false;
170
+ }
171
+ }
172
+ exports.isSecret = isSecret;
173
+ function pointNegate(p) {
174
+ // hasEvenY does basic structure check, so start there
175
+ const even = hasEvenY(p);
176
+ // `from` because node.Buffer.slice doesn't copy but looks like a Uint8Array
177
+ const negated = Uint8Array.from(p);
178
+ if (p.length === 33) {
179
+ negated[0] = even ? 3 : 2;
180
+ }
181
+ else if (p.length === 65) {
182
+ const y = read32b(p.subarray(33));
183
+ if (y >= CURVE.P)
184
+ throw new Error('Expected Y coordinate mod P');
185
+ const minusY = y === _0n ? _0n : CURVE.P - y;
186
+ write32b(minusY, negated.subarray(33));
187
+ }
188
+ return negated;
189
+ }
190
+ exports.pointNegate = pointNegate;
191
+ function pointX(p) {
192
+ if (p.length === 32)
193
+ return p;
194
+ hasEvenY(p); // hasEvenY throws if not well structured
195
+ return p.slice(1, 33);
196
+ }
197
+ exports.pointX = pointX;
198
+ function hasEvenY(p) {
199
+ if (p.length === 33) {
200
+ if (p[0] === 2)
201
+ return true;
202
+ else if (p[0] === 3)
203
+ return false;
204
+ else
205
+ throw new Error('Wrong first byte to be a point');
206
+ }
207
+ if (p.length === 65) {
208
+ if (p[0] !== 4)
209
+ throw new Error('Wrong first byte to be point');
210
+ return p[64] % 2 === 0;
211
+ }
212
+ throw new Error('Wrong length to be a point');
213
+ }
214
+ exports.hasEvenY = hasEvenY;
215
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZV9jcnlwdG8uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYmFzZV9jcnlwdG8udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDZFQUE2RTtBQUM3RSw2RUFBNkU7QUFDN0Usd0VBQXdFOzs7QUFFeEUsdURBQXVEO0FBQ3ZELE1BQU0sR0FBRyxHQUFHLE1BQU0sQ0FBQyxDQUFDLENBQUMsQ0FBQztBQUN0QixNQUFNLEdBQUcsR0FBRyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUM7QUFDdEIsTUFBTSxHQUFHLEdBQUcsTUFBTSxDQUFDLENBQUMsQ0FBQyxDQUFDO0FBQ3RCLE1BQU0sR0FBRyxHQUFHLE1BQU0sQ0FBQyxDQUFDLENBQUMsQ0FBQztBQUN0QixNQUFNLEdBQUcsR0FBRyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUM7QUFDdEIsTUFBTSxHQUFHLEdBQUcsTUFBTSxDQUFDLENBQUMsQ0FBQyxDQUFDO0FBQ3RCLE1BQU0sSUFBSSxHQUFHLE1BQU0sQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUN4QixNQUFNLE9BQU8sR0FBRyxNQUFNLENBQUMsb0JBQW9CLENBQUM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nVuY3Rpb24gcG9pbnRYKHA6IFVpbnQ4QXJyYXkpOiBVaW50OEFycmF5IHtcbiAgaWYgKHAubGVuZ3RoID09PSAzMikgcmV0dXJuIHA7XG4gIGhhc0V2ZW5ZKHApOyAvLyBoYXNFdmVuWSB0aHJvd3MgaWYgbm90IHdlbGwgc3RydWN0dXJlZFxuICByZXR1cm4gcC5zbGljZSgxLCAzMyk7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBoYXNFdmVuWShwOiBVaW50OEFycmF5KTogYm9vbGVhbiB7XG4gIGlmIChwLmxlbmd0aCA9PT0gMzMpIHtcbiAgICBpZiAocFswXSA9PT0gMikgcmV0dXJuIHRydWU7XG4gICAgZWxzZSBpZiAocFswXSA9PT0gMykgcmV0dXJuIGZhbHNlO1xuICAgIGVsc2UgdGhyb3cgbmV3IEVycm9yKCdXcm9uZyBmaXJzdCBieXRlIHRvIGJlIGEgcG9pbnQnKTtcbiAgfVxuICBpZiAocC5sZW5ndGggPT09IDY1KSB7XG4gICAgaWYgKHBbMF0gIT09IDQpIHRocm93IG5ldyBFcnJvcignV3JvbmcgZmlyc3QgYnl0ZSB0byBiZSBwb2ludCcpO1xuICAgIHJldHVybiBwWzY0XSAlIDIgPT09IDA7XG4gIH1cbiAgdGhyb3cgbmV3IEVycm9yKCdXcm9uZyBsZW5ndGggdG8gYmUgYSBwb2ludCcpO1xufVxuIl19
@@ -1,51 +1,149 @@
1
1
  /// <reference types="node" />
2
- import { ProprietaryKeyValueData, UtxoPsbt } from './UtxoPsbt';
3
- import { BIP32Interface } from 'bip32';
2
+ import { SessionKey } from '@brandonblack/musig';
4
3
  import { Tuple } from './types';
4
+ import { PsbtInput } from 'bip174/src/lib/interfaces';
5
+ import { ProprietaryKeyValue } from './PsbtUtil';
5
6
  /**
6
7
  * Participant key value object.
7
8
  */
8
- export interface PsbtMusig2ParticipantsKeyValueData {
9
+ export interface PsbtMusig2Participants {
9
10
  tapOutputKey: Buffer;
10
11
  tapInternalKey: Buffer;
11
12
  participantPubKeys: Tuple<Buffer>;
12
13
  }
14
+ export interface PsbtMusig2DeterministicParams {
15
+ privateKey: Buffer;
16
+ otherNonce: Buffer;
17
+ publicKeys: Tuple<Buffer>;
18
+ internalPubKey: Buffer;
19
+ tapTreeRoot: Buffer;
20
+ hash: Buffer;
21
+ }
13
22
  /**
14
23
  * Nonce key value object.
15
24
  */
16
- export interface PsbtMusig2NoncesKeyValueData {
25
+ export interface PsbtMusig2PubNonce {
17
26
  participantPubKey: Buffer;
18
27
  tapOutputKey: Buffer;
19
- pubNonces: Buffer;
28
+ pubNonce: Buffer;
29
+ }
30
+ /**
31
+ * Partial signature key value object.
32
+ */
33
+ export interface PsbtMusig2PartialSig {
34
+ participantPubKey: Buffer;
35
+ tapOutputKey: Buffer;
36
+ partialSig: Buffer;
37
+ }
38
+ /**
39
+ * Because musig uses reference-equal buffers to cache nonces, we wrap it here to allow using
40
+ * nonces that are byte-equal but not reference-equal.
41
+ */
42
+ export declare class Musig2NonceStore {
43
+ private nonces;
44
+ /**
45
+ * Get original Buffer instance for nonce (which may be a copy).
46
+ * @return byte-equal buffer that is reference-equal to what was stored earlier in createMusig2Nonce
47
+ */
48
+ getRef(nonce: Uint8Array): Uint8Array;
49
+ /**
50
+ * Creates musig2 nonce and stores buffer reference.
51
+ * tapInternalkey, tapMerkleRoot, tapBip32Derivation for rootWalletKey are required per p2trMusig2 key path input.
52
+ * Also participant keys are required from psbt proprietary key values.
53
+ * Ref: https://gist.github.com/sanket1729/4b525c6049f4d9e034d27368c49f28a6
54
+ * @param privateKey - signer private key
55
+ * @param publicKey - signer xy public key
56
+ * @param xOnlyPublicKey - tweaked aggregated key (tapOutputKey)
57
+ * @param sessionId Additional entropy. If provided it must either be a counter unique to this secret key,
58
+ * (converted to an array of 32 bytes), or 32 uniformly random bytes.
59
+ */
60
+ createMusig2Nonce(privateKey: Uint8Array, publicKey: Uint8Array, xOnlyPublicKey: Uint8Array, txHash: Uint8Array, sessionId?: Buffer): Uint8Array;
20
61
  }
21
62
  /**
22
63
  * Psbt proprietary key val util function for participants pub keys. SubType is 0x01
23
64
  * Ref: https://gist.github.com/sanket1729/4b525c6049f4d9e034d27368c49f28a6
24
65
  * @return x-only tapOutputKey||tapInternalKey as sub keydata, plain sigining participant keys as valuedata
25
66
  */
26
- export declare function encodePsbtMusig2ParticipantsKeyValData(participantsKeyValData: PsbtMusig2ParticipantsKeyValueData): ProprietaryKeyValueData;
67
+ export declare function encodePsbtMusig2Participants(participants: PsbtMusig2Participants): ProprietaryKeyValue;
27
68
  /**
28
69
  * Psbt proprietary key val util function for pub nonce. SubType is 0x02
29
70
  * Ref: https://gist.github.com/sanket1729/4b525c6049f4d9e034d27368c49f28a6
30
71
  * @return plain-participantPubKey||x-only-tapOutputKey as sub keydata, 66 bytes of 2 pub nonces as valuedata
31
72
  */
32
- export declare function encodePsbtMusig2PubNonceKeyValData(noncesKeyValueData: PsbtMusig2NoncesKeyValueData): ProprietaryKeyValueData;
73
+ export declare function encodePsbtMusig2PubNonce(nonce: PsbtMusig2PubNonce): ProprietaryKeyValue;
74
+ export declare function encodePsbtMusig2PartialSig(partialSig: PsbtMusig2PartialSig): ProprietaryKeyValue;
33
75
  /**
34
76
  * Decodes proprietary key value data for participant pub keys
35
77
  * @param kv
36
78
  */
37
- export declare function decodePsbtMusig2ParticipantsKeyValData(kv: ProprietaryKeyValueData): PsbtMusig2ParticipantsKeyValueData;
79
+ export declare function decodePsbtMusig2Participants(kv: ProprietaryKeyValue): PsbtMusig2Participants;
80
+ /**
81
+ * Decodes proprietary key value data for musig2 nonce
82
+ * @param kv
83
+ */
84
+ export declare function decodePsbtMusig2Nonce(kv: ProprietaryKeyValue): PsbtMusig2PubNonce;
85
+ /**
86
+ * Decodes proprietary key value data for musig2 partial sig
87
+ * @param kv
88
+ */
89
+ export declare function decodePsbtMusig2PartialSig(kv: ProprietaryKeyValue): PsbtMusig2PartialSig;
38
90
  export declare function createTapInternalKey(plainPubKeys: Buffer[]): Buffer;
39
91
  export declare function createTapOutputKey(internalPubKey: Buffer, tapTreeRoot: Buffer): Buffer;
92
+ export declare function createAggregateNonce(pubNonces: Tuple<Buffer>): Buffer;
93
+ export declare function createTapTweak(tapInternalKey: Buffer, tapMerkleRoot: Buffer): Buffer;
94
+ export declare function musig2PartialSign(privateKey: Buffer, publicNonce: Uint8Array, sessionKey: SessionKey, nonceStore: Musig2NonceStore): Buffer;
95
+ export declare function musig2PartialSigVerify(sig: Buffer, publicKey: Buffer, publicNonce: Buffer, sessionKey: SessionKey): boolean;
96
+ export declare function musig2AggregateSigs(sigs: Buffer[], sessionKey: SessionKey): Buffer;
97
+ /** @return session key that can be used to reference the session later */
98
+ export declare function createMusig2SigningSession(sessionArgs: {
99
+ pubNonces: Tuple<Buffer>;
100
+ txHash: Buffer;
101
+ pubKeys: Tuple<Buffer>;
102
+ internalPubKey: Buffer;
103
+ tapTreeRoot: Buffer;
104
+ }): SessionKey;
40
105
  /**
41
- * Generates and sets Musig2 nonces to p2trMusig2 key path spending inputs.
42
- * tapInternalkey, tapMerkleRoot, tapBip32Derivation for rootWalletKey are required per p2trMusig2 key path input.
43
- * Also participant keys are required from psbt proprietary key values.
44
- * Ref: https://gist.github.com/sanket1729/4b525c6049f4d9e034d27368c49f28a6
45
- * @param psbt
46
- * @param rootWalletKey
47
- * @param sessionId If provided it must either be a counter unique to this secret key,
48
- * (converted to an array of 32 bytes), or 32 uniformly random bytes.
106
+ * @returns psbt proprietary key for musig2 participant key value data
107
+ * If no key value exists, undefined is returned.
108
+ */
109
+ export declare function parsePsbtMusig2Participants(input: PsbtInput): PsbtMusig2Participants | undefined;
110
+ /**
111
+ * @returns psbt proprietary key for musig2 public nonce key value data
112
+ * If no key value exists, undefined is returned.
113
+ */
114
+ export declare function parsePsbtMusig2Nonces(input: PsbtInput): PsbtMusig2PubNonce[] | undefined;
115
+ /**
116
+ * @returns psbt proprietary key for musig2 partial sig key value data
117
+ * If no key value exists, undefined is returned.
118
+ */
119
+ export declare function parsePsbtMusig2PartialSigs(input: PsbtInput): PsbtMusig2PartialSig[] | undefined;
120
+ /**
121
+ * Assert musig2 participant key value data with tapInternalKey and tapMerkleRoot.
122
+ * <tapOutputKey><tapInputKey> => <participantKey1><participantKey2>
123
+ * Using tapMerkleRoot and 2 participant keys, the tapInputKey is validated and using tapMerkleRoot and tapInputKey,
124
+ * the tapOutputKey is validated.
125
+ */
126
+ export declare function assertPsbtMusig2Participants(participantKeyValData: PsbtMusig2Participants, tapInternalKey: Buffer, tapMerkleRoot: Buffer): void;
127
+ /**
128
+ * Assert musig2 public nonce key value data with participant key value data
129
+ * (refer assertPsbtMusig2ParticipantsKeyValData).
130
+ * <participantKey1><tapOutputKey> => <pubNonce1>
131
+ * <participantKey2><tapOutputKey> => <pubNonce2>
132
+ * Checks against participant keys and tapOutputKey
133
+ */
134
+ export declare function assertPsbtMusig2Nonces(noncesKeyValData: PsbtMusig2PubNonce[], participantKeyValData: PsbtMusig2Participants): void;
135
+ /**
136
+ * @returns Input object but sig hash type data is taken out from partialSig field.
137
+ * If sig hash type is not common for all sigs, error out, otherwise returns the modified object and single hash type.
49
138
  */
50
- export declare function setMusig2Nonces(psbt: UtxoPsbt, rootWalletKey: BIP32Interface, sessionId?: Buffer): void;
139
+ export declare function getSigHashTypeFromSigs(partialSigs: PsbtMusig2PartialSig[]): {
140
+ partialSigs: PsbtMusig2PartialSig[];
141
+ sigHashType: number;
142
+ };
143
+ export declare function createMusig2DeterministicNonce(params: PsbtMusig2DeterministicParams): Buffer;
144
+ export declare function musig2DeterministicSign(params: PsbtMusig2DeterministicParams): {
145
+ sig: Buffer;
146
+ sessionKey: SessionKey;
147
+ publicNonce: Buffer;
148
+ };
51
149
  //# sourceMappingURL=Musig2.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Musig2.d.ts","sourceRoot":"","sources":["../../../src/bitgo/Musig2.ts"],"names":[],"mappings":";AAAA,OAAO,EAA+B,uBAAuB,EAAE,QAAQ,EAAyB,MAAM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