All Projects → keybase → Go Keychain

keybase / Go Keychain

Licence: mit
Golang keychain package for iOS and macOS

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Keychain

kubectl-passman
kubectl plugin that provides the missing link/glue between common password managers and kubectl
Stars: ✭ 69 (-78.64%)
Mutual labels:  keychain
LAPSforMac
Local Administrator Password Solution for Mac
Stars: ✭ 29 (-91.02%)
Mutual labels:  keychain
Csvkeychain
Import/export between Apple Keychain.app and plain CSV file.
Stars: ✭ 281 (-13%)
Mutual labels:  keychain
vault
Is a plugin for project management system Redmine. Allows you to store various passwords/keys in one place for the project.
Stars: ✭ 44 (-86.38%)
Mutual labels:  keychain
MSession
A simple and sophisticated session and authentication solution written in Swift
Stars: ✭ 26 (-91.95%)
Mutual labels:  keychain
lockd
Generate strong passwords and save them in Keychain. Made with SwiftUI
Stars: ✭ 38 (-88.24%)
Mutual labels:  keychain
Secureenclavecrypto
Demonstration library for using the Secure Enclave on iOS
Stars: ✭ 251 (-22.29%)
Mutual labels:  keychain
Xyuuid
iOS14 UUID KeyChain DeviceInfo IDFA UDID
Stars: ✭ 301 (-6.81%)
Mutual labels:  keychain
osx-callhistory-decryptor
macOS (incl big sur) call history decryptor/converter to CSV format.
Stars: ✭ 19 (-94.12%)
Mutual labels:  keychain
pinentry-touchid
Custom GPG pinentry program for macOS that allows using Touch ID for fetching the password from the macOS keychain.
Stars: ✭ 152 (-52.94%)
Mutual labels:  keychain
vault-token-helper
@hashicorp Vault Token Helper for macOS, Linux and Windows with support for secure token storage and multiple Vault servers 🔐
Stars: ✭ 74 (-77.09%)
Mutual labels:  keychain
alks-cli
CLI for working with the ALKS service.
Stars: ✭ 40 (-87.62%)
Mutual labels:  keychain
KeychainWrapper
A lightweight, pure-Swift library for the iOS keychain.
Stars: ✭ 51 (-84.21%)
Mutual labels:  keychain
GenericLocalPersistence
GenericLocalPersistence is a clean and easy-to-use code that is useful for integrating local storage like UserDefaults, PList, Keychain.
Stars: ✭ 17 (-94.74%)
Mutual labels:  keychain
Uickeychainstore
UICKeyChainStore is a simple wrapper for Keychain on iOS, watchOS, tvOS and macOS. Makes using Keychain APIs as easy as NSUserDefaults.
Stars: ✭ 3,029 (+837.77%)
Mutual labels:  keychain
2ami
Your easy 2FA companion that keep the secrets secret.
Stars: ✭ 24 (-92.57%)
Mutual labels:  keychain
swift-standard-clients
Client declarations and live implementations for standard iOS managers
Stars: ✭ 28 (-91.33%)
Mutual labels:  keychain
Gokey
A simple vaultless password manager in Go
Stars: ✭ 305 (-5.57%)
Mutual labels:  keychain
Csv2keychain
Small tool for adding exported credentials from Chrome to macOS keychain
Stars: ✭ 295 (-8.67%)
Mutual labels:  keychain
WaxSealCore
Simple, expressive yet comprehensive keychain wrapper in Objective-C.
Stars: ✭ 33 (-89.78%)
Mutual labels:  keychain

Go Keychain

Travis CI

A library for accessing the Keychain for macOS, iOS, and Linux in Go (golang).

Requires macOS 10.9 or greater and iOS 8 or greater. On Linux, communicates to a provider of the DBUS SecretService spec like gnome-keyring or ksecretservice.

import "github.com/keybase/go-keychain"

Mac/iOS Usage

The API is meant to mirror the macOS/iOS Keychain API and is not necessarily idiomatic go.

Add Item

item := keychain.NewItem()
item.SetSecClass(keychain.SecClassGenericPassword)
item.SetService("MyService")
item.SetAccount("gabriel")
item.SetLabel("A label")
item.SetAccessGroup("A123456789.group.com.mycorp")
item.SetData([]byte("toomanysecrets"))
item.SetSynchronizable(keychain.SynchronizableNo)
item.SetAccessible(keychain.AccessibleWhenUnlocked)
err := keychain.AddItem(item)

if err == keychain.ErrorDuplicateItem {
  // Duplicate
}

Query Item

Query for multiple results, returning attributes:

query := keychain.NewItem()
query.SetSecClass(keychain.SecClassGenericPassword)
query.SetService(service)
query.SetAccount(account)
query.SetAccessGroup(accessGroup)
query.SetMatchLimit(keychain.MatchLimitAll)
query.SetReturnAttributes(true)
results, err := keychain.QueryItem(query)
if err != nil {
  // Error
} else {
  for _, r := range results {
    fmt.Printf("%#v\n", r)
  }
}

Query for a single result, returning data:

query := keychain.NewItem()
query.SetSecClass(keychain.SecClassGenericPassword)
query.SetService(service)
query.SetAccount(account)
query.SetAccessGroup(accessGroup)
query.SetMatchLimit(keychain.MatchLimitOne)
query.SetReturnData(true)
results, err := keychain.QueryItem(query)
if err != nil {
  // Error
} else if len(results) != 1 {
  // Not found
} else {
  password := string(results[0].Data)
}

Delete Item

Delete a generic password item with service and account:

item := keychain.NewItem()
item.SetSecClass(keychain.SecClassGenericPassword)
item.SetService(service)
item.SetAccount(account)
err := keychain.DeleteItem(item)

Other

There are some convenience methods for generic password:

// Create generic password item with service, account, label, password, access group
item := keychain.NewGenericPassword("MyService", "gabriel", "A label", []byte("toomanysecrets"), "A123456789.group.com.mycorp")
item.SetSynchronizable(keychain.SynchronizableNo)
item.SetAccessible(keychain.AccessibleWhenUnlocked)
err := keychain.AddItem(item)
if err == keychain.ErrorDuplicateItem {
  // Duplicate
}

accounts, err := keychain.GetGenericPasswordAccounts("MyService")
// Should have 1 account == "gabriel"

err := keychain.DeleteGenericPasswordItem("MyService", "gabriel")
if err == keychain.ErrorNotFound {
  // Not found
}

OS X

Creating a new keychain and add an item to it:


// Add a new key chain into ~/Application Support/Keychains, with the provided password
k, err := keychain.NewKeychain("mykeychain.keychain", "my keychain password")
if err != nil {
  // Error creating
}

// Create generic password item with service, account, label, password, access group
item := keychain.NewGenericPassword("MyService", "gabriel", "A label", []byte("toomanysecrets"), "A123456789.group.com.mycorp")
item.UseKeychain(k)
err := keychain.AddItem(item)
if err != nil {
  // Error creating
}

Using a Keychain at path:

k, err := keychain.NewWithPath("mykeychain.keychain")

iOS

Bindable package in bind. iOS project in ios. Run that project to test iOS.

To re-generate framework:

(cd bind && gomobile bind -target=ios -tags=ios -o ../ios/bind.framework)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].