@cosmjs/crypto
Advanced tools
Comparing version 0.25.2 to 0.25.3
@@ -21,3 +21,2 @@ import { EnglishMnemonic } from "./englishmnemonic"; | ||
static mnemonicToSeed(mnemonic: EnglishMnemonic, password?: string): Promise<Uint8Array>; | ||
private static pbkdf2; | ||
} |
@@ -25,4 +25,2 @@ "use strict"; | ||
const bip39 = __importStar(require("bip39")); | ||
const pbkdf2_1 = require("pbkdf2"); | ||
const unorm = __importStar(require("unorm")); | ||
const englishmnemonic_1 = require("./englishmnemonic"); | ||
@@ -56,24 +54,6 @@ class Bip39 { | ||
static async mnemonicToSeed(mnemonic, password) { | ||
// reimplementation of bip39.mnemonicToSeed using the asynchronous | ||
// interface of https://www.npmjs.com/package/pbkdf2 | ||
const mnemonicBytes = encoding_1.toUtf8(unorm.nfkd(mnemonic.toString())); | ||
const salt = "mnemonic" + (password ? unorm.nfkd(password) : ""); | ||
const saltBytes = encoding_1.toUtf8(salt); | ||
return this.pbkdf2(mnemonicBytes, saltBytes, 2048, 64, "sha512"); | ||
return new Uint8Array(await bip39.mnemonicToSeed(mnemonic.toString(), password)); | ||
} | ||
// convert pbkdf2's callback interface to Promise interface | ||
static async pbkdf2(secret, salt, iterations, keylen, digest) { | ||
return new Promise((resolve, reject) => { | ||
pbkdf2_1.pbkdf2(secret, salt, iterations, keylen, digest, (err, derivedKey) => { | ||
if (err) { | ||
reject(err); | ||
} | ||
else { | ||
resolve(new Uint8Array(derivedKey)); | ||
} | ||
}); | ||
}); | ||
} | ||
} | ||
exports.Bip39 = Bip39; | ||
//# sourceMappingURL=bip39.js.map |
{ | ||
"name": "@cosmjs/crypto", | ||
"version": "0.25.2", | ||
"version": "0.25.3", | ||
"description": "Cryptography resources for blockchain projects", | ||
@@ -44,5 +44,5 @@ "contributors": [ | ||
"dependencies": { | ||
"@cosmjs/encoding": "^0.25.2", | ||
"@cosmjs/math": "^0.25.2", | ||
"@cosmjs/utils": "^0.25.2", | ||
"@cosmjs/encoding": "^0.25.3", | ||
"@cosmjs/math": "^0.25.3", | ||
"@cosmjs/utils": "^0.25.3", | ||
"bip39": "^3.0.2", | ||
@@ -53,6 +53,4 @@ "bn.js": "^4.11.8", | ||
"libsodium-wrappers": "^0.7.6", | ||
"pbkdf2": "^3.1.2", | ||
"ripemd160": "^2.0.2", | ||
"sha.js": "^2.4.11", | ||
"unorm": "^1.5.0" | ||
"sha.js": "^2.4.11" | ||
}, | ||
@@ -63,8 +61,6 @@ "devDependencies": { | ||
"@types/libsodium-wrappers": "^0.7.7", | ||
"@types/pbkdf2": "^3.1.0", | ||
"@types/ripemd160": "^2.0.0", | ||
"@types/sha.js": "^2.4.0", | ||
"@types/unorm": "^1.3.27" | ||
"@types/sha.js": "^2.4.0" | ||
}, | ||
"gitHead": "dab008f2f524aab5063fdda3ad510376425dc50a" | ||
"gitHead": "ba7fd927d73ea56f85d8ff841282b88e4baeb718" | ||
} |
Sorry, the diff of this file is not supported yet
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
10
5
368387
3112
- Removedpbkdf2@^3.1.2
- Removedunorm@^1.5.0
- Removedcipher-base@1.0.4(transitive)
- Removedcreate-hash@1.2.0(transitive)
- Removedcreate-hmac@1.1.7(transitive)
- Removedmd5.js@1.3.5(transitive)
- Removedpbkdf2@3.1.2(transitive)
- Removedunorm@1.6.0(transitive)
Updated@cosmjs/encoding@^0.25.3
Updated@cosmjs/math@^0.25.3
Updated@cosmjs/utils@^0.25.3