···11+#!/usr/bin/env nix-shell
22+#!nix-shell -p nushell ssh-to-age -i nu
33+44+#==============================================================================
55+# SOPS w/ Age helper for retrieving my 1Password secret keys on the fly
66+#
77+# Because I am a very lazy person and don't like to watch out for the
88+# implications of storing my SSH keys on mobile devices that may hypothetically
99+# be seized at any second, I'm storing all my private keys with 1Password.
1010+#
1111+# Now, should you do this? For convenience, *maybe*? For maximum security?
1212+# Definitely not. Go use a Yubikey or something. I'm just not a fan of
1313+# keeping a metal dongle on my person this entire time. I'll probably just
1414+# write out my master passphrase in my last will or something so people
1515+# I trust can actually regain access to all my stuff in case something goes
1616+# awry. Just in case.
1717+#==============================================================================
1818+1919+# 1Password UUIDs of my private keys.
2020+#
2121+# I feel *somewhat* safe to make this globally visible since you do
2222+# need to sign in with my 1Password account to actually access them,
2323+# and if you ever get to that point, my security has already been defeated.
2424+#
2525+# All of these should be Ed25519.
2626+#
2727+# NOTE: Additions/deletions _MUST_ be synchronized with .sops.yaml!
2828+let items = [
2929+ # Main SSH key
3030+ "bkk3jg6qjnwyymb6gjiopczlba"
3131+]
3232+3333+# Make sure to sign in first.
3434+# Does nothing if already signed in
3535+^op signin
3636+3737+$items
3838+ | par-each { |item|
3939+ ^op read $"op://Development/($item)/private key?ssh-format=openssh"
4040+ | ^ssh-to-age -private-key
4141+ }
4242+ | str join "\n"
4343+