dotfiles/bin/fds-passsuite

29 lines
617 B
Plaintext
Raw Normal View History

2024-10-14 09:54:24 +00:00
#!/usr/bin/env ysh
proc main(...args) {
var subcommand = args[0]
shift 1
case (subcommand) {
2024-10-14 09:54:24 +00:00
passphrase {
gopass pwgen --xkcd --lang en --one-per-line --xkcdnumbers --xkcdcapitalize @[args] | head -n1
2024-10-14 09:54:24 +00:00
}
password {
gopass pwgen --symbols --one-per-line @[args] | head -n1
}
secret {
dd if=/dev/urandom bs=32 count=1 2>/dev/null | base64
2024-10-14 09:54:24 +00:00
}
encode-argon2 {
write -- $[args[1]] | argon2 $(openssl rand -base64 32) -e -id -k 65540 -t 3 -p 4
2024-10-14 09:54:24 +00:00
}
(else) {
echo "Invalid subcommand: '$[arg1]'." 1>&2
exit 1
}
}
}
if is-main {
main @ARGV
}