• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/workflows/H23-Sep-2021-4039

command/H23-Sep-2021-530387

info/H23-Sep-2021-114

security/H23-Sep-2021-12898

storage/H23-Sep-2021-400300

util/H23-Sep-2021-181127

vendor/H03-May-2022-1,051,571938,042

.gitignoreH A D23-Sep-202127 43

.travis.ymlH A D23-Sep-2021888 3631

LICENSEH A D23-Sep-20211 KiB2217

README.mdH A D23-Sep-20214.1 KiB142108

_totp-cliH A D23-Sep-2021923 3429

build-all.shH A D23-Sep-2021338 1812

go.modH A D23-Sep-2021340 1310

go.sumH A D23-Sep-20213.3 KiB3635

main.goH A D23-Sep-2021660 2821

README.md

1[![Go Report Card](https://goreportcard.com/badge/github.com/yitsushi/totp-cli)](https://goreportcard.com/report/github.com/yitsushi/totp-cli)
2[![Build Status](https://travis-ci.org/yitsushi/totp-cli.svg?branch=master)](https://travis-ci.org/yitsushi/totp-cli)
3[![Coverage Status](https://coveralls.io/repos/github/yitsushi/totp-cli/badge.svg?branch=master)](https://coveralls.io/github/yitsushi/totp-cli?branch=master)
4
5This is a simple TOTP _(Time-based One-time Password)_ CLI tool.
6TOTP is the most common mechanism for 2FA _(Two-Factor-Authentication)_.
7You can manage and organize your accounts with namespaces
8and protect your data with a password.
9
10### Install
11
12Download the latest version of the application
13from the [releases page](https://github.com/yitsushi/totp-cli/releases/latest).
14
15Users on macOS can also install the package using [MacPorts](https://ports.macports.org/port/totp-cli/summary):
16
17```
18sudo port selfupdate
19sudo port install totp-cli
20```
21
22### Update
23
24```
25$ totp-cli update
26```
27
28### Help output
29
30```
31$ totp-cli help
32
33version                           Print current version of this application
34add-token [namespace] [account]   Add new token
35delete <namespace> [account]      Delete an account or a whole namespace
36instant                           Generate an OTP from TOTP_TOKEN or stdin without the Storage backend
37list [namespace]                  List all available namespaces or accounts under a namespace
38update                            Check and update totp-cli itself
39change-password                   Change password
40dump [namespace]                  Dump all available namespaces or accounts under a namespace
41generate <namespace> <account>    Generate a specific OTP
42help [command]                    Display this help or a command specific help
43```
44
45### Usage
46
47When you run the application for the first time, it will ask
48for your password. **DO NOT FORGET IT!** There is no way to
49recover your password if you forget it.
50
51Your first command _(after `help`)_ would be `add-token`. You get get
52your token read a TOTP QR Code.
53
54```
55$ totp-cli add-token
56Namespace: personal
57Account: digitalocean
58Token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
59Password: ***
60```
61
62You can specify the namespace and the account name as a parameter:
63
64```
65$ totp-cli add-token personal randomaccount
66Token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
67Password: ***
68```
69
70If you want to delete `randomaccount` _(because it was a test for example)_,
71you can use `delete`:
72
73```
74$ totp-cli delete personal.randomaccount
75Password: ***
76You want to delete 'personal.randomaccount' account.
77Are you sure? yes
78```
79
80After few accounts, it's a bit hard to remember what did you added,
81so you can list namespaces:
82
83```
84$ totp-cli list
85Password: ***
86company1 (Number of accounts: 3)
87company2 (Number of accounts: 5)
88personal (Number of accounts: 8)
89```
90
91or you can list your accounts under a specific namespace:
92
93```
94$ totp-cli list personal
95Password: ***
96personal.evernote
97personal.google
98personal.github
99personal.ifttt
100personal.digitalocean
101personal.dropbox
102personal.facebook
103```
104
105If you want to change your password,
106you can do it with the `change-password` command.
107
108### Changing the location of the credentials file
109
110Simply put this into your `.zshrc` (or `.{YourShell}rc` or `.profile`):
111
112```
113export TOTP_CLI_CREDENTIAL_FILE="/mnt/mydrive/totp-credentials"
114```
115
116Or call the client with `TOTP_CLI_CREDENTIAL_FILE`:
117
118```
119$ TOTP_CLI_CREDENTIAL_FILE=/mnt/mydrive/totp-credentials totp-cli list
120```
121
122Note: It's a filename not just a directory.
123
124Note: It does not traverse through the given path,
125      parent directory has to be there already.
126
127### Zsh Completion
128
129A function to provide tab-completion for zsh is in the file `_totp-cli`.
130When installing or packaging totp-cli this should preferably be
131installed in `$prefix/share/zsh/site-functions`. Otherwise, it can be
132installed by copying to a directory where zsh searches for completion
133functions (the `$fpath` array). If you, for example, put all completion
134functions into the folder `~/.zsh/completions` you must add the
135following to your zsh main config file (`.zshrc`):
136
137```
138fpath=( ~/.zsh/completions $fpath )
139autoload -U compinit
140compinit
141```
142