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.
A formatted error code which may additionally be present if the SDK call encountered an error.
Possible values are: token_not_set, expired_token or network_error.
A formatted error code which may additionally be present if the SDK call encountered an error.
Possible values are: invalid_credential when the credential exists on the device but has
been removed from the server.
An unstructured error description present if the SDK call encountered an error. This could
occur if the credential on the device is no longer valid because the corresponding user
authenticator has been deleted in the Authsignal Portal.
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}
An unstructured error description present if the SDK call encountered an error. This could
occur if the credential on the device is no longer valid because the corresponding user
authenticator has been deleted in the Authsignal Portal.
An unstructured error description present if the SDK call encountered an error. This could
occur if the credential on the device is no longer valid because the corresponding user
authenticator has been deleted in the Authsignal Portal.
When adding a credential for push 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).
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.
Initialize a signature before displaying the biometric prompt
val signature = authsignal.push.startSigning()val cryptoObject = CryptoObject(signature)// Initialize biometric prompt and prompt infoval biometricPrompt = ...val promptInfo = ...biometricPrompt.authenticate(promptInfo, cryptoObject);
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 )}