aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Rodrigues Lordello <[email protected]>2026-04-20 12:55:23 +0200
committerNicholas Rodrigues Lordello <[email protected]>2026-04-20 12:55:23 +0200
commit36d01e1b9782805296ab7d9b7a12ce476d295951 (patch)
tree6ecb47971bfa683ff76e4bbd4cb93f1bb50fbf49
parent6aeba7c285f34bcbcc191a17e605686b3bbe662f (diff)
Script for KeePass Keyfile
Add a script for using a Trezor to generate a deterministic KeePass keyfile based on SLIP-0016.
-rwxr-xr-xinstall.sh2
-rwxr-xr-xkeyfile.sh16
2 files changed, 18 insertions, 0 deletions
diff --git a/install.sh b/install.sh
index 546f362..861f80d 100755
--- a/install.sh
+++ b/install.sh
@@ -1,5 +1,7 @@
#!/usr/bin/env bash
+set -euo pipefail
+
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd)"
dotlink() {
diff --git a/keyfile.sh b/keyfile.sh
new file mode 100755
index 0000000..b3a028a
--- /dev/null
+++ b/keyfile.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+mkdir -p "$HOME/.local/share/keepass"
+
+# We use the SLIP-0016 master key as the key file for our KeePass database,
+# with a more appropriate key.
+# <https://github.com/satoshilabs/slips/blob/master/slip-0016.md>
+
+ADDRESS=m/10016h/0
+KEY='Unlock vault.kdbx?'
+VALUE='2d650551248d792eabf628f451200d7f51cb63e46aadcbb1038aacb05e8c8aee2d650551248d792eabf628f451200d7f51cb63e46aadcbb1038aacb05e8c8aee'
+
+"${TREZORCTL:-trezorctl}" encrypt-keyvalue --address "$ADDRESS" --prompt always "$KEY" "$VALUE" \
+ | xxd -r -p > "$HOME/.local/share/keepass/trezor.key"