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

thor-devkit

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thor-devkit - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

dist/cry/hdnode.d.ts

1

dist/cry/index.d.ts

@@ -7,1 +7,2 @@ export * from './blake2b';

export * from './address';
export * from './hdnode';

3

dist/cry/index.js

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

__export(require("./address"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY3J5L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsK0JBQXlCO0FBQ3pCLGlDQUEyQjtBQUMzQiw4QkFBd0I7QUFDeEIsZ0NBQTBCO0FBQzFCLGdDQUEwQjtBQUMxQiwrQkFBeUIifQ==
__export(require("./hdnode"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY3J5L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsK0JBQXlCO0FBQ3pCLGlDQUEyQjtBQUMzQiw4QkFBd0I7QUFDeEIsZ0NBQTBCO0FBQzFCLGdDQUEwQjtBQUMxQiwrQkFBeUI7QUFDekIsOEJBQXdCIn0=

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

/**
* derive private key from mnemonic words according to BIP32.
* derive private key at index 0 from mnemonic words according to BIP32.
* the derivation path is defined at https://github.com/satoshilabs/slips/blob/master/slip-0044.md

@@ -14,0 +14,0 @@ */

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const hdnode_1 = require("@vechain/ethers/utils/hdnode");
const HD = require("@vechain/ethers/utils/hdnode");
const crypto_1 = require("crypto");
const hdnode_1 = require("./hdnode");
var mnemonic;
(function (mnemonic) {
// see https://github.com/satoshilabs/slips/blob/master/slip-0044.md
const VET_DERIVATION_PATH = `m/44'/818'/0'/0`;
/** generate BIP39 mnemonic words */
function generate() {
return hdnode_1.entropyToMnemonic(crypto_1.randomBytes(128 / 8)).split(' ');
return HD.entropyToMnemonic(crypto_1.randomBytes(128 / 8)).split(' ');
}

@@ -19,15 +18,14 @@ mnemonic.generate = generate;

function validate(words) {
return hdnode_1.isValidMnemonic(words.join(' '));
return HD.isValidMnemonic(words.join(' '));
}
mnemonic.validate = validate;
/**
* derive private key from mnemonic words according to BIP32.
* derive private key at index 0 from mnemonic words according to BIP32.
* the derivation path is defined at https://github.com/satoshilabs/slips/blob/master/slip-0044.md
*/
function derivePrivateKey(words) {
const node = hdnode_1.fromMnemonic(words.join(' '));
return Buffer.from(node.derivePath(VET_DERIVATION_PATH + '/0').privateKey.slice(2), 'hex');
return hdnode_1.HDNode.fromMnemonic(words).derive(0).privateKey;
}
mnemonic.derivePrivateKey = derivePrivateKey;
})(mnemonic = exports.mnemonic || (exports.mnemonic = {}));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW5lbW9uaWMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY3J5L21uZW1vbmljLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEseURBSXFDO0FBQ3JDLG1DQUFvQztBQUVwQyxJQUFpQixRQUFRLENBeUJ4QjtBQXpCRCxXQUFpQixRQUFRO0lBQ3JCLG9FQUFvRTtJQUNwRSxNQUFNLG1CQUFtQixHQUFHLGlCQUFpQixDQUFBO0lBRTdDLG9DQUFvQztJQUNwQyxTQUFnQixRQUFRO1FBQ3BCLE9BQU8sMEJBQWlCLENBQUMsb0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EMsU0FBZ0IsUUFBUTtRQUNwQixPQUFPLEVBQUUsQ0FBQyxpQkFBaUIsQ0FBQyxvQkFBVyxDQUFDLEdBQUcsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQTtJQUNoRSxDQUFDO0lBRmUsaUJBQVEsV0FFdkIsQ0FBQTtJQUVEOzs7T0FHRztJQUNILFNBQWdCLFFBQVEsQ0FBQyxLQUFlO1FBQ3BDLE9BQU8sRUFBRSxDQUFDLGVBQWUsQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUE7SUFDOUMsQ0FBQztJQUZlLGlCQUFRLFdBRXZCLENBQUE7SUFFRDs7O09BR0c7SUFDSCxTQUFnQixnQkFBZ0IsQ0FBQyxLQUFlO1FBQzVDLE9BQU8sZUFBTSxDQUFDLFlBQVksQ0FBQyxLQUFLLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUMsVUFBVyxDQUFBO0lBQzNELENBQUM7SUFGZSx5QkFBZ0IsbUJBRS9CLENBQUE7QUFDTCxDQUFDLEVBckJnQixRQUFRLEdBQVIsZ0JBQVEsS0FBUixnQkFBUSxRQXFCeEIifQ==
{
"name": "thor-devkit",
"version": "1.1.1",
"version": "1.2.0",
"description": "Typescript library to aid DApp development on VeChain Thor",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -79,2 +79,23 @@ # Thor DevKit

ok = cry.Keystore.wellFormed(keystore)
// create BIP32 HD node from mnemonic words
let hdnode = cry.HDNode.fromMnemonic(words)
// derive 5 child private keys
for (let i = 0; i < 5; i++) {
let child = hdnode.derive(i)
// get child private key
// child.privateKey
}
// or create HD node from xpub
const pub = Buffer.from('04dc40b4324626eb393dbf77b6930e915dcca6297b42508adb743674a8ad5c69a046010f801a62cb945a6cb137a050cefaba0572429fc4afc57df825bfca2f219a', 'hex')
const chainCode = Buffer.from('105da5578eb3228655a8abe70bf4c317e525c7f7bb333634f5b7d1f70e111a33', 'hex')
hdnode = cry.HDNode.fromPublicKey(pub, chainCode)
// derive 5 child public keys
for (let i = 0; i < 5; i++) {
let child = hdnode.derive(i)
// get child public key
// child.publicKey
}
```

@@ -81,0 +102,0 @@

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