How to convert Seed to the PrivateKey?

513 Views Asked by At

I'm developing a Hedera Wallet for Flutter, and I need to convert the mnemonic to the private key.

I use the bip39 to convert the mnemonic to seed.

But how can I convert the seed to the PrivateKey?

1

There are 1 best solutions below

1
On

As per documentation here https://docs.hedera.com/hedera/sdks-and-apis/sdks/keys/recover-keys-from-a-mnemonic-phrase:

//Use a recovered mnemonic to recover the private key
const recoveredMnemonic = await Mnemonic.fromString(mnemonic.toString());
const privateKey = await recoveredMnemonic.toPrivateKey();

//v2.0.5