Socket
Socket
Sign inDemoInstall

@metamask/key-tree

Package Overview
Dependencies
Maintainers
7
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/key-tree - npm Package Compare versions

Comparing version 4.0.0 to 5.0.0

2

dist/BIP44CoinTypeNode.d.ts

@@ -101,5 +101,7 @@ /// <reference types="node" />

get publicKey(): string;
get compressedPublicKey(): string;
get compressedPublicKeyBuffer(): Buffer;
get chainCode(): string;
get address(): string;
get masterFingerprint(): number | undefined;
get parentFingerprint(): number;

@@ -106,0 +108,0 @@ get fingerprint(): number;

@@ -144,2 +144,5 @@ "use strict";

}
get compressedPublicKey() {
return __classPrivateFieldGet(this, _BIP44CoinTypeNode_node, "f").compressedPublicKey;
}
get compressedPublicKeyBuffer() {

@@ -154,2 +157,5 @@ return __classPrivateFieldGet(this, _BIP44CoinTypeNode_node, "f").compressedPublicKeyBuffer;

}
get masterFingerprint() {
return __classPrivateFieldGet(this, _BIP44CoinTypeNode_node, "f").masterFingerprint;
}
get parentFingerprint() {

@@ -156,0 +162,0 @@ return __classPrivateFieldGet(this, _BIP44CoinTypeNode_node, "f").parentFingerprint;

@@ -35,2 +35,7 @@ /// <reference types="node" />

/**
* The fingerprint of the master node, i.e., the node at depth 0. May be
* undefined if this node was created from an extended key.
*/
readonly masterFingerprint?: number;
/**
* The fingerprint of the parent key, or 0 if this is a master node.

@@ -124,5 +129,7 @@ */

get publicKey(): string;
get compressedPublicKey(): string;
get compressedPublicKeyBuffer(): Buffer;
get chainCode(): string;
get address(): string;
get masterFingerprint(): number | undefined;
get parentFingerprint(): number;

@@ -129,0 +136,0 @@ get fingerprint(): number;

@@ -142,2 +142,5 @@ "use strict";

}
get compressedPublicKey() {
return __classPrivateFieldGet(this, _BIP44Node_node, "f").compressedPublicKey;
}
get compressedPublicKeyBuffer() {

@@ -152,2 +155,5 @@ return __classPrivateFieldGet(this, _BIP44Node_node, "f").compressedPublicKeyBuffer;

}
get masterFingerprint() {
return __classPrivateFieldGet(this, _BIP44Node_node, "f").masterFingerprint;
}
get parentFingerprint() {

@@ -218,2 +224,3 @@ return __classPrivateFieldGet(this, _BIP44Node_node, "f").parentFingerprint;

depth: this.depth,
masterFingerprint: this.masterFingerprint,
parentFingerprint: this.parentFingerprint,

@@ -220,0 +227,0 @@ index: this.index,

3

dist/derivation.js

@@ -83,5 +83,2 @@ "use strict";

}
if (path.length - 1 > constants_1.MAX_BIP_44_DEPTH) {
throw new Error(`Invalid HD path segment: The segment cannot exceed a 0-indexed depth of 5.`);
}
let startsWithBip39 = false;

