cardano-crypto.js
Advanced tools
Comparing version 4.0.1 to 4.0.2
@@ -7,3 +7,3 @@ const bip39 = require('bip39-light') | ||
const scrypt = require('./utils/scrypt-async') | ||
const pbkdf2Sync = require('pbkdf2').pbkdf2Sync | ||
const pbkdf2 = require('./utils/pbkdf2') | ||
@@ -150,3 +150,3 @@ const HARDENED_THRESHOLD = 0x80000000 | ||
function walletSecretFromMnemonic(mnemonic, derivationScheme) { | ||
async function walletSecretFromMnemonic(mnemonic, derivationScheme) { | ||
validateDerivationScheme(derivationScheme) | ||
@@ -196,6 +196,6 @@ | ||
function walletSecretFromMnemonicV2(mnemonic, password) { | ||
async function walletSecretFromMnemonicV2(mnemonic, password) { | ||
validateMnemonic(mnemonic) | ||
const entropy = Buffer.from(bip39.mnemonicToEntropy(mnemonic), 'hex') | ||
const xprv = pbkdf2Sync(password, entropy, 4096, 96, 'sha512') | ||
const xprv = await pbkdf2(password, entropy, 4096, 96, 'sha512') | ||
@@ -202,0 +202,0 @@ xprv[0] &= 248 |
{ | ||
"name": "cardano-crypto.js", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "input-output-hk/cardano-crypto compiled to pure javascript using Emscripten", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -15,3 +15,3 @@ # cardano-crypto.js | ||
var mnemonic = 'logic easily waste eager injury oval sentence wine bomb embrace gossip supreme' | ||
var walletSecret = lib.walletSecretFromMnemonic(mnemonic) | ||
var walletSecret = await lib.walletSecretFromMnemonic(mnemonic, 1) | ||
var msg = new Buffer('hello there') | ||
@@ -27,3 +27,3 @@ var sig = lib.sign(msg, walletSecret) | ||
var mnemonic = 'logic easily waste eager injury oval sentence wine bomb embrace gossip supreme' | ||
var parentWalletSecret = lib.walletSecretFromMnemonic(mnemonic) | ||
var parentWalletSecret = lib.walletSecretFromMnemonic(mnemonic, 1) | ||
var childWalletSecret = lib.derivePrivate(parentWalletSecret, 0x80000001, 1) | ||
@@ -38,3 +38,3 @@ ``` | ||
var mnemonic = 'logic easily waste eager injury oval sentence wine bomb embrace gossip supreme' | ||
var parentWalletSecret = lib.walletSecretFromMnemonic(mnemonic) | ||
var parentWalletSecret = lib.walletSecretFromMnemonic(mnemonic, 1) | ||
var parentWalletPublicKey = parentWalletSecret.slice(64, 128) | ||
@@ -48,5 +48,5 @@ var childWalletSecret = lib.derivePublic(parentWalletPublicKey, 1, 1) | ||
* `Bool verify(Buffer msg, Buffer publicKey, Buffer sig)` | ||
* `Buffer walletSecretFromMnemonic(String mnemonic)` | ||
* `Buffer derivePrivate(Buffer parentKey, int index, int derivationMode)` | ||
* `Buffer derivePublic(Buffer parentExtPubKey, int index, int derivationMode)` | ||
* `async Buffer walletSecretFromMnemonic(String mnemonic, int derivationScheme)` | ||
* `Buffer derivePrivate(Buffer parentKey, int index, int derivationScheme)` | ||
* `Buffer derivePublic(Buffer parentExtPubKey, int index, int derivationScheme)` | ||
* `Buffer blake2b(Buffer input, outputLen)` | ||
@@ -68,2 +68,2 @@ * `Buffer sha3_256(Buffer input)` | ||
* run `npm run test` | ||
* run `npm run test` |
@@ -21,6 +21,6 @@ var test = require('tape') | ||
test('wallet secret from mnemonic V1', function(t) { | ||
test('wallet secret from mnemonic V1', async function(t) { | ||
t.plan(1) | ||
var walletSecret = lib.walletSecretFromMnemonic(sampleWalletMnemonicV1, 1) | ||
var walletSecret = await lib.walletSecretFromMnemonic(sampleWalletMnemonicV1, 1) | ||
t.equals( | ||
@@ -33,6 +33,6 @@ walletSecret.toString('hex'), | ||
test('wallet secret from mnemonic V2', function(t) { | ||
test('wallet secret from mnemonic V2', async function(t) { | ||
t.plan(1) | ||
var walletSecret = lib.walletSecretFromMnemonic(sampleWalletMnemonicV2, 2) | ||
var walletSecret = await lib.walletSecretFromMnemonic(sampleWalletMnemonicV2, 2) | ||
t.equals( | ||
@@ -39,0 +39,0 @@ walletSecret.toString('hex'), |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
270264
10
2054
65