otp

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package otp provides functionality for generating and reading One-Time Passwords.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HOTP

type HOTP struct {
	// contains filtered or unexported fields
}

HOTP is not implemented due to syncing concerns.

This is a placeholder that doesn't contain real data.

func (HOTP) Code added in v0.3.0

func (hotp HOTP) Code() any

Code returns the raw code used for calculating the OTP.

func (HOTP) Digits added in v0.3.0

func (hotp HOTP) Digits() int

Digits returns the character/digit length of the OTP.

func (HOTP) String

func (hotp HOTP) String() string

String returns the calculated OTP used to authenticate with a service.

type MOTP

type MOTP struct {
	// contains filtered or unexported fields
}

func GenerateMOTP

func GenerateMOTP(secret []byte, algo string, digits int, period int64, pin string) (MOTP, error)

Generates an MOTP for the current time

func GenerateMOTPAt

func GenerateMOTPAt(secret []byte, algo string, digits int, period int64, pin string, sec int64) (MOTP, error)

Generates an MOTP at the specified time in seconds

func (MOTP) Code added in v0.3.0

func (motp MOTP) Code() any

Code returns the raw code used for calculating the OTP.

func (MOTP) Digits added in v0.3.0

func (motp MOTP) Digits() int

Digits returns the character/digit length of the OTP.

func (MOTP) String

func (motp MOTP) String() string

String returns the calculated OTP used to authenticate with a service.

type OTP

type OTP interface {
	Code() any
	Digits() int
	String() string
}

type SteamOTP

type SteamOTP struct {
	// contains filtered or unexported fields
}

func GenerateSteamOTP

func GenerateSteamOTP(secret []byte, algo string, digits int, period int64) (SteamOTP, error)

Generates a Steam OTP for the current time

func GenerateSteamOTPAt

func GenerateSteamOTPAt(secret []byte, algo string, digits int, period int64, seconds int64) (SteamOTP, error)

Generates a Steam OTP at the specified time in seconds

func (SteamOTP) Code added in v0.3.0

func (sotp SteamOTP) Code() any

Code returns the raw code used for calculating the OTP.

func (SteamOTP) Digits added in v0.3.0

func (sotp SteamOTP) Digits() int

Digits returns the character/digit length of the OTP.

func (SteamOTP) String

func (sotp SteamOTP) String() string

String returns the calculated OTP used to authenticate with a service.

type TOTP

type TOTP struct {
	// contains filtered or unexported fields
}

func GenerateTOTP

func GenerateTOTP(secret []byte, algo string, digits int, period int64) (TOTP, error)

Generates a TOTP for the current time

func GenerateTOTPAt

func GenerateTOTPAt(secret []byte, algo string, digits int, period int64, seconds int64) (TOTP, error)

Generates a TOTP at the specified time in seconds

func (TOTP) Code added in v0.3.0

func (totp TOTP) Code() any

Code returns the raw code used for calculating the OTP.

func (TOTP) Digits added in v0.3.0

func (totp TOTP) Digits() int

Digits returns the character/digit length of the OTP.

func (TOTP) String

func (totp TOTP) String() string

String returns the calculated OTP used to authenticate with a service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL