Skip to content

Commit

Permalink
Updated name for deviceMetadata to make it more clear what we are ref…
Browse files Browse the repository at this point in the history
…erring to
  • Loading branch information
gpanshu committed Oct 23, 2023
1 parent 820c018 commit 0b39eab
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ internal object SRPCognitoActions : SRPActions {
secretHash?.let { authParams[KEY_SECRET_HASH] = it }

val encodedContextData = getUserContextData(event.username)
var deviceMetadata = getDeviceMetadata(event.username)
val deviceMetadata = getDeviceMetadata(event.username)
deviceMetadata?.let { authParams[KEY_DEVICE_KEY] = it.deviceKey }
val pinpointEndpointId = getPinpointEndpointId()

Expand All @@ -80,7 +80,7 @@ internal object SRPCognitoActions : SRPActions {

when (initiateAuthResponse?.challengeName) {
ChallengeNameType.PasswordVerifier -> {
deviceMetadata = getDeviceMetadata(
val updatedDeviceMetadata = getDeviceMetadata(
AuthHelper.getActiveUsername(
username = event.username,
alternateUsername = initiateAuthResponse.challengeParameters?.get(KEY_USERNAME),
Expand All @@ -91,15 +91,15 @@ internal object SRPCognitoActions : SRPActions {
)

initiateAuthResponse.challengeParameters?.let { params ->
val challengeParams = deviceMetadata?.deviceKey?.let {
val challengeParams = updatedDeviceMetadata?.deviceKey?.let {
params.plus(KEY_DEVICE_KEY to it)
} ?: params

SRPEvent(
SRPEvent.EventType.RespondPasswordVerifier(
challengeParams,
event.metadata,
initiateAuthResponse?.session
initiateAuthResponse.session
)
)
} ?: throw Exception("Auth challenge parameters are empty.")
Expand Down

0 comments on commit 0b39eab

Please sign in to comment.