EDDSAPublicKey.fromPoint constructor
Creates an EdDSA public key from a generator and an existing public point.
Parameters:
generator: The generator point associated with this public key.publicPoint: An existing Edwards curve public point.
Throws:
- ArgumentException: If the size of the encoded public key extracted from the public point does not match the expected size based on the generator's curve.
Implementation
factory EDDSAPublicKey.fromPoint(EDPoint generator, EDPoint publicPoint) {
final int baselen = (generator.curve.p.bitLength + 1 + 7) ~/ 8;
final pubkeyBytes = publicPoint.toBytes();
if (pubkeyBytes.length != baselen) {
throw ArgumentException.invalidOperationArguments(
"EDDSAPublicKey",
name: "publicPoint",
reason: "Invalid public key point.",
);
}
return EDDSAPublicKey._(generator, pubkeyBytes, baselen, publicPoint);
}