@airgap/bitcoin 0.13.45-beta.3 → 0.13.45-beta.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/package.json +5 -5
- package/v0/index.js +10 -10
- package/v0/index.js.map +1 -1
- package/v0/protocol/BitcoinAddress.js +9 -8
- package/v0/protocol/BitcoinAddress.js.map +1 -1
- package/v0/protocol/BitcoinCryptoClient.js +85 -16
- package/v0/protocol/BitcoinCryptoClient.js.map +1 -1
- package/v0/protocol/BitcoinProtocol.js +987 -590
- package/v0/protocol/BitcoinProtocol.js.map +1 -1
- package/v0/protocol/BitcoinProtocolOptions.js +111 -45
- package/v0/protocol/BitcoinProtocolOptions.js.map +1 -1
- package/v0/protocol/BitcoinSegwitAddress.js +29 -12
- package/v0/protocol/BitcoinSegwitAddress.js.map +1 -1
- package/v0/protocol/BitcoinSegwitProtocol.js +483 -348
- package/v0/protocol/BitcoinSegwitProtocol.js.map +1 -1
- package/v0/protocol/BitcoinTestnetProtocol.js +36 -28
- package/v0/protocol/BitcoinTestnetProtocol.js.map +1 -1
- package/v0/serializer/validators/transaction-validator.js +30 -22
- package/v0/serializer/validators/transaction-validator.js.map +1 -1
- package/v0/serializer/validators/validators.js +23 -23
- package/v0/serializer/validators/validators.js.map +1 -1
- package/v1/block-explorer/BlockCypherBlockExplorer.js +61 -12
- package/v1/block-explorer/BlockCypherBlockExplorer.js.map +1 -1
- package/v1/data/BitcoinAddress.js +10 -9
- package/v1/data/BitcoinAddress.js.map +1 -1
- package/v1/data/BitcoinLegacyAddress.js +12 -11
- package/v1/data/BitcoinLegacyAddress.js.map +1 -1
- package/v1/data/BitcoinSegwitAddress.js +12 -11
- package/v1/data/BitcoinSegwitAddress.js.map +1 -1
- package/v1/data/BitcoinTaprootAddress.js +22 -31
- package/v1/data/BitcoinTaprootAddress.js.map +1 -1
- package/v1/index.js +11 -11
- package/v1/index.js.map +1 -1
- package/v1/module/BitcoinModule.d.ts +1 -1
- package/v1/module/BitcoinModule.js +102 -44
- package/v1/module/BitcoinModule.js.map +1 -1
- package/v1/module.js +3 -2
- package/v1/module.js.map +1 -1
- package/v1/protocol/BitcoinCryptoClient.js +90 -22
- package/v1/protocol/BitcoinCryptoClient.js.map +1 -1
- package/v1/protocol/BitcoinLegacyProtocol.js +796 -520
- package/v1/protocol/BitcoinLegacyProtocol.js.map +1 -1
- package/v1/protocol/BitcoinProtocol.js +1169 -735
- package/v1/protocol/BitcoinProtocol.js.map +1 -1
- package/v1/protocol/BitcoinSegwitProtocol.js +796 -542
- package/v1/protocol/BitcoinSegwitProtocol.js.map +1 -1
- package/v1/protocol/BitcoinTaprootProtocol.js +1000 -688
- package/v1/protocol/BitcoinTaprootProtocol.js.map +1 -1
- package/v1/protocol/BitcoinTestnetProtocol.js +33 -14
- package/v1/protocol/BitcoinTestnetProtocol.js.map +1 -1
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +52 -29
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -1
- package/v1/serializer/v3/serializer-companion.js +165 -98
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
- package/v1/serializer/v3/validators/transaction-validator.js +16 -13
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -1
- package/v1/serializer/v3/validators/validators.js +213 -122
- package/v1/serializer/v3/validators/validators.js.map +1 -1
- package/v1/types/crypto.d.ts +1 -1
- package/v1/types/key.d.ts +6 -6
- package/v1/types/protocol.d.ts +2 -2
- package/v1/types/transaction.d.ts +3 -3
- package/v1/utils/common.js +6 -4
- package/v1/utils/common.js.map +1 -1
- package/v1/utils/key.d.ts +6 -5
- package/v1/utils/key.js +39 -38
- package/v1/utils/key.js.map +1 -1
- package/v1/utils/network.js +4 -3
- package/v1/utils/network.js.map +1 -1
- package/v1/utils/protocol.js +19 -25
- package/v1/utils/protocol.js.map +1 -1
- package/v1/utils/signature.js +5 -4
- package/v1/utils/signature.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airgap/bitcoin",
|
|
3
|
-
"version": "0.13.45-beta.
|
|
3
|
+
"version": "0.13.45-beta.5",
|
|
4
4
|
"description": "The @airgap/bitcoin is a Bitcoin implementation of the ICoinProtocol interface from @airgap/coinlib-core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"airgap",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
},
|
|
31
31
|
"author": "Papers AG <contact@papers.ch> (https://papers.ch)",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@airgap/coinlib-core": "^0.13.45-beta.
|
|
34
|
-
"@airgap/crypto": "^0.13.45-beta.
|
|
35
|
-
"@airgap/module-kit": "^0.13.45-beta.
|
|
36
|
-
"@airgap/serializer": "^0.13.45-beta.
|
|
33
|
+
"@airgap/coinlib-core": "^0.13.45-beta.5",
|
|
34
|
+
"@airgap/crypto": "^0.13.45-beta.5",
|
|
35
|
+
"@airgap/module-kit": "^0.13.45-beta.5",
|
|
36
|
+
"@airgap/serializer": "^0.13.45-beta.5",
|
|
37
37
|
"@bitcoinerlab/secp256k1": "1.2.0",
|
|
38
38
|
"bip32": "5.0.0-rc.0",
|
|
39
39
|
"bitcoinjs-lib": "6.1.7"
|
package/v0/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BitcoinSegwitAddress = exports.BitcoinSegwitProtocol = exports.BitcoinAddress = exports.BitcoinProtocolOptions = exports.BitcoinProtocolConfig = exports.BitcoinProtocolNetwork = exports.BlockcypherBlockExplorer = exports.BitcoinProtocolNetworkExtras = exports.BitcoinCryptoClient = exports.BitcoinTestnetProtocol = exports.BitcoinProtocol = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
5
|
+
var serializer_1 = require("@airgap/serializer");
|
|
6
|
+
var BitcoinAddress_1 = require("./protocol/BitcoinAddress");
|
|
7
7
|
Object.defineProperty(exports, "BitcoinAddress", { enumerable: true, get: function () { return BitcoinAddress_1.BitcoinAddress; } });
|
|
8
|
-
|
|
8
|
+
var BitcoinCryptoClient_1 = require("./protocol/BitcoinCryptoClient");
|
|
9
9
|
Object.defineProperty(exports, "BitcoinCryptoClient", { enumerable: true, get: function () { return BitcoinCryptoClient_1.BitcoinCryptoClient; } });
|
|
10
|
-
|
|
10
|
+
var BitcoinProtocol_1 = require("./protocol/BitcoinProtocol");
|
|
11
11
|
Object.defineProperty(exports, "BitcoinProtocol", { enumerable: true, get: function () { return BitcoinProtocol_1.BitcoinProtocol; } });
|
|
12
|
-
|
|
12
|
+
var BitcoinProtocolOptions_1 = require("./protocol/BitcoinProtocolOptions");
|
|
13
13
|
Object.defineProperty(exports, "BitcoinProtocolConfig", { enumerable: true, get: function () { return BitcoinProtocolOptions_1.BitcoinProtocolConfig; } });
|
|
14
14
|
Object.defineProperty(exports, "BitcoinProtocolNetwork", { enumerable: true, get: function () { return BitcoinProtocolOptions_1.BitcoinProtocolNetwork; } });
|
|
15
15
|
Object.defineProperty(exports, "BitcoinProtocolNetworkExtras", { enumerable: true, get: function () { return BitcoinProtocolOptions_1.BitcoinProtocolNetworkExtras; } });
|
|
16
16
|
Object.defineProperty(exports, "BitcoinProtocolOptions", { enumerable: true, get: function () { return BitcoinProtocolOptions_1.BitcoinProtocolOptions; } });
|
|
17
17
|
Object.defineProperty(exports, "BlockcypherBlockExplorer", { enumerable: true, get: function () { return BitcoinProtocolOptions_1.BlockcypherBlockExplorer; } });
|
|
18
|
-
|
|
18
|
+
var BitcoinSegwitAddress_1 = require("./protocol/BitcoinSegwitAddress");
|
|
19
19
|
Object.defineProperty(exports, "BitcoinSegwitAddress", { enumerable: true, get: function () { return BitcoinSegwitAddress_1.BitcoinSegwitAddress; } });
|
|
20
|
-
|
|
20
|
+
var BitcoinSegwitProtocol_1 = require("./protocol/BitcoinSegwitProtocol");
|
|
21
21
|
Object.defineProperty(exports, "BitcoinSegwitProtocol", { enumerable: true, get: function () { return BitcoinSegwitProtocol_1.BitcoinSegwitProtocol; } });
|
|
22
|
-
|
|
22
|
+
var BitcoinTestnetProtocol_1 = require("./protocol/BitcoinTestnetProtocol");
|
|
23
23
|
Object.defineProperty(exports, "BitcoinTestnetProtocol", { enumerable: true, get: function () { return BitcoinTestnetProtocol_1.BitcoinTestnetProtocol; } });
|
|
24
|
-
|
|
24
|
+
var transaction_validator_1 = require("./serializer/validators/transaction-validator");
|
|
25
25
|
// Serializer
|
|
26
26
|
serializer_1.SerializerV3.addSchema(serializer_1.IACMessageType.TransactionSignRequest, { schema: require('./serializer/schemas/v3/transaction-sign-request-bitcoin-segwit.json') }, coinlib_core_1.MainProtocolSymbols.BTC_SEGWIT);
|
|
27
27
|
serializer_1.SerializerV3.addSchema(serializer_1.IACMessageType.TransactionSignResponse, { schema: require('./serializer/schemas/v3/transaction-sign-response-bitcoin-segwit.json') }, coinlib_core_1.MainProtocolSymbols.BTC_SEGWIT);
|
package/v0/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v0/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v0/index.ts"],"names":[],"mappings":";;;AAAA,qDAA0D;AAC1D,iDAA6E;AAE7E,4DAA0D;AA6BxD,+FA7BO,+BAAc,OA6BP;AA5BhB,sEAAoE;AAsBlE,oGAtBO,yCAAmB,OAsBP;AArBrB,8DAA4D;AAmB1D,gGAnBO,iCAAe,OAmBP;AAlBjB,4EAM0C;AAkBxC,sGAvBA,8CAAqB,OAuBA;AADrB,uGArBA,+CAAsB,OAqBA;AAFtB,6GAlBA,qDAA4B,OAkBA;AAI5B,uGArBA,+CAAsB,OAqBA;AAHtB,yGAjBA,iDAAwB,OAiBA;AAf1B,wEAAsE;AA4BtC,qGA5BvB,2CAAoB,OA4BuB;AA3BpD,0EAAwE;AA2B/D,sGA3BA,6CAAqB,OA2BA;AA1B9B,4EAA0E;AAUxE,uGAVO,+CAAsB,OAUP;AATxB,uFAAwI;AA2BxI,aAAa;AAEb,yBAAY,CAAC,SAAS,CACpB,2BAAc,CAAC,sBAAsB,EACrC,EAAE,MAAM,EAAE,OAAO,CAAC,sEAAsE,CAAC,EAAE,EAC3F,kCAAmB,CAAC,UAAU,CAC/B,CAAA;AACD,yBAAY,CAAC,SAAS,CACpB,2BAAc,CAAC,uBAAuB,EACtC,EAAE,MAAM,EAAE,OAAO,CAAC,uEAAuE,CAAC,EAAE,EAC5F,kCAAmB,CAAC,UAAU,CAC/B,CAAA;AAED,uBAAU,CAAC,SAAS,CAClB,2BAAc,CAAC,sBAAsB,EACrC,EAAE,MAAM,EAAE,OAAO,CAAC,+DAA+D,CAAC,EAAE,EACpF,kCAAmB,CAAC,GAAG,CACxB,CAAA;AACD,uBAAU,CAAC,SAAS,CAClB,2BAAc,CAAC,uBAAuB,EACtC,EAAE,MAAM,EAAE,OAAO,CAAC,gEAAgE,CAAC,EAAE,EACrF,kCAAmB,CAAC,GAAG,CACxB,CAAA;AAED,0BAA0B;AAC1B,2CAA2C;AAC3C,0FAA0F;AAC1F,4BAA4B;AAC5B,IAAI;AACJ,yBAAY,CAAC,SAAS,CACpB,2BAAc,CAAC,uBAAuB,EACtC,EAAE,MAAM,EAAE,OAAO,CAAC,gEAAgE,CAAC,EAAE,EACrF,kCAAmB,CAAC,GAAG,CACxB,CAAA;AAED,uBAAU,CAAC,YAAY,CAAC,kCAAmB,CAAC,GAAG,EAAE,IAAI,4DAAoC,EAAE,CAAC,CAAA;AAC5F,yBAAY,CAAC,YAAY,CAAC,kCAAmB,CAAC,GAAG,EAAE,IAAI,0DAAkC,EAAE,CAAC,CAAA"}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BitcoinAddress = void 0;
|
|
4
|
-
|
|
4
|
+
var BitcoinAddress = /** @class */ (function () {
|
|
5
5
|
// TODO: types
|
|
6
|
-
|
|
6
|
+
function BitcoinAddress(value, visibilityDerivationIndex, addressDerivationIndex) {
|
|
7
7
|
this.value = value;
|
|
8
8
|
this.visibilityDerivationIndex = visibilityDerivationIndex;
|
|
9
9
|
this.addressDerivationIndex = addressDerivationIndex;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
BitcoinAddress.from = function (node, visibilityDerivationIndex, addressDerivationIndex) {
|
|
12
|
+
var _node = visibilityDerivationIndex !== undefined && addressDerivationIndex !== undefined
|
|
13
13
|
? node.derive(visibilityDerivationIndex).derive(addressDerivationIndex)
|
|
14
14
|
: node;
|
|
15
15
|
return new BitcoinAddress(_node.getAddress(), visibilityDerivationIndex, addressDerivationIndex);
|
|
16
|
-
}
|
|
17
|
-
asString() {
|
|
16
|
+
};
|
|
17
|
+
BitcoinAddress.prototype.asString = function () {
|
|
18
18
|
return this.value;
|
|
19
|
-
}
|
|
20
|
-
|
|
19
|
+
};
|
|
20
|
+
return BitcoinAddress;
|
|
21
|
+
}());
|
|
21
22
|
exports.BitcoinAddress = BitcoinAddress;
|
|
22
23
|
//# sourceMappingURL=BitcoinAddress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitcoinAddress.js","sourceRoot":"","sources":["../../../src/v0/protocol/BitcoinAddress.ts"],"names":[],"mappings":";;;AAEA
|
|
1
|
+
{"version":3,"file":"BitcoinAddress.js","sourceRoot":"","sources":["../../../src/v0/protocol/BitcoinAddress.ts"],"names":[],"mappings":";;;AAEA;IACE,cAAc;IACd,wBACqB,KAAa,EAChB,yBAAkC,EAClC,sBAA+B;QAF5B,UAAK,GAAL,KAAK,CAAQ;QAChB,8BAAyB,GAAzB,yBAAyB,CAAS;QAClC,2BAAsB,GAAtB,sBAAsB,CAAS;IAC9C,CAAC;IAEU,mBAAI,GAAlB,UAAmB,IAAS,EAAE,yBAAkC,EAAE,sBAA+B;QAC/F,IAAM,KAAK,GACT,yBAAyB,KAAK,SAAS,IAAI,sBAAsB,KAAK,SAAS;YAC7E,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC,MAAM,CAAC,sBAAsB,CAAC;YACvE,CAAC,CAAC,IAAI,CAAA;QAEV,OAAO,IAAI,cAAc,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,yBAAyB,EAAE,sBAAsB,CAAC,CAAA;IAClG,CAAC;IAEM,iCAAQ,GAAf;QACE,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IACH,qBAAC;AAAD,CAAC,AApBD,IAoBC;AApBY,wCAAc"}
|
|
@@ -1,22 +1,91 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
2
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
54
|
exports.BitcoinCryptoClient = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const signature = this.bitcoinJSMessage.sign(message, Buffer.from(keypair.privateKey, 'hex'), true);
|
|
13
|
-
return signature.toString('base64');
|
|
14
|
-
}
|
|
15
|
-
async verifyMessage(message, signature, publicKey) {
|
|
16
|
-
const rawSignature = Buffer.from(signature, 'base64');
|
|
17
|
-
const address = await this.protocol.getAddressFromPublicKey(publicKey);
|
|
18
|
-
return this.bitcoinJSMessage.verify(message, address.address, rawSignature);
|
|
55
|
+
var Secp256k1CryptoClient_1 = require("@airgap/coinlib-core/protocols/Secp256k1CryptoClient");
|
|
56
|
+
var BitcoinCryptoClient = /** @class */ (function (_super) {
|
|
57
|
+
__extends(BitcoinCryptoClient, _super);
|
|
58
|
+
function BitcoinCryptoClient(protocol, bitcoinJSMessage) {
|
|
59
|
+
var _this = _super.call(this) || this;
|
|
60
|
+
_this.protocol = protocol;
|
|
61
|
+
_this.bitcoinJSMessage = bitcoinJSMessage;
|
|
62
|
+
return _this;
|
|
19
63
|
}
|
|
20
|
-
|
|
64
|
+
BitcoinCryptoClient.prototype.signMessage = function (message, keypair) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
66
|
+
var signature;
|
|
67
|
+
return __generator(this, function (_a) {
|
|
68
|
+
signature = this.bitcoinJSMessage.sign(message, Buffer.from(keypair.privateKey, 'hex'), true);
|
|
69
|
+
return [2 /*return*/, signature.toString('base64')];
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
BitcoinCryptoClient.prototype.verifyMessage = function (message, signature, publicKey) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
75
|
+
var rawSignature, address;
|
|
76
|
+
return __generator(this, function (_a) {
|
|
77
|
+
switch (_a.label) {
|
|
78
|
+
case 0:
|
|
79
|
+
rawSignature = Buffer.from(signature, 'base64');
|
|
80
|
+
return [4 /*yield*/, this.protocol.getAddressFromPublicKey(publicKey)];
|
|
81
|
+
case 1:
|
|
82
|
+
address = _a.sent();
|
|
83
|
+
return [2 /*return*/, this.bitcoinJSMessage.verify(message, address.address, rawSignature)];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
return BitcoinCryptoClient;
|
|
89
|
+
}(Secp256k1CryptoClient_1.Secp256k1CryptoClient));
|
|
21
90
|
exports.BitcoinCryptoClient = BitcoinCryptoClient;
|
|
22
91
|
//# sourceMappingURL=BitcoinCryptoClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitcoinCryptoClient.js","sourceRoot":"","sources":["../../../src/v0/protocol/BitcoinCryptoClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BitcoinCryptoClient.js","sourceRoot":"","sources":["../../../src/v0/protocol/BitcoinCryptoClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,8FAA4F;AAE5F;IAAyC,uCAAqB;IAC5D,6BAA6B,QAAuB,EAAmB,gBAAqB;QAA5F,YACE,iBAAO,SACR;QAF4B,cAAQ,GAAR,QAAQ,CAAe;QAAmB,sBAAgB,GAAhB,gBAAgB,CAAK;;IAE5F,CAAC;IAEY,yCAAW,GAAxB,UAAyB,OAAe,EAAE,OAA+B;;;;gBACjE,SAAS,GAAW,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,CAAA;gBAE3G,sBAAO,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAA;;;KACpC;IAEY,2CAAa,GAA1B,UAA2B,OAAe,EAAE,SAAiB,EAAE,SAAiB;;;;;;wBACxE,YAAY,GAAW,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;wBAE7C,qBAAM,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,EAAA;;wBAAhE,OAAO,GAAG,SAAsD;wBAEtE,sBAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,EAAA;;;;KAC5E;IACH,0BAAC;AAAD,CAAC,AAlBD,CAAyC,6CAAqB,GAkB7D;AAlBY,kDAAmB"}
|