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

@polkadot/wasm-crypto

Package Overview
Dependencies
Maintainers
2
Versions
565
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polkadot/wasm-crypto

A wasm interface layer for use by @polkadot/util-crypto

  • 6.0.2-9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
52K
decreased by-45.28%
Maintainers
2
Weekly downloads
 
Created
Source

@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 -

const { u8aToHex } = require('@polkadot/util');
const { bip39Generate, 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(12);

  // get ed25519 seed from phrase
  const seed = bip39ToSeed(phrase, '');

  // display
  console.log('phrase:', phrase);
  console.log('seed:', u8aToHex(seed));
}

FAQs

Package last updated on 10 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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