{"id":10898,"date":"2022-10-22T12:53:37","date_gmt":"2022-10-22T16:53:37","guid":{"rendered":"https:\/\/irreal.org\/blog\/?p=10898"},"modified":"2022-10-22T12:53:37","modified_gmt":"2022-10-22T16:53:37","slug":"mickey-on-generating-totp-codes","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=10898","title":{"rendered":"Mickey on Generating TOTP Codes"},"content":{"rendered":"<p>Happily for us Emacsers, <a href=\"https:\/\/www.masteringemacs.org\">Mickey<\/a> has been blogging up a storm on Emacs topics lately. His latest offering is on <a href=\"https:\/\/www.masteringemacs.org\/article\/securely-generating-totp-tokens-emacs?utm_source=newsletter&amp;utm_medium=email&amp;utm_campaign=rss\">generating TOPT codes with Emacs<\/a>. TOPT is \u201cTime-Based One-Time Password\u201d. If that doesn\u2019t mean anything to you, it\u2019s the basis of those two-factor fobs that many us do or have carried around that gives you code to use as part of a login. <a href=\"https:\/\/www.token2.com\/shop\/product\/token2-c105-keyfob-totp-hardware-token\">Here\u2019s one example<\/a> but there are many others.<\/p>\n<p>The fobs work by combining the time with a domain-specific secret and hashing them with SHA1 to generate the code. The <a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc6238\">TOTP protocol<\/a> handles things like the inevitable time drift of the fob\u2019s clock. At bottom, though, there\u2019s nothing very mysterious about the protocol and it\u2019s certainly possible to roll your own.<\/p>\n<p>Mickey has done just that. He\u2019s slightly modified J\u00fcrgen H\u00f6tzel\u2019s <code>totp.el<\/code> and provided his own version of a base-32 decoder so that the resulting implementation is standalone. You can add his code to your <code>init.el<\/code> and generate your TOTP codes directly from within Emacs. The only thing you need is the secret but that is typically provided the the TOTP provider. Be sure to check out Mickey\u2019s post for all the details.<\/p>\n<p>If nothing else, this is a nice way of reducing your \u201ceveryday carry\u201d, something that we here at Irreal are always interested in doing. If you\u2019re logging in using Emacs, it\u2019s also a way of avoiding the trauma of having to leave Emacs. What\u2019s not to like?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Happily for us Emacsers, Mickey has been blogging up a storm on Emacs topics lately. His latest offering is on generating TOPT codes with Emacs. TOPT is \u201cTime-Based One-Time Password\u201d. If that doesn\u2019t mean anything to you, it\u2019s the basis &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=10898\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[18],"class_list":["post-10898","post","type-post","status-publish","format-standard","hentry","category-general","tag-emacs"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/10898","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10898"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/10898\/revisions"}],"predecessor-version":[{"id":10899,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/10898\/revisions\/10899"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10898"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10898"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10898"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}