Generate secret keys

Key Generation Options

The SDK supports two methods for generating Aptos secret keys, allowing developers to choose the approach that best fits their use case:

  1. Mnemonic Phrase – A 12-word BIP-39 compatible seed phrase, widely used for wallet recovery and portability.

  2. Aptos Private Key – A direct 64-character hexadecimal string used to generate the account address and sign transactions.

Both methods are fully supported and seamlessly integrated, making key management flexible and developer-friendly.

Generate Aptos Private Key

const { utils } = window.fantasysAptosWalletSDK;
// in hex string, starts with 0x...
const newPrivateKey = utils.generateAptosPrivateKey();

Generate Mnemonic (12 words)

const { utils } = window.fantasysAptosWalletSDK;
const mnemonic = utils.generateAptosMnemonic();

Last updated