19 lines · 716 B · Swift
RawDownload
import Foundation #if os(macOS)import LocalAuthenticationimport Security enum KeychainNoUIQuery {    static func apply(to query: inout [String: Any]) {        let context = LAContext()        context.interactionNotAllowed = true        query[kSecUseAuthenticationContext as String] = context         // NOTE: While Apple recommends using LAContext.interactionNotAllowed, that alone is not sufficient to        // prevent the legacy keychain "Allow/Deny" prompt on some configurations. We also set the UI policy to fail        // so SecItemCopyMatching returns errSecInteractionNotAllowed instead of showing UI.        query[kSecUseAuthenticationUI as String] = kSecUseAuthenticationUIFail    }}#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t