util

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptSeed

func DecryptSeed(encryptedSeed string, password []byte) string

DecryptSeed decrypts the base32 encoded encrypted seed with the user's password as key. Reversing the EncryptSeed() we use AES-128 bit encryption and the key is generated by using the user's password as much as needed. The end result is the TOTP seed

func EncryptSeed

func EncryptSeed(seed string, password []byte) string

EncryptSeed encrypts the seed with the user's password as key We use AES-128 bit encryption so we reuse the user's password as much as needed. The end result is Base32 encoded and will be appended to the hashed password in the configuration file

func GenerateOTPCode

func GenerateOTPCode(seed string, timeval int64) string

GenerateOTPCode calculates a code as defined in rfc6238 using the seed and a specific time the settings are hardcoded to what is most commonly used: 30 seconds window (the code changes every 30 seconds) generated code is 6 digits long the HMAC is using SHA1

func GenerateSeed

func GenerateSeed() string

GenerateSeed creates a random 16 byte Base32 string that serves as OTP Seed

func ProvisionURI

func ProvisionURI(secret string) string

ProvisionURI creates an otpauth URI commonly used by mobile phone authenticator applications

Types

This section is empty.

Jump to

Keyboard shortcuts

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