Skip to content

Commit 2171558

Browse files
authored
feat: add support for totp_secret (#273)
* feat: add support for TOTP secret * bump version
1 parent 184646d commit 2171558

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

tests/test_user_management.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,7 @@ def test_enroll_auth_factor(
10131013
type = "totp"
10141014
totp_issuer = "WorkOS"
10151015
totp_user = "[email protected]"
1016+
totp_secret = "secret-test"
10161017

10171018
mock_request_method("post", mock_enroll_auth_factor_response, 200)
10181019

@@ -1021,6 +1022,7 @@ def test_enroll_auth_factor(
10211022
type=type,
10221023
totp_issuer=totp_issuer,
10231024
totp_user=totp_user,
1025+
totp_secret=totp_secret,
10241026
)
10251027

10261028
assert enroll_auth_factor == mock_enroll_auth_factor_response

workos/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
__package_url__ = "https://github.com/workos-inc/workos-python"
1414

15-
__version__ = "4.9.0"
15+
__version__ = "4.10.0"
1616

1717
__author__ = "WorkOS"
1818

workos/user_management.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,7 @@ def enroll_auth_factor(
11131113
type,
11141114
totp_issuer=None,
11151115
totp_user=None,
1116+
totp_secret=None,
11161117
):
11171118
"""Enrolls a user in a new auth factor.
11181119
@@ -1121,6 +1122,7 @@ def enroll_auth_factor(
11211122
type (str): The type of factor to enroll (Only option available is 'totp').
11221123
totp_issuer (str): Name of the Organization (Optional)
11231124
totp_user (str): Email of user (Optional)
1125+
totp_secret (str): The secret key for the TOTP factor. Generated if not provided. (Optional)
11241126
11251127
Returns: { WorkOSAuthenticationFactorTotp, WorkOSChallenge}
11261128
"""
@@ -1134,6 +1136,7 @@ def enroll_auth_factor(
11341136
"type": type,
11351137
"totp_issuer": totp_issuer,
11361138
"totp_user": totp_user,
1139+
"totp_secret": totp_secret,
11371140
}
11381141

11391142
response = self.request_helper.request(

0 commit comments

Comments
 (0)