diff --git a/moto/cognitoidp/models.py b/moto/cognitoidp/models.py index 7078583fa..13da5d41d 100644 --- a/moto/cognitoidp/models.py +++ b/moto/cognitoidp/models.py @@ -944,8 +944,8 @@ class CognitoIdpBackend(BaseBackend): "ChallengeName": "PASSWORD_VERIFIER", "Session": session, "ChallengeParameters": { - "SALT": str(uuid.uuid4()), - "SRP_B": str(uuid.uuid4()), + "SALT": uuid.uuid4().hex, + "SRP_B": uuid.uuid4().hex, "USERNAME": user.id, "USER_ID_FOR_SRP": user.id, "SECRET_BLOCK": session, diff --git a/tests/test_cognitoidp/test_cognitoidp.py b/tests/test_cognitoidp/test_cognitoidp.py index c61be4aa4..f45f7c079 100644 --- a/tests/test_cognitoidp/test_cognitoidp.py +++ b/tests/test_cognitoidp/test_cognitoidp.py @@ -1294,7 +1294,7 @@ def user_authentication_flow(conn): AuthFlow="USER_SRP_AUTH", AuthParameters={ "USERNAME": username, - "SRP_A": str(uuid.uuid4()), + "SRP_A": uuid.uuid4().hex, "SECRET_HASH": secret_hash, }, ) @@ -1341,7 +1341,7 @@ def user_authentication_flow(conn): AuthFlow="USER_SRP_AUTH", AuthParameters={ "USERNAME": username, - "SRP_A": str(uuid.uuid4()), + "SRP_A": uuid.uuid4().hex, "SECRET_HASH": secret_hash, }, ) @@ -1638,7 +1638,7 @@ def test_initiate_auth_USER_SRP_AUTH(): AuthFlow="USER_SRP_AUTH", AuthParameters={ "USERNAME": username, - "SRP_A": str(uuid.uuid4()), + "SRP_A": uuid.uuid4().hex, "SECRET_HASH": secret_hash, }, ) @@ -1688,7 +1688,7 @@ def test_initiate_auth_for_unconfirmed_user(): AuthFlow="USER_SRP_AUTH", AuthParameters={ "USERNAME": username, - "SRP_A": str(uuid.uuid4()), + "SRP_A": uuid.uuid4().hex, "SECRET_HASH": secret_hash, }, ) @@ -1724,7 +1724,7 @@ def test_initiate_auth_with_invalid_secret_hash(): AuthFlow="USER_SRP_AUTH", AuthParameters={ "USERNAME": username, - "SRP_A": str(uuid.uuid4()), + "SRP_A": uuid.uuid4().hex, "SECRET_HASH": invalid_secret_hash, }, ) @@ -1782,7 +1782,7 @@ def test_respond_to_auth_challenge_with_invalid_secret_hash(): AuthFlow="USER_SRP_AUTH", AuthParameters={ "USERNAME": result["username"], - "SRP_A": str(uuid.uuid4()), + "SRP_A": uuid.uuid4().hex, "SECRET_HASH": valid_secret_hash, }, )