Class DeviceBindingApi
The native host app owns the proof-of-possession flow end-to-end: it scans the QR code,
generates and uses the RSA key pair in the Android Keystore via DeviceKeyManager,
and signs the server-issued challenges locally.
Obtain an instance via AppIntegrityModuleApi.getDeviceBindingApi(com.unblu.sdk.core.configuration.UnbluClientConfiguration, java.lang.String, java.lang.String, java.lang.String).
-
Constructor Summary
ConstructorsConstructorDescriptionDeviceBindingApi(com.unblu.sdk.module.integrity.internal.devicebinding.DeviceBindingBridge bridge, com.unblu.sdk.module.integrity.internal.devicebinding.DeviceKeyManager deviceKeyManager) -
Method Summary
Modifier and TypeMethodDescriptionThe device identifier the server assigned during login (the value of the…-devicecookie), ornullif no server call has completed yet.The bindingId persisted on this device, ornullif there's no binding for this app (never enrolled, or revoked, or local data cleared).The session cookies (name -> value) obtained for the device binding REST calls, ornullif no server call has completed yet (or the bridge isn't REST-backed).The session obtained during the device-binding login asUnbluCookies.voidregisterWithQrPayload(String qrPayload, DeviceBindingCallback<String> callback) Registers the current device against the binding represented by the given QR code payload (theunblu-bind://…URI shown in the Agent Desk).voidregisterWithToken(String token, DeviceBindingCallback<String> callback) Registers the current device using a raw enrollmenttoken— thetokenvalue of the QR payload — for when the user types or pastes the code manually instead of scanning.voidrevoke(String bindingId, DeviceBindingCallback<Void> callback) Revokes the binding with the given ID on the server, then deletes the local Keystore key pair on success.voidverify(String bindingId, DeviceBindingCallback<Void> callback) Round-trips a fresh challenge to confirm the binding is still active server-side.
-
Constructor Details
-
DeviceBindingApi
public DeviceBindingApi(@NonNull com.unblu.sdk.module.integrity.internal.devicebinding.DeviceBindingBridge bridge, @NonNull com.unblu.sdk.module.integrity.internal.devicebinding.DeviceKeyManager deviceKeyManager)
-
-
Method Details
-
registerWithQrPayload
public void registerWithQrPayload(@NonNull String qrPayload, @NonNull DeviceBindingCallback<String> callback) Registers the current device against the binding represented by the given QR code payload (theunblu-bind://…URI shown in the Agent Desk).Steps performed locally: parse the
tokenfrom the QR code; ensure a Keystore key pair exists (recording the base64 X.509 SPKI public key); ask the server for an enrollment challenge; sign the (base64-decoded) challenge; send the base64 signature back to complete enrollment. On success thebindingIdis persisted locally and delivered tocallback.onSuccess. -
registerWithToken
public void registerWithToken(@NonNull String token, @NonNull DeviceBindingCallback<String> callback) Registers the current device using a raw enrollmenttoken— thetokenvalue of the QR payload — for when the user types or pastes the code manually instead of scanning. Same flow asregisterWithQrPayload(String, DeviceBindingCallback)without theunblu-bind://…URI parsing. -
verify
Round-trips a fresh challenge to confirm the binding is still active server-side. Succeeds withonSuccess(null)when the server confirms the signature; fails with aDeviceBindingExceptionotherwise (includingBINDING_REVOKED/BINDING_NOT_FOUND). -
revoke
Revokes the binding with the given ID on the server, then deletes the local Keystore key pair on success. Idempotent on the native side: if the server already revoked the binding, the local key is still cleared. -
getLocalBindingId
The bindingId persisted on this device, ornullif there's no binding for this app (never enrolled, or revoked, or local data cleared). There is no network round trip: the method reads from the encrypted Keystore-backed preferences. Pair this withverify(java.lang.String, com.unblu.sdk.module.integrity.devicebinding.DeviceBindingCallback<java.lang.Void>)to silently reconfirm a binding on session start. -
getSessionCookies
The session cookies (name -> value) obtained for the device binding REST calls, ornullif no server call has completed yet (or the bridge isn't REST-backed). -
getDeviceId
The device identifier the server assigned during login (the value of the…-devicecookie), ornullif no server call has completed yet. The server creates aDeviceInfofor this id, and the device binding is anchored to it. -
getSessionUnbluCookies
The session obtained during the device-binding login asUnbluCookies. Returns the same set the binding calls used, including the…-devicecookie carryinggetDeviceId(). Returnsnullif no server call has completed yet. Assign toUnbluClientConfiguration.Builder.setCustomCookies(...)so the WebView reuses the session (and the device id) without logging in again.
-