@@ -128,6 +128,7 @@ pub struct ItemSearchOptions {
128
128
keychains : Option < CFArray < SecKeychain > > ,
129
129
#[ cfg( not( target_os = "macos" ) ) ]
130
130
keychains : Option < CFArray < CFType > > ,
131
+ ignore_legacy_keychains : bool , // defined everywhere, only consulted on macOS
131
132
case_insensitive : Option < bool > ,
132
133
class : Option < ItemClass > ,
133
134
key_class : Option < KeyClass > ,
@@ -157,6 +158,12 @@ impl crate::ItemSearchOptionsInternals for ItemSearchOptions {
157
158
self . keychains = Some ( CFArray :: from_CFTypes ( keychains) ) ;
158
159
self
159
160
}
161
+
162
+ #[ inline]
163
+ fn ignore_legacy_keychains ( & mut self ) -> & mut Self {
164
+ self . ignore_legacy_keychains = true ;
165
+ self
166
+ }
160
167
}
161
168
162
169
impl ItemSearchOptions {
@@ -340,6 +347,15 @@ impl ItemSearchOptions {
340
347
& keychains. as_CFType ( ) . to_void ( ) ,
341
348
) ;
342
349
}
350
+ else {
351
+ if self . ignore_legacy_keychains {
352
+ #[ cfg( all( target_os = "macos" , feature = "OSX_10_15" ) ) ]
353
+ params. add (
354
+ & kSecUseDataProtectionKeychain. to_void ( ) ,
355
+ & CFBoolean :: true_value ( ) . to_void ( ) ,
356
+ )
357
+ }
358
+ }
343
359
344
360
if let Some ( class) = self . class {
345
361
params. add ( & kSecClass. to_void ( ) , & class. 0 . to_void ( ) ) ;
0 commit comments