Justfile: add commands to switch yubikey
This commit is contained in:
parent
2f5c911da4
commit
8ce1ea2e9d
1 changed files with 14 additions and 0 deletions
14
Justfile
14
Justfile
|
@ -241,3 +241,17 @@ run-with-channels +cmds:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
source $(just -v _get_nix_path {{invocation_directory()}}/nix/variables/versions.nix)
|
source $(just -v _get_nix_path {{invocation_directory()}}/nix/variables/versions.nix)
|
||||||
{{cmds}}
|
{{cmds}}
|
||||||
|
|
||||||
|
# Switch between yubikeys which have a copy of the same key
|
||||||
|
switch-yubikey:
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# See https://github.com/drduh/YubiKey-Guide/issues/19
|
||||||
|
set -xe
|
||||||
|
KEY_ID=$(gpg --card-status | rg sec | rg -o '[0-9A-Z]{16}')
|
||||||
|
gpg --delete-secret-and-public-keys $KEY_ID
|
||||||
|
gpg2 --edit-card <<-EOF
|
||||||
|
fetch
|
||||||
|
quit
|
||||||
|
EOF
|
||||||
|
gpg-connect-agent "scd serialno" "learn --force" /bye
|
||||||
|
gpg --card-status
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue