ed448DerivePublicKey function

Uint8List ed448DerivePublicKey(
  1. Uint8List privateKey
)

Derives the public key for privateKey.

Implementation

Uint8List ed448DerivePublicKey(Uint8List privateKey) {
  if (privateKey.length != ed448.KEY_LENGTH) {
    throw FormatException('Bad private key length');
  }

  if ((privateKey[ed448.KEY_LENGTH - 1] & 0x80) == 0) {
    return _bytes(ed448.secretToPublic(privateKey));
  }

  final scalar = _secretScalarForHdPrivateKey(privateKey);
  return _bytes(ed448.secretToPublicFromScalar(scalar));
}