SchnorrkelSignature.fromBytes constructor
Creates a signature from raw bytes.
Implementation
factory SchnorrkelSignature.fromBytes(List<int> signatureBytes) {
_KeyUtils._checkKeysBytes(
signatureBytes, SchnorrkelKeyCost.signatureLength, "signature");
final r = signatureBytes.sublist(0, 32);
final s = signatureBytes.sublist(32, SchnorrkelKeyCost.signatureLength);
if (s[31] & 128 == 0) {
throw ArgumentException(
"Signature not marked as schnorrkel, maybe try ed25519 instead.");
}
if (_KeyUtils.isCanonical(s)) {
return SchnorrkelSignature._(s, r);
}
throw ArgumentException("invalid signature");
}