Skip to main content
Check out our end-to-end guide on how to implement in-app verification.

Adding a 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 a 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 a 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>

Creating a PIN

Create a custom PIN backed by a cryptographic in-app credential stored securely on the user’s device.
let response = await authsignal.inapp.createPin(
    token: "eyJhbGciOiJ...",
    username: "[email protected]",
    pin: "123456"
)

Parameters

token
string
A short-lived token obtained by tracking an action.
username
string
The username associated with the PIN. A device can have multiple PINs stored for different users.
pin
string
The PIN value. Must be a valid 6-digit numeric value.

Response

response
AuthsignalResponse<AppCredential>

Verifying a PIN

Check a submitted PIN value against the value stored on the device and use the associated in-app credential to verify the user.
let response = await authsignal.inapp.verifyPin(
    username: "[email protected]",
    pin: "123456"
)

let isVerified = response.data?.isVerified
let token = response.data?.token

Response

response
AuthsignalResponse<VerifyPinResponse>

Get PIN usernames on device

Get all the usernames for PINs currently stored on the device. This method can be used if allowing multiple users to create PINs on the same device.
let response = await authsignal.inapp.getAllPinUsernames()

let usernames = response.data

Response

response
AuthsignalResponse<string[]>