Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
@metamask/scure-bip39
Advanced tools
MetaMask fork of @scure/bip39: a secure, audited & minimal implementation of BIP39 mnemonic phrases
This is a temporary fork of the @scure/bip39
package created by the MetaMask team. Please do not use this package for other projects, use @scure/bip39
directly instead. We are not interested in maintaining this long-term. We will not be accepting community issues or PRs.
Secure, audited & minimal implementation of BIP39 mnemonic phrases.
Compared to popular bip39
package, scure-bip39:
Check out scure-bip32 if you need hierarchical deterministic wallets ("HD Wallets").
scure — secure audited packages for every use case.
npm install @metamask/scure-bip39
Or
yarn add @metamask/scure-bip39
import * as bip39 from '@metamask/scure-bip39';
import { wordlist } from '@metamask/scure-bip39/wordlists/english';
// Generate x random words. Uses Cryptographically-Secure Random Number Generator.
const mn = bip39.generateMnemonic(wordlist);
console.log(mn);
// Reversible: Converts mnemonic string to raw entropy in form of byte array.
const ent = bip39.mnemonicToEntropy(mn, wordlist)
// Reversible: Converts raw entropy in form of byte array to mnemonic string.
bip39.entropyToMnemonic(ent, wordlist);
// Validates mnemonic for being 12-24 words contained in `wordlist`.
bip39.validateMnemonic(mn, wordlist);
// Irreversible: Uses KDF to derive 64 bytes of key data from mnemonic + optional password.
await bip39.mnemonicToSeed(mn, 'password');
bip39.mnemonicToSeedSync(mn, 'password');
This submodule contains the word lists defined by BIP39 for Czech, English, French, Italian, Japanese, Korean, Simplified and Traditional Chinese, and Spanish. These are not imported by default, as that would increase bundle sizes too much. Instead, you should import and use them explicitly.
function generateMnemonic(wordlist: string[], strength?: number): string;
function mnemonicToEntropy(mnemonic: string, wordlist: string[]): Uint8Array;
function entropyToMnemonic(entropy: Uint8Array, wordlist: string[]): string;
function validateMnemonic(mnemonic: string, wordlist: string[]): boolean;
function mnemonicToSeed(mnemonic: string, passphrase?: string): Promise<Uint8Array>;
function mnemonicToSeedSync(mnemonic: string, passphrase?: string): Uint8Array;
All wordlists:
import { wordlist } from '@metamask/scure-bip39/wordlists/czech';
import { wordlist } from '@metamask/scure-bip39/wordlists/english';
import { wordlist } from '@metamask/scure-bip39/wordlists/french';
import { wordlist } from '@metamask/scure-bip39/wordlists/italian';
import { wordlist } from '@metamask/scure-bip39/wordlists/japanese';
import { wordlist } from '@metamask/scure-bip39/wordlists/korean';
import { wordlist } from '@metamask/scure-bip39/wordlists/simplified-chinese';
import { wordlist } from '@metamask/scure-bip39/wordlists/spanish';
import { wordlist } from '@metamask/scure-bip39/wordlists/traditional-chinese';
The library has been audited by Cure53 on Jan 5, 2022. Check out the audit PDF & URL. See changes since audit.
micro-bip39
@micro
namespace was taken, we've renamed the package to @scure/bip39
@metamask/scure-bip39
.Copyright (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com)
[2.1.0]
mnemonicToSeed
(async version) to accept mnemonic arg formatted as Uint8Array
the same as the synchronous version already does (#14)FAQs
MetaMask fork of @scure/bip39: a secure, audited & minimal implementation of BIP39 mnemonic phrases
The npm package @metamask/scure-bip39 receives a total of 5,086 weekly downloads. As such, @metamask/scure-bip39 popularity was classified as popular.
We found that @metamask/scure-bip39 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?
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.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.