SchnorrkelKeypair.fromBytes constructor

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

Creates a key pair from raw bytes.

Implementation

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