From 69ec86ae1b78798ac20423e0b836fba827f82036 Mon Sep 17 00:00:00 2001 From: Alex McLeod Date: Mon, 27 Jan 2020 21:29:35 -0800 Subject: [PATCH] Rename variables and functions to match Apple --- keychain.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/keychain.go b/keychain.go index 0a51103..419a1aa 100644 --- a/keychain.go +++ b/keychain.go @@ -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 @@ -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