StikDebug/StikJIT/Utilities/Security.swift
Stephen 5db5f49117
(WIP) Rewrite parts of the app in Swift and fix iOS 26.4 issues (#358)
* Rewrite parts of the app in Swift and fix iOS 26.4 issues (WIP)

* Add more PID stuff

* Improve location simulation

* whoops
2026-03-30 12:34:13 -04:00

28 lines
762 B
Swift

//
// Security.swift
// StikJIT
// from MeloNX
// Created by s s on 2025/4/6.
//
import Foundation
import Security
typealias SecTaskRef = OpaquePointer
@_silgen_name("SecTaskCopyValueForEntitlement")
func SecTaskCopyValueForEntitlement(
_ task: SecTaskRef,
_ entitlement: CFString,
_ error: UnsafeMutablePointer<Unmanaged<CFError>?>?
) -> CFTypeRef?
@_silgen_name("SecTaskCreateFromSelf")
func SecTaskCreateFromSelf(
_ allocator: CFAllocator?
) -> SecTaskRef?
func checkAppEntitlement(_ ent: String) -> Bool {
guard let task = SecTaskCreateFromSelf(nil) else { return false }
guard let value = SecTaskCopyValueForEntitlement(task, ent as CFString, nil) else { return false }
return value.boolValue != nil && value.boolValue
}