Awesome Go

go-andotp

CategoryCommand Line
SubcategoryLibraries for building standard or basic Command Line applications.
Stars30

A CLI program to encrypt/decrypt [andOTP](https://github.com/andOTP/andOTP) files. Can be used as a library as well.

About go-andotp

go-andotp

CLI program to encrypt/decrypt andOTP files.

Installation

Download:

  • x86_64 Intel or AMD 64-Bit CPU
    curl -L "https://github.com/RijulGulati/go-andotp/releases/latest/download/go-andotp-linux-x86_64" \
         -o "go-andotp" && \
    chmod +x "go-andotp"
    
  • arm64 Arm-based 64-Bit CPU (i.e. in Raspberry Pi)
    curl -L "https://github.com/RijulGulati/go-andotp/releases/latest/download/go-andotp-linux-arm64" \
         -o "go-andotp" && \
    chmod +x "go-andotp"
    

To determine your OS version, run getconf LONG_BIT or uname -m at the command line.

Download:

  • x86_64 Intel 64-bit
    curl -L "https://github.com/RijulGulati/go-andotp/releases/latest/download/go-andotp-macos-x86_64" \
         -o "go-andotp" && \
    chmod +x "go-andotp"
    
  • arm64 Apple silicon 64-bit
    curl -L "https://github.com/RijulGulati/go-andotp/releases/latest/download/go-andotp-macos-arm64" \
         -o "go-andotp" && \
    chmod +x "go-andotp"
    

To determine your OS version, run uname -m at the command line.

Download:

  • x86_64 Intel or AMD 64-Bit CPU
    Invoke-WebRequest -Uri "https://github.com/RijulGulati/go-andotp/releases/latest/download/go-andotp-windows-x86_64.exe" -OutFile "go-andotp.exe"
    
  • arm64 Arm-based 64-Bit CPU
    Invoke-WebRequest -Uri "https://github.com/RijulGulati/go-andotp/releases/latest/download/go-andotp-windows-arm64.exe" -OutFile "go-andotp.exe"
    

To determine your OS version, run echo %PROCESSOR_ARCHITECTURE% at the command line.

go install github.com/grijul/go-andotp

Usage

Usage: go-andotp -i <INPUT_FILE> {-e|-d} [-o <OUT_FILE>] [-p PASSWORD]

  -d    Decrypt file
  -e    Encrypt file.
  -i string
        Input File
  -o string
        Output File. If no file is provided, output is printed to STDOUT
  -p string
        Encryption Password. This option can be skipped to get password prompt.

Examples

  • Encrypt JSON file (Password is asked after hitting Enter. Password is not echoed)
go-andotp -e -i file.json -o file.json.aes
  • Encrypt JSON file (Password is entered through CLI)
go-andotp -e -i file.json -o file.json.aes -p testpass
  • Decrypt JSON file
go-andotp -d -i file.aes.json -o file.json
  • Decrypt JSON file and print json to console
go-andotp -d -i file.aes.json

Using go-andotp as library

go-andotp can be used as library as well. It implements Encrypt() and Decrypt() functions to encrypt/decrypt text (respectively). It's documentation is available at: https://pkg.go.dev/github.com/grijul/go-andotp/andotp

Example usage:

import "github.com/grijul/go-andotp/andotp"

func main() {
    andotp.Encrypt(...)
    andotp.Decrypt(...)
}

Build

Compile go-andotp on your computer:

go build -o go-andotp main.go

To compile go-andotp for another platform please set the GOARCH and GOOS environmental variables. Example:

GOOS=windows GOARCH=amd64 go build -o go-andotp.exe main.go

To compile go-andotp for Windows, macOS and Linux you can use the script build.sh:

bash build.sh

More help: https://go.dev/doc/install/source#environment

License

MIT

Frequently Asked Questions

What is go-andotp?

go-andotp is a Command Line library for the Go programming language. A CLI program to encrypt/decrypt [andOTP](https://github.com/andOTP/andOTP) files. Can be used as a library as well.

How do I install go-andotp?

Install go-andotp with the Go module system using `go get grijul/go-andotp`. Check the repository for the current installation instructions.

What category does go-andotp belong to?

go-andotp is listed under Command Line, specifically Libraries for building standard or basic Command Line applications..

← Back to Libraries for building standard or basic Command Line applications.