Mobile SDK

The MIRACL Trust service provides a Designated Verifier Signature (DVS) scheme for digital signing that you can integrate directly into your mobile applications through the platform’s mobile SDKs.

As a preliminary step, you must set up the Mobile SDK as described in MIRACL Trust Android SDK and MIRACL Trust iOS SDK.

# Generate Signature

To generate a signature for signing a document, use the sign method as follows:

miraclTrust.sign(
        hashedMessage,
        timestamp,
        user,
        pinProvider,
        result -> {
            if (result instanceof MIRACLSuccess) {
               Signature signature =
                       ((MIRACLSuccess<Signature, SigningException>) result).getValue();
            } else {
                MIRACLError<Signature, SigningException> error =
                        (MIRACLError<Signature, SigningException>) result;
                // Cannot sign the message/document due to an error.
            }
        }
);
miraclTrust.sign(
    hashedMessage,
    timestamp,
    user,
    pinProvider
) { result ->
    when (result) {
        is MIRACLSuccess -> {
            val signature = result.value
        }
        is MIRACLError -> {
            val error = result.value
            // Cannot sign the message/document due to an error.
        }
    }
}
MIRACLTrust.getInstance().sign(
    message: <#Message hash#> ,
    timestamp: <#The time when the signature was created#>,
    user: <#Already registered user#>,
    didRequestSigningPinHandler: { pinProcessor in
        // Here the user provides their current signing PIN.

        pinProcessor(<#Provide your signing user PIN here#>)
    }, completionHandler: { signature, error in
        // The signature object can be sent to the server for verification.
    }
)
[[MIRACLTrust getInstance] signWithMessage: <#Message hash#>
                                 timestamp: <#The time when the signature was created#>
                                      user: <#Already registered signing user#>
                     signingSessionDetails: <#Signing session details, if used, othewise nil#>
               didRequestSigningPinHandler: ^(void (^ _Nonnull pinProcessor)(NSString * _Nullable)) {
                    // Here the user provides their current signing PIN.

                    pinProcessor(<#Provide your signing user PIN here#>);
                } completionHandler: ^(Signature * _Nullable signature, NSError * _Nullable error) {
                    // The signature object can be sent to the server for verification.
                }];

# Verify Signature

The signature must be verified on the back end. For more information, see Digital Signatures.