random

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultNonceSize = 16

Variables

This section is empty.

Functions

This section is empty.

Types

type Noncer

type Noncer interface {
	Nonce() (string, error)
}

Noncer is a strategy for creating nonces for JWTs, to be stored in the jti claim.

func NewBase64Noncer

func NewBase64Noncer(random io.Reader, size int, encoding *base64.Encoding) Noncer

NewBase64Noncer creates a Noncer that generates a random sequence of bits encoded via the given base64 encoding. All parameters have defaults:

If random is nil, crypto/rand.Reader is used If size is nonpositive, DefaultNonceSize is used if encoding is nil, base64.RawURLEncoding is used

type RandomOut

type RandomOut struct {
	fx.Out

	// Random is the source of randomness to use
	Random io.Reader

	// Noncer is the nonce generation strategy
	Noncer Noncer
}

RandomOut describes the components emitted by this package

func Provide

func Provide() RandomOut

Provide is an uber/fx provider that emits the components exposed by this package

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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