Documentation ¶
Index ¶
- Constants
- func AddGenericPassword(attributes *GenericPasswordAttributes) error
- func CreateKeychain(path string, password string) error
- func CreateKeychainViaPrompt(path string) error
- func DeleteKeychain(path string) error
- func FindAndRemoveGenericPassword(attributes *GenericPasswordAttributes) error
- func FindGenericPassword(attributes *GenericPasswordAttributes) ([]byte, error)
- func GetAllAccountNames(serviceName string, keychains ...string) (accountNames []string, err error)
- func RemoveAndAddGenericPassword(attributes *GenericPasswordAttributes) error
- type GenericPasswordAttributes
Constants ¶
const ( ErrUnimplemented keychainError = C.errSecUnimplemented ErrParam keychainError = C.errSecParam ErrAllocate keychainError = C.errSecAllocate ErrNotAvailable keychainError = C.errSecNotAvailable ErrReadOnly keychainError = C.errSecReadOnly ErrAuthFailed keychainError = C.errSecAuthFailed ErrNoSuchKeychain keychainError = C.errSecNoSuchKeychain ErrInvalidKeychain keychainError = C.errSecInvalidKeychain ErrDuplicateKeychain keychainError = C.errSecDuplicateKeychain ErrDuplicateCallback keychainError = C.errSecDuplicateCallback ErrInvalidCallback keychainError = C.errSecInvalidCallback ErrDuplicateItem keychainError = C.errSecDuplicateItem ErrItemNotFound keychainError = C.errSecItemNotFound ErrBufferTooSmall keychainError = C.errSecBufferTooSmall ErrDataTooLarge keychainError = C.errSecDataTooLarge ErrNoSuchAttr keychainError = C.errSecNoSuchAttr ErrInvalidItemRef keychainError = C.errSecInvalidItemRef ErrInvalidSearchRef keychainError = C.errSecInvalidSearchRef ErrNoSuchClass keychainError = C.errSecNoSuchClass ErrNoDefaultKeychain keychainError = C.errSecNoDefaultKeychain ErrReadOnlyAttr keychainError = C.errSecReadOnlyAttr )
Variables ¶
This section is empty.
Functions ¶
func AddGenericPassword ¶
func AddGenericPassword(attributes *GenericPasswordAttributes) error
AddGenericPassword adds a generic password to the Keychain defined in the attributes Keychain property. This will raise an error if the service and account name already exist as an item
func CreateKeychain ¶
CreateKeychain creates a Keychain from the provided password which must fit within 32-bits and be well-formed UTF-8
func CreateKeychainViaPrompt ¶
CreateKeychain creates a Keychain via a pop-up prompt to the user
func FindAndRemoveGenericPassword ¶
func FindAndRemoveGenericPassword(attributes *GenericPasswordAttributes) error
FindAndRemoveGenericPassword searches the Keychains defined in the attributes Keychain property (or the default if null) and removes the item if found.
func FindGenericPassword ¶
func FindGenericPassword(attributes *GenericPasswordAttributes) ([]byte, error)
FindGenericPassword searches the Keychains defined in the attributes Keychain property (or the default if null). It returns only the password found or an error
func GetAllAccountNames ¶
GetAllAccountNames returns the account names for a given service across the provided keychains. If no keychains are provided, the default is used
func RemoveAndAddGenericPassword ¶
func RemoveAndAddGenericPassword(attributes *GenericPasswordAttributes) error
RemoveAndAddGenericPassword calls FindAndRemoveGenericPassword() with the given attributes (ignoring ErrItemNotFound) and then calls AddGenericPassword with the same attributes.
Types ¶
type GenericPasswordAttributes ¶
type GenericPasswordAttributes struct { // ServiceName is the name of the service to add the item to ServiceName string // AccountName is the name of the account to add the item to AccountName string // Password is the password for the service Password []byte // TrustedApplications is a list of additional application paths // that will be given trusted access to the keychain item by default. // The application that creates the keychain item always has access, so // this list is for additional apps or executables. TrustedApplications []string // Keychain contains a list of keychain files to either search or add to. If this // is null or empty then the user's defaults will be used Keychain []string }
GenericPasswordAttributes describes the attributes for a Keychain item All string fields must have size that fits in 32 bits and be UTF-8