Skip to content

Commit 955cb49

Browse files
committed
VED-812: Use Python library for TOTP code generation. Add some missing env vars.
1 parent 5c71f49 commit 955cb49

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

e2e/poetry.lock

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ requests = "^2.32.5"
1717
pyjwt = "^2.10.1"
1818
cryptography = "^42.0.3"
1919
lxml = "~4.9.0"
20+
oath = "^1.4.4"
2021

2122
[build-system]
2223
requires = ["poetry-core"]

e2e/utils/compute_totp_code.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import base64
2+
import sys
3+
4+
import oath
5+
6+
7+
def compute_totp_code(key_base32: str) -> str:
8+
key_hex = base64.b32decode(key_base32).hex()
9+
return oath.totp(key_hex)
10+
11+
12+
if __name__ == "__main__":
13+
print(compute_totp_code(sys.argv[1]))

0 commit comments

Comments
 (0)