Skip to content

Commit

Permalink
Rename variables and functions to match Apple
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-mcleod committed Jan 28, 2020
1 parent 9ab73c4 commit 69ec86a
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions keychain.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,20 +191,20 @@ var syncTypeRef = map[Synchronizable]C.CFTypeRef{
}

// DataProtection is the items data protection status
type DataProtection int
type UseDataProtectionKeychain int

const (
// DataProtectionYes enables data protection mode
DataProtectionYes = 1
// DataProtectionNo disables data protection mode
DataProtectionNo = 2
// UseDataProtectionKeychainYes enables data protection mode
UseDataProtectionKeychainYes = 1
// UseDataProtectionKeychainNo disables data protection mode
UseDataProtectionKeychainNo = 2
)

// DataProtectionKey is the key type for DataProtection
var DataProtectionKey = attrKey(C.CFTypeRef(C.kSecUseDataProtectionKeychain))
var dataProtectionTypeRef = map[DataProtection]C.CFTypeRef{
DataProtectionYes: C.CFTypeRef(C.kCFBooleanTrue),
DataProtectionNo: C.CFTypeRef(C.kCFBooleanFalse),
var UseDataProtectionKey = attrKey(C.CFTypeRef(C.kSecUseDataProtectionKeychain))
var dataProtectionTypeRef = map[UseDataProtectionKeychain]C.CFTypeRef{
UseDataProtectionKeychainYes: C.CFTypeRef(C.kCFBooleanTrue),
UseDataProtectionKeychainNo: C.CFTypeRef(C.kCFBooleanFalse),
}

// Accessible is the items accessibility
Expand Down Expand Up @@ -321,8 +321,8 @@ func (k *Item) SetSynchronizable(sync Synchronizable) {
}

// SetSynchronizable sets the synchronizable attribute
func (k *Item) SetKeychainDataProtection(dataProtection DataProtection) {
k.attr[DataProtectionKey] = dataProtectionTypeRef[dataProtection]
func (k *Item) SetUseDataProtectionKeychain(dataProtection UseDataProtectionKeychain) {
k.attr[UseDataProtectionKey] = dataProtectionTypeRef[dataProtection]
}

// SetAccessible sets the accessible attribute
Expand Down

0 comments on commit 69ec86a

Please sign in to comment.