package otc
import "git.sr.ht/~pingoo/stdx/otc"
package otc provides alphanumeric One Time Codes that can be used for email-based 2FA, account verification and more.
Index ¶
- Variables
- func Verify(code, token string) bool
- type Code
- func New(length uint16) (code Code, err error)
- func (code *Code) Code() string
- func (code *Code) CodeHTML() (ret string)
- func (code *Code) Token() string
- type NewCodeOptions
Variables ¶
Functions ¶
func Verify ¶
Types ¶
type Code ¶
type Code struct {
// contains filtered or unexported fields
}
func New ¶
func (*Code) Code ¶
func (*Code) CodeHTML ¶
CodeHTML returns the code wrapped in a <span> and with numbers wrapped in <span style="color: red">
func (*Code) Token ¶
Token returns a token of the form otc.v[N].[XXXX] where [N] is the version number of the token and [XXXX] is Base64URL encoded data The token should be stored in a database or a similar secure place and use it later to verify that a code is valid
type NewCodeOptions ¶
type NewCodeOptions struct { }
Source Files ¶
otc.go
- Version
- v0.0.0-20240218134121-094174641f6e (latest)
- Published
- Feb 18, 2024
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 4 months ago –
Tools for package owners.