credential

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 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

This section is empty.

Functions

This section is empty.

Types

type Credential

type Credential struct {
	User     string                    `json:"user"`     // User name
	Password secretstring.SecretString `json:"password"` // Password (masked in JSON/logs)
}

Credential holds authentication information with password protection

func New

func New(user string, password string) Credential

New creates a Credential with the given user and password.

func NewFromEnv

func NewFromEnv(userEnv string, passwordEnv string) Credential

NewFromEnv creates a Credential from environment variables as-is

func (*Credential) Equal

func (cred *Credential) Equal(other *Credential) bool

Equal returns true if both credentials have the same username and password.

func (*Credential) IsValid

func (cred *Credential) IsValid() bool

IsValid returns true if the credential has a non-empty username Note: Password validation is intentionally not included for flexibility

func (*Credential) Patch

func (cred *Credential) Patch(nc *Credential) bool

Patch updates the credential with non-empty values from the given credential. It returns true if any field was updated.

func (*Credential) Retrieve

func (cred *Credential) Retrieve() (*string, *string)

Retrieve returns pointers to user and password if credential is valid Returns nil pointers if credential is invalid

func (*Credential) Update

func (cred *Credential) Update(user *string, password *string)

Update modifies credential fields if the provided pointers are not nil

Jump to

Keyboard shortcuts

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