keyring

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZetaUserName = "ZetaUserName"
)

Variables

View Source
var (
	// ErrNotFound is the expected error if the secret isn't found in the
	// keyring.
	ErrNotFound = errors.New("secret not found in keyring")
	// ErrSetDataTooBig is returned if `Set` was called with too much data.
	// On MacOS: The combination of service, username & password should not exceed ~3000 bytes
	// On Windows: The service is limited to 32KiB while the password is limited to 2560 bytes
	// On Linux/Unix: There is no theoretical limit but performance suffers with big values (>100KiB)
	ErrSetDataTooBig = errors.New("data passed to Set was too big")
)
View Source
var ErrUnsupportedPlatform = errors.New("unsupported platform: " + runtime.GOOS)

All of the following methods error out on unsupported platforms

Functions

func Discard

func Discard(ctx context.Context, targetName string) error

Discard cred

func Store

func Store(ctx context.Context, targetName string, c *Cred) error

Store target cred

Types

type Cred

type Cred struct {
	UserName string
	Password string
}

func Find

func Find(ctx context.Context, targetName string) (*Cred, error)

Find cred in keyring for target.

type Keyring

type Keyring interface {
	// Find cred in keyring for target.
	Find(ctx context.Context, targetName string) (*Cred, error)
	// Store target cred
	Store(ctx context.Context, targetName string, c *Cred) error
	// Discard cred
	Discard(ctx context.Context, targetName string) error
}

Keyring provides a simple set/get interface for a keyring service.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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