- Install
ykmanvia homebrew on the Mac.
brew install ykman- Create
bash/zshfunction somewhere in your shell rc files
function otp() {
code=$(ykman oath accounts code <ACCOUNT_NAME_HERE> -s)
echo $code | tr -d '\n' | pbcopy
echo $code
}- Call
otpwhenever you need a OTP. In my caseykmanasks me to touch my Yubikey and then provides the one-time code and usespbcopyto place it in my clipboard right away.
- Add the account name as an arg on the function
- Add account-specific aliases