Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ledgerhq/hw-app-btc

Package Overview
Dependencies
Maintainers
9
Versions
437
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ledgerhq/hw-app-btc - npm Package Compare versions

Comparing version 4.33.6 to 4.33.7

49

lib/Btc.js

@@ -505,2 +505,3 @@ "use strict";

* @param expiryHeight is an optional Buffer for zec overwinter / sapling Txs
* @param multisigInputs is an optional array of [ transaction, output_index ] that cannot be signed by the device
* @return the signed transaction ready to be broadcast

@@ -523,7 +524,8 @@ * @example

var initialTimestamp = arguments[7];
var additionals = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
var _this5 = this;
var additionals = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
var expiryHeight = arguments[9];
var multisigInputs = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : [];

@@ -595,2 +597,22 @@ var isDecred = additionals.includes("decred");

}).then(function () {
return (0, _utils.foreach)(multisigInputs, function (input) {
return (0, _utils.doIf)(!resuming, function () {
return getTrustedInputCall(input[1], input[0], additionals).then(function (trustedInput) {
var sequence = Buffer.alloc(4);
sequence.writeUInt32LE(input.length >= 4 && typeof input[3] === "number" ? input[3] : DEFAULT_SEQUENCE, 0);
trustedInputs.push({
trustedInput: false,
value: Buffer.from(trustedInput, "hex"),
sequence: sequence
});
var offset = useBip143 ? 0 : 4;
targetTransaction.inputs.push({
prevout: Buffer.from(trustedInput, "hex").slice(offset, offset + 0x24),
script: Buffer.alloc(0),
sequence: sequence
});
});
});
});
}).then(function () {
return (0, _utils.doIf)(!resuming, function () {

@@ -637,4 +659,9 @@ return (

// Do the second run with the individual transaction
(0, _utils.foreach)(inputs, function (input, i) {
var script = inputs[i].length >= 3 && typeof inputs[i][2] === "string" ? Buffer.from(inputs[i][2], "hex") : !segwit ? regularOutputs[i].script : Buffer.concat([Buffer.from([OP_DUP, OP_HASH160, HASH_SIZE]), _this5.hashPublicKey(publicKeys[i]), Buffer.from([OP_EQUALVERIFY, OP_CHECKSIG])]);
(0, _utils.foreach)(inputs.concat(multisigInputs), function (input, i) {
var script = void 0;
if (inputs[i]) {
script = inputs[i].length >= 3 && typeof inputs[i][2] === "string" ? Buffer.from(inputs[i][2], "hex") : !segwit ? regularOutputs[i].script : Buffer.concat([Buffer.from([OP_DUP, OP_HASH160, HASH_SIZE]), _this5.hashPublicKey(publicKeys[i]), Buffer.from([OP_EQUALVERIFY, OP_CHECKSIG])]);
} else {
script = Buffer.alloc(0);
}
var pseudoTX = Object.assign({}, targetTransaction);

@@ -657,8 +684,14 @@ var pseudoTrustedInputs = useBip143 ? [trustedInputs[i]] : trustedInputs;

}).then(function () {
return _this5.signTransaction(associatedKeysets[i], lockTime, sigHashType, expiryHeight, additionals);
if (associatedKeysets[i]) {
return _this5.signTransaction(associatedKeysets[i], lockTime, sigHashType, expiryHeight);
} else {
return false;
}
}).then(function (signature) {
signatures.push(signature);
targetTransaction.inputs[i].script = nullScript;
if (firstRun) {
firstRun = false;
if (signature) {
signatures.push(signature);
targetTransaction.inputs[i].script = nullScript;
if (firstRun) {
firstRun = false;
}
}

@@ -665,0 +698,0 @@ });

2

package.json
{
"name": "@ledgerhq/hw-app-btc",
"version": "4.33.6",
"version": "4.33.7",
"description": "Ledger Hardware Wallet Bitcoin Application API",

@@ -5,0 +5,0 @@ "keywords": [

@@ -572,2 +572,3 @@ //@flow

* @param expiryHeight is an optional Buffer for zec overwinter / sapling Txs
* @param multisigInputs is an optional array of [ transaction, output_index ] that cannot be signed by the device
* @return the signed transaction ready to be broadcast

@@ -592,3 +593,4 @@ * @example

additionals: Array<string> = [],
expiryHeight?: Buffer
expiryHeight?: Buffer,
multisigInputs?: Array<[Transaction, number, ?string, ?number]> = []
) {

@@ -702,2 +704,28 @@ const isDecred = additionals.includes("decred");

})
.then(() => {
return foreach(multisigInputs, input => {
return doIf(!resuming, () =>
getTrustedInputCall(input[1], input[0], additionals).then(trustedInput => {
let sequence = Buffer.alloc(4);
sequence.writeUInt32LE(
input.length >= 4 && typeof input[3] === "number"
? input[3]
: DEFAULT_SEQUENCE,
0
);
trustedInputs.push({
trustedInput: false,
value: Buffer.from(trustedInput, "hex"),
sequence
});
let offset = useBip143 ? 0 : 4;
targetTransaction.inputs.push({
prevout: Buffer.from(trustedInput, "hex").slice(offset, offset + 0x24),
script: Buffer.alloc(0),
sequence
});
})
);
});
})
.then(() =>

@@ -754,13 +782,18 @@ doIf(!resuming, () =>

// Do the second run with the individual transaction
foreach(inputs, (input, i) => {
let script =
inputs[i].length >= 3 && typeof inputs[i][2] === "string"
? Buffer.from(inputs[i][2], "hex")
: !segwit
? regularOutputs[i].script
: Buffer.concat([
Buffer.from([OP_DUP, OP_HASH160, HASH_SIZE]),
this.hashPublicKey(publicKeys[i]),
Buffer.from([OP_EQUALVERIFY, OP_CHECKSIG])
]);
foreach(inputs.concat(multisigInputs), (input, i) => {
let script;
if (inputs[i]) {
script =
inputs[i].length >= 3 && typeof inputs[i][2] === "string"
? Buffer.from(inputs[i][2], "hex")
: !segwit
? regularOutputs[i].script
: Buffer.concat([
Buffer.from([OP_DUP, OP_HASH160, HASH_SIZE]),
this.hashPublicKey(publicKeys[i]),
Buffer.from([OP_EQUALVERIFY, OP_CHECKSIG])
]);
} else {
script = Buffer.alloc(0);
}
let pseudoTX = Object.assign({}, targetTransaction);

@@ -792,15 +825,20 @@ let pseudoTrustedInputs = useBip143

.then(() => {
return this.signTransaction(
associatedKeysets[i],
lockTime,
sigHashType,
expiryHeight,
additionals
);
if (associatedKeysets[i]) {
return this.signTransaction(
associatedKeysets[i],
lockTime,
sigHashType,
expiryHeight
);
} else {
return false;
}
})
.then(signature => {
signatures.push(signature);
targetTransaction.inputs[i].script = nullScript;
if (firstRun) {
firstRun = false;
if (signature) {
signatures.push(signature);
targetTransaction.inputs[i].script = nullScript;
if (firstRun) {
firstRun = false;
}
}

@@ -807,0 +845,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc