deriveKeypair static method
Derive Secp256r1 keypair from mnemonics and path. The mnemonics must be normalized and validated against the english wordlist.
If path is none, it will default to m/74'/784'/0'/0/0, otherwise the path must be compliant to BIP-32 in form m/74'/784'/{account_index}'/{change_index}/{address_index}.
Implementation
static Secp256r1Keypair deriveKeypair(String path, String mnemonics) {
if (!isValidBIP32Path(path)) {
throw ArgumentError('Invalid derivation path');
}
final key = BIP32.fromSeed(mnemonicToSeed(mnemonics)).derivePath(path);
return Secp256r1Keypair(Secp256KeypairData(key.publicKey, key.privateKey!));
}