generateDeterministicKeyPair function
Generate a new keypair deterministically with a given private key, curve and origin id.
pvKey
: Private keycurve
: Elliptic curveoriginID
: 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!),
]),
);
}