]> gitweb.factorcode.org Git - factor.git/commitdiff
totp: ignore spaces in the key string
authorAlexander Ilin <alex.ilin@protonmail.com>
Sun, 2 Jan 2022 01:53:14 +0000 (02:53 +0100)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 3 Jan 2022 20:24:55 +0000 (12:24 -0800)
extra/totp/totp.factor

index ab5c2efee44f05885a11d6ea8fc1db81af8c65ec..e0d7590b606c3b34d5b8fcf9ee4b1355ae9040c2 100644 (file)
@@ -29,5 +29,5 @@ PRIVATE>
     [ number>string ] dip [ CHAR: 0 pad-head ] keep tail* ;
 
 : totp ( key -- string )
-    dup string? [ >upper base32> ] when
+    dup string? [ [ CHAR: space = ] reject >upper base32> ] when
     now timestamp>count swap totp-hash get totp* totp-digits get digits ;