auth

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const DIGITS = 6

Variables

This section is empty.

Functions

This section is empty.

Types

type HMAC

type HMAC struct {
	Required bool
	// contains filtered or unexported fields
}

func NewHMAC

func NewHMAC(required bool, key string) (*HMAC, error)

func (*HMAC) MAC

func (h *HMAC) MAC(message []byte) []byte

func (*HMAC) Verify

func (h *HMAC) Verify(message []byte, mac []byte) bool

type HOTP

type HOTP struct {
	// contains filtered or unexported fields
}

func NewHOTP

func NewHOTP(increment uint64, secrets string, counters string, logger *log.Logger) (*HOTP, error)

func (*HOTP) Validate

func (hotp *HOTP) Validate(clientID, otp string) error

type Nonce

type Nonce struct {
	// contains filtered or unexported fields
}

func NewNonce

func NewNonce(verify bool, server, clients string, logger *log.Logger) (*Nonce, error)

func (*Nonce) Next

func (n *Nonce) Next() uint64

func (*Nonce) Validate

func (n *Nonce) Validate(clientID *string, nonce *uint64) error

type Permissions

type Permissions struct {
	Enabled bool
	// contains filtered or unexported fields
}

func NewPermissions

func NewPermissions(enabled bool, users, groups string, logger *log.Logger) (*Permissions, error)

func (*Permissions) Validate

func (p *Permissions) Validate(clientID, resource, action string) error

type RSA

type RSA struct {
	// contains filtered or unexported fields
}

func NewRSA

func NewRSA(keydir string, logger *log.Logger) (*RSA, error)

func (*RSA) Decrypt

func (r *RSA) Decrypt(ciphertext []byte, key []byte, label string) ([]byte, error)

func (*RSA) Encrypt

func (r *RSA) Encrypt(plaintext []byte, clientID string, label string) ([]byte, []byte, error)

func (*RSA) Sign

func (r *RSA) Sign(message []byte) ([]byte, error)

func (*RSA) Validate

func (r *RSA) Validate(clientID string, request []byte, signature []byte) error

Jump to

Keyboard shortcuts

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