localstorage

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Version of the YAML strcuture.
	Version string = "v1"
	// Path of the credentials storage file relative to the current user's home directory.
	FilePath string = ".lino"
	// Name of the credentials storage file.
	FileName string = "credentials.yaml"
)

Variables

View Source
var (
	ErrPermissionDenied  = constError("permission denied")
	ErrInvalidParameters = constError("invalid parameters")
	ErrMasterPassword    = constError("invalid master password")
	ErrInvalidStorage    = constError("invalid storage")
)

Errors raised by package.

Functions

func GetFileLocation

func GetFileLocation() string

func Read

func Read(serverURL string) (*credentials.Credentials, error)

func Store

func Store(creds *credentials.Credentials) error

Types

type YAMLCredentials

type YAMLCredentials struct {
	ServerURL string `yaml:"serverURL"`
	Username  string `yaml:"username"`
	Secret    string `yaml:"secret"`
}

type YAMLCredentialsStore

type YAMLCredentialsStore struct {
	Version         string            `yaml:"version"`
	CredentialsList []YAMLCredentials `yaml:"credentials,omitempty"`
}

type YAMLStorage

type YAMLStorage struct{}

Store credentials in a local file.

func (YAMLStorage) Add

func (h YAMLStorage) Add(creds *credentials.Credentials) error

Add adds new credentials to the storage.

func (YAMLStorage) Delete

func (h YAMLStorage) Delete(serverURL string) error

Delete removes credentials from storage.

func (YAMLStorage) Get

func (h YAMLStorage) Get(serverURL string) (string, string, error)

Get returns the username and secret to use for a given registry server URL.

func (YAMLStorage) List

func (h YAMLStorage) List() (map[string]string, error)

List returns the stored URLs and corresponding usernames.

Jump to

Keyboard shortcuts

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