credential

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package credential implements standard credential protocols and URI matching.

Index

Constants

This section is empty.

Variables

View Source
var ErrLookup = errors.New("credential lookup failed; check Passbolt configuration, resource access and approval")
View Source
var ErrNotFound = errors.New("credentials not found in native keychain")
View Source
var ErrReadOnly = errors.New("credential writes are not supported")
View Source
var ErrRequest = errors.New("invalid credential request")
View Source
var ErrResponse = errors.New("resource cannot be represented as credentials")

Functions

func DockerRegistryKey

func DockerRegistryKey(value string) (string, error)

DockerRegistryKey follows Docker's origin-oriented server keys. Paths that identify repositories/web pages are not registry entries for Docker list.

func HandleDocker

func HandleDocker(helper dockercredentials.Helper, action string, input io.Reader, output io.Writer) error

HandleDocker delegates wire handling to Docker without Serve's stdout error printing. Buffering also works around upstream Get ignoring writer failures.

func KubernetesInteractive

func KubernetesInteractive(value string) (bool, error)

KubernetesInteractive validates the host's standard exec request without copying cluster data or input status into the credential response.

func MatchLabel

func MatchLabel(match Match) string

func ReadDockerServer

func ReadDockerServer(input io.Reader) (string, string, error)

func ValidResourceID

func ValidResourceID(value string) bool

func WriteAWS

func WriteAWS(output io.Writer, data ResourceData, tokenField, expirationField string) error

func WriteKubernetes

func WriteKubernetes(output io.Writer, data ResourceData, expirationField string) error

func WriteResponse

func WriteResponse(output io.Writer, username, password string) error

WriteResponse validates the complete response before writing any credentials. Credential bytes bypass terminal sanitization: this is a machine protocol.

Types

type AWSProcessCredentials

type AWSProcessCredentials struct {
	Version         int
	AccessKeyID     string `json:"AccessKeyId"`
	SecretAccessKey string
	SessionToken    *string    `json:",omitempty"`
	Expiration      *time.Time `json:",omitempty"`
}

type ClientStore

type ClientStore struct {
	Client  *api.Client
	Approve func(context.Context, Record) error
}

func (ClientStore) Load

func (s ClientStore) Load(ctx context.Context, id string) (ResourceData, error)

func (ClientStore) Read

func (s ClientStore) Read(ctx context.Context, id string) (Record, string, error)

func (ClientStore) Records

func (s ClientStore) Records(ctx context.Context) ([]Record, error)

type DockerBackend

type DockerBackend struct {
	Context  context.Context
	Resolver Resolver
}

DockerBackend implements Docker's upstream interface. Lookups stay read-only.

func (*DockerBackend) Add

func (*DockerBackend) Delete

func (*DockerBackend) Delete(string) error

func (*DockerBackend) Get

func (b *DockerBackend) Get(serverURL string) (string, string, error)

func (*DockerBackend) List

func (b *DockerBackend) List() (map[string]string, error)

type Match

type Match struct {
	Record
	URLs []string
}

func DockerMatches

func DockerMatches(key string, records []Record) []Match

func FindMatches

func FindMatches(req Request, records []Record) []Match

type Record

type Record struct {
	ID, Name, Username string
	URLs               []string
}

Record contains only searchable resource metadata, never a decrypted password.

type Request

type Request struct{ Protocol, Host, Path, Username string }

func ParseURL

func ParseURL(value string) (Request, error)

func ReadRequest

func ReadRequest(input io.Reader) (Request, error)

func (Request) Encode

func (r Request) Encode() string

type Resolver

type Resolver struct {
	Store  Store
	Select func(context.Context, []Match) (int, error)
}

func (Resolver) Docker

func (r Resolver) Docker(ctx context.Context, key string) (string, string, error)

func (Resolver) DockerList

func (r Resolver) DockerList(ctx context.Context) (map[string]string, error)

func (Resolver) Git

func (r Resolver) Git(ctx context.Context, req Request) (string, string, error)

type ResourceData

type ResourceData struct {
	Record           Record
	Metadata, Secret map[string]any
}

ResourceData is internal decrypted data, not a wire format. Optional values can live in ordinary secret fields or named Passbolt custom fields.

func (ResourceData) Field

func (d ResourceData) Field(name string) (*string, error)

func (ResourceData) Password

func (d ResourceData) Password() (string, error)

type Store

type Store interface {
	Records(context.Context) ([]Record, error)
	Read(context.Context, string) (Record, string, error)
}

Jump to

Keyboard shortcuts

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