encodeAptosPrivateKey static method
String
encodeAptosPrivateKey(
- List<
int> privateKey, { - EllipticCurveTypes? type,
- AptosKeyAlgorithm? keyScheme,
encode aptos private key to AIP-80 style.
Implementation
static String encodeAptosPrivateKey(List<int> privateKey,
{EllipticCurveTypes? type, AptosKeyAlgorithm? keyScheme}) {
if (keyScheme == null && type == null) {
throw DartAptosPluginException(
"Key scheme or Elliptic curve type required for generate Aptos AIP-80 private key.");
}
keyScheme ??= AptosKeyAlgorithm.fromEllipticCurveType(type!);
final key = IPrivateKey.fromBytes(privateKey, keyScheme.curveType);
return keyScheme.aip80 + key.toHex(prefix: "0x");
}