Skip to main content
The mobile SDK’s app verification methods can be used to respond to authentication requests using public key cryptography.

Push verification

Adding a push credential

Adding a push credential generates a private/public key pair, where the private key is secured on the user’s mobile device and the public key is held by Authsignal. This operation must be authorized with a short-lived token, which can be obtained by tracking an action from your backend in an authenticated context.
await authsignal.push.addCredential(token: "eyJhbGciOiJ...")

Parameters

token
string
A short-lived token obtained by tracking an action.

Response

response
AuthsignalResponse<AppCredential>

Getting a push credential

Get information about the push credential stored on the device, if one exists.
let response = await authsignal.push.getCredential()

Response

response
AuthsignalResponse<AppCredential>

Removing a push credential

await authsignal.push.removeCredential()

Response

response
AuthsignalResponse<boolean>

Getting a push challenge

let response = await authsignal.push.getChallenge()

if let error = result.error {
    // The credential stored on the device is invalid
} else if let challenge = result.data {
    // A pending challenge request is available
    // Present the user with a prompt to approve or deny the request
    let challengeId = challenge.challengeId
} else {
    // No pending challenge request
}

Response

response
AuthsignalResponse<DeviceChallenge>

Updating a push challenge

After presenting the user with a prompt to approve or reject the request, you should update the challenge with their response.
await authsignal.push.updateChallenge(
    challengeId: challengeId,
    approved: true
)

Response

response
AuthsignalResponse<boolean>

QR code verification

Adding a QR code credential

Adding a QR code credential generates a private/public key pair, where the private key is secured on the user’s mobile device and the public key is held by Authsignal. This operation must be authorized with a short-lived token, which can be obtained by tracking an action from your backend in an authenticated context.
await authsignal.qr.addCredential(token: "eyJhbGciOiJ...")

Parameters

token
string
A short-lived token obtained by tracking an action.

Response

response
AuthsignalResponse<AppCredential>

Getting a QR code credential

Get information about the QR code credential stored on the device, if one exists.
let response = await authsignal.qr.getCredential()

Response

response
AuthsignalResponse<AppCredential>

Removing a QR code credential

await authsignal.qr.removeCredential()

Response

response
AuthsignalResponse<boolean>

Claiming a QR code challenge

When the user scans the QR code, you should call claimChallenge to set the user attempting to complete the challenge. This will return some context about the desktop or kiosk device initiating the challenge such as ip address, location, user agent and custom data. This data can be shown to the user to help them decide if they want to approve or decline the challenge.
await authsignal.qr.claimChallenge(
    challengeId: challengeId
)

Response

response
AuthsignalResponse<ClaimChallengeResponse>

In-app verification

Adding an in-app credential

Adding an in-app credential generates a private/public key pair, where the private key is secured on the user’s mobile device and the public key is held by Authsignal. This operation must be authorized with a short-lived token, which can be obtained by tracking an action from your backend in an authenticated context.
await authsignal.inapp.addCredential(token: "eyJhbGciOiJ...")

Parameters

token
string
A short-lived token obtained by tracking an action.

Response

response
AuthsignalResponse<AppCredential>

Getting an in-app credential

Get information about the in-app credential stored on the device, if one exists.
let response = await authsignal.inapp.getCredential()

Response

response
AuthsignalResponse<AppCredential>

Removing an in-app credential

await authsignal.inapp.removeCredential()

Response

response
AuthsignalResponse<boolean>

Verifying an action

Verify an action in your app using the credential stored securely on the device.
let response = await authsignal.inapp.verify()

let token = response.data?.token

Response

response
AuthsignalResponse<VerifyDeviceResponse>

Requiring user authentication

When adding a credential for push, QR code, or in-app verification, it is possible to require that the user authenticate via their OS biometrics or PIN whenever they access the credential (e.g. when approving or rejecting a challenge).

iOS

To require user authentication on iOS, set the userPresenceRequired flag to true when adding the credential.
await authsignal.push.addCredential(
    token: token,
    userPresenceRequired: true
)
This is all that’s needed - iOS will automatically handle displaying the biometrics or PIN prompt when updating a challenge or verifying a device.

Android

To require user authentication on Android, set the userAuthenticationRequired flag to true when adding the credential.
authsignal.push.addCredential(
    token = token,
    userAuthenticationRequired = true
)
It’s also possible to specify additional user authentication parameters.
authsignal.push.addCredential(
    token = token,
    userAuthenticationRequired = true,
    timeout = 60,
    authorizationType = 0
)
The timeout param determines the time (in seconds) that the credential can be accessed after authenticating - or 0 if authentication must occur for every credential use. The authorizationType param determines if authentication is required via biometrics and/or device credential (e.g. pin). If user authentication is required for a credential, you must call updateChallenge in a biometric prompt authentication callback.
  1. Initialize a signature before displaying the biometric prompt
val signature = authsignal.push.startSigning()

val cryptoObject = CryptoObject(signature)

// Initialize biometric prompt and prompt info
val biometricPrompt = ...
val promptInfo = ...

biometricPrompt.authenticate(promptInfo, cryptoObject);
  1. Retrieve the signature from the crypto object in your prompt’s authentication callback
override fun onAuthenticationSucceeded(result: AuthenticationResult) {
    super.onAuthenticationSucceeded(result)

    val cryptoObject = result.cryptoObject
    val signer = cryptoObject.signature

    authsignal.push.updateChallenge(
        challengeId = challengeId,
        approved = true,
        signer = signer
    )
}