{"id":13459471,"url":"https://github.com/paulmillr/scure-bip39","last_synced_at":"2025-10-08T16:26:07.449Z","repository":{"id":43474627,"uuid":"440420201","full_name":"paulmillr/scure-bip39","owner":"paulmillr","description":"Secure, audited \u0026 minimal implementation of BIP39 mnemonic phrases","archived":false,"fork":false,"pushed_at":"2025-09-14T08:28:10.000Z","size":766,"stargazers_count":161,"open_issues_count":0,"forks_count":36,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-09-30T18:29:48.221Z","etag":null,"topics":["bip32","bip39","code","mnemonic","mnemonic-phrase"],"latest_commit_sha":null,"homepage":"https://paulmillr.com/noble/#scure","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paulmillr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":"audit/2022-01-05-cure53-audit-nbl2.pdf","citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"paulmillr"}},"created_at":"2021-12-21T06:55:51.000Z","updated_at":"2025-09-25T18:18:55.000Z","dependencies_parsed_at":"2024-10-02T15:09:09.862Z","dependency_job_id":"a7237d95-3d93-40eb-adfd-e2b87ed38b3b","html_url":"https://github.com/paulmillr/scure-bip39","commit_stats":{"total_commits":55,"total_committers":1,"mean_commits":55.0,"dds":0.0,"last_synced_commit":"c1ff6cbf9c6645d178ddf01e025c466fb6ebba52"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/paulmillr/scure-bip39","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulmillr%2Fscure-bip39","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulmillr%2Fscure-bip39/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulmillr%2Fscure-bip39/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulmillr%2Fscure-bip39/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paulmillr","download_url":"https://codeload.github.com/paulmillr/scure-bip39/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulmillr%2Fscure-bip39/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278444545,"owners_count":25987789,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bip32","bip39","code","mnemonic","mnemonic-phrase"],"created_at":"2024-07-31T10:00:17.658Z","updated_at":"2025-10-08T16:26:07.443Z","avatar_url":"https://github.com/paulmillr.png","language":"TypeScript","funding_links":["https://github.com/sponsors/paulmillr"],"categories":["Web 3","TypeScript"],"sub_categories":[],"readme":"# scure-bip39\n\nAudited \u0026 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 2 audited dependencies by the same author:\n  [noble-hashes](https://github.com/paulmillr/noble-hashes) and [scure-base](https://github.com/paulmillr/scure-base)\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\u003e **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) \u0026 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\u003e `npm install @scure/bip39`\n\n\u003e `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// 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);\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\u003cUint8Array\u003e;\nfunction mnemonicToSeedSync(mnemonic: string, passphrase?: string): Uint8Array;\nfunction mnemonicToSeedWebcrypto(mnemonic: string, passphrase?: string): Promise\u003cUint8Array\u003e;\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\nTo audit wordlist content, run `node scripts/fetch-wordlist.js`.\n\nThe library has been independently audited:\n\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\n### Supply chain security\n\n- **Commits** are signed with PGP keys, to prevent forgery. Make sure to verify commit signatures\n- **Releases** are transparent and built on GitHub CI. Make sure to verify [provenance](https://docs.npmjs.com/generating-provenance-statements) logs\n  - Use GitHub CLI to verify single-file builds:\n    `gh attestation verify --owner paulmillr scure-bip39.js`\n- **Rare releasing** is followed to ensure less re-audit need for end-users\n- **Dependencies** are minimized and locked-down: any dependency could get hacked and users will be downloading malware with every install.\n  - We make sure to use as few dependencies as possible\n  - Automatic dep updates are prevented by locking-down version ranges; diffs are checked with `npm-diff`\n- **Dev Dependencies** are disabled for end-users; they are only used to develop / build the source code\n\nFor this package, there are 2 dependencies; and a few dev dependencies:\n\n- [noble-hashes](https://github.com/paulmillr/noble-hashes) provides cryptographic hashing functionality\n- [scure-base](https://github.com/paulmillr/scure-base) provides low-level wordlist utilities\n- micro-bmark, micro-should and jsbt are 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. It's hard to audit their source code thoroughly and fully because of their size\n\n## Contributing \u0026 testing\n\n- `npm install \u0026\u0026 npm run build \u0026\u0026 npm test` will build the code and run tests.\n- `npm run lint` / `npm run format` will run linter / fix linter issues.\n- `npm run build:release` will build single file\n\n## License\n\n[MIT License](./LICENSE)\n\nCopyright (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulmillr%2Fscure-bip39","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaulmillr%2Fscure-bip39","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulmillr%2Fscure-bip39/lists"}