nix-files/pkgs/sane-scripts/src/sane-secrets-dump

13 lines
434 B
Bash
Executable File

#!/usr/bin/env bash
# use: `sane-dump-secret /path/to/accounts/website.yaml`
# dumps relevant information about the account, include a OTP code if present
secrets=$(sops -d --output-type dotenv $1)
function get_value() {
echo "$secrets" | grep "^$1=" | cut -d '=' -f 2-
}
echo username: $(get_value username)
echo password: $(get_value password)
totp=$(get_value totp-b32)
[[ -z "$totp" ]] || echo totp: $(oathtool -b --totp $totp)