sign method
Creates a cryptographic signature for a given document hash.
This method requires the user's PIN for authorization and, upon success, returns a SigningResult object containing the signature and timestamp.
Parameters:
message: The hash of the document to be signed.user: The registered User performing the signature.pin: The user's PIN.
Throws SigningException if the signing process fails for any reason (e.g., incorrect PIN, revoked user).
Implementation
Future<SigningResult> sign(User user, Uint8List message, String pin) async {
try {
final mUser = user._toMUser();
final mSigningResult = await _sdk.sign(mUser, message, pin);
final signingResult = mSigningResult._toSigningResult();
return signingResult;
} on PlatformException catch(e) {
final exceptionCode = e._getExceptionCode();
if (exceptionCode is MSigningExceptionCode) {
throw SigningException._create(
exceptionCode.toSigningExceptionCode(),
e.details["error"]
);
} else {
rethrow;
}
}
}