Merge nucleic/upbeat-slate-lemur-7euo into dev

This commit is contained in:
2026-07-17 22:21:12 -07:00
parent 1fc4c32097
commit 608e7d0450
5 changed files with 44 additions and 19 deletions
@@ -22,6 +22,15 @@ import Foundation
#endif
import Security // [Nucleic vendored patch] SecKeychain*UserInteractionAllowed for prompt-free reads
// [Nucleic vendored patch] `SecKeychainGet/SetUserInteractionAllowed` are formally deprecated but
// remain the ONLY API that suppresses the legacy Keychain ACL panel. Bind the C symbols directly —
// the deprecation rides on their Swift imports, not the raw symbols — so `withoutInteractiveUI`
// compiles without deprecation warnings. Mirrors `KeychainOwnedAccess` in NucleicCore.
@_silgen_name("SecKeychainGetUserInteractionAllowed")
private func nucleic_SecKeychainGetUserInteractionAllowed(_ state: UnsafeMutablePointer<DarwinBoolean>) -> OSStatus
@_silgen_name("SecKeychainSetUserInteractionAllowed")
private func nucleic_SecKeychainSetUserInteractionAllowed(_ state: DarwinBoolean) -> OSStatus
/// Holds the result of a query to the keychain.
public struct KeychainQueryResult {
public var username: String
@@ -260,9 +269,9 @@ public struct KeychainQuery {
/// `KeychainOwnedAccess.withoutLegacyKeychainUI` in NucleicCore.
private static func withoutInteractiveUI<T>(_ body: () -> T) -> T {
var previous = DarwinBoolean(true)
SecKeychainGetUserInteractionAllowed(&previous)
SecKeychainSetUserInteractionAllowed(false)
defer { SecKeychainSetUserInteractionAllowed(previous.boolValue) }
_ = nucleic_SecKeychainGetUserInteractionAllowed(&previous)
_ = nucleic_SecKeychainSetUserInteractionAllowed(false)
defer { _ = nucleic_SecKeychainSetUserInteractionAllowed(previous) }
return body()
}
}