{"id":16170421,"url":"https://github.com/corentinth/bip39","last_synced_at":"2025-03-18T23:31:09.588Z","repository":{"id":57307108,"uuid":"479425771","full_name":"CorentinTh/bip39","owner":"CorentinTh","description":null,"archived":false,"fork":false,"pushed_at":"2023-04-09T13:10:59.000Z","size":292,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-28T13:18:15.134Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/CorentinTh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-08T14:37:25.000Z","updated_at":"2024-07-11T09:11:18.000Z","dependencies_parsed_at":"2024-10-27T19:29:47.834Z","dependency_job_id":null,"html_url":"https://github.com/CorentinTh/bip39","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"6719e29c0229a8d0f76549e5f41f723af78aa6f2"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorentinTh%2Fbip39","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorentinTh%2Fbip39/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorentinTh%2Fbip39/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorentinTh%2Fbip39/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CorentinTh","download_url":"https://codeload.github.com/CorentinTh/bip39/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243955755,"owners_count":20374373,"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","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":[],"created_at":"2024-10-10T03:18:42.573Z","updated_at":"2025-03-18T23:31:09.583Z","avatar_url":"https://github.com/CorentinTh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n![logo](.github/logo.png)\n\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/CorentinTh/bip39/Node%20CI)](https://github.com/CorentinTh/bip39/actions?query=workflow%3A%22Node+CI%22)\n[![npm bundle size](https://img.shields.io/bundlephobia/minzip/@it-tools/bip39.svg)](https://www.npmjs.com/package/@it-tools/bip39)\n[![GitHub package.json version](https://img.shields.io/github/package-json/v/CorentinTh/bip39.svg)](https://github.com/CorentinTh/bip39/blob/master/package.json)\n[![Licence Badge](https://img.shields.io/github/license/CorentinTh/bip39.svg)](LICENCE)\n\n\u003c/div\u003e\n\nA simple and complete bip39 mnemonic (passphrase) and entropy generator in typescript.\n\nThis package is similar to [bitcoinjs/bip39](https://github.com/bitcoinjs/bip39) but lighter, strongly typed and without the heavy dependency to `Buffer` in order to be easily used in the browser.\n\n## Installation\n\n### Node JS\n\nInstall using yarn or npm.\n\n```bash\nnpm install @it-tools/bip39\n# or\nyarn add @it-tools/bip39\n```\n\nAnd import :\n\n```typescript\n// EMAScript import\nimport { entropyToMnemonic, mnemonicToEntropy } from '@it-tools/bip39';\n// Or Common JS:\nconst { entropyToMnemonic, mnemonicToEntropy } = require('@it-tools/bip39');\n\nconst passphrase = entropyToMnemonic('063679ca1b28b5cfda9c186b367e271e');\n\nconsole.log(passphrase);\n// alert record income curve mercy tree heavy loan hen recycle mean devote\n```\n\n## Usage\n\n### Create mnemonic (passphrase) from entropy\n\nDefault language is `english`. The entropy must an hexadecimal string with a length \u003e= 16 or \u003c= 32 and that is a multiple or 4.\n\n```typescript\nimport { entropyToMnemonic } from '@it-tools/bip39';\n\nconst passphrase = entropyToMnemonic('063679ca1b28b5cfda9c186b367e271e');\n\nconsole.log(passphrase);\n// alert record income curve mercy tree heavy loan hen recycle mean devote\n```\n\n### Get entropy from a mnemonic (passphrase)\n\nDefault language is `english`.\n\n```typescript\nimport { mnemonicToEntropy } from '@it-tools/bip39';\n\nconst entropy = mnemonicToEntropy('alert record income curve mercy tree heavy loan hen recycle mean devote');\n\nconsole.log(entropy);\n// 063679ca1b28b5cfda9c186b367e271e\n```\n\n### Generate an entropy\n\n```typescript\nimport { generateEntropy } from '@it-tools/bip39';\n\n// Default is a 32 long entropy\nconst entropy = generateEntropy();\n\nconsole.log(entropy);\n// 063679ca1b28b5cfda9c186b367e271e\n```\n\n```typescript\nimport { generateEntropy } from '@it-tools/bip39';\n\nconst entropy = generateEntropy(16);\n\nconsole.log(entropy);\n// b063679ca1b28b5c\n```\n\n### Other languages\n\nTo use another language, just import the wordlist an use it in the function:\n\n```typescript\nimport { entropyToMnemonic, mnemonicToEntropy, frenchWordList } from '@it-tools/bip39';\n\nconst passphrase = entropyToMnemonic('063679ca1b28b5cfda9c186b367e271e', frenchWordList);\n\nconsole.log(passphrase);\n// adroit pastèque glace commande lanceur tarder forcer insigne fougère paternel label culminer\n\nconst entropy = entropyToMnemonic('adroit pastèque glace commande lanceur tarder forcer insigne fougère paternel label culminer', frenchWordList);\n\nconsole.log(entropy);\n// a063679ca1b28b5cfda9c186b367e271e\n```\n\nAvailable languages are:\n\n- **chineseSimplified**: `import { chineseSimplifiedWordList } from '@it-tools/bip39';`\n- **chineseTraditional**: `import { chineseTraditionalWordList } from '@it-tools/bip39';`\n- **czech**: `import { czechWordList } from '@it-tools/bip39';`\n- **english**: `import { englishWordList } from '@it-tools/bip39';`\n- **french**: `import { frenchWordList } from '@it-tools/bip39';`\n- **italian**: `import { italianWordList } from '@it-tools/bip39';`\n- **japanese**: `import { japaneseWordList } from '@it-tools/bip39';`\n- **korean**: `import { koreanWordList } from '@it-tools/bip39';`\n- **portuguese**: `import { portugueseWordList } from '@it-tools/bip39';`\n- **spanish**: `import { spanishWordList } from '@it-tools/bip39';`\n\nYou can event define your custom language:\n\n```typescript\nimport { entropyToMnemonic, IWordList } from '@it-tools/bip39';\n\nconst customWordList: IWordList = {\n  language: 'my-language',\n  spacer: ' ', // character used to split word in a sentence, mainly space\n  words: [\n    'word1',\n    'word2',\n    // ...\n  ],\n};\n\nconst passphrase = entropyToMnemonic('063679ca1b28b5cfda9c186b367e271e', customWordList);\n```\n\n## Contribute\n\n**Pull requests are welcome !** Feel free to contribute.\n\n## Credits\n\nCoded with ❤️ by [Corentin Thomasset](//corentin-thomasset.fr).\n\nInspired from [bitcoinjs/bip39](https://github.com/bitcoinjs/bip39)\n\n## License\n\nThis project is under the [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorentinth%2Fbip39","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcorentinth%2Fbip39","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorentinth%2Fbip39/lists"}