getECKeysAsync function
Implementation
Future<ECKeys> getECKeysAsync(
String phrase, {
String passphrase = '',
int index = 0,
int coinType = CoinType.icp,
}) async {
final basePath = getPathWithCoinType(coinType: coinType);
final seed = await mnemonicPhraseToSeed(
req: PhraseToSeedReq(phrase: phrase, password: passphrase),
);
final prv = await mnemonicSeedToKey(
req: SeedToKeyReq(seed: seed, path: '$basePath/0/$index'),
);
final kp = await secp256K1FromSeed(
req: Secp256k1FromSeedReq(seed: prv),
);
final kpSchnorr = await schnorrFromSeed(
req: SchnorrFromSeedReq(seed: prv),
);
final kpP256 = await p256FromSeed(
req: P256FromSeedReq(seed: prv),
);
return ECKeys(
ecPrivateKey: prv,
ecPublicKey: Secp256k1PublicKey.fromDer(kp.derEncodedPublicKey).toRaw(),
ecSchnorrPublicKey:
SchnorrPublicKey.fromRaw(kpSchnorr.publicKeyHash).toRaw(),
ecP256PublicKey: P256PublicKey.fromDer(kpP256.derEncodedPublicKey).toRaw(),
);
}