File tree Expand file tree Collapse file tree 5 files changed +20
-14
lines changed
commonMain/kotlin/com/jump/sdk/amplifyframework
commonTest/kotlin/com/jump/sdk/amplifyframework Expand file tree Collapse file tree 5 files changed +20
-14
lines changed Original file line number Diff line number Diff line change 1+ package com.jump.sdk.amplifyframework
2+
3+ enum class CognitoAction (val headerValue : String ) {
4+ CONFIRM_SIGN_UP (" AWSCognitoIdentityProviderService.ConfirmSignUp" ),
5+ SIGN_UP (" AWSCognitoIdentityProviderService.SignUp" ),
6+ INITIATE_AUTH (" AWSCognitoIdentityProviderService.InitiateAuth" ),
7+ RESPOND_TO_AUTH_CHALLENGE (" AWSCognitoIdentityProviderService.RespondToAuthChallenge" ),
8+ }
Original file line number Diff line number Diff line change @@ -16,16 +16,18 @@ package com.jump.sdk.amplifyframework
1616 */
1717
1818object CognitoKeys {
19+ const val CHALLENGE_NAME = " CHALLENGE_NAME"
20+ const val DEVICE_KEY = " DEVICE_KEY"
1921 const val PASSWORD_CLAIM_SECRET_BLOCK = " PASSWORD_CLAIM_SECRET_BLOCK"
2022 const val PASSWORD_CLAIM_SIGNATURE = " PASSWORD_CLAIM_SIGNATURE"
21- const val TIMESTAMP = " TIMESTAMP "
23+ const val PASSWORD_VERIFIER = " PASSWORD_VERIFIER "
2224 const val SALT = " SALT"
2325 const val SECRET_BLOCK = " SECRET_BLOCK"
26+ const val SECRET_HASH = " SECRET_HASH"
2427 const val SRP_A = " SRP_A"
2528 const val SRP_B = " SRP_B"
26- const val USER_ID_FOR_SRP = " USER_ID_FOR_SRP"
27- const val SECRET_HASH = " SECRET_HASH"
29+ const val TIMESTAMP = " TIMESTAMP"
2830 const val USERNAME = " USERNAME"
29- const val DEVICE_KEY = " DEVICE_KEY "
30- const val CHALLENGE_NAME = " CHALLENGE_NAME "
31+ const val USER_ID_FOR_SRP = " USER_ID_FOR_SRP "
32+ const val USER_SRP_AUTH = " USER_SRP_AUTH "
3133}
Original file line number Diff line number Diff line change @@ -26,9 +26,7 @@ val DayOfWeek.shortName: String
2626 DayOfWeek .FRIDAY -> " Fri"
2727 DayOfWeek .SATURDAY -> " Sat"
2828 DayOfWeek .SUNDAY -> " Sun"
29- else -> {
30- throw IllegalArgumentException (" Unknown day of week: $this " )
31- }
29+ else -> throw IllegalArgumentException (" Unknown day of week: $this " )
3230 }
3331
3432val Month .shortName: String
@@ -45,7 +43,5 @@ val Month.shortName: String
4543 Month .OCTOBER -> " Oct"
4644 Month .NOVEMBER -> " Nov"
4745 Month .DECEMBER -> " Dec"
48- else -> {
49- throw IllegalArgumentException (" Unknown month: $this " )
50- }
46+ else -> throw IllegalArgumentException (" Unknown month: $this " )
5147 }
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ class SRPHelper(private val password: String) {
5757 private val k: BigInteger
5858 private var privateA: BigInteger
5959 private var publicA: ModularBigInteger
60- var dateString : String = nowAsFormattedString()
60+ var timestamp : String = nowAsFormattedString()
6161 internal set
6262
6363 private val digest = SHA256 ()
@@ -155,7 +155,7 @@ class SRPHelper(private val password: String) {
155155 mac.update(userPoolName.toByteArray())
156156 mac.update(userId.toByteArray())
157157 mac.update(Base64 .decode(secretBlock))
158- return mac.doFinal(dateString .toByteArray())
158+ return mac.doFinal(timestamp .toByteArray())
159159 }
160160
161161 @Throws(CognitoException ::class )
Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ class SRPHelperTests {
156156
157157 @Test
158158 fun testGenerateM1 () {
159- helper.dateString = " Wed Sep 29 06:40:48 UTC 2021"
159+ helper.timestamp = " Wed Sep 29 06:40:48 UTC 2021"
160160 val m1Actual = helper.generateM1Signature(keyExpected.toByteArray(), secretBlock)
161161 assertEquals(m1Expected, Base64 .encode(m1Actual))
162162 }
You can’t perform that action at this time.
0 commit comments