SchnorrkelSecretKey constructor
Creates a SchnorrkelSecretKey
instance from provided secret key and nonce components.
Parameters:
key
: A byte array representing the secret key.nonce
: A byte array representing the nonce.
Returns:
A SchnorrkelSecretKey
instance if the input components are valid and in canonical form.
Throws:
- An
ArgumentException
if the input components are invalid or not in canonical form.
Implementation
factory SchnorrkelSecretKey(List<int> key, List<int> nonce) {
_KeyUtils._checkKeysBytes(
key, SchnorrkelKeyCost.miniSecretLength, "mini secret key");
_KeyUtils._checkKeysBytes(nonce, SchnorrkelKeyCost.nonceLength, "nonce");
if (_KeyUtils.isCanonical(key)) {
return SchnorrkelSecretKey._(key, nonce);
}
throw ArgumentException("invalid key");
}