secret

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package secret provides functions for interacting with the macOS keychain API in a simplified manner.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(name, user string) error

Delete removes a secret from the Keychain

func Exist

func Exist(name, user string) (bool, error)

Exist returns true if a secret already exists in the Keychain

func Generate

func Generate(length int, digits int, symbols int, noUpperCase bool, noRepeats bool) (string, error)

Generate a random string of length characters. The number of digits and the number of symbols will be used to determine the number of each character type in the final string. If noUpperCase is true, then only lower case letters will be used in the string. If noRepeats is true, then each character will only be used once in the string. To generate a secret without numbers or symbols set them to 0.

func Get

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

Get the password for a secret matching the name and user. The name parameter gets mapped to the Keychain API field called a Service (Note: the Keychain Access application calls it Where). The user parameter gets mapped to the Keychain API field called Account.

func List

func List(user string) ([]string, error)

List all secrets for a user

func Set

func Set(name, user, pass string) error

Set or update the label and password for a secret matching the name and user.

Types

This section is empty.

Jump to

Keyboard shortcuts

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