Hello,
I am creating CryptotokenKit persistent token extension for macOS using Xcode on Sonoma. The goal is to support external crypto provider over network (with API calls).
I created a bare minimum app and a new target “Persistent Token Extension”. Before I go into specific implementation, I wanted to check if my extension/token initialises correctly. My understanding is that once the host app is started and the extension is registered by the OS, future queries for digital identities should check with it as well.
I tried is accessing mTLS website with Safari and Firefox that require client certificates, as well running custom application using SecItemCopyMatching
to query the keychain for identities.
However, Token / TokenDriver seem to not initialize (logging never executes). Am I missing something here?
pluginkit sees the extension:
$ pluginkit -vvvvmi demo.TokenApp.TokenExt
demo.TokenApp.TokenExt(1.0)
Path = /Users/alexander/Library/Developer/Xcode/DerivedData/TokenApp-dzulesgoanwnacguirprimnipibk/Build/Intermediates.noindex/Previews/TokenApp/Products/Debug/TokenApp.app/Contents/PlugIns/TokenExt.appex
UUID = 617526E8-987A-493F-A9E3-6295FF5AB00D
Timestamp = 2024-01-19 13:13:35 +0000
SDK = com.apple.ctk-tokens
Parent Bundle = /Users/alexander/Library/Developer/Xcode/DerivedData/TokenApp-dzulesgoanwnacguirprimnipibk/Build/Intermediates.noindex/Previews/TokenApp/Products/Debug/TokenApp.app
Display Name = TokenExt
Short Name = TokenExt
Parent Name = TokenApp
Platform = macOS
Token.swift:
import CryptoTokenKit
import OSLog
class Token: TKToken, TKTokenDelegate {
private let log = Logger(subsystem: "demo.tokenapp", category: "Token");
func createSession(_ token: TKToken) throws -> TKTokenSession {
log.log(level: .info, "Token.createSession")
return TokenSession(token:self)
}
}
TokenDriver.swift:
import CryptoTokenKit
import OSLog
class TokenDriver: TKTokenDriver, TKTokenDriverDelegate {
private let log = Logger(subsystem: "demo.tokenapp", category: "TokenDriver");
func tokenDriver(_ driver: TKTokenDriver, tokenFor configuration: TKToken.Configuration) throws -> TKToken {
log.log(level: .info, "TokenDriver.tokenDriver")
return Token(tokenDriver: self, instanceID: configuration.instanceID)
}
}