@@ -88,0 +85,0 @@ path.forEach((node, index) => {

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

depth: node.depth + 1,
masterFingerprint: node.masterFingerprint,
parentFingerprint: node.fingerprint,

@@ -115,2 +116,3 @@ index: childIndex + (isHardened ? constants_1.BIP_32_HARDENED_OFFSET : 0),

depth: node.depth + 1,
masterFingerprint: node.masterFingerprint,
parentFingerprint: node.fingerprint,

@@ -117,0 +119,0 @@ index: childIndex,

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

const SLIP10Node_1 = require("../SLIP10Node");
const utils_1 = require("../utils");
/**

@@ -35,5 +36,7 @@ * @param mnemonic

const chainCode = key.slice(32);
const masterFingerprint = utils_1.getFingerprint(await curve.getPublicKey(privateKey, true));
return SLIP10Node_1.SLIP10Node.fromExtendedKey({
privateKey,
chainCode,
masterFingerprint,
depth: 0,

@@ -40,0 +43,0 @@ parentFingerprint: 0,

@@ -11,2 +11,2 @@ /// <reference types="node" />

*/
export declare const PackageBuffer: typeof Buffer;
export declare const PackageBuffer: BufferConstructor;

@@ -17,2 +17,7 @@ /// <reference types="node" />

/**
* The fingerprint of the master node, i.e., the node at depth 0. May be
* undefined if this node was created from an extended key.
*/
readonly masterFingerprint?: number;
/**
* The fingerprint of the parent key, or 0 if this is a master node.

@@ -60,2 +65,3 @@ */

readonly depth: number;
readonly masterFingerprint?: number;
readonly parentFingerprint: number;

@@ -70,2 +76,3 @@ readonly index: number;

readonly depth: number;
readonly masterFingerprint?: number;
readonly parentFingerprint: number;

@@ -108,3 +115,3 @@ readonly index: number;

*/
static fromExtendedKey({ depth, parentFingerprint, index, privateKey, publicKey, chainCode, curve, }: SLIP10ExtendedKeyOptions): Promise<SLIP10Node>;
static fromExtendedKey({ depth, masterFingerprint, parentFingerprint, index, privateKey, publicKey, chainCode, curve, }: SLIP10ExtendedKeyOptions): Promise<SLIP10Node>;
/**

@@ -134,2 +141,3 @@ * Create a new SLIP-10 node from a derivation path. The derivation path

readonly depth: number;
readonly masterFingerprint?: number;
readonly parentFingerprint: number;

@@ -140,3 +148,3 @@ readonly index: number;

readonly publicKeyBuffer: Buffer;
constructor({ depth, parentFingerprint, index, chainCode, privateKey, publicKey, curve, }: SLIP10NodeConstructorOptions);
constructor({ depth, masterFingerprint, parentFingerprint, index, chainCode, privateKey, publicKey, curve, }: SLIP10NodeConstructorOptions);
get chainCode(): string;

@@ -146,2 +154,3 @@ get privateKey(): string | undefined;

get compressedPublicKeyBuffer(): Buffer;
get compressedPublicKey(): string;
get address(): string;

@@ -148,0 +157,0 @@ get fingerprint(): number;

@@ -10,4 +10,5 @@ "use strict";

class SLIP10Node {
constructor({ depth, parentFingerprint, index, chainCode, privateKey, publicKey, curve, }) {
constructor({ depth, masterFingerprint, parentFingerprint, index, chainCode, privateKey, publicKey, curve, }) {
this.depth = depth;
this.masterFingerprint = masterFingerprint;
this.parentFingerprint = parentFingerprint;

@@ -48,3 +49,3 @@ this.index = index;

*/
static async fromExtendedKey({ depth, parentFingerprint, index, privateKey, publicKey, chainCode, curve, }) {
static async fromExtendedKey({ depth, masterFingerprint, parentFingerprint, index, privateKey, publicKey, chainCode, curve, }) {
const chainCodeBuffer = utils_1.getBuffer(chainCode, constants_1.BUFFER_KEY_LENGTH);

@@ -59,2 +60,3 @@ validateCurve(curve);

depth,
masterFingerprint,
parentFingerprint,

@@ -72,2 +74,3 @@ index,

depth,
masterFingerprint,
parentFingerprint,

@@ -130,2 +133,5 @@ index,

}
get compressedPublicKey() {
return this.compressedPublicKeyBuffer.toString('hex');
}
get address() {

@@ -146,2 +152,3 @@ if (this.curve !== 'secp256k1') {

depth: this.depth,
masterFingerprint: this.masterFingerprint,
parentFingerprint: this.parentFingerprint,

@@ -174,2 +181,3 @@ index: this.index,

depth: this.depth,
masterFingerprint: this.masterFingerprint,
parentFingerprint: this.parentFingerprint,

@@ -176,0 +184,0 @@ index: this.index,

@@ -31,3 +31,3 @@ /// <reference types="node" />

* @param coinTypePath - The parent `coin_type` path.
* @param coin_type - The `change` index to create a path visualization for.
* @param indices - The `account` and `change` index to create a path visualization for.
* @returns The visualization of the BIP-44 path for the specified `coin_type`

@@ -34,0 +34,0 @@ * and `change` indices.

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

function getBIP44CoinTypePathString(coin_type) {
return `m / ${constants_1.BIP44PurposeNodeToken} / ${getUnhardenedBIP32NodeToken(coin_type)}'`;
return `m / ${constants_1.BIP44PurposeNodeToken} / ${getHardenedBIP32NodeToken(coin_type)}`;
}

@@ -30,3 +30,3 @@ exports.getBIP44CoinTypePathString = getBIP44CoinTypePathString;

* @param coinTypePath - The parent `coin_type` path.
* @param coin_type - The `change` index to create a path visualization for.
* @param indices - The `account` and `change` index to create a path visualization for.
* @returns The visualization of the BIP-44 path for the specified `coin_type`

@@ -174,3 +174,3 @@ * and `change` indices.

function nullableHexStringToBuffer(hexString) {
if (hexString) {
if (hexString !== undefined) {
return hexStringToBuffer(hexString);

@@ -177,0 +177,0 @@ }

{
"name": "@metamask/key-tree",
"version": "4.0.0",
"version": "5.0.0",
"description": "An interface over BIP-32 and BIP-39 key derivation paths.",

@@ -18,2 +18,3 @@ "repository": {

"build:clean": "rimraf dist && yarn build",
"postinstall": "simple-git-hooks",
"lint": "yarn lint:eslint && yarn lint:misc --check",

@@ -24,6 +25,17 @@ "lint:eslint": "eslint . --cache --ext js,ts",

"prepublishOnly": "yarn build:clean && yarn lint && yarn test",
"setup": "yarn install && yarn allow-scripts",
"setup": "yarn install",
"test": "jest",
"test:watch": "jest --watch"
},
"simple-git-hooks": {
"pre-commit": "yarn lint-staged && yarn dedupe --check"
},
"lint-staged": {
"*.{js,ts}": [
"eslint --fix"
],
"!(CHANGELOG).{json,yml,md}": [
"prettier --write"
]
},
"dependencies": {

@@ -37,3 +49,3 @@ "@noble/ed25519": "^1.6.0",

"devDependencies": {
"@lavamoat/allow-scripts": "^1.0.6",
"@lavamoat/allow-scripts": "^2.0.3",
"@metamask/auto-changelog": "^2.5.0",

@@ -55,10 +67,13 @@ "@metamask/eslint-config": "^8.0.0",

"jest": "^27.2.5",
"lint-staged": "^13.0.3",
"prettier": "^2.4.1",
"prettier-plugin-packagejson": "^2.2.13",
"rimraf": "^3.0.2",
"simple-git-hooks": "^2.8.0",
"ts-jest": "^27.0.6",
"typescript": "4.3.5"
},
"packageManager": "yarn@3.2.3",
"engines": {
"node": ">=12.0.0"
"node": ">=16.0.0"
},

@@ -71,5 +86,7 @@ "publishConfig": {

"allowScripts": {
"@lavamoat/preinstall-always-fail": false
"@lavamoat/preinstall-always-fail": false,
"$root$": false,
"simple-git-hooks": 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

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

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