rand

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const RememberTokenBytes = 8

RememberTokenBytes specifies the byte size of a remember token.

Variables

This section is empty.

Functions

func Bytes

func Bytes(n int) ([]byte, error)

Bytes helps generate n random bytes, or will return an error if there was one. This uses the crypto/rand package so it is safe to use with things like remember tokens.

func NBytes

func NBytes(base64String string) (int, error)

NBytes returns the number of bytes used in the base64 URL encoded string.

func RememberToken

func RememberToken() (string, error)

RememberToken is a helper function designed to generate remember tokens of a predetermined byte size.

func String

func String(nBytes int) (string, error)

String helps generate a byte slice of size nBytes and then return a string that is the base64 URL encoded version of that byte slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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