SchnorrkelSecretKey constructor

SchnorrkelSecretKey(
  1. List<int> key,
  2. List<int> nonce
)

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:

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.",
  );
}