Silent Revalidation
| Attribute | Type | Required | Description |
|---|---|---|---|
externalUserId | String | ✅ | User identifier in your system. Automatically hashed with SHA-256 before transmission, never sent in plain text. |
Step 1 — Implement initializeSDK
Create a new UnicoSDK class/object, with a static initializeSDK method that returns the UnicoSDK instance, receiving the context and a UnicoSDKConfig with your sdkKey, bundleId, and environment. Keep the returned instance — it is needed later to call startSilentValidation from Java.
UnicoSDK.initializeSDK must be called as early as possible on app launch (e.g., Application.onCreate). Calling it later reduces background processing time and increases the chance of inconclusive authentication responses.
- Kotlin
- Java
UnicoSDK.initializeSDK(
context,
UnicoSDKConfig(
sdkKey = "your_sdk_key",
bundleId = "your_bundle_id",
environment = Environment.UAT
)
)
UnicoSDK sdk = UnicoSDK.initializeSDK(
context,
new UnicoSDKConfig("your_sdk_key", "your_bundle_id", Environment.UAT)
);
Step 2 — Implement startSilentValidation
After initializeSDK, associate the collection already in progress with the identified user by calling startSilentValidation with a PrepareInfo containing the externalUserId.
- Kotlin
- Java
val prepareInfo = PrepareInfo(
externalUserId = "external_user_id"
)
UnicoSDK.startSilentValidation(prepareInfo)
.onSuccess { result -> /* ... */ }
.onFailure { error -> /* ... */ }
startSilentValidation is a Kotlin suspend function — Java can't call it directly. Use the bridge below to make the connection.
interface SilentAuthCallback {
fun onSuccess(success: Boolean)
fun onFailure(message: String?)
}
object SilentAuthBridge {
@JvmStatic
fun startSilentValidation(
owner: LifecycleOwner,
sdk: UnicoSDK,
externalUserId: String,
callback: SilentAuthCallback
) {
owner.lifecycleScope.launch {
val result = sdk.startSilentValidation(PrepareInfo(externalUserId, null))
result.onSuccess { callback.onSuccess(it.success) }
.onFailure { callback.onFailure(it.message) }
}
}
}
SilentAuthBridge.startSilentValidation(this, sdk, externalUserId, new SilentAuthCallback() {
@Override
public void onSuccess(boolean success) {
/* ... */
}
@Override
public void onFailure(String message) {
/* ... */
}
});
If the validation happens at the start of the flow, for example at login, wait for the onSuccess callback before moving on to Step 3.
Step 3 — Create the process and authenticate
With validation in progress, create the verification process to complete the authentication. See API Reference ▸ API ▸ Create Process.
Include the same externalUserId sent in the PrepareInfo from Step 2 in the request body — this is what allows the backend to correlate the process creation with the validation already in progress.
curl -X POST https://api.id.unico.app/processes/v1 \
-H "Authorization: Bearer $TOKEN" \
-H "APIKEY: $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"subject": {
"duiType": 1,
"code": "12345678909",
"name": "Luke Skywalker",
"gender": "M",
"birthDate": "2000-05-20",
"email": "[email protected]",
"phone": "5519725570707"
},
"useCase": "Onboarding",
"externalUserId": "external_user_id",
"imageBase64": "/9j/4AAQSkZJR..."
}'
The response includes the silentAuth.result field with the authentication result:
{
"id": "80371b2a-3ac7-432e-866d-57fe37896ac6",
"status": 3,
"silentAuth": {
"result": "yes"
}
}
| Field | Type | Description |
|---|---|---|
silentAuth.result | string | yes or no — see possible values below. |
silentAuth.result — possible values
| Value | Meaning |
|---|---|
yes | Authentication approved, user recognized with sufficient confidence, no additional capture needed. |
no | Insufficient data to approve silently. Authenticating via biometrics (selfie) or another alternative method is recommended. |