Skip to content
forked from xlzd/gotp

Golang OTP(One-Time Password) Library.

License

Notifications You must be signed in to change notification settings

ganboonhong/gotp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GOTP - The Golang One-Time Password Library

workflow MIT License

GOTP aims to be the CLI version of Google Authenticator that we use daily to secure our accounts. As a Vim lover, I enjoy having (most of) my work done without leaving keyboard.

Why using it

More efficient

  • In order to get an OTP from your phone when working on computer, we need:
    • Grab a phone
    • Unlock it
    • Find google authenticator app
    • Read the OTP
    • Type it on computer
  • Although these action seems can be done less than 30 seconds, repeating it while working on a computer (like what I did) is a pain
  • As a developer, it would be better if I can just get my OTP without leaving a computer (even keyboard)
  • You can feel the efficiency especially when you need to get different OTPs from different issuers frequently
  • Your OTP can be available in 3 seconds by utilizing this application (OTP is copied to clipboard immediately after generated)

Easy to Backup

  • All your data are stored in single database file (sqlite file), you just need to keep the file in somewhere secure (cloud, hard disk, ...)
    • When you lost your phone, your secret is still available on cloud
    • The secret of your OTP is encryped in database
    • Even you lost the file, your OTP still won't be accessible by others
  • Portable backup file means you can make it avialble in any computers you want (working computer, home computer, need to switch to another computer, ...)

Caveat:
Some people might think it goes against the purpose of OTP to store OTP on the same device with the application you’re using.
Use it if it brings more advantages to you while this doesn't bother you.

Prerequisite

go version ^1.14

Installation

# Clone source code
$ git clone git@github.com:ganboonhong/gotp.git

# Change to package directory
$ cd gotp

# Get package dependencies
$ go get ./...

# Compile and install package
$ go install

# Setup database
$ gotp app init

Usage

Here is the CRUD of it

Actions Command
Create gotp otp create
Read (List) gotp otp list
Update gotp otp update
Delete gotp otp delete
Actions Command
Generate gotp [otp] gen

Since generate OTP command is likely to be used frequently, there is a shorthand gotp gen for gotp otp gen.

Tests

# Run this at project root direcotry to run all tests.
$ cd gotp && go clean -testcache && go test ./...

# Change path to specific directory to run specific test(s)
$ cd gotp/cmd/otp && go clean -testcache && go test -run TestDeleteOTP

License

GOTP is licensed under the MIT License

About

Golang OTP(One-Time Password) Library.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%