Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How is the package not rejected Seed phrase greater than 24 words ? #35

Open
nabeel99 opened this issue Apr 3, 2023 · 1 comment
Open

Comments

@nabeel99
Copy link

nabeel99 commented Apr 3, 2023

If I understand correctly near used bip39 standard for seed phrases if. so, the max number of words allowed is 24, but from my testing seed phrases with words more than 24 get converted into keypairs ? am confused if there is something I don't understand or is this a bug ? if not what does the algorithm do when encountered with more than 24 words ?

@frol
Copy link
Collaborator

frol commented Apr 11, 2023

@nabeel99 Well, near-seed-phrase package is extremely thin wrapper, so you can actually inspect the whole implementation here:

const parseSeedPhrase = (seedPhrase, derivationPath) => {
const seed = bip39.mnemonicToSeed(normalizeSeedPhrase(seedPhrase))
const { key } = derivePath(derivationPath || KEY_DERIVATION_PATH, seed.toString('hex'))
const keyPair = nacl.sign.keyPair.fromSeed(key)
const publicKey = 'ed25519:' + bs58.encode(Buffer.from(keyPair.publicKey))
const secretKey = 'ed25519:' + bs58.encode(Buffer.from(keyPair.secretKey))
return { seedPhrase, secretKey, publicKey }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants