SchnorrkelSecretKey.fromEd25519 constructor
Creates a SchnorrkelSecretKey instance from a byte representation of an Ed25519 secret key.
Parameters:
secretKeyBytes: A byte array representing an Ed25519 secret key.
Returns: A SchnorrkelSecretKey instance derived from the provided Ed25519 secret key representation.
Throws:
- An CryptoException if the byte array does not have the correct length for a secret key.
Implementation
factory SchnorrkelSecretKey.fromEd25519(List<int> secretKeyBytes) {
_KeyUtils._checkKeysBytes(
secretKeyBytes,
SchnorrkelKeyCost.secretKeyLength,
"secret key",
"SchnorrkelSecretKey",
);
final newKey = secretKeyBytes.sublist(
0,
SchnorrkelKeyCost.miniSecretLength,
);
_KeyUtils.divideScalarByCofactor(newKey);
return SchnorrkelSecretKey(
newKey,
secretKeyBytes.sublist(
SchnorrkelKeyCost.miniSecretLength,
SchnorrkelKeyCost.secretKeyLength,
),
);
}