{"id":13517633,"url":"https://github.com/chatch/stellar-hd-wallet","last_synced_at":"2025-04-09T21:23:08.989Z","repository":{"id":57370678,"uuid":"115299747","full_name":"chatch/stellar-hd-wallet","owner":"chatch","description":"🔐  Key derivation for Stellar (SEP-0005)  🚀","archived":false,"fork":false,"pushed_at":"2022-09-09T22:37:37.000Z","size":85,"stargazers_count":83,"open_issues_count":6,"forks_count":48,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-10-03T12:18:49.109Z","etag":null,"topics":["bip32","bip39","bip44","ed25519","javascript","nodejs","npm","sep-0005","stellar"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/stellar-hd-wallet","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chatch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-25T02:31:31.000Z","updated_at":"2024-07-26T13:35:59.000Z","dependencies_parsed_at":"2022-08-29T18:31:15.815Z","dependency_job_id":null,"html_url":"https://github.com/chatch/stellar-hd-wallet","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chatch%2Fstellar-hd-wallet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chatch%2Fstellar-hd-wallet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chatch%2Fstellar-hd-wallet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chatch%2Fstellar-hd-wallet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chatch","download_url":"https://codeload.github.com/chatch/stellar-hd-wallet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248113035,"owners_count":21049769,"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":["bip32","bip39","bip44","ed25519","javascript","nodejs","npm","sep-0005","stellar"],"created_at":"2024-08-01T05:01:35.813Z","updated_at":"2025-04-09T21:23:08.966Z","avatar_url":"https://github.com/chatch.png","language":"JavaScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# stellar-hd-wallet\n\n[![NPM Package](https://img.shields.io/npm/v/stellar-hd-wallet.svg?style=flat-square)](https://www.npmjs.org/package/stellar-hd-wallet)\n[![Node.js CI](https://github.com/chatch/stellar-hd-wallet/actions/workflows/nodejs.yml/badge.svg)](https://github.com/chatch/stellar-hd-wallet/actions/workflows/nodejs.yml)\n\nKey derivation for Stellar ([SEP-0005](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0005.md))\n\n## Usage\n\n```ts\nimport StellarHDWallet from 'stellar-hd-wallet';\n\nconst mnemonic = StellarHDWallet.generateMnemonic();\nconst wallet = StellarHDWallet.fromMnemonic(mnemonic);\n\nwallet.getPublicKey(0); // =\u003e GDKYMXOAJ5MK4EVIHHNWRGAAOUZMNZYAETMHFCD6JCVBPZ77TUAZFPKT\nwallet.getSecret(0); // =\u003e SCVVKNLBHOWBNJYHD3CNROOA2P3K35I5GNTYUHLLMUHMHWQYNEI7LVED\nwallet.getKeypair(0); // =\u003e StellarBase.Keypair for account 0\nwallet.derive(`m/44'/148'/0'`); // =\u003e raw key for account 0 as a Buffer\n\n// wallet instance from seeds\nconst seedHex =\n  '794fc27373add3ac7676358e868a787bcbf1edfac83edcecdb34d7f1068c645dbadba563f3f3a4287d273ac4f052d2fc650ba953e7af1a016d7b91f4d273378f';\nconst seedBuffer = Buffer.from(seedHex);\nStellarHDWallet.fromSeed(seedHex);\nStellarHDWallet.fromSeed(seedBuffer);\n\n// mnemonics with different lengths\nStellarHDWallet.generateMnemonic(); // 24 words\nStellarHDWallet.generateMnemonic({entropyBits: 224}); // 21 words\nStellarHDWallet.generateMnemonic({entropyBits: 160}); // 18 words\nStellarHDWallet.generateMnemonic({entropyBits: 128}); // 12 words\n\n// validate a mnemonic\nStellarHDWallet.validateMnemonic('too short and non wordlist words'); // false\n```\n\n## Mnemonic Language\n\nMnemonics can be generated in any language supported by the underlying [bip39 npm module](https://github.com/bitcoinjs/bip39).\n\nThe full list of language keys are under exports 'wordlists' [here](https://github.com/bitcoinjs/bip39/blob/master/index.js).\n\n### Usage\n\n```ts\nimport StellarHDWallet from 'stellar-hd-wallet';\n\n// traditional chinese - 24 words\nStellarHDWallet.generateMnemonic({\n  language: 'chinese_traditional',\n});\n// =\u003e '省 从 唯 芽 激 顿 埋 愤 碳 它 炸 如 青 领 涨 骤 度 牲 朱 师 即 姓 讲 蒋'\n\n// french - 12 words\nStellarHDWallet.generateMnemonic({language: 'french', entropyBits: 128});\n// =\u003e 'directif terrible légume dérober science vision venimeux exulter abrasif vague mutuel innocent'\n```\n\n## Randomness\n\n* NodeJs: crypto.randomBytes\n* Browser: window.crypto.getRandomValues\n\n(using [randombytes npm module](https://github.com/crypto-browserify/randombytes))\n\n## Development\n\n### Setup\n\n```bash\nnpm install\n```\n\n### Build\n\n```bash\nnpm run build\n```\n\n### Test\n\n```bash\nnpm test\n```\n\n## Tests\n\nAll [SEP-0005 test cases](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0005.md#test-cases) are exercised [here](https://github.com/chatch/stellar-hd-wallet/blob/master/test/sep0005.ts) against [these](https://github.com/chatch/stellar-hd-wallet/tree/master/test/data).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchatch%2Fstellar-hd-wallet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchatch%2Fstellar-hd-wallet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchatch%2Fstellar-hd-wallet/lists"}