@airgap/bitcoin 0.13.45-beta.3 → 0.13.45-beta.4
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
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BitcoinSegwitAddress = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
5
|
+
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
6
|
+
var BitcoinSegwitAddress = /** @class */ (function () {
|
|
7
|
+
function BitcoinSegwitAddress(value) {
|
|
8
8
|
this.value = value;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
BitcoinSegwitAddress.fromBip32 = function (bip32) {
|
|
11
11
|
return new BitcoinSegwitAddress(bip32.toBase58());
|
|
12
|
-
}
|
|
13
|
-
|
|
12
|
+
};
|
|
13
|
+
BitcoinSegwitAddress.fromPayment = function (payment) {
|
|
14
14
|
if (payment.address === undefined) {
|
|
15
15
|
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.BITCOIN, 'Could not generate address.');
|
|
16
16
|
}
|
|
17
17
|
return new BitcoinSegwitAddress(payment.address);
|
|
18
|
-
}
|
|
19
|
-
asString() {
|
|
18
|
+
};
|
|
19
|
+
BitcoinSegwitAddress.prototype.asString = function () {
|
|
20
20
|
return this.value;
|
|
21
|
-
}
|
|
22
|
-
|
|
21
|
+
};
|
|
22
|
+
return BitcoinSegwitAddress;
|
|
23
|
+
}());
|
|
23
24
|
exports.BitcoinSegwitAddress = BitcoinSegwitAddress;
|
|
24
25
|
//# sourceMappingURL=BitcoinSegwitAddress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitcoinSegwitAddress.js","sourceRoot":"","sources":["../../../src/v1/data/BitcoinSegwitAddress.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"BitcoinSegwitAddress.js","sourceRoot":"","sources":["../../../src/v1/data/BitcoinSegwitAddress.ts"],"names":[],"mappings":";;;AAAA,qDAA6C;AAC7C,sDAA8D;AAI9D;IACE,8BAAuC,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;IAE1C,8BAAS,GAAvB,UAAwB,KAAqB;QAC3C,OAAO,IAAI,oBAAoB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAA;IACnD,CAAC;IAEa,gCAAW,GAAzB,UAA0B,OAAwB;QAChD,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE;YACjC,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,OAAO,EAAE,6BAA6B,CAAC,CAAA;SAC1E;QAED,OAAO,IAAI,oBAAoB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAClD,CAAC;IAEM,uCAAQ,GAAf;QACE,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IACH,2BAAC;AAAD,CAAC,AAlBD,IAkBC;AAlBY,oDAAoB"}
|
|
@@ -15,35 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) ||
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
35
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
26
|
exports.BitcoinTaprootAddress = void 0;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
28
|
+
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
29
|
+
var bitcoin = __importStar(require("bitcoinjs-lib"));
|
|
30
|
+
var BitcoinTaprootAddress = /** @class */ (function () {
|
|
31
|
+
function BitcoinTaprootAddress(value) {
|
|
42
32
|
this.value = value;
|
|
43
33
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
BitcoinTaprootAddress.fromBip32 = function (bip32) {
|
|
35
|
+
var xOnlyPubkey = bip32.publicKey.slice(1, 33);
|
|
36
|
+
var payment = bitcoin.payments.p2tr({
|
|
47
37
|
internalPubkey: Buffer.from(xOnlyPubkey),
|
|
48
38
|
network: bitcoin.networks.bitcoin
|
|
49
39
|
});
|
|
@@ -51,16 +41,17 @@ class BitcoinTaprootAddress {
|
|
|
51
41
|
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.BITCOIN, 'Could not generate Taproot address from BIP32.');
|
|
52
42
|
}
|
|
53
43
|
return new BitcoinTaprootAddress(payment.address);
|
|
54
|
-
}
|
|
55
|
-
|
|
44
|
+
};
|
|
45
|
+
BitcoinTaprootAddress.fromPayment = function (payment) {
|
|
56
46
|
if (payment.address === undefined) {
|
|
57
47
|
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.BITCOIN, 'Could not generate Taproot address from payment.');
|
|
58
48
|
}
|
|
59
49
|
return new BitcoinTaprootAddress(payment.address);
|
|
60
|
-
}
|
|
61
|
-
asString() {
|
|
50
|
+
};
|
|
51
|
+
BitcoinTaprootAddress.prototype.asString = function () {
|
|
62
52
|
return this.value;
|
|
63
|
-
}
|
|
64
|
-
|
|
53
|
+
};
|
|
54
|
+
return BitcoinTaprootAddress;
|
|
55
|
+
}());
|
|
65
56
|
exports.BitcoinTaprootAddress = BitcoinTaprootAddress;
|
|
66
57
|
//# sourceMappingURL=BitcoinTaprootAddress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitcoinTaprootAddress.js","sourceRoot":"","sources":["../../../src/v1/data/BitcoinTaprootAddress.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BitcoinTaprootAddress.js","sourceRoot":"","sources":["../../../src/v1/data/BitcoinTaprootAddress.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA6C;AAC7C,sDAA8D;AAC9D,qDAAwC;AAGxC;IACE,+BAAuC,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;IAE1C,+BAAS,GAAvB,UAAwB,KAAqB;QAC3C,IAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QAEhD,IAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;YACpC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC;YACxC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,OAAO;SAClC,CAAC,CAAA;QAEF,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE;YACjC,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,OAAO,EAAE,gDAAgD,CAAC,CAAA;SAC7F;QAED,OAAO,IAAI,qBAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACnD,CAAC;IAEa,iCAAW,GAAzB,UAA0B,OAAwB;QAChD,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE;YACjC,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,OAAO,EAAE,kDAAkD,CAAC,CAAA;SAC/F;QAED,OAAO,IAAI,qBAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACnD,CAAC;IAEM,wCAAQ,GAAf;QACE,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IACH,4BAAC;AAAD,CAAC,AA7BD,IA6BC;AA7BY,sDAAqB"}
|
package/v1/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isBitcoinTaprootProtocol = exports.isBitcoinSegwitProtocol = exports.isBitcoinProtocol = exports.bitcoinTransactionSignResponseToSigned = exports.bitcoinTransactionSignRequestToUnsigned = exports.bitcoinSignedTransactionToResponse = exports.bitcoinUnsignedTransactionToRequest = exports.bitcoinValidators = exports.BitcoinTransactionValidator = exports.BlockCypherBlockExplorer = exports.createBitcoinProtocolOptions = exports.createBitcoinTaprootProtocol = exports.createBitcoinSegwitProtocol = exports.createBitcoinTestnetProtocol = exports.createBitcoinLegacyProtocol = exports.createBitcoinProtocol = exports.BitcoinModule = void 0;
|
|
4
|
-
|
|
4
|
+
var BlockCypherBlockExplorer_1 = require("./block-explorer/BlockCypherBlockExplorer");
|
|
5
5
|
Object.defineProperty(exports, "BlockCypherBlockExplorer", { enumerable: true, get: function () { return BlockCypherBlockExplorer_1.BlockCypherBlockExplorer; } });
|
|
6
|
-
|
|
6
|
+
var BitcoinModule_1 = require("./module/BitcoinModule");
|
|
7
7
|
Object.defineProperty(exports, "BitcoinModule", { enumerable: true, get: function () { return BitcoinModule_1.BitcoinModule; } });
|
|
8
|
-
|
|
8
|
+
var BitcoinLegacyProtocol_1 = require("./protocol/BitcoinLegacyProtocol");
|
|
9
9
|
Object.defineProperty(exports, "createBitcoinLegacyProtocol", { enumerable: true, get: function () { return BitcoinLegacyProtocol_1.createBitcoinLegacyProtocol; } });
|
|
10
|
-
|
|
10
|
+
var BitcoinProtocol_1 = require("./protocol/BitcoinProtocol");
|
|
11
11
|
Object.defineProperty(exports, "createBitcoinProtocol", { enumerable: true, get: function () { return BitcoinProtocol_1.createBitcoinProtocol; } });
|
|
12
12
|
Object.defineProperty(exports, "createBitcoinProtocolOptions", { enumerable: true, get: function () { return BitcoinProtocol_1.createBitcoinProtocolOptions; } });
|
|
13
|
-
|
|
13
|
+
var BitcoinSegwitProtocol_1 = require("./protocol/BitcoinSegwitProtocol");
|
|
14
14
|
Object.defineProperty(exports, "createBitcoinSegwitProtocol", { enumerable: true, get: function () { return BitcoinSegwitProtocol_1.createBitcoinSegwitProtocol; } });
|
|
15
|
-
|
|
15
|
+
var BitcoinTaprootProtocol_1 = require("./protocol/BitcoinTaprootProtocol");
|
|
16
16
|
Object.defineProperty(exports, "createBitcoinTaprootProtocol", { enumerable: true, get: function () { return BitcoinTaprootProtocol_1.createBitcoinTaprootProtocol; } });
|
|
17
|
-
|
|
17
|
+
var BitcoinTestnetProtocol_1 = require("./protocol/BitcoinTestnetProtocol");
|
|
18
18
|
Object.defineProperty(exports, "createBitcoinTestnetProtocol", { enumerable: true, get: function () { return BitcoinTestnetProtocol_1.createBitcoinTestnetProtocol; } });
|
|
19
|
-
|
|
19
|
+
var transaction_converter_1 = require("./serializer/v3/schemas/converter/transaction-converter");
|
|
20
20
|
Object.defineProperty(exports, "bitcoinSignedTransactionToResponse", { enumerable: true, get: function () { return transaction_converter_1.bitcoinSignedTransactionToResponse; } });
|
|
21
21
|
Object.defineProperty(exports, "bitcoinTransactionSignRequestToUnsigned", { enumerable: true, get: function () { return transaction_converter_1.bitcoinTransactionSignRequestToUnsigned; } });
|
|
22
22
|
Object.defineProperty(exports, "bitcoinTransactionSignResponseToSigned", { enumerable: true, get: function () { return transaction_converter_1.bitcoinTransactionSignResponseToSigned; } });
|
|
23
23
|
Object.defineProperty(exports, "bitcoinUnsignedTransactionToRequest", { enumerable: true, get: function () { return transaction_converter_1.bitcoinUnsignedTransactionToRequest; } });
|
|
24
|
-
|
|
24
|
+
var transaction_validator_1 = require("./serializer/v3/validators/transaction-validator");
|
|
25
25
|
Object.defineProperty(exports, "BitcoinTransactionValidator", { enumerable: true, get: function () { return transaction_validator_1.BitcoinTransactionValidator; } });
|
|
26
|
-
|
|
26
|
+
var validators_1 = require("./serializer/v3/validators/validators");
|
|
27
27
|
Object.defineProperty(exports, "bitcoinValidators", { enumerable: true, get: function () { return validators_1.bitcoinValidators; } });
|
|
28
|
-
|
|
28
|
+
var protocol_1 = require("./utils/protocol");
|
|
29
29
|
Object.defineProperty(exports, "isBitcoinProtocol", { enumerable: true, get: function () { return protocol_1.isBitcoinProtocol; } });
|
|
30
30
|
Object.defineProperty(exports, "isBitcoinSegwitProtocol", { enumerable: true, get: function () { return protocol_1.isBitcoinSegwitProtocol; } });
|
|
31
31
|
Object.defineProperty(exports, "isBitcoinTaprootProtocol", { enumerable: true, get: function () { return protocol_1.isBitcoinTaprootProtocol; } });
|
package/v1/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,sFAAoF;AA8D3E,yGA9DA,mDAAwB,OA8DA;AA7DjC,wDAAsD;AAyC7C,8FAzCA,6BAAa,OAyCA;AAxCtB,0EAAqG;AAmDnG,4GAnD8B,mDAA2B,OAmD9B;AAlD7B,8DAAiH;AAiD/G,sGAjDwB,uCAAqB,OAiDxB;AAKrB,6GAtD+C,8CAA4B,OAsD/C;AArD9B,0EAAqG;AAmDnG,4GAnD8B,mDAA2B,OAmD9B;AAlD7B,4EAAwG;AAmDtG,6GAnD+B,qDAA4B,OAmD/B;AAlD9B,4EAAwG;AAgDtG,6GAhD+B,qDAA4B,OAgD/B;AA/C9B,iGAKgE;AAsF9D,mHA1FA,0DAAkC,OA0FA;AAClC,wHA1FA,+DAAuC,OA0FA;AACvC,uHA1FA,8DAAsC,OA0FA;AAHtC,oHAtFA,2DAAmC,OAsFA;AA5ErC,0FAA8F;AA0E5F,4GA1EO,mDAA2B,OA0EP;AAzE7B,oEAAyE;AA0EvE,kGA1EO,8BAAiB,OA0EP;AA1DnB,6CAAuG;AAmE9F,kGAnEA,4BAAiB,OAmEA;AAAE,wGAnEA,kCAAuB,OAmEA;AAAE,yGAnEA,mCAAwB,OAmEA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MainProtocolSymbols } from '@airgap/coinlib-core';
|
|
2
2
|
import { AirGapBlockExplorer, AirGapModule, AirGapOfflineProtocol, AirGapOnlineProtocol, AirGapV3SerializerCompanion, ProtocolConfiguration } from '@airgap/module-kit';
|
|
3
3
|
import { BitcoinProtocolNetwork } from '../types/protocol';
|
|
4
|
-
type SupportedProtocols = MainProtocolSymbols.BTC | MainProtocolSymbols.BTC_SEGWIT | MainProtocolSymbols.BTC_TAPROOT;
|
|
4
|
+
declare type SupportedProtocols = MainProtocolSymbols.BTC | MainProtocolSymbols.BTC_SEGWIT | MainProtocolSymbols.BTC_TAPROOT;
|
|
5
5
|
export declare class BitcoinModule implements AirGapModule<{
|
|
6
6
|
Protocols: SupportedProtocols;
|
|
7
7
|
ProtocolNetwork: BitcoinProtocolNetwork;
|
|
@@ -1,60 +1,118 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
2
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
39
|
exports.BitcoinModule = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
40
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
41
|
+
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
42
|
+
var module_kit_1 = require("@airgap/module-kit");
|
|
43
|
+
var BlockCypherBlockExplorer_1 = require("../block-explorer/BlockCypherBlockExplorer");
|
|
8
44
|
// import { BITCOIN_MAINNET_PROTOCOL_NETWORK, createBitcoinProtocol } from '../protocol/BitcoinProtocol'
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
45
|
+
var BitcoinProtocol_1 = require("../protocol/BitcoinProtocol");
|
|
46
|
+
var BitcoinSegwitProtocol_1 = require("../protocol/BitcoinSegwitProtocol");
|
|
47
|
+
var BitcoinTaprootProtocol_1 = require("../protocol/BitcoinTaprootProtocol");
|
|
48
|
+
var serializer_companion_1 = require("../serializer/v3/serializer-companion");
|
|
49
|
+
var BitcoinLegacyProtocol_1 = require("../protocol/BitcoinLegacyProtocol");
|
|
50
|
+
var BitcoinModule = /** @class */ (function () {
|
|
51
|
+
function BitcoinModule() {
|
|
52
|
+
var _a;
|
|
53
|
+
var networkRegistry = new module_kit_1.ModuleNetworkRegistry({
|
|
17
54
|
supportedNetworks: [BitcoinProtocol_1.BITCOIN_MAINNET_PROTOCOL_NETWORK]
|
|
18
55
|
});
|
|
19
|
-
this.networkRegistries = {
|
|
20
|
-
[coinlib_core_1.MainProtocolSymbols.BTC]
|
|
21
|
-
[coinlib_core_1.MainProtocolSymbols.BTC_SEGWIT]
|
|
22
|
-
[coinlib_core_1.MainProtocolSymbols.BTC_TAPROOT]
|
|
23
|
-
|
|
56
|
+
this.networkRegistries = (_a = {},
|
|
57
|
+
_a[coinlib_core_1.MainProtocolSymbols.BTC] = networkRegistry,
|
|
58
|
+
_a[coinlib_core_1.MainProtocolSymbols.BTC_SEGWIT] = networkRegistry,
|
|
59
|
+
_a[coinlib_core_1.MainProtocolSymbols.BTC_TAPROOT] = networkRegistry,
|
|
60
|
+
_a);
|
|
24
61
|
this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
|
|
25
62
|
}
|
|
26
|
-
|
|
27
|
-
return this
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
63
|
+
BitcoinModule.prototype.createOfflineProtocol = function (identifier) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
+
return __generator(this, function (_a) {
|
|
66
|
+
return [2 /*return*/, this.createProtocol(identifier)];
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
BitcoinModule.prototype.createOnlineProtocol = function (identifier, networkOrId) {
|
|
71
|
+
var _a;
|
|
72
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
+
var network;
|
|
74
|
+
return __generator(this, function (_b) {
|
|
75
|
+
network = typeof networkOrId === 'object' ? networkOrId : (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkOrId);
|
|
76
|
+
if (network === undefined) {
|
|
77
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.BITCOIN, 'Protocol network not supported.');
|
|
78
|
+
}
|
|
79
|
+
return [2 /*return*/, this.createProtocol(identifier, network)];
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
BitcoinModule.prototype.createBlockExplorer = function (identifier, networkOrId) {
|
|
84
|
+
var _a;
|
|
85
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
86
|
+
var network;
|
|
87
|
+
return __generator(this, function (_b) {
|
|
88
|
+
network = typeof networkOrId === 'object' ? networkOrId : (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkOrId);
|
|
89
|
+
if (network === undefined) {
|
|
90
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.BITCOIN, 'Block Explorer network not supported.');
|
|
91
|
+
}
|
|
92
|
+
return [2 /*return*/, new BlockCypherBlockExplorer_1.BlockCypherBlockExplorer(network.blockExplorerUrl)];
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
BitcoinModule.prototype.createV3SerializerCompanion = function () {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
98
|
+
return __generator(this, function (_a) {
|
|
99
|
+
return [2 /*return*/, new serializer_companion_1.BitcoinV3SerializerCompanion()];
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
BitcoinModule.prototype.createProtocol = function (identifier, network) {
|
|
47
104
|
switch (identifier) {
|
|
48
105
|
case coinlib_core_1.MainProtocolSymbols.BTC:
|
|
49
|
-
return (0, BitcoinLegacyProtocol_1.createBitcoinLegacyProtocol)({ network });
|
|
106
|
+
return (0, BitcoinLegacyProtocol_1.createBitcoinLegacyProtocol)({ network: network });
|
|
50
107
|
case coinlib_core_1.MainProtocolSymbols.BTC_SEGWIT:
|
|
51
|
-
return (0, BitcoinSegwitProtocol_1.createBitcoinSegwitProtocol)({ network });
|
|
108
|
+
return (0, BitcoinSegwitProtocol_1.createBitcoinSegwitProtocol)({ network: network });
|
|
52
109
|
case coinlib_core_1.MainProtocolSymbols.BTC_TAPROOT:
|
|
53
|
-
return (0, BitcoinTaprootProtocol_1.createBitcoinTaprootProtocol)({ network });
|
|
110
|
+
return (0, BitcoinTaprootProtocol_1.createBitcoinTaprootProtocol)({ network: network });
|
|
54
111
|
default:
|
|
55
|
-
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.BITCOIN,
|
|
112
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.BITCOIN, "Protocol ".concat(identifier, " not supported."));
|
|
56
113
|
}
|
|
57
|
-
}
|
|
58
|
-
|
|
114
|
+
};
|
|
115
|
+
return BitcoinModule;
|
|
116
|
+
}());
|
|
59
117
|
exports.BitcoinModule = BitcoinModule;
|
|
60
118
|
//# sourceMappingURL=BitcoinModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitcoinModule.js","sourceRoot":"","sources":["../../../src/v1/module/BitcoinModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BitcoinModule.js","sourceRoot":"","sources":["../../../src/v1/module/BitcoinModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkE;AAClE,sDAAqE;AACrE,iDAW2B;AAE3B,uFAAqF;AACrF,wGAAwG;AACxG,+DAA8E;AAC9E,2EAA+E;AAC/E,6EAAiF;AACjF,8EAAoF;AAEpF,2EAA+E;AAI/E;IAIE;;QACE,IAAM,eAAe,GAA0B,IAAI,kCAAqB,CAAC;YACvE,iBAAiB,EAAE,CAAC,kDAAgC,CAAC;SACtD,CAAC,CAAA;QACF,IAAI,CAAC,iBAAiB;YACpB,GAAC,kCAAmB,CAAC,GAAG,IAAG,eAAe;YAC1C,GAAC,kCAAmB,CAAC,UAAU,IAAG,eAAe;YACjD,GAAC,kCAAmB,CAAC,WAAW,IAAG,eAAe;eACnD,CAAA;QACD,IAAI,CAAC,kBAAkB,GAAG,IAAA,qCAAwB,EAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IAC5E,CAAC;IAEY,6CAAqB,GAAlC,UAAmC,UAA8B;;;gBAC/D,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,EAAA;;;KACvC;IAEY,4CAAoB,GAAjC,UACE,UAA8B,EAC9B,WAA6C;;;;;gBAEvC,OAAO,GACX,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,0CAAE,WAAW,CAAC,WAAW,CAAC,CAAA;gBAE9G,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,OAAO,EAAE,iCAAiC,CAAC,CAAA;iBACrF;gBAED,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,EAAA;;;KAChD;IAEY,2CAAmB,GAAhC,UACE,UAA8B,EAC9B,WAA6C;;;;;gBAEvC,OAAO,GACX,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,0CAAE,WAAW,CAAC,WAAW,CAAC,CAAA;gBAE9G,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,OAAO,EAAE,uCAAuC,CAAC,CAAA;iBAC3F;gBAED,sBAAO,IAAI,mDAAwB,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAA;;;KAC9D;IAEY,mDAA2B,GAAxC;;;gBACE,sBAAO,IAAI,mDAA4B,EAAE,EAAA;;;KAC1C;IAEO,sCAAc,GAAtB,UAAuB,UAA8B,EAAE,OAAyB;QAC9E,QAAQ,UAAU,EAAE;YAClB,KAAK,kCAAmB,CAAC,GAAG;gBAC1B,OAAO,IAAA,mDAA2B,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;YACjD,KAAK,kCAAmB,CAAC,UAAU;gBACjC,OAAO,IAAA,mDAA2B,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;YACjD,KAAK,kCAAmB,CAAC,WAAW;gBAClC,OAAO,IAAA,qDAA4B,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;YAClD;gBACE,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,OAAO,EAAE,mBAAY,UAAU,oBAAiB,CAAC,CAAA;SAC7F;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AAhED,IAgEC;AAhEY,sCAAa"}
|
package/v1/module.js
CHANGED
|
@@ -14,10 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.create =
|
|
18
|
-
|
|
17
|
+
exports.create = void 0;
|
|
18
|
+
var BitcoinModule_1 = require("./module/BitcoinModule");
|
|
19
19
|
__exportStar(require("./index"), exports);
|
|
20
20
|
function create() {
|
|
21
21
|
return new BitcoinModule_1.BitcoinModule();
|
|
22
22
|
}
|
|
23
|
+
exports.create = create;
|
|
23
24
|
//# sourceMappingURL=module.js.map
|
package/v1/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/v1/module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/v1/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,wDAAsD;AAEtD,0CAAuB;AAEvB,SAAgB,MAAM;IACpB,OAAO,IAAI,6BAAa,EAAE,CAAA;AAC5B,CAAC;AAFD,wBAEC"}
|
|
@@ -1,28 +1,96 @@
|
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
const signature = this.bitcoinjs.message.sign(message, Buffer.from(keypair.privateKey, 'hex'), true);
|
|
15
|
-
return signature.toString('base64');
|
|
16
|
-
}
|
|
17
|
-
async verifyMessage(message, signature, publicKey) {
|
|
18
|
-
const rawSignature = Buffer.from(signature, 'base64');
|
|
19
|
-
// TODO: pass objects directly instead of string values
|
|
20
|
-
const _publicKey = (0, hex_1.isHex)(publicKey)
|
|
21
|
-
? (0, module_kit_1.newPublicKey)(publicKey, 'hex')
|
|
22
|
-
: (0, module_kit_1.newExtendedPublicKey)(publicKey, 'encoded');
|
|
23
|
-
const address = await this.protocol.getAddressFromPublicKey(_publicKey);
|
|
24
|
-
return this.bitcoinjs.message.verify(message, address, rawSignature);
|
|
55
|
+
var Secp256k1CryptoClient_1 = require("@airgap/coinlib-core/protocols/Secp256k1CryptoClient");
|
|
56
|
+
var hex_1 = require("@airgap/coinlib-core/utils/hex");
|
|
57
|
+
var module_kit_1 = require("@airgap/module-kit");
|
|
58
|
+
var BitcoinCryptoClient = /** @class */ (function (_super) {
|
|
59
|
+
__extends(BitcoinCryptoClient, _super);
|
|
60
|
+
function BitcoinCryptoClient(protocol, bitcoinjs) {
|
|
61
|
+
var _this = _super.call(this) || this;
|
|
62
|
+
_this.protocol = protocol;
|
|
63
|
+
_this.bitcoinjs = bitcoinjs;
|
|
64
|
+
return _this;
|
|
25
65
|
}
|
|
26
|
-
|
|
66
|
+
BitcoinCryptoClient.prototype.signMessage = function (message, keypair) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
68
|
+
var signature;
|
|
69
|
+
return __generator(this, function (_a) {
|
|
70
|
+
signature = this.bitcoinjs.message.sign(message, Buffer.from(keypair.privateKey, 'hex'), true);
|
|
71
|
+
return [2 /*return*/, signature.toString('base64')];
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
BitcoinCryptoClient.prototype.verifyMessage = function (message, signature, publicKey) {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
77
|
+
var rawSignature, _publicKey, address;
|
|
78
|
+
return __generator(this, function (_a) {
|
|
79
|
+
switch (_a.label) {
|
|
80
|
+
case 0:
|
|
81
|
+
rawSignature = Buffer.from(signature, 'base64');
|
|
82
|
+
_publicKey = (0, hex_1.isHex)(publicKey)
|
|
83
|
+
? (0, module_kit_1.newPublicKey)(publicKey, 'hex')
|
|
84
|
+
: (0, module_kit_1.newExtendedPublicKey)(publicKey, 'encoded');
|
|
85
|
+
return [4 /*yield*/, this.protocol.getAddressFromPublicKey(_publicKey)];
|
|
86
|
+
case 1:
|
|
87
|
+
address = _a.sent();
|
|
88
|
+
return [2 /*return*/, this.bitcoinjs.message.verify(message, address, rawSignature)];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
return BitcoinCryptoClient;
|
|
94
|
+
}(Secp256k1CryptoClient_1.Secp256k1CryptoClient));
|
|
27
95
|
exports.BitcoinCryptoClient = BitcoinCryptoClient;
|
|
28
96
|
//# sourceMappingURL=BitcoinCryptoClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitcoinCryptoClient.js","sourceRoot":"","sources":["../../../src/v1/protocol/BitcoinCryptoClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BitcoinCryptoClient.js","sourceRoot":"","sources":["../../../src/v1/protocol/BitcoinCryptoClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAA4F;AAC5F,sDAAsD;AACtD,iDAAqG;AAKrG;IAAyC,uCAAqB;IAC5D,6BAA6B,QAAyB,EAAmB,SAAoB;QAA7F,YACE,iBAAO,SACR;QAF4B,cAAQ,GAAR,QAAQ,CAAiB;QAAmB,eAAS,GAAT,SAAS,CAAW;;IAE7F,CAAC;IAEY,yCAAW,GAAxB,UAAyB,OAAe,EAAE,OAA+B;;;;gBACjE,SAAS,GAAW,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,CAAA;gBAE5G,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;wBAGvD,UAAU,GAAkC,IAAA,WAAK,EAAC,SAAS,CAAC;4BAChE,CAAC,CAAC,IAAA,yBAAY,EAAC,SAAS,EAAE,KAAK,CAAC;4BAChC,CAAC,CAAC,IAAA,iCAAoB,EAAC,SAAS,EAAE,SAAS,CAAC,CAAA;wBAE9B,qBAAM,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,UAAU,CAAC,EAAA;;wBAAjE,OAAO,GAAG,SAAuD;wBAEvE,sBAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,EAAA;;;;KACrE;IACH,0BAAC;AAAD,CAAC,AAvBD,CAAyC,6CAAqB,GAuB7D;AAvBY,kDAAmB"}
|