SchnorrkelSecretKey.fromBytes constructor
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 CryptoException 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",
"SchnorrkelSecretKey",
);
final keyBytes = secretKeyBytes.sublist(
0,
SchnorrkelKeyCost.miniSecretLength,
);
final nonceBytes = secretKeyBytes.sublist(
SchnorrkelKeyCost.miniSecretLength,
SchnorrkelKeyCost.secretKeyLength,
);
return SchnorrkelSecretKey(keyBytes, nonceBytes);
}