From da51e8ea262fa113da7bd77c4e67ba14c7262851 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 21 Sep 2023 00:40:56 +0000 Subject: [PATCH 1/2] fix: add verify token hash --- gotrue/types.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/gotrue/types.py b/gotrue/types.py index e7ae555e..270b1c4f 100644 --- a/gotrue/types.py +++ b/gotrue/types.py @@ -41,6 +41,15 @@ "zoom", ] +EmailOtpType = Literal[ + "signup", + "invite", + "magiclink", + "recovery", + "email_change", + "email" +] + AuthChangeEventMFA = Literal["MFA_CHALLENGE_VERIFIED"] AuthChangeEvent = Literal[ @@ -325,13 +334,7 @@ class VerifyOtpParamsOptions(TypedDict): class VerifyEmailOtpParams(TypedDict): email: str token: str - type: Literal[ - "signup", - "invite", - "magiclink", - "recovery", - "email_change", - ] + type: EmailOtpType options: NotRequired[VerifyOtpParamsOptions] @@ -344,10 +347,15 @@ class VerifyMobileOtpParams(TypedDict): ] options: NotRequired[VerifyOtpParamsOptions] +class VerifyTokenHashParams(TypedDict): + token_hash: str + type: EmailOtpType + options: NotRequired[VerifyOtpParamsOptions] VerifyOtpParams = Union[ VerifyEmailOtpParams, VerifyMobileOtpParams, + VerifyTokenHashParams ] From 82a04aaee7c6cb1047091789007f6366bbe1a535 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 21 Sep 2023 01:37:15 +0000 Subject: [PATCH 2/2] Fixed formatting --- gotrue/types.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/gotrue/types.py b/gotrue/types.py index 270b1c4f..5000549d 100644 --- a/gotrue/types.py +++ b/gotrue/types.py @@ -42,12 +42,7 @@ ] EmailOtpType = Literal[ - "signup", - "invite", - "magiclink", - "recovery", - "email_change", - "email" + "signup", "invite", "magiclink", "recovery", "email_change", "email" ] AuthChangeEventMFA = Literal["MFA_CHALLENGE_VERIFIED"] @@ -347,15 +342,15 @@ class VerifyMobileOtpParams(TypedDict): ] options: NotRequired[VerifyOtpParamsOptions] + class VerifyTokenHashParams(TypedDict): token_hash: str type: EmailOtpType options: NotRequired[VerifyOtpParamsOptions] + VerifyOtpParams = Union[ - VerifyEmailOtpParams, - VerifyMobileOtpParams, - VerifyTokenHashParams + VerifyEmailOtpParams, VerifyMobileOtpParams, VerifyTokenHashParams ]