Skip to content

Commit

Permalink
Replaces kSecAttrAccessible with kSecAttrAccessControl
Browse files Browse the repository at this point in the history
  • Loading branch information
ultimaweapon committed Apr 29, 2024
1 parent 1ba39f4 commit 252e7ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/home/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ impl Home {
self.0.join("config.yml")
}

#[cfg(target_os = "windows")]
pub fn keys(&self) -> PathBuf {
self.0.join("keys")
}
Expand Down
6 changes: 5 additions & 1 deletion src/key/store/default.m
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down

0 comments on commit 252e7ae

Please sign in to comment.