项目作者: rdaniels6813

项目描述 :
Keychain access using golang
高级语言: C
项目地址: git://github.com/rdaniels6813/go-chains.git
创建时间: 2019-08-23T03:48:51Z
项目社区:https://github.com/rdaniels6813/go-chains

开源协议:MIT License

下载


go-chains

Build Status
Appveyor
codecov
GolangCI

Install

  1. go get github.com/rdaniels6813/go-chains

Usage

  • Creating the keychain interface object

    1. import (
    2. "fmt"
    3. "github.com/rdaniels6813/go-chains"
    4. )
    5. func main() {
    6. keychain, err := chains.NewKeyChain()
    7. if err != nil {
    8. fmt.Printf("An error occurred creating the keychain wrapper: %s", err)
    9. }
    10. }
  • Getting a password

    1. password, err := keychain.Get("account-name", "username")
  • Setting a password

    1. err := keychain.Set("account-name", "username", "super-secret-password")
  • Deleting a password

    1. err := keychain.Delete("account-name", "username")

How does it work?

Using the cgo, and code written in c. Those parts are abstracted behind a golang API and separate OS-dependent implementations are used to make the calls to the keychain.

OS Support

  • Windows 10 (Credential Manager)
  • macOS 10.14 Mojave (Keychain)
  • Ubuntu 18 (libsecret)
    • apt-get install libsecret-1-dev to build an app using this library

NOTE: There may be further OS support for other versions of macOS, Windows, and Linux but I have verified the three above are working.

LINUX NOTE: Other variations of linux may work as well, but I have not tested them. Any linux OS with libsecret installed should work though.