Files
app-check/AppCheckCore/Sources/Core/AppCheckCoreTokenResult.swift
T

45 lines
1.5 KiB
Swift
Raw Normal View History

2026-09-23 15:22:08 -07:00
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import Foundation
private let kPlaceholderTokenValue = "eyJlcnJvciI6IlVOS05PV05fRVJST1IifQ=="
@objc(GACAppCheckTokenResult)
public final class AppCheckCoreTokenResult: NSObject, @unchecked Sendable {
@objc public let token: AppCheckCoreToken
@objc public let error: Error?
@objc(initWithToken:error:)
public init(token: AppCheckCoreToken, error: Error?) {
self.token = token
self.error = error
super.init()
}
@objc(initWithToken:)
public convenience init(token: AppCheckCoreToken) {
self.init(token: token, error: nil)
}
@objc(initWithError:)
public convenience init(error: Error) {
let placeholder = AppCheckCoreTokenResult.placeholderToken()
self.init(token: placeholder, error: error)
}
public static func placeholderToken() -> AppCheckCoreToken {
return AppCheckCoreToken(token: kPlaceholderTokenValue, expirationDate: Date.distantPast)
}
}