Documentation
¶
Overview ¶
Package otpauth implements encoding and decoding functionality for the otpauth URI scheme, defined by google (https://github.com/google/google-authenticator/wiki/Key-Uri-Format).
Index ¶
Constants ¶
View Source
const ( TOTP = "totp" HOTP = "hotp" )
Variables ¶
View Source
var ( ErrUnsupportedURIScheme = errors.New("unsupported uri scheme") ErrUnsupportedOTPAlgorithm = errors.New("unsupported otp algorithm") ErrInvalidSecretEncoding = errors.New("invalid secret encoding") ErrUnsupportedHashAlgorithm = errors.New("unsupported hash algorithm") ErrNoCounterPresent = errors.New("no counter present") )
Functions ¶
Types ¶
type AlgorithmParameters ¶
type AlgorithmParameters struct {
// contains filtered or unexported fields
}
func FromURI ¶
func FromURI(value string) (*AlgorithmParameters, error)
func (*AlgorithmParameters) AccountName ¶
func (d *AlgorithmParameters) AccountName() string
func (*AlgorithmParameters) Algorithm ¶
func (d *AlgorithmParameters) Algorithm() otp.Algorithm
func (*AlgorithmParameters) Counter ¶
func (d *AlgorithmParameters) Counter() int64
func (*AlgorithmParameters) Issuer ¶
func (d *AlgorithmParameters) Issuer() string
func (*AlgorithmParameters) Key ¶
func (d *AlgorithmParameters) Key() []byte
func (*AlgorithmParameters) Type ¶
func (d *AlgorithmParameters) Type() Type
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
func NewEncoder ¶
func NewEncoder(alg otp.Algorithm, accountName string, opts ...EncoderOption) *Encoder
type EncoderOption ¶
type EncoderOption func(enc *exporter)
func WithCounter ¶
func WithCounter(counter int64) EncoderOption
func WithIssuer ¶
func WithIssuer(issuer string) EncoderOption
Click to show internal directories.
Click to hide internal directories.