auth

package
v0.8.9 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const DIGITS = 6
View Source
const LOG_TAG = "auth"

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) (*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) (*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) (*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) (*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