[PATCH] add contrib/andotp.py: import from andotp
Export this patch
This script converts the andOTP JSON dump into a list of otpauth://
URLs.
---
contrib/andotp.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
create mode 100755 contrib/andotp.py
diff --git a/contrib/andotp.py b/contrib/andotp.py
new file mode 100755
index 0000000..a98e004
--- /dev/null
+++ b/contrib/andotp.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python3
+from urllib.parse import quote
+import json
+import sys
+
+items = json.load(sys.stdin)
+for item in items:
+ if item["type"] != "TOTP":
+ sys.stderr.write(f"Unknown code type {item['type']}\n")
+ label = quote(item["label"])
+ secret = item["secret"]
+ url = f"otpauth://totp/{label}?secret={secret}"
+ if item["issuer"]:
+ issuer = quote(item["issuer"])
+ url += f"&issuer={issuer}"
+ print(url)
--
2.34.1
Thanks, applied to master
On 12/1/21 14:56, Drew DeVault wrote: