@exodus/bip322-js 1.1.0-exodus.3 → 1.1.0-exodus.5
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/BIP322.d.ts +1 -1
- package/dist/BIP322.js +1 -1
- package/dist/Signer.d.ts +1 -1
- package/dist/Signer.js +2 -6
- package/dist/Verifier.js +1 -1
- package/dist/helpers/Address.js +1 -1
- package/dist/helpers/BIP137.js +3 -2
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/dist/BIP322.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import * as bitcoin from 'bitcoinjs-lib';
|
|
2
|
+
import * as bitcoin from '@exodus/bitcoinjs-lib';
|
|
3
3
|
/**
|
|
4
4
|
* Class that handles BIP-322 related operations.
|
|
5
5
|
* Reference: https://github.com/LegReq/bip0322-signatures/blob/master/BIP0322_signing.ipynb
|
package/dist/BIP322.js
CHANGED
|
@@ -28,7 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
// Import dependencies
|
|
30
30
|
const create_hash_1 = __importDefault(require("create-hash"));
|
|
31
|
-
const bitcoin = __importStar(require("bitcoinjs-lib"));
|
|
31
|
+
const bitcoin = __importStar(require("@exodus/bitcoinjs-lib"));
|
|
32
32
|
/**
|
|
33
33
|
* Class that handles BIP-322 related operations.
|
|
34
34
|
* Reference: https://github.com/LegReq/bip0322-signatures/blob/master/BIP0322_signing.ipynb
|
package/dist/Signer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import * as bitcoin from 'bitcoinjs-lib';
|
|
2
|
+
import * as bitcoin from '@exodus/bitcoinjs-lib';
|
|
3
3
|
/**
|
|
4
4
|
* Class that signs BIP-322 signature using a private key.
|
|
5
5
|
* Reference: https://github.com/LegReq/bip0322-signatures/blob/master/BIP0322_signing.ipynb
|
package/dist/Signer.js
CHANGED
|
@@ -30,7 +30,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
30
30
|
const BIP322_1 = __importDefault(require("./BIP322"));
|
|
31
31
|
const ecpair_1 = __importDefault(require("ecpair"));
|
|
32
32
|
const helpers_1 = require("./helpers");
|
|
33
|
-
const bitcoin = __importStar(require("bitcoinjs-lib"));
|
|
33
|
+
const bitcoin = __importStar(require("@exodus/bitcoinjs-lib"));
|
|
34
34
|
const bitcoinerlab_secp256k1_1 = __importDefault(require("@exodus/bitcoinerlab-secp256k1"));
|
|
35
35
|
const bitcoinMessage = __importStar(require("bitcoinjs-message"));
|
|
36
36
|
/**
|
|
@@ -88,13 +88,9 @@ class Signer {
|
|
|
88
88
|
signer = signer.tweak(bitcoin.crypto.taggedHash('TapTweak', signer.publicKey.subarray(1, 33)));
|
|
89
89
|
// Draft a toSign transaction that spends toSpend transaction
|
|
90
90
|
toSignTx = BIP322_1.default.buildToSignTx(toSpendTx.getId(), scriptPubKey, false, internalPublicKey);
|
|
91
|
-
// Set the sighashType to bitcoin.Transaction.SIGHASH_ALL since it defaults to SIGHASH_DEFAULT
|
|
92
|
-
toSignTx.updateInput(0, {
|
|
93
|
-
sighashType: bitcoin.Transaction.SIGHASH_ALL
|
|
94
|
-
});
|
|
95
91
|
}
|
|
96
92
|
// Sign the toSign transaction
|
|
97
|
-
const toSignTxSigned = toSignTx.signAllInputs(signer, [bitcoin.Transaction.SIGHASH_ALL]).finalizeAllInputs();
|
|
93
|
+
const toSignTxSigned = toSignTx.signAllInputs(signer, [bitcoin.Transaction.SIGHASH_ALL, bitcoin.Transaction.SIGHASH_DEFAULT]).finalizeAllInputs();
|
|
98
94
|
// Extract and return the signature
|
|
99
95
|
return BIP322_1.default.encodeWitness(toSignTxSigned);
|
|
100
96
|
}
|
package/dist/Verifier.js
CHANGED
|
@@ -29,7 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
// Import dependencies
|
|
30
30
|
const BIP322_1 = __importDefault(require("./BIP322"));
|
|
31
31
|
const helpers_1 = require("./helpers");
|
|
32
|
-
const bitcoin = __importStar(require("bitcoinjs-lib"));
|
|
32
|
+
const bitcoin = __importStar(require("@exodus/bitcoinjs-lib"));
|
|
33
33
|
const bitcoinerlab_secp256k1_1 = __importDefault(require("@exodus/bitcoinerlab-secp256k1"));
|
|
34
34
|
const bitcoinMessage = __importStar(require("bitcoinjs-message"));
|
|
35
35
|
const bitcoinjs_1 = require("./bitcoinjs");
|
package/dist/helpers/Address.js
CHANGED
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
// Import dependency
|
|
27
|
-
const bitcoin = __importStar(require("bitcoinjs-lib"));
|
|
27
|
+
const bitcoin = __importStar(require("@exodus/bitcoinjs-lib"));
|
|
28
28
|
/**
|
|
29
29
|
* Class that implement address-related utility functions.
|
|
30
30
|
*/
|
package/dist/helpers/BIP137.js
CHANGED
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
// Import dependencies
|
|
27
|
-
const secp256k1_1 = require("@
|
|
27
|
+
const secp256k1_1 = require("@exodus/secp256k1");
|
|
28
28
|
const bitcoinMessage = __importStar(require("bitcoinjs-message"));
|
|
29
29
|
/**
|
|
30
30
|
* Class that implement BIP137-related utility functions.
|
|
@@ -57,7 +57,8 @@ class BIP137 {
|
|
|
57
57
|
// Decode the provided BIP-137 signature
|
|
58
58
|
const signatureDecoded = this.decodeSignature(Buffer.from(signature, 'base64'));
|
|
59
59
|
// Recover the public key
|
|
60
|
-
|
|
60
|
+
const recoveredPublicKey = (0, secp256k1_1.ecdsaRecover)(signatureDecoded.signature, signatureDecoded.recovery, messageHash, signatureDecoded.compressed);
|
|
61
|
+
return Buffer.from(recoveredPublicKey);
|
|
61
62
|
}
|
|
62
63
|
/**
|
|
63
64
|
* Decode a BIP-137 signature.
|
package/dist/index.js
CHANGED
|
@@ -40,6 +40,6 @@ Object.defineProperty(exports, "Address", { enumerable: true, get: function () {
|
|
|
40
40
|
Object.defineProperty(exports, "BIP137", { enumerable: true, get: function () { return helpers_1.BIP137; } });
|
|
41
41
|
// Provide a ECC library to bitcoinjs-lib
|
|
42
42
|
const bitcoinerlab_secp256k1_1 = __importDefault(require("@exodus/bitcoinerlab-secp256k1"));
|
|
43
|
-
const bitcoin = __importStar(require("bitcoinjs-lib"));
|
|
43
|
+
const bitcoin = __importStar(require("@exodus/bitcoinjs-lib"));
|
|
44
44
|
bitcoin.initEccLib(bitcoinerlab_secp256k1_1.default);
|
|
45
45
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/bip322-js",
|
|
3
|
-
"version": "1.1.0-exodus.
|
|
3
|
+
"version": "1.1.0-exodus.5",
|
|
4
4
|
"description": "A Javascript library that provides utility functions related to the BIP-322 signature scheme",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@exodus/bitcoinerlab-secp256k1": "^1.0.5-exodus.1",
|
|
42
|
-
"@
|
|
43
|
-
"bitcoinjs-lib": "^6.1.
|
|
42
|
+
"@exodus/secp256k1": "4.0.2-exodus.0",
|
|
43
|
+
"@exodus/bitcoinjs-lib": "^6.1.5-exodus.0",
|
|
44
44
|
"bitcoinjs-message": "^2.2.0",
|
|
45
45
|
"ecpair": "^2.0.1"
|
|
46
46
|
}
|