mirror of
https://github.com/maxgoedjen/secretive.git
synced 2025-09-15 08:50:57 +00:00
WIP
This commit is contained in:
parent
45f6d43bb5
commit
ce4af2deca
@ -22,9 +22,6 @@ let package = Package(
|
|||||||
.library(
|
.library(
|
||||||
name: "SecretAgentKit",
|
name: "SecretAgentKit",
|
||||||
targets: ["SecretAgentKit", "XPCWrappers"]),
|
targets: ["SecretAgentKit", "XPCWrappers"]),
|
||||||
.library(
|
|
||||||
name: "SecretAgentKitHeaders",
|
|
||||||
targets: ["SecretAgentKitHeaders"]),
|
|
||||||
.library(
|
.library(
|
||||||
name: "Brief",
|
name: "Brief",
|
||||||
targets: ["Brief"]),
|
targets: ["Brief"]),
|
||||||
@ -60,13 +57,10 @@ let package = Package(
|
|||||||
),
|
),
|
||||||
.target(
|
.target(
|
||||||
name: "SecretAgentKit",
|
name: "SecretAgentKit",
|
||||||
dependencies: ["SecretKit", "SecretAgentKitHeaders"],
|
dependencies: ["SecretKit"],
|
||||||
resources: [localization],
|
resources: [localization],
|
||||||
swiftSettings: swiftSettings,
|
swiftSettings: swiftSettings,
|
||||||
),
|
),
|
||||||
.systemLibrary(
|
|
||||||
name: "SecretAgentKitHeaders",
|
|
||||||
),
|
|
||||||
.testTarget(
|
.testTarget(
|
||||||
name: "SecretAgentKitTests",
|
name: "SecretAgentKitTests",
|
||||||
dependencies: ["SecretAgentKit"],
|
dependencies: ["SecretAgentKit"],
|
||||||
@ -83,7 +77,7 @@ let package = Package(
|
|||||||
),
|
),
|
||||||
.target(
|
.target(
|
||||||
name: "XPCWrappers",
|
name: "XPCWrappers",
|
||||||
swiftSettings: swiftSettings,
|
swiftSettings: swiftSettings + [.treatWarning("DeprecatedDeclaration", as: .warning)],
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@ -2,7 +2,15 @@ import Foundation
|
|||||||
import AppKit
|
import AppKit
|
||||||
import Security
|
import Security
|
||||||
import SecretKit
|
import SecretKit
|
||||||
import SecretAgentKitHeaders
|
//import SecretAgentKitHeaders
|
||||||
|
|
||||||
|
// from libproc.h
|
||||||
|
@_silgen_name("proc_pidpath")
|
||||||
|
@discardableResult func proc_pidpath(_ pid: Int32, _ buffer: UnsafeMutableRawPointer!, _ buffersize: UInt32) -> Int32
|
||||||
|
|
||||||
|
//// from SecTask.h
|
||||||
|
@_silgen_name("SecCodeCreateWithPID")
|
||||||
|
@discardableResult func SecCodeCreateWithPID(_: Int32, _: SecCSFlags, _: UnsafeMutablePointer<Unmanaged<SecCode>?>!) -> OSStatus
|
||||||
|
|
||||||
/// An object responsible for generating ``SecretKit.SigningRequestProvenance`` objects.
|
/// An object responsible for generating ``SecretKit.SigningRequestProvenance`` objects.
|
||||||
struct SigningRequestTracer {
|
struct SigningRequestTracer {
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <Security/Security.h>
|
|
||||||
|
|
||||||
|
|
||||||
// Forward declarations
|
|
||||||
|
|
||||||
// from libproc.h
|
|
||||||
int proc_pidpath(int pid, void * buffer, uint32_t buffersize);
|
|
||||||
|
|
||||||
// from SecTask.h
|
|
||||||
OSStatus SecCodeCreateWithPID(int32_t, SecCSFlags, SecCodeRef *);
|
|
||||||
|
|
||||||
//! Project version number for SecretAgentKit.
|
|
||||||
FOUNDATION_EXPORT double SecretAgentKitVersionNumber;
|
|
||||||
|
|
||||||
//! Project version string for SecretAgentKit.
|
|
||||||
FOUNDATION_EXPORT const unsigned char SecretAgentKitVersionString[];
|
|
||||||
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
|||||||
module SecretAgentKitHeaders [system] {
|
|
||||||
header "include/SecretAgentKit.h"
|
|
||||||
export *
|
|
||||||
}
|
|
@ -1,15 +1,32 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
import XPC
|
||||||
|
|
||||||
|
@_silgen_name("xpc_session_set_peer_code_signing_requirement")
|
||||||
|
func xpc_session_set_peer_code_signing_requirement(_ session: Any, _ requirement: UnsafePointer<CChar>) -> Int32
|
||||||
|
|
||||||
public struct XPCTypedSession<ResponseType: Codable & Sendable, ErrorType: Error & Codable>: Sendable {
|
public struct XPCTypedSession<ResponseType: Codable & Sendable, ErrorType: Error & Codable>: Sendable {
|
||||||
|
|
||||||
private let session: XPCSession
|
private let session: XPCSession
|
||||||
|
|
||||||
public init(serviceName: String, warmup: Bool = false) throws {
|
public init(serviceName: String, warmup: Bool = false) throws {
|
||||||
if #available(macOS 26.0, *) {
|
// if #available(macOS 26.0, *) {
|
||||||
session = try XPCSession(xpcService: serviceName, requirement: .isFromSameTeam())
|
// session = try XPCSession(xpcService: serviceName, requirement: .isFromSameTeam())
|
||||||
} else {
|
// } else {
|
||||||
session = try XPCSession(xpcService: serviceName)
|
session = try XPCSession(xpcService: serviceName, options: .inactive)
|
||||||
|
let test = Mirror(reflecting: session)
|
||||||
|
for case let (label?, value) in test.children {
|
||||||
|
if label == "_session" {
|
||||||
|
print("HIT")
|
||||||
|
"anchor apple".utf8CString.withUnsafeBufferPointer { x in
|
||||||
|
_ = xpc_session_set_peer_code_signing_requirement(
|
||||||
|
value,
|
||||||
|
x.baseAddress!
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// try session.activate()
|
||||||
|
// }
|
||||||
if warmup {
|
if warmup {
|
||||||
Task { [self] in
|
Task { [self] in
|
||||||
_ = try? await send()
|
_ = try? await send()
|
||||||
|
Loading…
Reference in New Issue
Block a user