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.
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",
"SchnorrkelSecretKey",
);
_KeyUtils._checkKeysBytes(
nonce,
SchnorrkelKeyCost.nonceLength,
"nonce",
"SchnorrkelSecretKey",
);
final canonicalKey = _KeyUtils.toCanonical(key);
if (canonicalKey != null) {
return SchnorrkelSecretKey._(canonicalKey, nonce);
}
throw CryptoException.failed(
"SchnorrkelSecretKey",
reason: "invalid sr25519 private key.",
);
}