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
|
|
|
|
|
|
|
|
|
|
@objc(GACAppCheckToken)
|
|
|
|
|
public class AppCheckCoreToken: NSObject, @unchecked Sendable {
|
|
|
|
|
@objc public let token: String
|
|
|
|
|
@objc public let expirationDate: Date
|
|
|
|
|
@objc public let receivedAtDate: Date
|
|
|
|
|
|
2026-11-06 13:38:26 -05:00
|
|
|
/// Creates an App Check token.
|
|
|
|
|
/// - Parameters:
|
|
|
|
|
/// - token: A Firebase App Check token string.
|
|
|
|
|
/// - expirationDate: The token's expiration date in the device's local clock time.
|
|
|
|
|
/// - receivedAtDate: The date the token was received in the device's local clock time.
|
2026-09-23 15:22:08 -07:00
|
|
|
@objc(initWithToken:expirationDate:receivedAtDate:)
|
|
|
|
|
public init(token: String, expirationDate: Date, receivedAt receivedAtDate: Date) {
|
|
|
|
|
self.token = token
|
|
|
|
|
self.expirationDate = expirationDate
|
|
|
|
|
self.receivedAtDate = receivedAtDate
|
|
|
|
|
super.init()
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-06 13:38:26 -05:00
|
|
|
/// Creates an App Check token.
|
|
|
|
|
/// - Parameters:
|
|
|
|
|
/// - token: A Firebase App Check token string.
|
|
|
|
|
/// - expirationDate: The token's expiration date in the device's local clock time.
|
2026-09-23 15:22:08 -07:00
|
|
|
@objc(initWithToken:expirationDate:)
|
|
|
|
|
public convenience init(token: String, expirationDate: Date) {
|
|
|
|
|
self.init(token: token, expirationDate: expirationDate, receivedAt: Date())
|
|
|
|
|
}
|
|
|
|
|
}
|