I use a Yubikey to store my ssh keys as a physical hardware key.
Retrieving the key to a new machine
- Plug in the yubikey and make sure yubikey manager is installed (temporarily install it with
nix-shell -p yubikey-manager)
- Run
ssh-keygen -K to generate the id_ed25519_sk_rk.pub and id_ed25519_sk_rk files in the current directory.
To add the key to the ssh-agent (ephemeral):
Or, to permanently add it to the agent, add the following to ~/.ssh/config: