generateDeterministicKeyPair function

KeyPair generateDeterministicKeyPair(
  1. Uint8List pvKey,
  2. String curve,
  3. int originID
)

Generate a new keypair deterministically with a given private key, curve and origin id @params {Uint8List} privateKey Private key @params {String} curve Elliptic curve @params {int} originID Origin identification

Implementation

KeyPair generateDeterministicKeyPair(
  Uint8List pvKey,
  String curve,
  int originID,
) {
  final curveID = curveToID(curve);
  final keyPair = getKeypair(pvKey, curve);
  return KeyPair(
    privateKey: concatUint8List(<Uint8List>[
      Uint8List.fromList(<int>[curveID]),
      Uint8List.fromList(<int>[originID]),
      Uint8List.fromList(keyPair.privateKey!),
    ]),
    publicKey: concatUint8List(<Uint8List>[
      Uint8List.fromList(<int>[curveID]),
      Uint8List.fromList(<int>[originID]),
      Uint8List.fromList(keyPair.publicKey!),
    ]),
  );
}