crypto

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSecureToken

func GenerateSecureToken(byteSize int, stringLength int) (string, error)

GenerateSecureToken generates a cryptographically secure random token encoded as a base64 URL-safe string. If stringLength > 0, generates a token of exactly that character length (truncated after encoding). If stringLength is 0, uses byteSize to determine the number of random bytes to generate before encoding. If both are 0, defaults to 32 bytes.

Maximum byte size is 96, which produces a 128-character encoded token. Returns an error if stringLength exceeds 128 or byteSize exceeds 96.

Types

This section is empty.

Jump to

Keyboard shortcuts

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