Documentation ¶
Index ¶
- Variables
- type AuthenticatedCredential
- func (ac *AuthenticatedCredential) Base64URLDecode(username string, password string) error
- func (ac *AuthenticatedCredential) Base64URLEncodePassword() (string, error)
- func (ac *AuthenticatedCredential) Base64URLEncodeUsername() string
- func (ac *AuthenticatedCredential) MarshalJSON() ([]byte, error)
- func (ac *AuthenticatedCredential) Pb() *pb.AuthenticatedCredential
- func (ac *AuthenticatedCredential) UnmarshalJSON(data []byte) error
- type CredentialManager
- func (c *CredentialManager) Create(timestamp time.Time, nodeID []byte, OperatorType OperatorType) (*AuthenticatedCredential, error)
- func (c *CredentialManager) ID() *ID
- func (c *CredentialManager) PartnerIDs() []*ID
- func (c *CredentialManager) Verify(authenticatedCredential *AuthenticatedCredential) (*ID, error)
- type Error
- type ID
- type OperatorType
Constants ¶
This section is empty.
Variables ¶
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 (ac *AuthenticatedCredential) Pb() *pb.AuthenticatedCredential
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 ID ¶
type ID struct {
// contains filtered or unexported fields
}
func (*ID) StringWithLength ¶
type OperatorType ¶
type OperatorType = pb.OperatorType