keyring

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: MIT Imports: 8 Imported by: 2

Documentation

Overview

Package keyring implements functions for accessing and storing passwords in the system's keyring (Keychain on macOS, Credential Manager on Windows, Secret Service on Linux).

Index

Constants

View Source
const ErrKeyring = "ErrKeyring"

Variables

This section is empty.

Functions

func Delete

func Delete(service, user string) error

Delete deletes the password for a service and user in the default keyring.

func Get

func Get(service, user string) (string, error)

Get gets the password for a service and user in the default keyring.

func Set

func Set(service, user, pass string) error

Set sets the password for a service and user in the default keyring.

Types

type FileKeyring

type FileKeyring struct {
	Path string
	Key  []byte
	// contains filtered or unexported fields
}

FileKeyring is a keyring that stores passwords in a file.

func (*FileKeyring) Delete

func (self *FileKeyring) Delete(service, user string) error

func (*FileKeyring) Get

func (self *FileKeyring) Get(service, user string) (string, error)

func (*FileKeyring) Set

func (self *FileKeyring) Set(service, user, pass string) error

type Keyring

type Keyring interface {
	// Get gets the password for a service and user.
	Get(service, user string) (string, error)

	// Set sets the password for a service and user.
	Set(service, user, pass string) error

	// Delete deletes the password for a service and user.
	Delete(service, user string) error
}

Keyring is the interface that a system-specific or custom keyring must implement.

var DefaultKeyring Keyring

The default keyring.

type OverlayKeyring

type OverlayKeyring struct {
	Keyrings []Keyring
	// contains filtered or unexported fields
}

OverlayKeyring is a keyring that stores passwords in a hierarchy of keyrings.

func (*OverlayKeyring) Delete

func (self *OverlayKeyring) Delete(service, user string) error

func (*OverlayKeyring) Get

func (self *OverlayKeyring) Get(service, user string) (string, error)

func (*OverlayKeyring) Set

func (self *OverlayKeyring) Set(service, user, pass string) error

type SystemKeyring

type SystemKeyring struct {
}

SystemKeyring implements the system-specific keyring.

func (*SystemKeyring) Delete

func (self *SystemKeyring) Delete(service, user string) error

func (*SystemKeyring) Get

func (self *SystemKeyring) Get(service, user string) (string, error)

func (*SystemKeyring) Set

func (self *SystemKeyring) Set(service, user, pass string) error

Jump to

Keyboard shortcuts

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