Documentation
¶
Overview ¶
Package secure provides utilities for generating and handling cryptographically secure tokens intended for authentication, API keys, and other security-sensitive use cases.
Index ¶
- func Fingerprint(value string) string
- func Hash(value string) string
- func MustRandomHex(n int) string
- func NewAPIToken() (string, error)
- func NewDeviceToken() (string, error)
- func NewInspectToken() (string, error)
- func NewOTP() (string, error)
- func NewSessionToken() (string, error)
- func NewWebhookToken() (string, error)
- func Verify(token, hash string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fingerprint ¶
Fingerprint returns a short BLAKE2b-derived fingerprint for display purposes.
func MustRandomHex ¶
MustRandomHex returns n cryptographically secure random bytes as a hex-encoded string. Returns 2*n hex characters. Suitable for request IDs, boundaries, and nonces. Panics on random source failure (indicates system-level issue).
func NewAPIToken ¶
NewAPIToken generates a cryptographically secure token for API authentication. Returns a prefixed token in the format beebuzz_api_<token>.
func NewDeviceToken ¶
NewDeviceToken generates a cryptographically secure token for device authentication. Returns a prefixed token in the format beebuzz_device_<token>.
func NewInspectToken ¶
NewInspectToken generates a cryptographically secure token for webhook inspect sessions. Returns a prefixed token in the format beebuzz_whi_<token>.
func NewSessionToken ¶
NewSessionToken generates a cryptographically secure token for user sessions. Returns a prefixed token in the format beebuzz_session_<token>.
func NewWebhookToken ¶
NewWebhookToken generates a cryptographically secure token for webhook endpoints. Returns a prefixed token in the format beebuzz_wh_<token>.
Types ¶
This section is empty.