ec8SignMessage function
Implementation
Uint8List ec8SignMessage(String message, NodeWithAddress node) {
final privateKey = node.bip32Node!.privateKey!;
// message test vector: https://zeniq.id/safir.com/backend/qrl?n=2f24bc32c0752e835e21&r=/backend/qrll
final messageHash = createEurocoinMessageHash(message);
// messageHash test vector: u8 uint8_t[32] "\xf9\x9b\xf9~\U00000015j\xf1\xd1K\U0000001a\U00000002[\U00000011\x83\U0000001ae\xeb\nH\xa0zⴞ\xa8k\xc4Tn~\x80\xe3"
final signature =
Signature.createSignature(messageHash, privateKey, hashPayload: false);
final r = padUint8ListTo32(unsignedIntToBytes(signature.r));
final s = padUint8ListTo32(unsignedIntToBytes(signature.s));
final v = unsignedIntToBytes(BigInt.from(signature.v));
// https://github.com/ethereumjs/ethereumjs-util/blob/8ffe697fafb33cefc7b7ec01c11e3a7da787fe0e/src/signature.ts#L63
return uint8ListFromList(v + r + s);
}