awgo: Index | Files

package keychain

import ""

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


Package Files



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.

type Keychain Uses

type Keychain struct {
    // contains filtered or unexported fields

Keychain manages macOS Keychain passwords for a specific service.

func New Uses

func New(service string) *Keychain

New Keychain for specified service.

func (*Keychain) Delete Uses

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

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

func (*Keychain) Get Uses

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 Uses

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

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

Package keychain imports 6 packages (graph) and is imported by 4 packages. Updated 2020-05-21. Refresh now. Tools for package owners.