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

@bigchaindb/wallet-hd

Package Overview
Dependencies
Maintainers
7
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bigchaindb/wallet-hd - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

10

dist/bytestring-buffer.js

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

if (input !== undefined && encoding === 'utf8') {
input = exports.encodeUtf8(input);
input = (0, exports.encodeUtf8)(input);
}

@@ -19,3 +19,3 @@ return new ByteStringBuffer(input);

const isArrayBufferView = (x) => {
return x && exports.isArrayBuffer(x === null || x === void 0 ? void 0 : x.buffer) && x.byteLength !== undefined;
return x && (0, exports.isArrayBuffer)(x === null || x === void 0 ? void 0 : x.buffer) && x.byteLength !== undefined;
};

@@ -121,3 +121,3 @@ exports.isArrayBufferView = isArrayBufferView;

putString(str) {
return this.putBytes(exports.encodeUtf8(str));
return this.putBytes((0, exports.encodeUtf8)(str));
}

@@ -327,3 +327,3 @@ putInt16(i) {

copy() {
const c = exports.createBuffer(this.data);
const c = (0, exports.createBuffer)(this.data);
c.read = this.read;

@@ -377,3 +377,3 @@ return c;

toString() {
return exports.decodeUtf8(this.bytes());
return (0, exports.decodeUtf8)(this.bytes());
}

@@ -380,0 +380,0 @@ }

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

// TODO: find a way to pass derivationPath ?
return new EncryptKeyPair({ publicKey: utils_1.toUint8Array(buffer.slice(2)) });
return new EncryptKeyPair({ publicKey: (0, utils_1.toUint8Array)(buffer.slice(2)) });
}

