Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Tad Fisher committed Feb 15, 2017
0 parents commit a4e02ea
Show file tree
Hide file tree
Showing 4 changed files with 529 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Makefile
@@ -0,0 +1,37 @@
PROG ?= otp
PREFIX ?= /usr
DESTDIR ?=
LIBDIR ?= $(PREFIX)/lib
SYSTEM_EXTENSION_DIR ?= $(LIBDIR)/password-store/extensions
MANDIR ?= $(PREFIX)/share/man

all:
@echo "pass-$(PROG) is a shell script and does not need compilation, it can be simply executed."
@echo ""
@echo "To install it try \"make install\" instead."
@echo
@echo "To run pass $(PROG) one needs to have some tools installed on the system:"
@echo " password store"

install:
@install -v -d "$(DESTDIR)$(MANDIR)/man1" && install -m 0644 -v pass-$(PROG).1 "$(DESTDIR)$(MANDIR)/man1/pass-$(PROG).1"
@install -v -d "$(DESTDIR)$(SYSTEM_EXTENSION_DIR)/"
@install -Dm0755 $(PROG).bash "$(DESTDIR)$(SYSTEM_EXTENSION_DIR)/$(PROG).bash"
@echo
@echo "pass-$(PROG) is installed succesfully"
@echo

uninstall:
@rm -vrf \
"$(DESTDIR)$(SYSTEM_EXTENSION_DIR)/$(PROG).bash" \
"$(DESTDIR)$(IMPORTERS_DIR)/" \
"$(DESTDIR)$(MANDIR)/man1/pass-$(PROG).1" \

test:
make -C tests

lint:
shellcheck -s bash $(PROG).bash


.PHONY: install uninstall test lint
87 changes: 87 additions & 0 deletions README.md
@@ -0,0 +1,87 @@
# pass-otp

A [pass](https://www.passwordstore.org/) extension for managing
one-time-password (OTP) tokens.

## Usage

```
Usage:
pass otp [show] [--clip,-c] pass-name
Generate an OTP code and optionally put it on the clipboard.
If put on the clipboard, it will be cleared in 45 seconds.
pass otp insert totp [--secret=key,-s key] [--algorithm alg,-a alg]
[--period=seconds,-p seconds]
[--digits=digits,-d digits] [--force,-f] pass-name
Insert new TOTP secret. Prompt before overwriting existing password
unless forced.
pass otp insert hotp [--secret=secret,-s secret]
[--digits=digits,-d digits] [--force,-f]
pass-name counter
Insert new HOTP secret with initial counter. Prompt before overwriting
existing password unless forced.
pass otp uri [--clip,-c] [--qrcode,-q] pass-name
Create a secret key URI suitable for importing into other TOTP clients.
Optionally, put it on the clipboard, or display a QR code.
More information may be found in the pass-otp(1) man page.
```

## Example

Insert a TOTP token:

```
$ pass otp insert totp -s AAAAAAAAAAAAAAAAAAAAA totp-secret
[master 4f9b989] Add given OTP secret for totp-secret to store.
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 totp-secret.gpg
$ pass show totp-secret
otp_secret: AAAAAAAAAAAAAAAAAAAAA
otp_type: totp
otp_algorithm: sha1
otp_period: 30
otp_digits: 6
```

Generate a 2FA code using this token:

```
$ pass otp show totp-secret
698816
```

## Installation

````
git clone https://github.com/tadfisher/pass-otp
cd pass-otp
sudo make install
```
## Requirements
- `pass` 1.7.0 or later for extenstion support
- `oathtool` for generating 2FA codes
- `qrencode` for generating QR code images
## License
```
Copyright (C) 2017 Tad Fisher
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
```

0 comments on commit a4e02ea

Please sign in to comment.