keyring

package module
v0.0.0-...-0c8bdba Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: ISC Imports: 4 Imported by: 39

README

keyring provides cross-platform keychain access

http://godoc.org/github.com/tmc/keyring

Keyring provides a common interface to keyring/keychain tools.

License: ISC

Currently implemented:

  • OSX
  • SecretService
  • gnome-keychain (via "gnome_keyring" build flag)
  • Windows

Contributions welcome!

Usage example:

  err := keyring.Set("libraryFoo", "jack", "sacrifice")
  password, err := keyring.Get("libraryFoo", "jack")
  fmt.Println(password) //Output: sacrifice

Linux

Linux requirements:

SecretService provider
  • dbus
gnome-keychain provider
  • gnome-keychain headers
  • Ubuntu/Debian: libsecret-dev
  • Fedora: libsecret-devel
  • Archlinux: libsecret

Tests on Linux:

 $ go test github.com/tmc/keyring
 $ # for gnome-keyring provider
 $ go test -tags gnome_keyring github.com/tmc/keyring

Documentation

Overview

Package keyring provides a cross-platform interface to keychains for password management

Currently implemented:

  • OSX
  • SecretService
  • gnome-keychain (via "gnome_keyring" build flag)

Usage

Example usage:

err := keyring.Set("libraryFoo", "jack", "sacrifice")
password, err := keyring.Get("libraryFoo", "jack")
fmt.Println(password)
Output: sacrifice

TODO

  • Write Windows provider

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound means the requested password was not found
	ErrNotFound = errors.New("keyring: Password not found")
	// ErrNoDefault means that no default keyring provider has been found
	ErrNoDefault = errors.New("keyring: No suitable keyring provider found (check your build flags)")
)

Functions

func Get

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

Get gets the password for a paricular Service and Username using the default keyring provider.

func Set

func Set(service, username, password string) error

Set sets the password for a particular Service and Username using the default keyring provider.

Types

This section is empty.

Directories

Path Synopsis
Shows example use of the keyring package
Shows example use of the keyring package

Jump to

Keyboard shortcuts

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