SchnorrkelSecretKey.fromBytes constructor

SchnorrkelSecretKey.fromBytes(
  1. List<int> secretKeyBytes
)

Creates a SchnorrkelSecretKey instance from a byte representation of a secret key.

Parameters:

  • secretKeyBytes: A byte array representing the secret key.

Returns: A SchnorrkelSecretKey instance derived from the provided byte representation.

Throws:

  • An ArgumentException if the byte array does not have the correct length for a secret key.

Implementation

factory SchnorrkelSecretKey.fromBytes(List<int> secretKeyBytes) {
  _KeyUtils._checkKeysBytes(
      secretKeyBytes, SchnorrkelKeyCost.secretKeyLength, "secret key");

  return SchnorrkelSecretKey(
      secretKeyBytes.sublist(0, SchnorrkelKeyCost.miniSecretLength),
      secretKeyBytes.sublist(SchnorrkelKeyCost.miniSecretLength,
          SchnorrkelKeyCost.secretKeyLength));
}