{"name":"@scure/bip39","version":"2.0.1","keywords":["bip39","mnemonic","phrase","code","bip0039","bip-39","wordlist","scure","noble","bitcoin"],"author":{"url":"https://paulmillr.com","name":"Paul Miller"},"license":"MIT","_id":"@scure/bip39@2.0.1","maintainers":[{"name":"paulmillr","email":"paul@paulmillr.com"}],"homepage":"https://paulmillr.com/noble/#scure","bugs":{"url":"https://github.com/paulmillr/scure-bip39/issues"},"dist":{"shasum":"47a6dc15e04faf200041239d46ae3bb7c3c96add","tarball":"http://registry-npm.ywwl.com/@scure/bip39/download/@scure/bip39-2.0.1.tgz","fileCount":26,"integrity":"sha512-PsxdFj/d2AcJcZDX1FXN3dDgitDDTmwf78rKZq1a6c1P1Nan1X/Sxc7667zU3U+AN60g7SxxP0YCVw2H/hBycg==","signatures":[{"sig":"MEQCIGH2nsVCZQayVszj5O35M+Phr8yv0hbar01K21Re1axqAiBY8VozHHdfcfDPTcBR9iCso4F1AeVQcs123K8dWj4zcg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@scure%2fbip39@2.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":197938,"size":79766,"noattachment":false,"key":"/@scure/bip39/-/@scure/bip39-2.0.1.tgz"},"main":"index.js","type":"module","types":"index.d.ts","module":"index.js","exports":{".":"./index.js","./wordlists/czech.js":"./wordlists/czech.js","./wordlists/french.js":"./wordlists/french.js","./wordlists/korean.js":"./wordlists/korean.js","./wordlists/english.js":"./wordlists/english.js","./wordlists/italian.js":"./wordlists/italian.js","./wordlists/spanish.js":"./wordlists/spanish.js","./wordlists/japanese.js":"./wordlists/japanese.js","./wordlists/portuguese.js":"./wordlists/portuguese.js","./wordlists/simplified-chinese.js":"./wordlists/simplified-chinese.js","./wordlists/traditional-chinese.js":"./wordlists/traditional-chinesejss"},"funding":"https://paulmillr.com/funding/","gitHead":"753ea75ac2621b71b64e7899bd72cfd140107296","scripts":{"test":"node --experimental-strip-types --no-warnings test/index.ts","bench":"node test/benchmark.js","build":"tsc","format":"prettier --write 'src/**/*.ts' 'test/*.test.ts' 'test/scripts/*.js'","test:bun":"bun test/index.ts","test:deno":"deno --allow-env --allow-read test/index.js","test:node20":"cd test; npx tsc; node compiled/test/index.js","build:release":"npx --no @paulmillr/jsbt esbuild test/build","fetch-wordlist":"./test/scripts/fetch-wordlist.js"},"_npmUser":{"name":"paulmillr","email":"paul@paulmillr.com"},"repository":{"url":"git+https://github.com/paulmillr/scure-bip39.git","type":"git"},"_npmVersion":"11.5.1","description":"Secure, audited & minimal implementation of BIP39 mnemonic phrases","directories":{},"sideEffects":false,"_nodeVersion":"24.6.0","dependencies":{"@scure/base":"2.0.0","@noble/hashes":"2.0.1"},"_hasShrinkwrap":false,"devDependencies":{"prettier":"3.6.2","typescript":"5.9.2","@paulmillr/jsbt":"0.4.4"},"_npmOperationalInternal":{"tmp":"tmp/bip39_2.0.1_1759805142624_0.5212819547861498","host":"s3://npm-registry-packages-npm-production"},"readme":"# scure-bip39\n\nAudited & minimal JS implementation of [BIP39 mnemonic phrases](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki).\n\n- 🔒 [**Audited**](#security) by an independent security firm\n- 🔻 Tree-shakeable: unused code is excluded from your builds\n- 🥈 Two implementations: pure JS or friendly WebCrypto wrapper\n- ➰ Only 1 audited dependency by the same author:\n  [noble-hashes](https://github.com/paulmillr/noble-hashes)\n- 🪶 14KB (gzipped) with one wordlist, 79KB with all of them: much smaller than similar libraries\n\nCheck out [scure-bip32](https://github.com/paulmillr/scure-bip32) if you need\nhierarchical deterministic wallets (\"HD Wallets\").\n\n### This library belongs to _scure_\n\n> **scure** — audited micro-libraries.\n\n- Zero or minimal dependencies\n- Highly readable TypeScript / JS code\n- PGP-signed releases and transparent NPM builds\n- Check out [homepage](https://paulmillr.com/noble/#scure) & all libraries:\n  [base](https://github.com/paulmillr/scure-base),\n  [bip32](https://github.com/paulmillr/scure-bip32),\n  [bip39](https://github.com/paulmillr/scure-bip39),\n  [btc-signer](https://github.com/paulmillr/scure-btc-signer),\n  [sr25519](https://github.com/paulmillr/scure-sr25519),\n  [starknet](https://github.com/paulmillr/scure-starknet)\n\n## Usage\n\n> `npm install @scure/bip39`\n\n> `deno add jsr:@scure/bip39`\n\nWe don't provide source maps.\nWordlists are large, including source maps would double package size.\n\n```js\nimport * as bip39 from '@scure/bip39';\nimport { wordlist } from '@scure/bip39/wordlists/english.js';\n\n// Generate x random words. Uses Cryptographically-Secure Random Number Generator.\nconst mn = bip39.generateMnemonic(wordlist);\nconsole.log(mn);\n\n// You can customize the strength of the generated mnemonic by passing a value between 128 and 256 as the second argument to the generateMnemonic function.\n// This value must be a multiple of 32. Default is 128.\nconst mn256 = bip39.generateMnemonic(wordlist, 256);\nconsole.log(mn256);\n\n// Reversible: Converts mnemonic string to raw entropy in form of byte array.\nconst ent = bip39.mnemonicToEntropy(mn, wordlist);\n\n// Reversible: Converts raw entropy in form of byte array to mnemonic string.\nbip39.entropyToMnemonic(ent, wordlist);\n\n// Validates mnemonic for being 12-24 words contained in `wordlist`.\nbip39.validateMnemonic(mn, wordlist);\nbip39.validateMnemonic(mn256, wordlist);\n\n// Irreversible: Uses KDF to derive 64 bytes of key data from mnemonic + optional password.\nconst seed1 = await bip39.mnemonicToSeed(mn, 'password');\nconst seed2 = bip39.mnemonicToSeedSync(mn, 'password');\nconst seed3 = await bip39.mnemonicToSeedWebcrypto(mn, 'password'); // Native, WebCrypto version.\n```\n\nThis submodule contains the word lists defined by BIP39 for Czech, English, French, Italian, Japanese, Korean, Portuguese, 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.\n\n```typescript\nfunction generateMnemonic(wordlist: string[], strength?: number): string;\nfunction mnemonicToEntropy(mnemonic: string, wordlist: string[]): Uint8Array;\nfunction entropyToMnemonic(entropy: Uint8Array, wordlist: string[]): string;\nfunction validateMnemonic(mnemonic: string, wordlist: string[]): boolean;\nfunction mnemonicToSeed(mnemonic: string, passphrase?: string): Promise<Uint8Array>;\nfunction mnemonicToSeedSync(mnemonic: string, passphrase?: string): Uint8Array;\nfunction mnemonicToSeedWebcrypto(mnemonic: string, passphrase?: string): Promise<Uint8Array>;\n```\n\nAll wordlists (**warning: non-english wordlists are officially discouraged by bip39**):\n\n```typescript\nimport { wordlist as czech } from '@scure/bip39/wordlists/czech.js';\nimport { wordlist as english } from '@scure/bip39/wordlists/english.js';\nimport { wordlist as french } from '@scure/bip39/wordlists/french.js';\nimport { wordlist as italian } from '@scure/bip39/wordlists/italian.js';\nimport { wordlist as japanese } from '@scure/bip39/wordlists/japanese.js';\nimport { wordlist as korean } from '@scure/bip39/wordlists/korean.js';\nimport { wordlist as portuguese } from '@scure/bip39/wordlists/portuguese.js';\nimport { wordlist as simplifiedChinese } from '@scure/bip39/wordlists/simplified-chinese.js';\nimport { wordlist as spanish } from '@scure/bip39/wordlists/spanish.js';\nimport { wordlist as traditionalChinese } from '@scure/bip39/wordlists/traditional-chinese.js';\n```\n\n## Security\n\nThe library has been audited:\n\n- at version 2.2.0, in Apr 2026, by ourselves (self-audited)\n  - Scope: everything\n  - [Changes since audit](https://github.com/paulmillr/scure-bip39/compare/2.2.0..main)\n- at version 1.0.0, in Jan 2022, by [cure53](https://cure53.de)\n  - PDFs: [online](https://cure53.de/pentest-report_hashing-libs.pdf), [offline](./audit/2022-01-05-cure53-audit-nbl2.pdf)\n  - [Changes since audit](https://github.com/paulmillr/scure-bip39/compare/1.0.0..main).\n  - The audit has been funded by [Ethereum Foundation](https://ethereum.org/en/) with help of [Nomic Labs](https://nomiclabs.io)\n\nThe library was initially developed for [js-ethereum-cryptography](https://github.com/ethereum/js-ethereum-cryptography).\nAt commit [ae00e6d7](https://github.com/ethereum/js-ethereum-cryptography/commit/ae00e6d7d24fb3c76a1c7fe10039f6ecd120b77e),\nit was extracted to a separate package called `micro-bip39`.\nAfter the audit we've decided to use `@scure` NPM namespace for security.\n\nTo audit wordlist content, run `node scripts/fetch-wordlist.js`.\n\n### Supply chain security\n\n- **Commits** are signed with PGP keys to prevent forgery. Be sure to verify the commit signatures\n- **Releases** are made transparently through token-less GitHub CI and Trusted Publishing. Be sure to verify the [provenance logs](https://docs.npmjs.com/generating-provenance-statements) for authenticity.\n- **Rare releasing** is practiced to minimize the need for re-audits by end-users.\n- **Dependencies** are minimized and strictly pinned to reduce supply-chain risk.\n  - We use as few dependencies as possible.\n  - Version ranges are locked, and changes are checked with npm-diff.\n- **Dev dependencies** are excluded from end-user installs; they’re only used for development and build steps.\n\nFor this package, there is 1 dependency; and a few dev dependencies:\n\n- [noble-hashes](https://github.com/paulmillr/noble-hashes) provides cryptographic hashing functionality\n- jsbt is used for benchmarking / testing / build tooling and developed by the same author\n- prettier, fast-check and typescript are used for code quality / test generation / ts compilation\n\n## License\n\n[MIT License](./LICENSE)\n\nCopyright (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com)\n","publish_time":1759805142822,"_cnpm_publish_time":1759805142822,"dist-tags":{"beta":"2.0.0-beta.1","latest":"2.4.0"}}