Documentation ¶
Overview ¶
Package gotp core library for building gotp CLI.
Index ¶
- Constants
- Variables
- type Cli
- func (cli *Cli) Add(issuer *Issuer) (err error)
- func (cli *Cli) Export(w io.Writer, formatName string) (err error)
- func (cli *Cli) Generate(label string, n int) (listOtp []string, err error)
- func (cli *Cli) Get(label string) (issuer *Issuer, err error)
- func (cli *Cli) Import(providerName, file string) (n int, err error)
- func (cli *Cli) List() (labels []string)
- func (cli *Cli) Remove(label string) (err error)
- func (cli *Cli) RemovePrivateKey() (err error)
- func (cli *Cli) Rename(label, newLabel string) (err error)
- func (cli *Cli) SetPrivateKey(pkeyFile string) (err error)
- type Issuer
Constants ¶
const ( HashSHA1 = `SHA1` // Default algorithm. HashSHA256 = `SHA256` HashSHA512 = `SHA512` )
List of available algorithm for Provider.
Variables ¶
var Readme string
Readme embed the README.md, rendered in "gotp help".
var Version = `0.6.0`
Version define the latest version of this module and gotp CLI.
Functions ¶
This section is empty.
Types ¶
type Cli ¶
type Cli struct {
// contains filtered or unexported fields
}
Cli define the command line interface for gotp program.
func (*Cli) Export ¶ added in v0.6.0
Export all the issuers and its secret to the file or standard output. List of supported format: "uri".
func (*Cli) RemovePrivateKey ¶ added in v0.3.0
RemovePrivateKey decrypt the issuer's value (hash:secret...) using current private key and store it back to file as plain text. The current private key file will be removed from gotp directory.
If no private key file, this method does nothing.
func (*Cli) Rename ¶
Rename a label to newLabel. It will return an error if the label parameter is not exist or newLabel already exist.
func (*Cli) SetPrivateKey ¶ added in v0.3.0
SetPrivateKey encrypt all the OTP secret using the new private key. The only accepted private key is RSA. If the pkeyFile is valid, it will be copied to "$XDG_CONFIG_DIR/gotp/gotp.key".
type Issuer ¶
type Issuer struct { Name string Label string Hash string Secret string // The secret value in base32. Digits int TimeStep int // contains filtered or unexported fields }
Issuer contains the configuration for single TOTP issuer, including their unique label, algorithm, secret key, and number of digits.