getMessagingSignature method
- Uint8List signatureBytes
override
Gets the messaging signature from the PassKeys authentication response.
signatureBytes
: The base64 encoded signature.
Returns a List
containing String values representing 'r' and 's'.
Implementation
@override
Future<List<String>> getMessagingSignature(Uint8List signatureBytes) async {
ASN1Parser parser = ASN1Parser(signatureBytes);
ASN1Sequence parsedSignature = parser.nextObject() as ASN1Sequence;
ASN1Integer rValue = parsedSignature.elements[0] as ASN1Integer;
ASN1Integer sValue = parsedSignature.elements[1] as ASN1Integer;
Uint8List rBytes = rValue.valueBytes();
Uint8List sBytes = sValue.valueBytes();
if (shouldRemoveLeadingZero(rBytes)) {
rBytes = rBytes.sublist(1);
}
if (shouldRemoveLeadingZero(sBytes)) {
sBytes = sBytes.sublist(1);
}
final r = hexlify(rBytes);
final s = hexlify(sBytes);
return [r, s];
}