Bash one-liner for IndieLogin

Recently I’ve been updating my website to be more IndieWeb ready. In addition to adding a h-card to my homepage I also came across IndieLogin, which allows you to use your personal domain to log in to services that support it.

In order to get this working I just needed to include a link to my PGP key from my homepage:

<a class="u-key" rel="pgpkey" type="application/pgp-keys" href="/pgp.asc"></a>

When logging in at IndieLogin I can then select to use my PGP key for authentication, and I am asked to sign a short message using my key. To make working with PGP less cumbersome I use the following one-line script:

echo $1 | gpg --clearsign 2>/dev/null | xsel -ib

which I invoke with dmenu like:

auth dee3ddb27870390b62b7ae1cef44d25bf4128aafaab5ffc9c80f5cba8392f5f7

which signs the message and sends the signature to the clipboard. From there I just need to paste into the login form and I’m logged in!