2024-10-14 09:54:24 +00:00
|
|
|
#!/usr/bin/env ysh
|
|
|
|
|
2024-12-29 04:18:03 +00:00
|
|
|
proc main(...args) {
|
|
|
|
var subcommand = args[0]
|
|
|
|
shift 1
|
|
|
|
case (subcommand) {
|
2024-10-14 09:54:24 +00:00
|
|
|
passphrase {
|
2024-12-29 04:18:03 +00:00
|
|
|
gopass pwgen --xkcd --lang en --one-per-line --xkcdnumbers --xkcdcapitalize @[args] | head -n1
|
2024-10-14 09:54:24 +00:00
|
|
|
}
|
|
|
|
password {
|
2024-12-29 04:18:03 +00:00
|
|
|
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 {
|
2024-12-29 04:18:03 +00:00
|
|
|
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
|
|
|
|
}
|