model

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Algorithm

type Algorithm int
const (
	ES256 Algorithm = iota
	ES384
	ES512
	RS256
	RS384
	RS512
	PS256
	PS384
	PS512
	HS256
	HS384
	HS512
)

func GetAlgorithm

func GetAlgorithm(alg string) *Algorithm

GetAlgorithm takes in a string representation of an Algorithm ("ES256" or "HS384") If the provided string does not match a defined algorithm, nil is returned

func (Algorithm) String

func (a Algorithm) String() string

type Opts

type Opts struct {
	BitSize   int
	SecretKey *[]byte
}

type Signer

type Signer interface {
	Alg() Algorithm
	Public() crypto.PublicKey
	Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error)
}

type SignerOpts

type SignerOpts struct {
	Hash crypto.Hash
}

func (SignerOpts) HashFunc

func (s SignerOpts) HashFunc() crypto.Hash

type Validator

type Validator interface {
	ValidateSignature(digest, signature []byte) (bool, error)
	Public() crypto.PublicKey
}

Jump to

Keyboard shortcuts

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