Expand onboarding and adaptive keyboard intelligence
Add resilient usage analytics, OOBE gateway flows, clipboard semantic ranking, purchase recovery, style learning, and managed current-information search.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
// OOBEGrantProvisioningCoordinator.swift
|
||||
// OSGKeyboard · HostSupport
|
||||
//
|
||||
// Provisions anonymous, App-Attest-bound OOBE credentials without creating or
|
||||
// mutating an AccountSession.
|
||||
|
||||
import Foundation
|
||||
import OSGKeyboardShared
|
||||
|
||||
public actor OOBEGrantProvisioningCoordinator {
|
||||
private let apiClient: AccountAPIClient
|
||||
private let integrity: DeviceIntegrityCoordinator
|
||||
private let installationIDs: any OOBEInstallationIDStoring
|
||||
private let grants: OOBEGatewayGrantCoordinator
|
||||
|
||||
public init(
|
||||
apiClient: AccountAPIClient,
|
||||
integrity: DeviceIntegrityCoordinator,
|
||||
installationIDs: any OOBEInstallationIDStoring,
|
||||
grants: OOBEGatewayGrantCoordinator = OOBEGatewayGrantCoordinator()
|
||||
) {
|
||||
self.apiClient = apiClient
|
||||
self.integrity = integrity
|
||||
self.installationIDs = installationIDs
|
||||
self.grants = grants
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
public func provision() async throws -> ManagedGatewayGrantCredentials {
|
||||
let installationID = try await installationIDs.oobeInstallationID()
|
||||
let request = try await integrity.makeOOBEGrantRequest(
|
||||
installationID: installationID
|
||||
)
|
||||
let credentials = try await apiClient.requestOOBEGrant(request)
|
||||
try await grants.install(credentials)
|
||||
return credentials
|
||||
}
|
||||
|
||||
public func clear() async {
|
||||
try? await grants.clearGrant()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user