Migration guide

Migrating to 4.3.0

Before version 4.3.0 the "customToken" was saved by default during enrollment and retrieved by default during authentication.

Your custom token could be a secret that you have provided to the app from the backend, the seed of an OTP protocol, or anything else. If you only need to know just the result of the authentication (success/failed), you can provide any constant value as token.

The "customToken" is from now on referred to as "secret".

Starting from version 4.3.0 we require you to explicitly state that you want to save/retrieve a secret when enrolling/authenticating with Keyless.

Enroll saving secret

From version 4.3.0 use savingSecret instead of withCustomToken.

// Before 4.3.0
val configuration = EnrollmentConfiguration.builder
  .withCustomToken("myToken") 
  .build()

// After 4.3.0
val configuration = EnrollmentConfiguration.builder
  .savingSecret("mySecret") 
  .build()

Keyless.enroll(
  enrollmentConfiguration = configuration,
  onCompletion = { ... }
) 

Authenticate retrieving secret

From version 4.3.0 you need to add retrievingSecret to the AuthenticationConfiguration builder if you with to retrieve the secret you saved during enrollment.

Also to retrieve the secret upon successful authentication you must use result.customSecret instead of the no longer supported result.customToken .

// Before 4.3.0
val configuration = AuthenticationConfiguration.builder.build()

// After 4.3.0
val configuration = AuthenticationConfiguration.builder
.retrievingSecret()
.build()

Keyless.authenticate(
    authenticationConfiguration = configuration,
    onCompletion = { result ->
        when (result) {
            is Keyless.KeylessResult.Success -> Log.d("KeylessSDK ", "Authentication success - token = ${result.customSecret}") // no longer result.customToken
            is Keyless.KeylessResult.Failure -> Log.d("KeylessSDK ", "Authentication failure - error code ${result.error.code}")
        }
    }
)

Last updated