keyring

package
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: MIT Imports: 15 Imported by: 3

README

Keyring

This package provides a cross platform keyring using system APIs (macOS/keychain, Windows/wincred, Linux/libsecret).

For more details visit keys.pub.

macOS

The Keychain API via the github.com/keybase/go-keychain package.

Windows

The Windows Credential Manager API via the github.com/danieljoos/wincred package.

Linux

The SecretService dbus interface via the github.com/zalando/go-keyring package. The SecretService dbus interface, which is provided by GNOME Keyring.

We are still exploring whether to use kwallet or libsecret directly for linux environments that support that instead. In the meantime, you can fall back to the FS based keyring.

FS

There is a filesystem based keyring.

Mem

The is an in memory keyring for ephemeral keys or for testing.

Documentation

Overview

Package keyring provides a cross-platform secure keyring.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backup added in v0.1.1

func Backup(path string, kr Keyring, now time.Time) error

Backup into {path}.tgz.

func CheckSystem

func CheckSystem() error

CheckSystem returns error if system keyring (dbus+libsecret) is not available.

func IDs added in v0.1.18

func IDs(kr Keyring, prefix string) ([]string, error)

IDs from Keyring.

func Restore added in v0.1.1

func Restore(path string, kr Keyring) error

Restore from path.tgz.

Types

type Item added in v0.1.18

type Item struct {
	ID   string
	Data []byte
}

Item ..

type Keyring

type Keyring interface {
	// Name of the keyring implementation.
	Name() string

	// Get bytes.
	Get(id string) ([]byte, error)
	// Set bytes.
	Set(id string, data []byte) error
	// Delete bytes.
	Delete(id string) (bool, error)

	// Exists returns true if exists.
	Exists(id string) (bool, error)

	// Reset removes all data.
	Reset() error

	Items(prefix string) ([]*Item, error)
}

Keyring is the interface used to store data.

func NewFS

func NewFS(dir string) (Keyring, error)

NewFS returns Keyring backed by the filesystem.

func NewMem

func NewMem() Keyring

NewMem returns an in memory keyring useful for testing or ephemeral keys.

func NewSystem

func NewSystem(service string) (Keyring, error)

NewSystem creates system keyring.

Jump to

Keyboard shortcuts

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