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

@metamask/eth-ledger-bridge-keyring

Package Overview
Dependencies
Maintainers
0
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/eth-ledger-bridge-keyring - npm Package Compare versions

Comparing version 3.0.0 to 4.0.0

dist/ledger-hw-app.d.ts

11

CHANGELOG.md

@@ -9,2 +9,10 @@ # Changelog

## [4.0.0]
### Added
- Add classes `LedgerMobileBridge`, `LedgerTransportMiddleware`, and `MetaMaskLedgerHwAppEth` to support Bluetooth as a HW Ledger Transport option ([#225](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/225))
### Changed
- **BREAKING**: The `LedgerKeyring` method `setAccountToUnlock` now only accepts an input of type `number` ([#225](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/225))
- **BREAKING**: Removed the `chainCode` property from the `GetPublicKeyResponse` type ([#225](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/225))
## [3.0.0]

@@ -103,3 +111,4 @@ ### Added

[Unreleased]: https://github.com/MetaMask/eth-ledger-bridge-keyring/compare/v3.0.0...HEAD
[Unreleased]: https://github.com/MetaMask/eth-ledger-bridge-keyring/compare/v4.0.0...HEAD
[4.0.0]: https://github.com/MetaMask/eth-ledger-bridge-keyring/compare/v3.0.0...v4.0.0
[3.0.0]: https://github.com/MetaMask/eth-ledger-bridge-keyring/compare/v2.0.1...v3.0.0

@@ -106,0 +115,0 @@ [2.0.1]: https://github.com/MetaMask/eth-ledger-bridge-keyring/compare/v2.0.0...v2.0.1

export * from './ledger-keyring';
export * from './ledger-iframe-bridge';
export * from './ledger-mobile-bridge';
export * from './ledger-bridge';
export * from './ledger-transport-middleware';
export * from './type';
export * from './ledger-hw-app';

@@ -19,3 +19,7 @@ "use strict";

__exportStar(require("./ledger-iframe-bridge"), exports);
__exportStar(require("./ledger-mobile-bridge"), exports);
__exportStar(require("./ledger-bridge"), exports);
__exportStar(require("./ledger-transport-middleware"), exports);
__exportStar(require("./type"), exports);
__exportStar(require("./ledger-hw-app"), exports);
//# sourceMappingURL=index.js.map

7

dist/ledger-bridge.d.ts
import type LedgerHwAppEth from '@ledgerhq/hw-app-eth';
import type Transport from '@ledgerhq/hw-transport';
export declare type GetPublicKeyParams = {
hdPath: string;
};
export declare type GetPublicKeyResponse = Awaited<ReturnType<LedgerHwAppEth['getAddress']>> & {
chainCode: string;
};
export declare type GetPublicKeyResponse = Awaited<ReturnType<LedgerHwAppEth['getAddress']>>;
export declare type LedgerSignTransactionParams = {

@@ -40,3 +39,3 @@ hdPath: string;

attemptMakeApp(): Promise<boolean>;
updateTransportMethod(transportType: string): Promise<boolean>;
updateTransportMethod(transportType: string | Transport): Promise<boolean>;
getPublicKey(params: GetPublicKeyParams): Promise<GetPublicKeyResponse>;

@@ -43,0 +42,0 @@ deviceSignTransaction(params: LedgerSignTransactionParams): Promise<LedgerSignTransactionResponse>;

@@ -9,4 +9,4 @@ /// <reference types="node" />

declare enum NetworkApiUrls {
Ropsten = "http://api-ropsten.etherscan.io",
Kovan = "http://api-kovan.etherscan.io",
Ropsten = "https://api-ropsten.etherscan.io",
Kovan = "https://api-kovan.etherscan.io",
Rinkeby = "https://api-rinkeby.etherscan.io",

@@ -23,2 +23,3 @@ Mainnet = "https://api.etherscan.io"

accounts: readonly string[];
deviceId: string;
accountDetails: Readonly<Record<string, AccountDetails>>;

@@ -31,2 +32,3 @@ accountIndexes: Readonly<Record<string, number>>;

static type: string;
deviceId: string;
readonly type: string;

@@ -52,2 +54,3 @@ page: number;

accounts: readonly string[];
deviceId: string;
accountDetails: Record<string, AccountDetails>;

@@ -57,8 +60,11 @@ implementFullBIP44: boolean;

deserialize(opts?: Partial<LedgerBridgeKeyringOptions>): Promise<void>;
setDeviceId(deviceId: string): void;
getDeviceId(): string;
isUnlocked(): boolean;
isConnected(): boolean;
setAccountToUnlock(index: number | string): void;
setAccountToUnlock(index: number): void;
setHdPath(hdPath: string): void;
unlock(hdPath?: string, updateHdk?: boolean): Promise<string>;
addAccounts(amount?: number): Promise<string[]>;
getName(): string;
getFirstPage(): Promise<{

@@ -65,0 +71,0 @@ address: string;

@@ -51,4 +51,4 @@ "use strict";

(function (NetworkApiUrls) {
NetworkApiUrls["Ropsten"] = "http://api-ropsten.etherscan.io";
NetworkApiUrls["Kovan"] = "http://api-kovan.etherscan.io";
NetworkApiUrls["Ropsten"] = "https://api-ropsten.etherscan.io";
NetworkApiUrls["Kovan"] = "https://api-kovan.etherscan.io";
NetworkApiUrls["Rinkeby"] = "https://api-rinkeby.etherscan.io";

@@ -77,2 +77,3 @@ NetworkApiUrls["Mainnet"] = "https://api.etherscan.io";

_LedgerKeyring_instances.add(this);
this.deviceId = '';
this.type = keyringType;

@@ -104,2 +105,3 @@ this.page = 0;

accounts: this.accounts,
deviceId: this.deviceId,
accountDetails: this.accountDetails,

@@ -110,10 +112,11 @@ implementFullBIP44: false,

async deserialize(opts = {}) {
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e;
this.hdPath = (_a = opts.hdPath) !== null && _a !== void 0 ? _a : hdPathString;
this.accounts = (_b = opts.accounts) !== null && _b !== void 0 ? _b : [];
this.accountDetails = (_c = opts.accountDetails) !== null && _c !== void 0 ? _c : {};
this.deviceId = (_c = opts.deviceId) !== null && _c !== void 0 ? _c : '';
this.accountDetails = (_d = opts.accountDetails) !== null && _d !== void 0 ? _d : {};
if (!opts.accountDetails) {
__classPrivateFieldGet(this, _LedgerKeyring_instances, "m", _LedgerKeyring_migrateAccountDetails).call(this, opts);
}
this.implementFullBIP44 = (_d = opts.implementFullBIP44) !== null && _d !== void 0 ? _d : false;
this.implementFullBIP44 = (_e = opts.implementFullBIP44) !== null && _e !== void 0 ? _e : false;
const keys = new Set(Object.keys(this.accountDetails));

@@ -124,5 +127,10 @@ // Remove accounts that don't have corresponding account details

}
setDeviceId(deviceId) {
this.deviceId = deviceId;
}
getDeviceId() {
return this.deviceId;
}
isUnlocked() {
var _a;
return Boolean((_a = this.hdk) === null || _a === void 0 ? void 0 : _a.publicKey);
return Boolean(this.hdk.publicKey);
}

@@ -133,4 +141,3 @@ isConnected() {

setAccountToUnlock(index) {
this.unlockedAccount =
typeof index === 'number' ? index : parseInt(index, 10);
this.unlockedAccount = index;
}

@@ -195,2 +202,5 @@ setHdPath(hdPath) {

}
getName() {
return keyringType;
}
async getFirstPage() {

@@ -236,7 +246,7 @@ this.page = 0;

// object.
// @ts-expect-error tx.v should be a Buffer but we are assigning a string
// @ts-expect-error tx.v should be a Buffer, but we are assigning a string
tx.v = ethUtil.bufferToHex(tx.getChainId());
// @ts-expect-error tx.r should be a Buffer but we are assigning a string
// @ts-expect-error tx.r should be a Buffer, but we are assigning a string
tx.r = '0x00';
// @ts-expect-error tx.s should be a Buffer but we are assigning a string
// @ts-expect-error tx.s should be a Buffer, but we are assigning a string
tx.s = '0x00';

@@ -302,7 +312,7 @@ rawTxHex = tx.serialize().toString('hex');

}
let recoveryId = parseInt(String(payload.v), 10).toString(16);
if (recoveryId.length < 2) {
recoveryId = `0${recoveryId}`;
let modifiedV = parseInt(String(payload.v), 10).toString(16);
if (modifiedV.length < 2) {
modifiedV = `0${modifiedV}`;
}
const signature = `0x${payload.r}${payload.s}${recoveryId}`;
const signature = `0x${payload.r}${payload.s}${modifiedV}`;
const addressSignedWith = (0, eth_sig_util_1.recoverPersonalSignature)({

@@ -400,14 +410,9 @@ data: message,

this.accounts.forEach((account) => {
try {
const key = ethUtil.toChecksumAddress(account);
if (!keys.has(key)) {
this.accountDetails[key] = {
bip44: false,
hdPath: __classPrivateFieldGet(this, _LedgerKeyring_instances, "m", _LedgerKeyring_pathFromAddress).call(this, account),
};
}
const key = ethUtil.toChecksumAddress(account);
if (!keys.has(key)) {
this.accountDetails[key] = {
bip44: false,
hdPath: __classPrivateFieldGet(this, _LedgerKeyring_instances, "m", _LedgerKeyring_pathFromAddress).call(this, account),
};
}
catch (error) {
console.log(`failed to migrate account ${account}`);
}
});

@@ -524,6 +529,3 @@ }

const parsedResponse = await response.json();
if (parsedResponse.status !== '0' && parsedResponse.result.length > 0) {
return true;
}
return false;
return parsedResponse.status !== '0' && parsedResponse.result.length > 0;
}, _LedgerKeyring_getApiUrl = function _LedgerKeyring_getApiUrl() {

@@ -530,0 +532,0 @@ return this.network;

{
"name": "@metamask/eth-ledger-bridge-keyring",
"version": "3.0.0",
"version": "4.0.0",
"description": "A MetaMask compatible keyring, for ledger hardware wallets",

@@ -41,11 +41,12 @@ "keywords": [

"@ethereumjs/rlp": "^4.0.0",
"@ethereumjs/tx": "^4.1.1",
"@ethereumjs/tx": "^4.2.0",
"@ethereumjs/util": "^8.0.0",
"@metamask/eth-sig-util": "^7.0.0",
"@ledgerhq/hw-app-eth": "6.26.1",
"@metamask/eth-sig-util": "^7.0.1",
"hdkey": "^2.1.0"
},
"devDependencies": {
"@ethereumjs/common": "^3.1.1",
"@ethereumjs/common": "^3.2.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@ledgerhq/hw-app-eth": "^6.32.0",
"@ledgerhq/hw-transport": "^6.24.1",
"@ledgerhq/types-cryptoassets": "^7.6.0",

@@ -99,5 +100,6 @@ "@ledgerhq/types-devices": "^6.22.4",

"ethereumjs-tx>ethereumjs-util>secp256k1": false,
"hdkey>secp256k1": false
"hdkey>secp256k1": false,
"ethereumjs-tx>ethereumjs-util>ethereum-cryptography>keccak": false
}
}
}

Sorry, the diff of this file is not supported yet

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