Skip to content

Commit

Permalink
[Auth] Use constants for 'supportsSecureCoding' implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ncooke3 committed Oct 29, 2024
1 parent a0ad239 commit 69f545f
Show file tree
Hide file tree
Showing 17 changed files with 17 additions and 33 deletions.
2 changes: 1 addition & 1 deletion FirebaseAuth/Sources/Swift/Auth/AuthDataResult.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ extension AuthDataResult: NSSecureCoding {}
private let kUserCodingKey = "user"
private let kCredentialCodingKey = "credential"

public static var supportsSecureCoding = true
public static let supportsSecureCoding = true

public func encode(with coder: NSCoder) {
coder.encode(user, forKey: kUserCodingKey)
Expand Down
4 changes: 1 addition & 3 deletions FirebaseAuth/Sources/Swift/Auth/AuthTokenResult.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ extension AuthTokenResult: NSSecureCoding {}

private static let kTokenKey = "token"

public static var supportsSecureCoding: Bool {
return true
}
public static let supportsSecureCoding = true

public func encode(with coder: NSCoder) {
coder.encode(token, forKey: AuthTokenResult.kTokenKey)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import Foundation

// MARK: Secure Coding

static var supportsSecureCoding = true
static let supportsSecureCoding = true

func encode(with coder: NSCoder) {
coder.encode(email, forKey: "email")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import Foundation

// MARK: Secure Coding

static var supportsSecureCoding = true
static let supportsSecureCoding = true

func encode(with coder: NSCoder) {
coder.encode(accessToken, forKey: "accessToken")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@

// MARK: Secure Coding

static var supportsSecureCoding = true
static let supportsSecureCoding = true

func encode(with coder: NSCoder) {
coder.encode(playerID, forKey: "playerID")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import Foundation

// MARK: Secure Coding

public static var supportsSecureCoding = true
public static let supportsSecureCoding = true

func encode(with coder: NSCoder) {
coder.encode(token, forKey: "token")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import Foundation

// MARK: Secure Coding

static var supportsSecureCoding = true
static let supportsSecureCoding = true

func encode(with coder: NSCoder) {
coder.encode(idToken, forKey: "idToken")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ import Foundation

// MARK: Secure Coding

public static var supportsSecureCoding: Bool = true
public static let supportsSecureCoding: Bool = true

public func encode(with coder: NSCoder) {
coder.encode(idToken, forKey: "IDToken")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import Foundation

// MARK: Secure Coding

public static var supportsSecureCoding = true
public static let supportsSecureCoding = true

public func encode(with coder: NSCoder) {
switch credentialKind {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import Foundation

// MARK: Secure Coding

static var supportsSecureCoding = true
static let supportsSecureCoding = true

func encode(with coder: NSCoder) {
coder.encode(token, forKey: "token")
Expand Down
4 changes: 1 addition & 3 deletions FirebaseAuth/Sources/Swift/MultiFactor/MultiFactor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,7 @@ import Foundation

private let kEnrolledFactorsCodingKey = "enrolledFactors"

public static var supportsSecureCoding: Bool {
true
}
public static let supportsSecureCoding = true

public func encode(with coder: NSCoder) {
coder.encode(enrolledFactors, forKey: kEnrolledFactorsCodingKey)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ class AuthAppCredential: NSObject, NSSecureCoding {
private static let kReceiptKey = "receipt"
private static let kSecretKey = "secret"

static var supportsSecureCoding: Bool {
true
}
static let supportsSecureCoding = true

required convenience init?(coder: NSCoder) {
guard let receipt = coder.decodeObject(of: NSString.self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@ class SecureTokenService: NSObject, NSSecureCoding {
private static let kAccessTokenKey = "accessToken"
private static let kAccessTokenExpirationDateKey = "accessTokenExpirationDate"

static var supportsSecureCoding: Bool {
true
}
static let supportsSecureCoding = true

required convenience init?(coder: NSCoder) {
guard let refreshToken = coder.decodeObject(of: [NSString.self],
Expand Down
4 changes: 1 addition & 3 deletions FirebaseAuth/Sources/Swift/User/AdditionalUserInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ extension AdditionalUserInfo: NSSecureCoding {}
private static let usernameCodingKey = "username"
private static let newUserKey = "newUser"

public static var supportsSecureCoding: Bool {
return true
}
public static let supportsSecureCoding = true

public required init?(coder aDecoder: NSCoder) {
guard let providerID = aDecoder.decodeObject(
Expand Down
4 changes: 1 addition & 3 deletions FirebaseAuth/Sources/Swift/User/User.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1680,9 +1680,7 @@ extension User: NSSecureCoding {}
private let kMultiFactorCodingKey = "multiFactor"
private let kTenantIDCodingKey = "tenantID"

public static var supportsSecureCoding: Bool {
return true
}
public static let supportsSecureCoding = true

public func encode(with coder: NSCoder) {
coder.encode(uid, forKey: kUserIDCodingKey)
Expand Down
4 changes: 1 addition & 3 deletions FirebaseAuth/Sources/Swift/User/UserInfoImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ extension UserInfoImpl: NSSecureCoding {}
private static let kEmailCodingKey = "email"
private static let kPhoneNumberCodingKey = "phoneNumber"

static var supportsSecureCoding: Bool {
return true
}
static let supportsSecureCoding = true

func encode(with coder: NSCoder) {
coder.encode(providerID, forKey: UserInfoImpl.kProviderIDCodingKey)
Expand Down
4 changes: 1 addition & 3 deletions FirebaseAuth/Sources/Swift/User/UserMetadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ extension UserMetadata: NSSecureCoding {}
private static let kCreationDateCodingKey = "creationDate"
private static let kLastSignInDateCodingKey = "lastSignInDate"

public static var supportsSecureCoding: Bool {
return true
}
public static let supportsSecureCoding = true

public func encode(with coder: NSCoder) {
coder.encode(creationDate, forKey: UserMetadata.kCreationDateCodingKey)
Expand Down

0 comments on commit 69f545f

Please sign in to comment.