Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
all: totp.html totp.xpi
totp.html: form.html README.md totp.js form.js form-tweaks.js
set -e; exec >$@; \
grep -v '^<script' form.html && printf '<hr>\n'; \
sed 's/totp\.js/#source/' README.md; \
printf '<script%s>\n%s\n</script>\n' '' "$$(cat form.js form-tweaks.js)" \
' id=source style="display: block; white-space: pre; font-family: monospace; overflow: auto"' "$$(cat totp.js)"
./generate-website.sh > totp.html
xpi_sources = manifest.json form.html form.js totp.js totp.png
totp.xpi: $(xpi_sources)
rm -f $@
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ a <a href=https://www.rfc-editor.org/rfc/rfc6238>TOTP</a> generator,
using the browser's
<a href=https://w3c.github.io/webcrypto/#subtlecrypto-interface>crypto API</a>.
It should do the exactly same thing as the google authenticator or any other
TOTP generating app.
TOTP generating app.</p>

<p>The <a href=totp.js>javascript code</a> does not send to or fetch any data
from anywhere remotely, and
the <a href=https://turistu.github.io/totp.html>demo page</a>
should work the same when served over https, saved locally or used inside
a browser extension.
a browser extension.</p>

<p>I have also packaged this into an <a href=https://addons.mozilla.org/en-US/firefox/addon/totp/>xpi firefox browser extension</a>,
which offers the convenience of generating the TOTP (for a key you have saved)
directly from a toolbar popup instead of having to switch to another tab.
The xpi does not do anything more than that and does not include any content
scripts or filters.
scripts or filters.</p>
14 changes: 14 additions & 0 deletions generate-website.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Generates totp.html for https://turistu.github.io/totp.html

set -e

# strip lines starting with "<script" from form.html output
grep -v '^<script' form.html && printf '<hr>\n'
# replace totp.js references with #source in README.md output
sed 's/totp\.js/#source/' README.md
# insert form.js form-tweaks.js as scripts, and totp.js as listing
printf '<script>\n%s\n</script>\n' "$(cat form.js form-tweaks.js)"
printf '<script %s>\n%s\n</script>\n' \
'id=source style="display: block; white-space: pre; font-family: monospace; overflow: auto"' "$(cat totp.js)"