crypto

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptData

func DecryptData(encodedData string, key []byte) ([]byte, error)

func EncryptData

func EncryptData(data []byte, key []byte) (string, error)

func GetDataEncryptionKey

func GetDataEncryptionKey(userID string, decryptionKey string, dbPassword string) (string, error)

func HashPassword

func HashPassword(string, password string, secret string) string

HashPassword returns Argon2id password hash string with per-user random salt.

Output format (PHC-ish):

$argon2id$v=19$m=65536,t=1,p=4$<salt_b64>$<hash_b64>

secret: server-side pepper (optional). Keep out of DB.

func ParsePrivateKey

func ParsePrivateKey(text string) (*rsa.PrivateKey, error)

func VerifyPassword

func VerifyPassword(email string, password string, secret string, stored string) (bool, error)

VerifyPassword verifies password against stored HashPassword output. Supports legacy deterministic hashes (pre per-user-salt change) for backward compatibility.

Types

This section is empty.

Jump to

Keyboard shortcuts

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