Skip to content

Commit 1d526cf

Browse files
committed
[MOD] Add support for kSecUseDataProtectionKeychain
1 parent b561510 commit 1d526cf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

keychain.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ var syncTypeRef = map[Synchronizable]C.CFTypeRef{
209209
SynchronizableNo: C.CFTypeRef(C.kCFBooleanFalse),
210210
}
211211

212+
var DataProtectionKey = attrKey(C.CFTypeRef(C.kSecUseDataProtectionKeychain))
213+
var dataProtectionYes = C.CFTypeRef(C.kCFBooleanTrue)
214+
212215
// Accessible is the items accessibility
213216
type Accessible int
214217

@@ -362,6 +365,10 @@ func (k *Item) SetSynchronizable(sync Synchronizable) {
362365
}
363366
}
364367

368+
func (key *Item) SetDataProtection() {
369+
key.attr[DataProtectionKey] = dataProtectionYes
370+
}
371+
365372
// SetAccessible sets the accessible attribute
366373
func (k *Item) SetAccessible(accessible Accessible) {
367374
if accessible != AccessibleDefault {

0 commit comments

Comments
 (0)