Socket
Socket
Sign inDemoInstall

@iov/crypto

Package Overview
Dependencies
Maintainers
3
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iov/crypto - npm Package Compare versions

Comparing version 0.12.2 to 0.13.0-alpha.0

40

build/bip39.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importStar = (this && this.__importStar) || function (mod) {

@@ -58,19 +66,23 @@ if (mod && mod.__esModule) return mod;

static mnemonicToSeed(mnemonic, password) {
// reimplementation of bip39.mnemonicToSeed using the asynchonous
// interface of https://www.npmjs.com/package/pbkdf2
const mnemonicBytes = Buffer.from(unorm.nfkd(mnemonic.asString()), "utf8");
const salt = "mnemonic" + (password ? unorm.nfkd(password) : "");
const saltBytes = Buffer.from(salt, "utf8");
return this.pbkdf2(mnemonicBytes, saltBytes, 2048, 64, "sha512");
return __awaiter(this, void 0, void 0, function* () {
// reimplementation of bip39.mnemonicToSeed using the asynchonous
// interface of https://www.npmjs.com/package/pbkdf2
const mnemonicBytes = Buffer.from(unorm.nfkd(mnemonic.asString()), "utf8");
const salt = "mnemonic" + (password ? unorm.nfkd(password) : "");
const saltBytes = Buffer.from(salt, "utf8");
return this.pbkdf2(mnemonicBytes, saltBytes, 2048, 64, "sha512");
});
}
// convert pbkdf2's calllback interface to Promise interface
static 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));
}
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => {
pbkdf2_1.pbkdf2(secret, salt, iterations, keylen, digest, (err, derivedKey) => {
if (err) {
reject(err);
}
else {
resolve(new Uint8Array(derivedKey));
}
});
});

@@ -77,0 +89,0 @@ });

{
"name": "@iov/crypto",
"version": "0.12.2",
"version": "0.13.0-alpha.0",
"description": "Cryptography resources for IOV projects",

@@ -33,3 +33,3 @@ "author": "IOV SAS <admin@iov.one>",

"dependencies": {
"@iov/encoding": "^0.12.0",
"@iov/encoding": "^0.13.0-alpha.0",
"bip39": "^2.5.0",

@@ -48,3 +48,3 @@ "bn.js": "^4.11.8",

},
"gitHead": "31d50f38de85345fd027f0a0acb4065ee48012cf"
"gitHead": "3b88ba18d9906ca04a608406329c7684d92e83bd"
}

@@ -61,3 +61,3 @@ import * as bip39 from "bip39";

public static mnemonicToSeed(mnemonic: EnglishMnemonic, password?: string): Promise<Uint8Array> {
public static async mnemonicToSeed(mnemonic: EnglishMnemonic, password?: string): Promise<Uint8Array> {
// reimplementation of bip39.mnemonicToSeed using the asynchonous

@@ -72,3 +72,3 @@ // interface of https://www.npmjs.com/package/pbkdf2

// convert pbkdf2's calllback interface to Promise interface
private static pbkdf2(
private static async pbkdf2(
secret: Uint8Array,

@@ -75,0 +75,0 @@ salt: Uint8Array,

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