generateEcKeyPair static method

Generates a new random EC key pair.

Implementation

static Future<CommercioKeyPair<CommercioECPublicKey, CommercioECPrivateKey>>
    generateEcKeyPair({String? type}) async {
  final keyParams = ECKeyGeneratorParameters(ECCurve_secp256k1());
  final generator = ECKeyGenerator();
  generator.init(ParametersWithRandom(keyParams, _getSecureRandom()));
  final keyPair = generator.generateKeyPair();
  return CommercioKeyPair(
    CommercioECPublicKey(keyPair.publicKey as ECPublicKey, keyType: type),
    CommercioECPrivateKey(keyPair.privateKey as ECPrivateKey),
  );
}