AMAXSignature.fromBuffer constructor
Construct AMAX signature from buffer
Implementation
AMAXSignature.fromBuffer(Uint8List buffer, String? keyType) {
this.keyType = keyType;
if (buffer.lengthInBytes != 65) {
throw InvalidKey('Invalid signature length, got: ${buffer.lengthInBytes}');
}
i = buffer.first;
if (i! - 27 != i! - 27 & 7) {
throw InvalidKey('Invalid signature parameter');
}
BigInt r = decodeBigIntWithSign(1, buffer.sublist(1, 33));
BigInt s = decodeBigIntWithSign(1, buffer.sublist(33, 65));
this.ecSig = ECSignature(r, s);
}