Documentation
¶
Index ¶
- func ConstantTimeCompare(a, b string) bool
- func Decrypt(ciphertext string, key []byte) (string, error)
- func Encrypt(plaintext string, key []byte) (string, error)
- func GenerateBackupCodes(num int) ([]string, error)
- func GenerateEncryptionKey() ([]byte, string, error)
- func GenerateQRCode(content string, size int) ([]byte, error)
- func GenerateRandomHex(length int) string
- func GenerateRandomHexString(numBytes int) (string, error)
- func GenerateSSHKey() (pubKey, privKey string, err error)
- func GetOrCreateEncryptionKey(hexKey string) ([]byte, bool, error)
- func HashBackupCodes(codes []string) string
- func HashPassword(password string) (string, error)
- func MustParseEncryptionKey(hexKey string) []byte
- func ParseEncryptionKey(hexKey string) ([]byte, error)
- func Sha256Hash(input string) string
- func VerifyPassword(password, hash string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConstantTimeCompare ¶
ConstantTimeCompare performs a constant-time comparison of two strings.
func GenerateBackupCodes ¶
GenerateBackupCodes generates a set of backup codes for 2FA.
func GenerateEncryptionKey ¶
GenerateEncryptionKey generates a new encryption key.
func GenerateQRCode ¶
GenerateQRCode generates a QR code PNG image for the given content.
func GenerateRandomHex ¶
func GenerateRandomHexString ¶
GenerateRandomHexString generates a random hex string of the specified byte length.
func GenerateSSHKey ¶
func GetOrCreateEncryptionKey ¶
GetOrCreateEncryptionKey gets an encryption key from the provided hex string or generates a new one.
func HashBackupCodes ¶
HashBackupCodes hashes all backup codes and joins them.
func HashPassword ¶
HashPassword hashes a password using bcrypt.
func MustParseEncryptionKey ¶
func ParseEncryptionKey ¶
ParseEncryptionKey parses a hex-encoded encryption key.
func Sha256Hash ¶
Sha256Hash returns the SHA-256 hash of the input string in hexadecimal format.
func VerifyPassword ¶
VerifyPassword compares a plaintext password with a bcrypt hash.
Types ¶
This section is empty.