SchnorrkelKeypair.fromEd25519 constructor

SchnorrkelKeypair.fromEd25519(
  1. List<int> bytes
)

Creates a key pair from Ed25519 key bytes.

Implementation

factory SchnorrkelKeypair.fromEd25519(List<int> bytes) {
  _KeyUtils._checkKeysBytes(
    bytes,
    SchnorrkelKeyCost.keypairLength,
    "keypair",
    "SchnorrkelKeypair",
  );
  final secret = SchnorrkelSecretKey.fromEd25519(
    bytes.sublist(0, SchnorrkelKeyCost.secretKeyLength),
  );
  final public = SchnorrkelPublicKey(
    bytes.sublist(
      SchnorrkelKeyCost.secretKeyLength,
      SchnorrkelKeyCost.keypairLength,
    ),
  );
  return SchnorrkelKeypair._(secret.toBytes(), public.toBytes());
}