Skip to content

Latest commit

 

History

History
36 lines (28 loc) · 1.31 KB

recover-keys-from-a-mnemonic-phrase.md

File metadata and controls

36 lines (28 loc) · 1.31 KB

Recover keys from a mnemonic phrase

Recover private keys from a mnemonic phrase.

MethodTypeDescription
PrivateKey.fromMnemonic(<mnemonic>)MnemonicRecover a private key from a mnemonic phrase compatible with the iOS and Android wallets
PrivateKey.fromMnemonic(<mnemonic, passphrase>)Mnemonic. StringRecover a private key from a generated mnemonic phrase and a passphrase

{% tabs %} {% tab title="Java" %}

//Use the mnemonic to recover the private key
PrivateKey privateKey = PrivateKey.fromMnemonic(mnemonic);
PublicKey publicKey = privateKey.publicKey();

//v2.0.0

{% endtab %}

{% tab title="JavaScript" %}

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

//v2.0.5

{% endtab %}

{% tab title="Go" %}

recoveredKey, err := hedera.PrivateKeyFromMnemonic(mnemonic, "")
publicKey := recoveredKey.PublicKey()

//v2.0.0

{% endtab %} {% endtabs %}