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

@polkadot/wasm-crypto

Package Overview
Dependencies
Maintainers
1
Versions
565
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polkadot/wasm-crypto - npm Package Compare versions

Comparing version 0.3.1 to 0.4.1

1

index.d.ts

@@ -8,2 +8,3 @@ // Copyright 2019 @polkadot/wasm-crypto authors & contributors

export function bip39ToMiniSecret (phrase: string, password: string): Uint8Array;
export function bip39ToSeed (phrase: string): Uint8Array;
export function bip39Validate (phrase: string): boolean;

@@ -10,0 +11,0 @@ export function blake2b (data: Uint8Array, key: Uint8Array, byteSize: number): Uint8Array;

@@ -10,2 +10,3 @@ // Copyright 2019 @polkadot/wasm-crypto authors & contributors

module.exports.bip39ToMiniSecret = stubbed.ext_bip39_to_mini_secret;
module.exports.bip39ToSeed = stubbed.ext_bip39_to_seed;
module.exports.bip39Validate = stubbed.ext_bip39_validate

@@ -12,0 +13,0 @@ module.exports.blake2b = stubbed.ext_blake2b;

2

package.json
{
"name": "@polkadot/wasm-crypto",
"version": "0.3.1",
"version": "0.4.1",
"author": "Jaco Greeff <jacogr@gmail.com>",

@@ -5,0 +5,0 @@ "files": [

# @polkadot/wasm-crypto
Wrapper around crypto hashing functions
## Usage
Install the package (also requires `@polkadot/util` for `TextEncoder` polyfills - not included here as a dependency to keep the tree lean)
`yarn add @polkadot/wasm-crypto @polkadot/util`
Use it -
```js
const { u8aToHex } = require('@polkadot/util');
const { bio39Generate, bip39ToSeed, waitReady } = require('@polkadot/wasm-crypto');
async function main () {
// first wait until the WASM has been loaded (async init)
await waitReady();
// generate phrase
const phrase = bip39Generate();
// get ed25519 seed from phrase
const seed = bip39ToSeed(phrase);
// display
console.log('phrase:', phrase);
console.log('seed:', u8aToHex(seed));
}
```

@@ -34,2 +34,12 @@ /* tslint:disable */

/**
* Creates a see from a bip-39 phrase
*
* @phrase: mnemonic phrase
*
* Returns a 32-byte seed
* @param {string} arg0
* @returns {Uint8Array}
*/
export function ext_bip39_to_seed(arg0: string): Uint8Array;
/**
* Validates a bip39 phrase

@@ -36,0 +46,0 @@ *

@@ -164,2 +164,33 @@ const crypto = require('crypto'); let wasm; const requires = { crypto };

/**
* Creates a see from a bip-39 phrase
*
* @phrase: mnemonic phrase
*
* Returns a 32-byte seed
* @param {string} arg0
* @returns {Uint8Array}
*/
module.exports.ext_bip39_to_seed = function(arg0) {
const ptr0 = passStringToWasm(arg0);
const len0 = WASM_VECTOR_LEN;
const retptr = globalArgumentPtr();
try {
wasm.ext_bip39_to_seed(retptr, ptr0, len0);
const mem = getUint32Memory();
const rustptr = mem[retptr / 4];
const rustlen = mem[retptr / 4 + 1];
const realRet = getArrayU8FromWasm(rustptr, rustlen).slice();
wasm.__wbindgen_free(rustptr, rustlen * 1);
return realRet;
} finally {
wasm.__wbindgen_free(ptr0, len0 * 1);
}
};
/**
* Validates a bip39 phrase

@@ -166,0 +197,0 @@ *

Sorry, the diff of this file is too big to display

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