credentials

package module
v0.0.0-...-20009ab Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: AGPL-3.0-or-later Imports: 16 Imported by: 3 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MismatchError      = errors.New("credential MAC mismatch")
	MemoryError        = errors.New("memory allocation error")
	SerializationError = errors.New("error serializing HMAC protobuf body")
)

Functions

This section is empty.

Types

type AuthenticatedCredential

type AuthenticatedCredential pb.AuthenticatedCredential

func (*AuthenticatedCredential) Base64URLDecode

func (ac *AuthenticatedCredential) Base64URLDecode(username string, password string) error

func (*AuthenticatedCredential) Base64URLEncodePassword

func (ac *AuthenticatedCredential) Base64URLEncodePassword() (string, error)

func (*AuthenticatedCredential) Base64URLEncodeUsername

func (ac *AuthenticatedCredential) Base64URLEncodeUsername() string

func (*AuthenticatedCredential) MarshalJSON

func (ac *AuthenticatedCredential) MarshalJSON() ([]byte, error)

func (*AuthenticatedCredential) Pb

func (*AuthenticatedCredential) UnmarshalJSON

func (ac *AuthenticatedCredential) UnmarshalJSON(data []byte) error

type CredentialManager

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

CredentialManager authenticates and verifies rescue node credentials

func NewCredentialManager

func NewCredentialManager(key []byte, extraSecrets ...[]byte) *CredentialManager

NewCredentialManager creates a new CredentialManager which can create and verify authenticated credentials Credentials are created with `key` but validated against `key` and all `extraSecrets`. Under the hood, the library uses sha256 as an hmac hash, so keys should be at least 32 bytes for full security.

func (*CredentialManager) Create

func (c *CredentialManager) Create(timestamp time.Time, nodeID []byte, OperatorType OperatorType) (*AuthenticatedCredential, error)

Create makes a new credential and authenticates it, returning a protoc struct that can be marshaled/unmarshaled

func (*CredentialManager) ID

func (c *CredentialManager) ID() *ID

ID returns the ID struct of the primary secret

func (*CredentialManager) PartnerIDs

func (c *CredentialManager) PartnerIDs() []*ID

PartnerIDs returns a slice of ID structs of partner secrets

func (*CredentialManager) Verify

func (c *CredentialManager) Verify(authenticatedCredential *AuthenticatedCredential) (*ID, error)

Verify checks that a AuthenticatedCredential has a valid mac

type Error

type Error error

type ID

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

func (*ID) Equals

func (i *ID) Equals(b *ID) bool

func (*ID) String

func (i *ID) String() string

func (*ID) StringWithLength

func (i *ID) StringWithLength(length uint8) string

type OperatorType

type OperatorType = pb.OperatorType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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