Skip to content

Commit

Permalink
Added oath-toolkit and otp function
Browse files Browse the repository at this point in the history
  • Loading branch information
eko committed Feb 28, 2019
1 parent 1d8c54e commit ddd4567
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions .brew
Expand Up @@ -23,6 +23,7 @@ brew install ffmpeg
brew install fzf
brew install rs/tap/jaggr
brew install rs/tap/jplot
brew install oath-toolkit
brew install prettyping
brew install ncdu
brew install tmux
Expand Down
Binary file added .encrypted/.otpkeys
Binary file not shown.
22 changes: 22 additions & 0 deletions .functions
Expand Up @@ -279,6 +279,28 @@ function loc() {
echo "${fg[white]}Total${reset_color} lines of code: ${fg[yellow]}$total${reset_color}"
}

# Returns 2FA code
# Usage: otp <service name>
function otp() {
if [ -z $1 ]; then
echo
echo "Usage:"
echo " otp google"
echo
echo "Configuration: $HOME/.otpkeys"
echo "Format: name=key"
return 1;
fi

OTPKEY=$(sed -n "s/${1}=//p" ~/.otpkeys)
if [ -z $OTPKEY ]; then
echo "$(basename $0): Unknown service name '$1'"
return 1;
fi

oathtool --totp -b $OTPKEY
}

# Uploads a file to transfer.sh and returns the public URL
# Usage: transfer <file>
function transfer() {
Expand Down
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -20,6 +20,7 @@ install: ## Installs dotfiles into current environment

install-encrypted: ## Installs encrypted dotfiles into current environment
@$(MAKE) DOTFILE=.ssh/config install_encrypted_file
@$(MAKE) DOTFILE=.otpkeys install_encrypted_file

install_file:
@if [ ! -f ${HOME}/${DOTFILE} ]; then \
Expand Down

0 comments on commit ddd4567

Please sign in to comment.