Skip to content

Commit

Permalink
Custom keychain management is no longer supported (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshblum committed Nov 19, 2021
1 parent 9505f25 commit 5d323af
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 445 deletions.
27 changes: 0 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,33 +112,6 @@ if err == keychain.ErrorNotFound {
}
```

### OS X

Creating a new keychain and add an item to it:

```go

// 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:

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

## iOS

Bindable package in `bind`. iOS project in `ios`. Run that project to test iOS.
Expand Down
15 changes: 15 additions & 0 deletions keychain.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build darwin
// +build darwin

package keychain
Expand All @@ -18,6 +19,20 @@ import (
"time"
)

// AccessibleKey is key for kSecAttrAccessible
var AccessibleKey = attrKey(C.CFTypeRef(C.kSecAttrAccessible))
var accessibleTypeRef = map[Accessible]C.CFTypeRef{
AccessibleWhenUnlocked: C.CFTypeRef(C.kSecAttrAccessibleWhenUnlocked),
AccessibleAfterFirstUnlock: C.CFTypeRef(C.kSecAttrAccessibleAfterFirstUnlock),
AccessibleAlways: C.CFTypeRef(C.kSecAttrAccessibleAlways),
AccessibleWhenUnlockedThisDeviceOnly: C.CFTypeRef(C.kSecAttrAccessibleWhenUnlockedThisDeviceOnly),
AccessibleAfterFirstUnlockThisDeviceOnly: C.CFTypeRef(C.kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly),
AccessibleAccessibleAlwaysThisDeviceOnly: C.CFTypeRef(C.kSecAttrAccessibleAlwaysThisDeviceOnly),

// Only available in 10.10
//AccessibleWhenPasscodeSetThisDeviceOnly: C.CFTypeRef(C.kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly),
}

// Error defines keychain errors
type Error int

Expand Down
184 changes: 0 additions & 184 deletions macos.go

This file was deleted.

Loading

0 comments on commit 5d323af

Please sign in to comment.