@ledgerhq/hw-app-btc 6.24.2-monorepo.0 → 6.24.2-monorepo.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +5 -1
- package/CHANGELOG.md +9 -0
- package/lib/Btc.d.ts +149 -0
- package/lib/Btc.d.ts.map +1 -0
- package/lib/Btc.js +357 -0
- package/lib/Btc.js.map +1 -0
- package/lib/BtcNew.d.ts +122 -0
- package/lib/BtcNew.d.ts.map +1 -0
- package/lib/BtcNew.js +451 -0
- package/lib/BtcNew.js.map +1 -0
- package/lib/BtcOld.d.ts +120 -0
- package/lib/BtcOld.d.ts.map +1 -0
- package/lib/BtcOld.js +263 -0
- package/lib/BtcOld.js.map +1 -0
- package/lib/bip32.d.ts +13 -0
- package/lib/bip32.d.ts.map +1 -0
- package/lib/bip32.js +57 -0
- package/lib/bip32.js.map +1 -0
- package/lib/buffertools.d.ts +30 -0
- package/lib/buffertools.d.ts.map +1 -0
- package/lib/buffertools.js +132 -0
- package/lib/buffertools.js.map +1 -0
- package/lib/compressPublicKey.d.ts +3 -0
- package/lib/compressPublicKey.d.ts.map +1 -0
- package/lib/compressPublicKey.js +11 -0
- package/lib/compressPublicKey.js.map +1 -0
- package/lib/constants.d.ts +13 -0
- package/lib/constants.d.ts.map +1 -0
- package/lib/constants.js +17 -0
- package/lib/constants.js.map +1 -0
- package/lib/createTransaction.d.ts +35 -0
- package/lib/createTransaction.d.ts.map +1 -0
- package/lib/createTransaction.js +411 -0
- package/lib/createTransaction.js.map +1 -0
- package/lib/debug.d.ts +4 -0
- package/lib/debug.d.ts.map +1 -0
- package/lib/debug.js +45 -0
- package/lib/debug.js.map +1 -0
- package/lib/finalizeInput.d.ts +5 -0
- package/lib/finalizeInput.d.ts.map +1 -0
- package/lib/finalizeInput.js +81 -0
- package/lib/finalizeInput.js.map +1 -0
- package/lib/getAppAndVersion.d.ts +9 -0
- package/lib/getAppAndVersion.d.ts.map +1 -0
- package/lib/getAppAndVersion.js +69 -0
- package/lib/getAppAndVersion.js.map +1 -0
- package/lib/getTrustedInput.d.ts +6 -0
- package/lib/getTrustedInput.d.ts.map +1 -0
- package/lib/getTrustedInput.js +275 -0
- package/lib/getTrustedInput.js.map +1 -0
- package/lib/getTrustedInputBIP143.d.ts +4 -0
- package/lib/getTrustedInputBIP143.d.ts.map +1 -0
- package/lib/getTrustedInputBIP143.js +34 -0
- package/lib/getTrustedInputBIP143.js.map +1 -0
- package/lib/getWalletPublicKey.d.ts +15 -0
- package/lib/getWalletPublicKey.d.ts.map +1 -0
- package/lib/getWalletPublicKey.js +93 -0
- package/lib/getWalletPublicKey.js.map +1 -0
- package/lib/hashPublicKey.d.ts +3 -0
- package/lib/hashPublicKey.d.ts.map +1 -0
- package/lib/hashPublicKey.js +13 -0
- package/lib/hashPublicKey.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -0
- package/lib/newops/accounttype.d.ts +110 -0
- package/lib/newops/accounttype.d.ts.map +1 -0
- package/lib/newops/accounttype.js +236 -0
- package/lib/newops/accounttype.js.map +1 -0
- package/lib/newops/appClient.d.ts +18 -0
- package/lib/newops/appClient.d.ts.map +1 -0
- package/lib/newops/appClient.js +243 -0
- package/lib/newops/appClient.js.map +1 -0
- package/lib/newops/clientCommands.d.ts +77 -0
- package/lib/newops/clientCommands.d.ts.map +1 -0
- package/lib/newops/clientCommands.js +353 -0
- package/lib/newops/clientCommands.js.map +1 -0
- package/lib/newops/merkelizedPsbt.d.ts +26 -0
- package/lib/newops/merkelizedPsbt.d.ts.map +1 -0
- package/lib/newops/merkelizedPsbt.js +102 -0
- package/lib/newops/merkelizedPsbt.js.map +1 -0
- package/lib/newops/merkle.d.ts +34 -0
- package/lib/newops/merkle.d.ts.map +1 -0
- package/lib/newops/merkle.js +138 -0
- package/lib/newops/merkle.js.map +1 -0
- package/lib/newops/merkleMap.d.ts +25 -0
- package/lib/newops/merkleMap.d.ts.map +1 -0
- package/lib/newops/merkleMap.js +47 -0
- package/lib/newops/merkleMap.js.map +1 -0
- package/lib/newops/policy.d.ts +22 -0
- package/lib/newops/policy.d.ts.map +1 -0
- package/lib/newops/policy.js +48 -0
- package/lib/newops/policy.js.map +1 -0
- package/lib/newops/psbtExtractor.d.ts +10 -0
- package/lib/newops/psbtExtractor.d.ts.map +1 -0
- package/lib/newops/psbtExtractor.js +42 -0
- package/lib/newops/psbtExtractor.js.map +1 -0
- package/lib/newops/psbtFinalizer.d.ts +17 -0
- package/lib/newops/psbtFinalizer.d.ts.map +1 -0
- package/lib/newops/psbtFinalizer.js +135 -0
- package/lib/newops/psbtFinalizer.js.map +1 -0
- package/lib/newops/psbtv2.d.ts +149 -0
- package/lib/newops/psbtv2.d.ts.map +1 -0
- package/lib/newops/psbtv2.js +506 -0
- package/lib/newops/psbtv2.js.map +1 -0
- package/lib/serializeTransaction.d.ts +10 -0
- package/lib/serializeTransaction.d.ts.map +1 -0
- package/lib/serializeTransaction.js +72 -0
- package/lib/serializeTransaction.js.map +1 -0
- package/lib/shouldUseTrustedInputForSegwit.d.ts +5 -0
- package/lib/shouldUseTrustedInputForSegwit.d.ts.map +1 -0
- package/lib/shouldUseTrustedInputForSegwit.js +17 -0
- package/lib/shouldUseTrustedInputForSegwit.js.map +1 -0
- package/lib/signMessage.d.ts +10 -0
- package/lib/signMessage.d.ts.map +1 -0
- package/lib/signMessage.js +118 -0
- package/lib/signMessage.js.map +1 -0
- package/lib/signP2SHTransaction.d.ts +21 -0
- package/lib/signP2SHTransaction.d.ts.map +1 -0
- package/lib/signP2SHTransaction.js +208 -0
- package/lib/signP2SHTransaction.js.map +1 -0
- package/lib/signTransaction.d.ts +4 -0
- package/lib/signTransaction.d.ts.map +1 -0
- package/lib/signTransaction.js +36 -0
- package/lib/signTransaction.js.map +1 -0
- package/lib/splitTransaction.d.ts +3 -0
- package/lib/splitTransaction.d.ts.map +1 -0
- package/lib/splitTransaction.js +142 -0
- package/lib/splitTransaction.js.map +1 -0
- package/lib/startUntrustedHashTransactionInput.d.ts +9 -0
- package/lib/startUntrustedHashTransactionInput.d.ts.map +1 -0
- package/lib/startUntrustedHashTransactionInput.js +197 -0
- package/lib/startUntrustedHashTransactionInput.js.map +1 -0
- package/lib/types.d.ts +34 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/lib/varint.d.ts +4 -0
- package/lib/varint.d.ts.map +1 -0
- package/lib/varint.js +45 -0
- package/lib/varint.js.map +1 -0
- package/lib-es/Btc.d.ts +149 -0
- package/lib-es/Btc.d.ts.map +1 -0
- package/lib-es/Btc.js +329 -0
- package/lib-es/Btc.js.map +1 -0
- package/lib-es/BtcNew.d.ts +122 -0
- package/lib-es/BtcNew.d.ts.map +1 -0
- package/lib-es/BtcNew.js +444 -0
- package/lib-es/BtcNew.js.map +1 -0
- package/lib-es/BtcOld.d.ts +120 -0
- package/lib-es/BtcOld.d.ts.map +1 -0
- package/lib-es/BtcOld.js +258 -0
- package/lib-es/BtcOld.js.map +1 -0
- package/lib-es/bip32.d.ts +13 -0
- package/lib-es/bip32.d.ts.map +1 -0
- package/lib-es/bip32.js +44 -0
- package/lib-es/bip32.js.map +1 -0
- package/lib-es/buffertools.d.ts +30 -0
- package/lib-es/buffertools.d.ts.map +1 -0
- package/lib-es/buffertools.js +124 -0
- package/lib-es/buffertools.js.map +1 -0
- package/lib-es/compressPublicKey.d.ts +3 -0
- package/lib-es/compressPublicKey.d.ts.map +1 -0
- package/lib-es/compressPublicKey.js +7 -0
- package/lib-es/compressPublicKey.js.map +1 -0
- package/lib-es/constants.d.ts +13 -0
- package/lib-es/constants.d.ts.map +1 -0
- package/lib-es/constants.js +14 -0
- package/lib-es/constants.js.map +1 -0
- package/lib-es/createTransaction.d.ts +35 -0
- package/lib-es/createTransaction.d.ts.map +1 -0
- package/lib-es/createTransaction.js +407 -0
- package/lib-es/createTransaction.js.map +1 -0
- package/lib-es/debug.d.ts +4 -0
- package/lib-es/debug.d.ts.map +1 -0
- package/lib-es/debug.js +40 -0
- package/lib-es/debug.js.map +1 -0
- package/lib-es/finalizeInput.d.ts +5 -0
- package/lib-es/finalizeInput.d.ts.map +1 -0
- package/lib-es/finalizeInput.js +76 -0
- package/lib-es/finalizeInput.js.map +1 -0
- package/lib-es/getAppAndVersion.d.ts +9 -0
- package/lib-es/getAppAndVersion.d.ts.map +1 -0
- package/lib-es/getAppAndVersion.js +62 -0
- package/lib-es/getAppAndVersion.js.map +1 -0
- package/lib-es/getTrustedInput.d.ts +6 -0
- package/lib-es/getTrustedInput.d.ts.map +1 -0
- package/lib-es/getTrustedInput.js +267 -0
- package/lib-es/getTrustedInput.js.map +1 -0
- package/lib-es/getTrustedInputBIP143.d.ts +4 -0
- package/lib-es/getTrustedInputBIP143.d.ts.map +1 -0
- package/lib-es/getTrustedInputBIP143.js +27 -0
- package/lib-es/getTrustedInputBIP143.js.map +1 -0
- package/lib-es/getWalletPublicKey.d.ts +15 -0
- package/lib-es/getWalletPublicKey.d.ts.map +1 -0
- package/lib-es/getWalletPublicKey.js +89 -0
- package/lib-es/getWalletPublicKey.js.map +1 -0
- package/lib-es/hashPublicKey.d.ts +3 -0
- package/lib-es/hashPublicKey.d.ts.map +1 -0
- package/lib-es/hashPublicKey.js +6 -0
- package/lib-es/hashPublicKey.js.map +1 -0
- package/lib-es/index.d.ts +3 -0
- package/lib-es/index.d.ts.map +1 -0
- package/lib-es/index.js +3 -0
- package/lib-es/index.js.map +1 -0
- package/lib-es/newops/accounttype.d.ts +110 -0
- package/lib-es/newops/accounttype.d.ts.map +1 -0
- package/lib-es/newops/accounttype.js +233 -0
- package/lib-es/newops/accounttype.js.map +1 -0
- package/lib-es/newops/appClient.d.ts +18 -0
- package/lib-es/newops/appClient.d.ts.map +1 -0
- package/lib-es/newops/appClient.js +240 -0
- package/lib-es/newops/appClient.js.map +1 -0
- package/lib-es/newops/clientCommands.d.ts +77 -0
- package/lib-es/newops/clientCommands.d.ts.map +1 -0
- package/lib-es/newops/clientCommands.js +350 -0
- package/lib-es/newops/clientCommands.js.map +1 -0
- package/lib-es/newops/merkelizedPsbt.d.ts +26 -0
- package/lib-es/newops/merkelizedPsbt.d.ts.map +1 -0
- package/lib-es/newops/merkelizedPsbt.js +99 -0
- package/lib-es/newops/merkelizedPsbt.js.map +1 -0
- package/lib-es/newops/merkle.d.ts +34 -0
- package/lib-es/newops/merkle.d.ts.map +1 -0
- package/lib-es/newops/merkle.js +134 -0
- package/lib-es/newops/merkle.js.map +1 -0
- package/lib-es/newops/merkleMap.d.ts +25 -0
- package/lib-es/newops/merkleMap.d.ts.map +1 -0
- package/lib-es/newops/merkleMap.js +44 -0
- package/lib-es/newops/merkleMap.js.map +1 -0
- package/lib-es/newops/policy.d.ts +22 -0
- package/lib-es/newops/policy.d.ts.map +1 -0
- package/lib-es/newops/policy.js +44 -0
- package/lib-es/newops/policy.js.map +1 -0
- package/lib-es/newops/psbtExtractor.d.ts +10 -0
- package/lib-es/newops/psbtExtractor.d.ts.map +1 -0
- package/lib-es/newops/psbtExtractor.js +38 -0
- package/lib-es/newops/psbtExtractor.js.map +1 -0
- package/lib-es/newops/psbtFinalizer.d.ts +17 -0
- package/lib-es/newops/psbtFinalizer.d.ts.map +1 -0
- package/lib-es/newops/psbtFinalizer.js +131 -0
- package/lib-es/newops/psbtFinalizer.js.map +1 -0
- package/lib-es/newops/psbtv2.d.ts +149 -0
- package/lib-es/newops/psbtv2.d.ts.map +1 -0
- package/lib-es/newops/psbtv2.js +503 -0
- package/lib-es/newops/psbtv2.js.map +1 -0
- package/lib-es/serializeTransaction.d.ts +10 -0
- package/lib-es/serializeTransaction.d.ts.map +1 -0
- package/lib-es/serializeTransaction.js +67 -0
- package/lib-es/serializeTransaction.js.map +1 -0
- package/lib-es/shouldUseTrustedInputForSegwit.d.ts +5 -0
- package/lib-es/shouldUseTrustedInputForSegwit.d.ts.map +1 -0
- package/lib-es/shouldUseTrustedInputForSegwit.js +10 -0
- package/lib-es/shouldUseTrustedInputForSegwit.js.map +1 -0
- package/lib-es/signMessage.d.ts +10 -0
- package/lib-es/signMessage.d.ts.map +1 -0
- package/lib-es/signMessage.js +111 -0
- package/lib-es/signMessage.js.map +1 -0
- package/lib-es/signP2SHTransaction.d.ts +21 -0
- package/lib-es/signP2SHTransaction.d.ts.map +1 -0
- package/lib-es/signP2SHTransaction.js +204 -0
- package/lib-es/signP2SHTransaction.js.map +1 -0
- package/lib-es/signTransaction.d.ts +4 -0
- package/lib-es/signTransaction.d.ts.map +1 -0
- package/lib-es/signTransaction.js +32 -0
- package/lib-es/signTransaction.js.map +1 -0
- package/lib-es/splitTransaction.d.ts +3 -0
- package/lib-es/splitTransaction.d.ts.map +1 -0
- package/lib-es/splitTransaction.js +138 -0
- package/lib-es/splitTransaction.js.map +1 -0
- package/lib-es/startUntrustedHashTransactionInput.d.ts +9 -0
- package/lib-es/startUntrustedHashTransactionInput.d.ts.map +1 -0
- package/lib-es/startUntrustedHashTransactionInput.js +192 -0
- package/lib-es/startUntrustedHashTransactionInput.js.map +1 -0
- package/lib-es/types.d.ts +34 -0
- package/lib-es/types.d.ts.map +1 -0
- package/lib-es/types.js +2 -0
- package/lib-es/types.js.map +1 -0
- package/lib-es/varint.d.ts +4 -0
- package/lib-es/varint.d.ts.map +1 -0
- package/lib-es/varint.js +40 -0
- package/lib-es/varint.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,243 @@
|
|
|
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
|
+
};
|
|
38
|
+
var __values = (this && this.__values) || function(o) {
|
|
39
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
+
if (m) return m.call(o);
|
|
41
|
+
if (o && typeof o.length === "number") return {
|
|
42
|
+
next: function () {
|
|
43
|
+
if (o && i >= o.length) o = void 0;
|
|
44
|
+
return { value: o && o[i++], done: !o };
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
+
};
|
|
49
|
+
exports.__esModule = true;
|
|
50
|
+
exports.AppClient = void 0;
|
|
51
|
+
var bip32_1 = require("../bip32");
|
|
52
|
+
var merkelizedPsbt_1 = require("./merkelizedPsbt");
|
|
53
|
+
var clientCommands_1 = require("./clientCommands");
|
|
54
|
+
var varint_1 = require("../varint");
|
|
55
|
+
var merkle_1 = require("./merkle");
|
|
56
|
+
var CLA_BTC = 0xe1;
|
|
57
|
+
var CLA_FRAMEWORK = 0xf8;
|
|
58
|
+
var BitcoinIns;
|
|
59
|
+
(function (BitcoinIns) {
|
|
60
|
+
BitcoinIns[BitcoinIns["GET_PUBKEY"] = 0] = "GET_PUBKEY";
|
|
61
|
+
// GET_ADDRESS = 0x01, // Removed from app
|
|
62
|
+
BitcoinIns[BitcoinIns["REGISTER_WALLET"] = 2] = "REGISTER_WALLET";
|
|
63
|
+
BitcoinIns[BitcoinIns["GET_WALLET_ADDRESS"] = 3] = "GET_WALLET_ADDRESS";
|
|
64
|
+
BitcoinIns[BitcoinIns["SIGN_PSBT"] = 4] = "SIGN_PSBT";
|
|
65
|
+
BitcoinIns[BitcoinIns["GET_MASTER_FINGERPRINT"] = 5] = "GET_MASTER_FINGERPRINT";
|
|
66
|
+
})(BitcoinIns || (BitcoinIns = {}));
|
|
67
|
+
var FrameworkIns;
|
|
68
|
+
(function (FrameworkIns) {
|
|
69
|
+
FrameworkIns[FrameworkIns["CONTINUE_INTERRUPTED"] = 1] = "CONTINUE_INTERRUPTED";
|
|
70
|
+
})(FrameworkIns || (FrameworkIns = {}));
|
|
71
|
+
/**
|
|
72
|
+
* This class encapsulates the APDU protocol documented at
|
|
73
|
+
* https://github.com/LedgerHQ/app-bitcoin-new/blob/master/doc/bitcoin.md
|
|
74
|
+
*/
|
|
75
|
+
var AppClient = /** @class */ (function () {
|
|
76
|
+
function AppClient(transport) {
|
|
77
|
+
this.transport = transport;
|
|
78
|
+
}
|
|
79
|
+
AppClient.prototype.makeRequest = function (ins, data, cci) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
+
var response, hwRequest, commandResponse;
|
|
82
|
+
return __generator(this, function (_a) {
|
|
83
|
+
switch (_a.label) {
|
|
84
|
+
case 0: return [4 /*yield*/, this.transport.send(CLA_BTC, ins, 0, 0, data, [0x9000, 0xe000])];
|
|
85
|
+
case 1:
|
|
86
|
+
response = _a.sent();
|
|
87
|
+
_a.label = 2;
|
|
88
|
+
case 2:
|
|
89
|
+
if (!(response.readUInt16BE(response.length - 2) === 0xe000)) return [3 /*break*/, 4];
|
|
90
|
+
if (!cci) {
|
|
91
|
+
throw new Error("Unexpected SW_INTERRUPTED_EXECUTION");
|
|
92
|
+
}
|
|
93
|
+
hwRequest = response.slice(0, -2);
|
|
94
|
+
commandResponse = cci.execute(hwRequest);
|
|
95
|
+
return [4 /*yield*/, this.transport.send(CLA_FRAMEWORK, FrameworkIns.CONTINUE_INTERRUPTED, 0, 0, commandResponse, [0x9000, 0xe000])];
|
|
96
|
+
case 3:
|
|
97
|
+
response = _a.sent();
|
|
98
|
+
return [3 /*break*/, 2];
|
|
99
|
+
case 4: return [2 /*return*/, response.slice(0, -2)]; // drop the status word (can only be 0x9000 at this point)
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
AppClient.prototype.getExtendedPubkey = function (display, pathElements) {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
+
var response;
|
|
107
|
+
return __generator(this, function (_a) {
|
|
108
|
+
switch (_a.label) {
|
|
109
|
+
case 0:
|
|
110
|
+
if (pathElements.length > 6) {
|
|
111
|
+
throw new Error("Path too long. At most 6 levels allowed.");
|
|
112
|
+
}
|
|
113
|
+
return [4 /*yield*/, this.makeRequest(BitcoinIns.GET_PUBKEY, Buffer.concat([
|
|
114
|
+
Buffer.from(display ? [1] : [0]),
|
|
115
|
+
(0, bip32_1.pathElementsToBuffer)(pathElements),
|
|
116
|
+
]))];
|
|
117
|
+
case 1:
|
|
118
|
+
response = _a.sent();
|
|
119
|
+
return [2 /*return*/, response.toString("ascii")];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
AppClient.prototype.getWalletAddress = function (walletPolicy, walletHMAC, change, addressIndex, display) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
126
|
+
var clientInterpreter, addressIndexBuffer, response;
|
|
127
|
+
return __generator(this, function (_a) {
|
|
128
|
+
switch (_a.label) {
|
|
129
|
+
case 0:
|
|
130
|
+
if (change !== 0 && change !== 1)
|
|
131
|
+
throw new Error("Change can only be 0 or 1");
|
|
132
|
+
if (addressIndex < 0 || !Number.isInteger(addressIndex))
|
|
133
|
+
throw new Error("Invalid address index");
|
|
134
|
+
if (walletHMAC != null && walletHMAC.length != 32) {
|
|
135
|
+
throw new Error("Invalid HMAC length");
|
|
136
|
+
}
|
|
137
|
+
clientInterpreter = new clientCommands_1.ClientCommandInterpreter(function () { });
|
|
138
|
+
clientInterpreter.addKnownList(walletPolicy.keys.map(function (k) { return Buffer.from(k, "ascii"); }));
|
|
139
|
+
clientInterpreter.addKnownPreimage(walletPolicy.serialize());
|
|
140
|
+
addressIndexBuffer = Buffer.alloc(4);
|
|
141
|
+
addressIndexBuffer.writeUInt32BE(addressIndex, 0);
|
|
142
|
+
return [4 /*yield*/, this.makeRequest(BitcoinIns.GET_WALLET_ADDRESS, Buffer.concat([
|
|
143
|
+
Buffer.from(display ? [1] : [0]),
|
|
144
|
+
walletPolicy.getWalletId(),
|
|
145
|
+
walletHMAC || Buffer.alloc(32, 0),
|
|
146
|
+
Buffer.from([change]),
|
|
147
|
+
addressIndexBuffer,
|
|
148
|
+
]), clientInterpreter)];
|
|
149
|
+
case 1:
|
|
150
|
+
response = _a.sent();
|
|
151
|
+
return [2 /*return*/, response.toString("ascii")];
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
AppClient.prototype.signPsbt = function (psbt, walletPolicy, walletHMAC, progressCallback) {
|
|
157
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
158
|
+
var merkelizedPsbt, clientInterpreter, _a, _b, map, _c, _d, map, inputMapsRoot, outputMapsRoot, yielded, ret, yielded_1, yielded_1_1, inputAndSig;
|
|
159
|
+
var e_1, _e, e_2, _f, e_3, _g;
|
|
160
|
+
return __generator(this, function (_h) {
|
|
161
|
+
switch (_h.label) {
|
|
162
|
+
case 0:
|
|
163
|
+
merkelizedPsbt = new merkelizedPsbt_1.MerkelizedPsbt(psbt);
|
|
164
|
+
if (walletHMAC != null && walletHMAC.length != 32) {
|
|
165
|
+
throw new Error("Invalid HMAC length");
|
|
166
|
+
}
|
|
167
|
+
clientInterpreter = new clientCommands_1.ClientCommandInterpreter(progressCallback);
|
|
168
|
+
// prepare ClientCommandInterpreter
|
|
169
|
+
clientInterpreter.addKnownList(walletPolicy.keys.map(function (k) { return Buffer.from(k, "ascii"); }));
|
|
170
|
+
clientInterpreter.addKnownPreimage(walletPolicy.serialize());
|
|
171
|
+
clientInterpreter.addKnownMapping(merkelizedPsbt.globalMerkleMap);
|
|
172
|
+
try {
|
|
173
|
+
for (_a = __values(merkelizedPsbt.inputMerkleMaps), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
174
|
+
map = _b.value;
|
|
175
|
+
clientInterpreter.addKnownMapping(map);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
179
|
+
finally {
|
|
180
|
+
try {
|
|
181
|
+
if (_b && !_b.done && (_e = _a["return"])) _e.call(_a);
|
|
182
|
+
}
|
|
183
|
+
finally { if (e_1) throw e_1.error; }
|
|
184
|
+
}
|
|
185
|
+
try {
|
|
186
|
+
for (_c = __values(merkelizedPsbt.outputMerkleMaps), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
187
|
+
map = _d.value;
|
|
188
|
+
clientInterpreter.addKnownMapping(map);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
192
|
+
finally {
|
|
193
|
+
try {
|
|
194
|
+
if (_d && !_d.done && (_f = _c["return"])) _f.call(_c);
|
|
195
|
+
}
|
|
196
|
+
finally { if (e_2) throw e_2.error; }
|
|
197
|
+
}
|
|
198
|
+
clientInterpreter.addKnownList(merkelizedPsbt.inputMapCommitments);
|
|
199
|
+
inputMapsRoot = new merkle_1.Merkle(merkelizedPsbt.inputMapCommitments.map(function (m) { return (0, merkle_1.hashLeaf)(m); })).getRoot();
|
|
200
|
+
clientInterpreter.addKnownList(merkelizedPsbt.outputMapCommitments);
|
|
201
|
+
outputMapsRoot = new merkle_1.Merkle(merkelizedPsbt.outputMapCommitments.map(function (m) { return (0, merkle_1.hashLeaf)(m); })).getRoot();
|
|
202
|
+
return [4 /*yield*/, this.makeRequest(BitcoinIns.SIGN_PSBT, Buffer.concat([
|
|
203
|
+
merkelizedPsbt.getGlobalKeysValuesRoot(),
|
|
204
|
+
(0, varint_1.createVarint)(merkelizedPsbt.getGlobalInputCount()),
|
|
205
|
+
inputMapsRoot,
|
|
206
|
+
(0, varint_1.createVarint)(merkelizedPsbt.getGlobalOutputCount()),
|
|
207
|
+
outputMapsRoot,
|
|
208
|
+
walletPolicy.getWalletId(),
|
|
209
|
+
walletHMAC || Buffer.alloc(32, 0),
|
|
210
|
+
]), clientInterpreter)];
|
|
211
|
+
case 1:
|
|
212
|
+
_h.sent();
|
|
213
|
+
yielded = clientInterpreter.getYielded();
|
|
214
|
+
ret = new Map();
|
|
215
|
+
try {
|
|
216
|
+
for (yielded_1 = __values(yielded), yielded_1_1 = yielded_1.next(); !yielded_1_1.done; yielded_1_1 = yielded_1.next()) {
|
|
217
|
+
inputAndSig = yielded_1_1.value;
|
|
218
|
+
ret.set(inputAndSig[0], inputAndSig.slice(1));
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
222
|
+
finally {
|
|
223
|
+
try {
|
|
224
|
+
if (yielded_1_1 && !yielded_1_1.done && (_g = yielded_1["return"])) _g.call(yielded_1);
|
|
225
|
+
}
|
|
226
|
+
finally { if (e_3) throw e_3.error; }
|
|
227
|
+
}
|
|
228
|
+
return [2 /*return*/, ret];
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
AppClient.prototype.getMasterFingerprint = function () {
|
|
234
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
235
|
+
return __generator(this, function (_a) {
|
|
236
|
+
return [2 /*return*/, this.makeRequest(BitcoinIns.GET_MASTER_FINGERPRINT, Buffer.from([]))];
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
return AppClient;
|
|
241
|
+
}());
|
|
242
|
+
exports.AppClient = AppClient;
|
|
243
|
+
//# sourceMappingURL=appClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appClient.js","sourceRoot":"","sources":["../../src/newops/appClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kCAAgD;AAEhD,mDAA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c,CAAC,mBAAmB,EAAE,CAAC;gCAClD,aAAa;gCACb,IAAA,qBAAY,EAAC,cAAc,CAAC,oBAAoB,EAAE,CAAC;gCACnD,cAAc;gCACd,YAAY,CAAC,WAAW,EAAE;gCAC1B,UAAU,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;6BAClC,CAAC,EACF,iBAAiB,CAClB,EAAA;;wBAZD,SAYC,CAAC;wBAEI,OAAO,GAAG,iBAAiB,CAAC,UAAU,EAAE,CAAC;wBAEzC,GAAG,GAAwB,IAAI,GAAG,EAAE,CAAC;;4BAC3C,KAA0B,YAAA,SAAA,OAAO,CAAA,qFAAE;gCAAxB,WAAW;gCACpB,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;6BAC/C;;;;;;;;;wBACD,sBAAO,GAAG,EAAC;;;;KACZ;IAEK,wCAAoB,GAA1B;;;gBACE,sBAAO,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,sBAAsB,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAC;;;KAC7E;IACH,gBAAC;AAAD,CAAC,AAhKD,IAgKC;AAhKY,8BAAS"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Merkle } from "./merkle";
|
|
3
|
+
import { MerkleMap } from "./merkleMap";
|
|
4
|
+
declare enum ClientCommandCode {
|
|
5
|
+
YIELD = 16,
|
|
6
|
+
GET_PREIMAGE = 64,
|
|
7
|
+
GET_MERKLE_LEAF_PROOF = 65,
|
|
8
|
+
GET_MERKLE_LEAF_INDEX = 66,
|
|
9
|
+
GET_MORE_ELEMENTS = 160
|
|
10
|
+
}
|
|
11
|
+
declare abstract class ClientCommand {
|
|
12
|
+
abstract code: ClientCommandCode;
|
|
13
|
+
abstract execute(request: Buffer): Buffer;
|
|
14
|
+
}
|
|
15
|
+
export declare class YieldCommand extends ClientCommand {
|
|
16
|
+
private progressCallback;
|
|
17
|
+
private results;
|
|
18
|
+
code: ClientCommandCode;
|
|
19
|
+
constructor(results: Buffer[], progressCallback: () => void);
|
|
20
|
+
execute(request: Buffer): Buffer;
|
|
21
|
+
}
|
|
22
|
+
export declare class GetPreimageCommand extends ClientCommand {
|
|
23
|
+
private known_preimages;
|
|
24
|
+
private queue;
|
|
25
|
+
code: ClientCommandCode;
|
|
26
|
+
constructor(known_preimages: Map<string, Buffer>, queue: Buffer[]);
|
|
27
|
+
execute(request: Buffer): Buffer;
|
|
28
|
+
}
|
|
29
|
+
export declare class GetMerkleLeafProofCommand extends ClientCommand {
|
|
30
|
+
private known_trees;
|
|
31
|
+
private queue;
|
|
32
|
+
code: ClientCommandCode;
|
|
33
|
+
constructor(known_trees: Map<string, Merkle>, queue: Buffer[]);
|
|
34
|
+
execute(request: Buffer): Buffer;
|
|
35
|
+
}
|
|
36
|
+
export declare class GetMerkleLeafIndexCommand extends ClientCommand {
|
|
37
|
+
private known_trees;
|
|
38
|
+
code: ClientCommandCode;
|
|
39
|
+
constructor(known_trees: Map<string, Merkle>);
|
|
40
|
+
execute(request: Buffer): Buffer;
|
|
41
|
+
}
|
|
42
|
+
export declare class GetMoreElementsCommand extends ClientCommand {
|
|
43
|
+
queue: Buffer[];
|
|
44
|
+
code: ClientCommandCode;
|
|
45
|
+
constructor(queue: Buffer[]);
|
|
46
|
+
execute(request: Buffer): Buffer;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* This class will dispatch a client command coming from the hardware device to
|
|
50
|
+
* the appropriate client command implementation. Those client commands
|
|
51
|
+
* typically requests data from a merkle tree or merkelized maps.
|
|
52
|
+
*
|
|
53
|
+
* A ClientCommandInterpreter is prepared by adding the merkle trees and
|
|
54
|
+
* merkelized maps it should be able to serve to the hardware device. This class
|
|
55
|
+
* doesn't know anything about the semantics of the data it holds, it just
|
|
56
|
+
* serves merkle data. It doesn't even know in what context it is being
|
|
57
|
+
* executed, ie SignPsbt, getWalletAddress, etc.
|
|
58
|
+
*
|
|
59
|
+
* If the command yelds results to the client, as signPsbt does, the yielded
|
|
60
|
+
* data will be accessible after the command completed by calling getYielded(),
|
|
61
|
+
* which will return the yields in the same order as they came in.
|
|
62
|
+
*/
|
|
63
|
+
export declare class ClientCommandInterpreter {
|
|
64
|
+
private roots;
|
|
65
|
+
private preimages;
|
|
66
|
+
private yielded;
|
|
67
|
+
private queue;
|
|
68
|
+
private commands;
|
|
69
|
+
constructor(progressCallback: () => void);
|
|
70
|
+
getYielded(): Buffer[];
|
|
71
|
+
addKnownPreimage(preimage: Buffer): void;
|
|
72
|
+
addKnownList(elements: Buffer[]): void;
|
|
73
|
+
addKnownMapping(mm: MerkleMap): void;
|
|
74
|
+
execute(request: Buffer): Buffer;
|
|
75
|
+
}
|
|
76
|
+
export {};
|
|
77
|
+
//# sourceMappingURL=clientCommands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clientCommands.d.ts","sourceRoot":"","sources":["../../src/newops/clientCommands.ts"],"names":[],"mappings":";AAGA,OAAO,EAAY,MAAM,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,aAAK,iBAAiB;IACpB,KAAK,KAAO;IACZ,YAAY,KAAO;IACnB,qBAAqB,KAAO;IAC5B,qBAAqB,KAAO;IAC5B,iBAAiB,MAAO;CACzB;AAED,uBAAe,aAAa;IAC1B,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAC1C;AAED,qBAAa,YAAa,SAAQ,aAAa;IAKd,OAAO,CAAC,gBAAgB;IAJvD,OAAO,CAAC,OAAO,CAAW;IAE1B,IAAI,oBAA2B;gBAEnB,OAAO,EAAE,MAAM,EAAE,EAAU,gBAAgB,EAAE,MAAM,IAAI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