@@ -132,3 +132,3 @@ static generate(options = {}) {

const { encoding, secretKey } = options;
const secretKeyBytes = utils_1.toUint8Array(secretKey, encoding);
const secretKeyBytes = (0, utils_1.toUint8Array)(secretKey, encoding);
if (!(secretKeyBytes instanceof Uint8Array && secretKeyBytes.length === this.privateKeyLength)) {

@@ -156,3 +156,3 @@ throw new TypeError(INVALID_LENGTH('SecretKey', this.privateKeyLength));

: Buffer.from(keyPair.publicKey);
return utils_1.toUint8Array(pubKeyBuffer);
return (0, utils_1.toUint8Array)(pubKeyBuffer);
}

@@ -202,3 +202,3 @@ static getSharedKey(privateKey, publicKey) {

// (multicodec('x25519-pub') + key bytes)
const pubkeyBytes = utils_1.base58Decode({
const pubkeyBytes = (0, utils_1.base58Decode)({
decode: base58.decode,

@@ -230,3 +230,3 @@ keyMaterial: publicKeyBase58,

try {
fingerprintBuffer = utils_1.base58Decode({
fingerprintBuffer = (0, utils_1.base58Decode)({
decode: base58.decode,

@@ -242,3 +242,3 @@ keyMaterial: fingerprint.slice(1),

try {
publicKeyBuffer = utils_1.base58Decode({
publicKeyBuffer = (0, utils_1.base58Decode)({
decode: base58.decode,

@@ -268,6 +268,6 @@ keyMaterial: publicKeyBase58,

}
return this.chainCode ? utils_1.encodeKey(this.chainCode, encoding) : null;
return this.chainCode ? (0, utils_1.encodeKey)(this.chainCode, encoding) : null;
}
getPublicKey(encoding = 'default') {
return utils_1.encodeKey(this.publicKey, encoding);
return (0, utils_1.encodeKey)(this.publicKey, encoding);
}

@@ -278,3 +278,3 @@ getPrivateKey(encoding = 'default') {

}
return this.privateKey ? utils_1.encodeKey(this.privateKey, encoding, 'private', 'sec1') : null;
return this.privateKey ? (0, utils_1.encodeKey)(this.privateKey, encoding, 'private', 'sec1') : null;
}

@@ -281,0 +281,0 @@ getFingerprint() {

@@ -36,8 +36,8 @@ "use strict";

const key = purpose === 'sign' ? exports.ED25519_CURVE : exports.X25519_CURVE;
const I = crypto_1.createHmac('sha512', key).update(seedBuffer).digest();
const I = (0, crypto_1.createHmac)('sha512', key).update(seedBuffer).digest();
const IL = I.slice(0, 32);
const IR = I.slice(32);
return {
key: utils_1.toUint8Array(IL),
chainCode: utils_1.toUint8Array(IR),
key: (0, utils_1.toUint8Array)(IL),
chainCode: (0, utils_1.toUint8Array)(IR),
derivationPath: 'm',

@@ -62,8 +62,8 @@ curve: key,

const data = Buffer.concat([Buffer.alloc(1, 0), key, indexBuffer]);
const I = crypto_1.createHmac('sha512', chainCode).update(data).digest();
const I = (0, crypto_1.createHmac)('sha512', chainCode).update(data).digest();
const IL = I.slice(0, 32);
const IR = I.slice(32);
return {
key: utils_1.toUint8Array(IL),
chainCode: utils_1.toUint8Array(IR),
key: (0, utils_1.toUint8Array)(IL),
chainCode: (0, utils_1.toUint8Array)(IR),
derivationPath,

@@ -75,3 +75,3 @@ curve: parentKeys.curve,

static derivePath(path, seed, purpose = 'sign', encoding = 'hex', offset = exports.HARDENED_OFFSET) {
if (!utils_1.isValidDerivationPath(path)) {
if (!(0, utils_1.isValidDerivationPath)(path)) {
throw new Error(INVALID_DERIVATION_PATH);

@@ -78,0 +78,0 @@ }

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

return new SignKeyPair({
publicKey: utils_1.toUint8Array(buffer.slice(2)),
publicKey: (0, utils_1.toUint8Array)(buffer.slice(2)),
});

@@ -122,3 +122,3 @@ }

const { encoding, seed } = options;
const seedBytes = utils_1.toUint8Array(seed, encoding);
const seedBytes = (0, utils_1.toUint8Array)(seed, encoding);
if (!(seedBytes instanceof Uint8Array && seedBytes.length === this.seedLength)) {

@@ -131,3 +131,3 @@ throw new TypeError(INVALID_LENGTH('Seed', this.seedLength));

const { encoding, secretKey } = options;
const secretKeyBytes = utils_1.toUint8Array(secretKey, encoding);
const secretKeyBytes = (0, utils_1.toUint8Array)(secretKey, encoding);
if (!(secretKeyBytes instanceof Uint8Array && secretKeyBytes.length === this.fullPrivateKeyLength)) {

@@ -156,3 +156,3 @@ throw new TypeError(INVALID_LENGTH('SecretKey', this.fullPrivateKeyLength));

const pubKeyBuffer = withZeroByte ? Buffer.concat([zero, Buffer.from(signPk)]) : Buffer.from(signPk);
return utils_1.toUint8Array(pubKeyBuffer);
return (0, utils_1.toUint8Array)(pubKeyBuffer);
}

@@ -174,3 +174,3 @@ static getFullPrivateKey(privateKey, publicKey) {

// (multicodec ed25519-pub 0xed01 + key bytes)
const pubkeyBytes = utils_1.base58Decode({
const pubkeyBytes = (0, utils_1.base58Decode)({
decode: base58.decode,

@@ -198,3 +198,3 @@ keyMaterial: publicKeyBase58,

try {
fingerprintBuffer = utils_1.base58Decode({
fingerprintBuffer = (0, utils_1.base58Decode)({
decode: base58.decode,

@@ -210,3 +210,3 @@ keyMaterial: fingerprint.slice(1),

try {
publicKeyBuffer = utils_1.base58Decode({
publicKeyBuffer = (0, utils_1.base58Decode)({
decode: base58.decode,

@@ -220,3 +220,3 @@ keyMaterial: publicKeyBase58,

}
const buffersEqual = utils_1.isEqualBuffer(publicKeyBuffer, fingerprintBuffer.slice(2));
const buffersEqual = (0, utils_1.isEqualBuffer)(publicKeyBuffer, fingerprintBuffer.slice(2));
// validate the first two multicodec bytes 0xed01

@@ -236,6 +236,6 @@ const valid = fingerprintBuffer[0] === 0xed && fingerprintBuffer[1] === 0x01 && buffersEqual;

}
return this.chainCode ? utils_1.encodeKey(this.chainCode, encoding) : null;
return this.chainCode ? (0, utils_1.encodeKey)(this.chainCode, encoding) : null;
}
getPublicKey(encoding = 'default') {
return utils_1.encodeKey(this.publicKey, encoding);
return (0, utils_1.encodeKey)(this.publicKey, encoding);
}

@@ -247,8 +247,8 @@ getPrivateKey(encoding = 'default') {

if (encoding === 'der' || encoding === 'pem' || encoding === 'keyObject') {
return utils_1.encodeKey(this.fullPrivateKey, encoding, 'private', 'pkcs8');
return (0, utils_1.encodeKey)(this.fullPrivateKey, encoding, 'private', 'pkcs8');
}
return utils_1.encodeKey(this.privateKey, encoding, 'private', 'pkcs8');
return (0, utils_1.encodeKey)(this.privateKey, encoding, 'private', 'pkcs8');
}
getFullPrivateKey(encoding = 'default') {
return this.fullPrivateKey ? utils_1.encodeKey(this.fullPrivateKey, encoding, 'private', 'pkcs8') : null;
return this.fullPrivateKey ? (0, utils_1.encodeKey)(this.fullPrivateKey, encoding, 'private', 'pkcs8') : null;
}

@@ -255,0 +255,0 @@ getFingerprint() {

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

const { format = 'der', publicKeyBytes, type = 'spki' } = options;
return crypto_1.createPublicKey({
return (0, crypto_1.createPublicKey)({
key: publicKeyDerEncode({ publicKeyBytes }),

@@ -185,3 +185,3 @@ format,

const { format = 'der', privateKeyBytes, seedBytes, type = 'pkcs8' } = options;
return crypto_1.createPrivateKey({
return (0, crypto_1.createPrivateKey)({
key: privateKeyDerEncode({ privateKeyBytes, seedBytes }),

@@ -222,3 +222,3 @@ format,

base58: () => base58.encode(Buffer.from(key)),
base64: () => tweetnacl_util_1.encodeBase64(key),
base64: () => (0, tweetnacl_util_1.encodeBase64)(key),
buffer: () => Buffer.from(key),

@@ -225,0 +225,0 @@ pem: () => toPem(Buffer.from(key), type, outputType),

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

const wordlist = bip39_1.wordlists[language];
return bip39_1.generateMnemonic(strength || ENTROPY_BITS, rngFn, wordlist);
return (0, bip39_1.generateMnemonic)(strength || ENTROPY_BITS, rngFn, wordlist);
}

@@ -34,3 +34,3 @@ static validateMnemonic(mnemonic, language = 'english') {

const wordlist = bip39_1.wordlists[language];
return bip39_1.validateMnemonic(mnemonic, wordlist);
return (0, bip39_1.validateMnemonic)(mnemonic, wordlist);
}

@@ -41,3 +41,3 @@ static createSeed(mnemonic, password = undefined, language = 'english') {

}
return bip39_1.mnemonicToSeedSync(mnemonic, password);
return (0, bip39_1.mnemonicToSeedSync)(mnemonic, password);
}

@@ -44,0 +44,0 @@ static fromMnemonic(mnemonic, password = undefined, language = 'english') {

{
"name": "@bigchaindb/wallet-hd",
"version": "0.4.2",
"version": "0.4.3",
"description": "Key derivation for BigChainDB",

@@ -37,9 +37,8 @@ "keywords": [

"lint": "eslint ./ --ext .js,.ts,.tsx --quiet --fix",
"test": "jest --ci --config ../../jest.config.json ",
"test": "jest --runInBand",
"test:cov": "rimraf -rf ./coverage && jest --ci --runInBand --coverage",
"prepublishOnly": "npm run build"
},
"devDependencies": {
"eslint": "^7.16.0",
"rimraf": "~3.0.2",
"typescript": "^4.3.2"
"rimraf": "~3.0.2"
},

@@ -53,3 +52,3 @@ "dependencies": {

},
"gitHead": "5f12d288204a92e3c3a331f7f2181fead584cd69"
"gitHead": "1be1eadd72f305c0e915b0d67b0c7bc565dda9d2"
}

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