diff --git a/src/home/mod.rs b/src/home/mod.rs index 54d4e13..a3aea0d 100644 --- a/src/home/mod.rs +++ b/src/home/mod.rs @@ -29,6 +29,7 @@ impl Home { self.0.join("config.yml") } + #[cfg(target_os = "windows")] pub fn keys(&self) -> PathBuf { self.0.join("keys") } diff --git a/src/key/store/default.m b/src/key/store/default.m index 00932ac..22aec5f 100644 --- a/src/key/store/default.m +++ b/src/key/store/default.m @@ -7,6 +7,7 @@ int default_store_store_key(const UInt8 *id, const UInt8 *key, const char *tag) CFMutableDictionaryRef attrs; CFDataRef bin; CFStringRef str; + SecAccessControlRef access; OSStatus status; // Setup attributes, @@ -33,9 +34,12 @@ int default_store_store_key(const UInt8 *id, const UInt8 *key, const char *tag) CFDictionarySetValue(attrs, kSecAttrIsPermanent, kCFBooleanTrue); CFDictionarySetValue(attrs, kSecAttrSynchronizable, kCFBooleanTrue); CFDictionarySetValue(attrs, kSecUseDataProtectionKeychain, kCFBooleanTrue); - CFDictionarySetValue(attrs, kSecAttrAccessible, kSecAttrAccessibleAfterFirstUnlock); CFDictionarySetValue(attrs, kSecAttrKeyClass, kSecAttrKeyClassSymmetric); + access = SecAccessControlCreateWithFlags(NULL, kSecAttrAccessibleWhenUnlocked, kSecAccessControlUserPresence, NULL); + CFDictionarySetValue(attrs, kSecAttrAccessControl, access); + CFRelease(access); + // Store key. status = SecItemAdd(attrs, nil); CFRelease(attrs);