keychain

package
v0.29.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: MIT Imports: 6 Imported by: 9

Documentation

Overview

Package keychain implements a simple interface to the macOS Keychain. Based on /usr/bin/security.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Returned by Keychain.Get() and Keychain.Delete() if the specified
	// account doesn't exist.
	ErrNotFound = errors.New("password not found")
)

Specific errors returned by the API.

Functions

This section is empty.

Types

type Keychain

type Keychain struct {
	// contains filtered or unexported fields
}

Keychain manages macOS Keychain passwords for a specific service.

func New

func New(service string) *Keychain

New Keychain for specified service.

func (*Keychain) Delete

func (kc *Keychain) Delete(account string) error

Delete a password from user's Keychain. Returns ErrNotFound if account doesn't exist.

func (*Keychain) Get

func (kc *Keychain) Get(account string) (password string, err error)

Get password from user's Keychain. Returns ErrNotFound if specified account doesn't exist.

func (*Keychain) Set

func (kc *Keychain) Set(account, password string) error

Set password in user's Keychain. If the account already exists, it is replaced.

Jump to

Keyboard shortcuts

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