Skip to content

Commit 26c230e

Browse files
authored
make gkey strip whitespace and accept lowercase
So I can paste from my copy of the original secret google provided.
1 parent 1069ccc commit 26c230e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

onlykey/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def prompt_pin():
185185
only_key.setslot(slot_id, MessageField.TFATYPE, sys.argv[4])
186186
elif sys.argv[3] == 'gkey':
187187
totpkey = prompt_key()
188-
totpkey = base64.b32decode(totpkey)
188+
totpkey = base64.b32decode("".join(totpkey.split()).upper())
189189
totpkey = binascii.hexlify(totpkey)
190190
# pad with zeros for even digits
191191
totpkey = totpkey.zfill(len(totpkey) + len(totpkey) % 2)
@@ -419,7 +419,7 @@ def mprompt():
419419
only_key.setslot(slot_id, MessageField.TFATYPE, data[3])
420420
elif data[2] == 'gkey':
421421
totpkey = prompt_key()
422-
totpkey = base64.b32decode(totpkey)
422+
totpkey = base64.b32decode("".join(totpkey.split()).upper())
423423
totpkey = binascii.hexlify(totpkey)
424424
# pad with zeros for even digits
425425
totpkey = totpkey.zfill(len(totpkey) + len(totpkey) % 2)

0 commit comments

Comments
 (0)