EDDSAPublicKey constructor

EDDSAPublicKey(
  1. EDPoint generator,
  2. List<int> publicKey
)

Creates an EdDSA public key from a generator, encoded public key bytes, and an optional public point.

This constructor initializes an EdDSA public key using the provided generator, encoded public key bytes, and an optional public point. It calculates the length of the base data and ensures that the size of the encoded public key matches the expected size based on the generator's curve. If no public point is provided, the constructor attempts to create one from the encoded public key bytes.

Parameters:

  • generator: The generator point associated with this public key.
  • publicKey: The encoded form of the public key as bytes.
  • publicPoint: An optional Edwards curve point (if already available).

Throws:

  • ArgumentException: If the size of the encoded public key does not match the expected size based on the generator's curve.

Details:

  • The constructor performs initialization and validation of the public key components. It ensures that the encoded public key's size matches the expected size for the associated curve.
  • If the public point is not provided, the constructor attempts to create it from the encoded public key bytes.

Note: This constructor is used to create EdDSA public keys from the generator and encoded public key bytes, making them ready for cryptographic operations. The public point can be optionally provided if it is already available.

Implementation

factory EDDSAPublicKey(EDPoint generator, List<int> publicKey) {
  return EDDSAPublicKey.fromPoint(
      generator, EDPoint.fromBytes(curve: generator.curve, data: publicKey));
}