๐ŸงชMulti-user (beta)

Use Keyless to authenticate many users on a shared, non-trusted device.

Different Keyless users can use their Keyless account(s) on the same device.

The user is identified by user information stored in a "blob": UserInfo. You can see the UserInfo blob as a snapshot of the Keyless SDK for the current user.

You can decide to populate the Keyless SDK with the UserInfo that you retrieved in the past from the Keyless SDK.

You are responsible to store the UserInfo securely in your application or elsewhere in a custom vault.

Retrieve the User Info

You can retrieve the UserInfo either during the enrollment or during the authentication by adding the retrievingUserInfo parameter to the EnrollmentConfiguration or the AuthenticationConfiguration builders.

The EnrollmentSuccess or the AuthenticationSuccess will contain an optional parameter userInfo that is a valid json containing the Keyless SDK snapshot for the current user.

Below you can find an example on how to retrieve the user information during an authentication:

val configuration = AuthenticationConfiguration.builder
    authenticationConfiguration = configuration,
    onCompletion = { result ->
        when (result) {
            is Keyless.KeylessResult.Success -> Log.d("KeylessSDK ", "Authentication success - userInfo = ${result.userInfo}")
            is Keyless.KeylessResult.Failure -> Log.d("KeylessSDK ", "Authentication failure - error code ${result.error.code}")

Set the User Info

To swap from a user to another you can set the user information using the setUserInfo(userInfo:String). After this call the SDK will be configured to perform all operations on the provided user extracted from the userInfo json string provided as parameter.

If you never call setUserInfo the Keyless SDK behaves as if there is only one default user.

Below is an example to set the user information from a UserInfo blob that you retrieved in the past from the Keyless SDK:

    userInfo = userInfo,
    onCompletion = { result ->
        when (result) {
            is Keyless.KeylessResult.Success -> Log.d("KeylessSDK ", "User set succcessfully")
            is Keyless.KeylessResult.Failure -> Log.d("KeylessSDK ", "Set userInfo failure - error code ${result.error.code}")

Last updated