File tree Expand file tree Collapse file tree 18 files changed +182
-11
lines changed Expand file tree Collapse file tree 18 files changed +182
-11
lines changed Original file line number Diff line number Diff line change @@ -2310,11 +2310,11 @@ - (void)getUserTokenResultWithForce:(BOOL)force {
2310
2310
}
2311
2311
2312
2312
/* * @fn getAppTokenWithForce:
2313
- @brief Gets the token from @c FIRApp , optionally a refreshed one.
2313
+ @brief Gets the token from @c FIRAuth , optionally a refreshed one.
2314
2314
@param force Whether the refresh is forced or not.
2315
2315
*/
2316
2316
- (void )getAppTokenWithForce : (BOOL )force {
2317
- [[FIRApp defaultApp ] getTokenForcingRefresh: force withCallback: [self tokenCallback ]];
2317
+ [[FIRAuth auth ] getTokenForcingRefresh: force withCallback: [self tokenCallback ]];
2318
2318
}
2319
2319
2320
2320
/* * @fn setDisplayName
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
23
23
/* * @class FIREmailPasswordAuthCredential
24
24
@brief Internal implementation of FIRAuthCredential for Email/Password credentials.
25
25
*/
26
- @interface FIREmailPasswordAuthCredential : FIRAuthCredential
26
+ @interface FIREmailPasswordAuthCredential : FIRAuthCredential < NSSecureCoding >
27
27
28
28
/* * @property email
29
29
@brief The user's email address.
Original file line number Diff line number Diff line change @@ -57,4 +57,30 @@ - (void)prepareVerifyAssertionRequest:(FIRVerifyAssertionRequest *)request {
57
57
@" Attempt to call prepareVerifyAssertionRequest: on a FIREmailPasswordAuthCredential." ];
58
58
}
59
59
60
+ #pragma mark - NSSecureCoding
61
+
62
+ + (BOOL )supportsSecureCoding {
63
+ return YES ;
64
+ }
65
+
66
+ - (nullable instancetype )initWithCoder : (NSCoder *)aDecoder {
67
+ NSString *email = [aDecoder decodeObjectOfClass: [NSString class ] forKey: @" email" ];
68
+ NSString *password = [aDecoder decodeObjectOfClass: [NSString class ] forKey: @" password" ];
69
+ NSString *link = [aDecoder decodeObjectOfClass: [NSString class ] forKey: @" link" ];
70
+ if (email.length && password.length ) {
71
+ self = [self initWithEmail: email password: password];
72
+ } else if (email.length && link.length ) {
73
+ self = [self initWithEmail: email link: link];
74
+ } else {
75
+ self = nil ;
76
+ }
77
+ return self;
78
+ }
79
+
80
+ - (void )encodeWithCoder : (NSCoder *)aCoder {
81
+ [aCoder encodeObject: self .email forKey: @" email" ];
82
+ [aCoder encodeObject: self .password forKey: @" password" ];
83
+ [aCoder encodeObject: self .link forKey: @" link" ];
84
+ }
85
+
60
86
@end
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
23
23
/* * @class FIRFacebookAuthCredential
24
24
@brief Internal implementation of FIRAuthCredential for the Facebook IdP.
25
25
*/
26
- @interface FIRFacebookAuthCredential : FIRAuthCredential
26
+ @interface FIRFacebookAuthCredential : FIRAuthCredential < NSSecureCoding >
27
27
28
28
/* * @fn initWithAccessToken:
29
29
@brief Designated initializer.
Original file line number Diff line number Diff line change @@ -48,4 +48,20 @@ - (void)prepareVerifyAssertionRequest:(FIRVerifyAssertionRequest *)request {
48
48
request.providerAccessToken = _accessToken;
49
49
}
50
50
51
+ #pragma mark - NSSecureCoding
52
+
53
+ + (BOOL )supportsSecureCoding {
54
+ return YES ;
55
+ }
56
+
57
+ - (nullable instancetype )initWithCoder : (NSCoder *)aDecoder {
58
+ NSString *accessToken = [aDecoder decodeObjectOfClass: [NSString class ] forKey: @" accessToken" ];
59
+ self = [self initWithAccessToken: accessToken];
60
+ return self;
61
+ }
62
+
63
+ - (void )encodeWithCoder : (NSCoder *)aCoder {
64
+ [aCoder encodeObject: _accessToken forKey: @" accessToken" ];
65
+ }
66
+
51
67
@end
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
23
23
/* * @class FIRGameCenterAuthCredential
24
24
@brief Internal implementation of FIRAuthCredential for Game Center credentials.
25
25
*/
26
- @interface FIRGameCenterAuthCredential : FIRAuthCredential
26
+ @interface FIRGameCenterAuthCredential : FIRAuthCredential < NSSecureCoding >
27
27
28
28
/* * @property playerID
29
29
@brief The ID of the Game Center local player.
Original file line number Diff line number Diff line change @@ -52,4 +52,35 @@ - (void)prepareVerifyAssertionRequest:(FIRVerifyAssertionRequest *)request {
52
52
@" Attempt to call prepareVerifyAssertionRequest: on a FIRGameCenterAuthCredential." ];
53
53
}
54
54
55
+ #pragma mark - NSSecureCoding
56
+
57
+ + (BOOL )supportsSecureCoding {
58
+ return YES ;
59
+ }
60
+
61
+ - (nullable instancetype )initWithCoder : (NSCoder *)aDecoder {
62
+ NSString *playerID = [aDecoder decodeObjectOfClass: [NSString class ] forKey: @" playerID" ];
63
+ NSURL *publicKeyURL = [aDecoder decodeObjectOfClass: [NSURL class ] forKey: @" publicKeyURL" ];
64
+ NSData *signature = [aDecoder decodeObjectOfClass: [NSData class ] forKey: @" signature" ];
65
+ NSData *salt = [aDecoder decodeObjectOfClass: [NSData class ] forKey: @" salt" ];
66
+ NSNumber *timestamp = [aDecoder decodeObjectOfClass: [NSNumber class ] forKey: @" timestamp" ];
67
+ NSString *displayName = [aDecoder decodeObjectOfClass: [NSString class ] forKey: @" displayName" ];
68
+ self = [self initWithPlayerID: playerID
69
+ publicKeyURL: publicKeyURL
70
+ signature: signature
71
+ salt: salt
72
+ timestamp: timestamp.unsignedLongLongValue
73
+ displayName: displayName];
74
+ return self;
75
+ }
76
+
77
+ - (void )encodeWithCoder : (NSCoder *)aCoder {
78
+ [aCoder encodeObject: self .playerID forKey: @" playerID" ];
79
+ [aCoder encodeObject: self .publicKeyURL forKey: @" publicKeyURL" ];
80
+ [aCoder encodeObject: self .signature forKey: @" signature" ];
81
+ [aCoder encodeObject: self .salt forKey: @" salt" ];
82
+ [aCoder encodeObject: [NSNumber numberWithUnsignedLongLong: self .timestamp] forKey: @" timestamp" ];
83
+ [aCoder encodeObject: self .displayName forKey: @" displayName" ];
84
+ }
85
+
55
86
@end
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
23
23
/* * @class FIRGitHubAuthCredential
24
24
@brief Internal implementation of FIRAuthCredential for GitHub credentials.
25
25
*/
26
- @interface FIRGitHubAuthCredential : FIRAuthCredential
26
+ @interface FIRGitHubAuthCredential : FIRAuthCredential < NSSecureCoding >
27
27
28
28
/* * @property token
29
29
@brief The GitHub OAuth access token.
Original file line number Diff line number Diff line change @@ -46,4 +46,20 @@ - (void)prepareVerifyAssertionRequest:(FIRVerifyAssertionRequest *)request {
46
46
request.providerAccessToken = _token;
47
47
}
48
48
49
+ #pragma mark - NSSecureCoding
50
+
51
+ + (BOOL )supportsSecureCoding {
52
+ return YES ;
53
+ }
54
+
55
+ - (nullable instancetype )initWithCoder : (NSCoder *)aDecoder {
56
+ NSString *token = [aDecoder decodeObjectOfClass: [NSString class ] forKey: @" token" ];
57
+ self = [self initWithToken: token];
58
+ return self;
59
+ }
60
+
61
+ - (void )encodeWithCoder : (NSCoder *)aCoder {
62
+ [aCoder encodeObject: self .token forKey: @" token" ];
63
+ }
64
+
49
65
@end
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
23
23
/* * @class FIRGoogleAuthCredential
24
24
@brief Internal implementation of FIRAuthCredential for the Google IdP.
25
25
*/
26
- @interface FIRGoogleAuthCredential : FIRAuthCredential
26
+ @interface FIRGoogleAuthCredential : FIRAuthCredential < NSSecureCoding >
27
27
28
28
/* * @fn initWithIDToken:accessToken:
29
29
@brief Designated initializer.
Original file line number Diff line number Diff line change @@ -51,4 +51,22 @@ - (void)prepareVerifyAssertionRequest:(FIRVerifyAssertionRequest *)request {
51
51
request.providerAccessToken = _accessToken;
52
52
}
53
53
54
+ #pragma mark - NSSecureCoding
55
+
56
+ + (BOOL )supportsSecureCoding {
57
+ return YES ;
58
+ }
59
+
60
+ - (nullable instancetype )initWithCoder : (NSCoder *)aDecoder {
61
+ NSString *IDToken = [aDecoder decodeObjectOfClass: [NSString class ] forKey: @" IDToken" ];
62
+ NSString *accessToken = [aDecoder decodeObjectOfClass: [NSString class ] forKey: @" accessToken" ];
63
+ self = [self initWithIDToken: IDToken accessToken: accessToken];
64
+ return self;
65
+ }
66
+
67
+ - (void )encodeWithCoder : (NSCoder *)aCoder {
68
+ [aCoder encodeObject: _IDToken forKey: @" IDToken" ];
69
+ [aCoder encodeObject: _accessToken forKey: @" accessToken" ];
70
+ }
71
+
54
72
@end
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
23
23
/* * @class FIROAuthCredential
24
24
@brief Internal implementation of FIRAuthCredential for generic credentials.
25
25
*/
26
- @interface FIROAuthCredential : FIRAuthCredential
26
+ @interface FIROAuthCredential : FIRAuthCredential < NSSecureCoding >
27
27
28
28
/* * @property IDToken
29
29
@brief The ID Token associated with this credential.
Original file line number Diff line number Diff line change @@ -44,6 +44,24 @@ - (void)prepareVerifyAssertionRequest:(FIRVerifyAssertionRequest *)request {
44
44
request.providerAccessToken = _accessToken;
45
45
}
46
46
47
+ #pragma mark - NSSecureCoding
48
+
49
+ + (BOOL )supportsSecureCoding {
50
+ return YES ;
51
+ }
52
+
53
+ - (nullable instancetype )initWithCoder : (NSCoder *)aDecoder {
54
+ NSString *IDToken = [aDecoder decodeObjectOfClass: [NSString class ] forKey: @" IDToken" ];
55
+ NSString *accessToken = [aDecoder decodeObjectOfClass: [NSString class ] forKey: @" accessToken" ];
56
+ self = [self initWithProviderID: self .provider IDToken: IDToken accessToken: accessToken];
57
+ return self;
58
+ }
59
+
60
+ - (void )encodeWithCoder : (NSCoder *)aCoder {
61
+ [aCoder encodeObject: self .IDToken forKey: @" IDToken" ];
62
+ [aCoder encodeObject: self .accessToken forKey: @" accessToken" ];
63
+ }
64
+
47
65
NS_ASSUME_NONNULL_END
48
66
49
67
@end
Original file line number Diff line number Diff line change @@ -59,6 +59,34 @@ - (instancetype)initWithProviderID:(NSString *)providerID
59
59
return self;
60
60
}
61
61
62
+ #pragma mark - NSSecureCoding
63
+
64
+ + (BOOL )supportsSecureCoding {
65
+ return YES ;
66
+ }
67
+
68
+ - (nullable instancetype )initWithCoder : (NSCoder *)aDecoder {
69
+ NSString *verificationID = [aDecoder decodeObjectOfClass: [NSString class ] forKey: @" verificationID" ];
70
+ NSString *verificationCode = [aDecoder decodeObjectOfClass: [NSString class ] forKey: @" verificationCode" ];
71
+ NSString *temporaryProof = [aDecoder decodeObjectOfClass: [NSString class ] forKey: @" temporaryProof" ];
72
+ NSString *phoneNumber = [aDecoder decodeObjectOfClass: [NSString class ] forKey: @" phoneNumber" ];
73
+ if (temporaryProof.length && phoneNumber.length ) {
74
+ self = [self initWithTemporaryProof: temporaryProof phoneNumber: phoneNumber providerID: self .provider];
75
+ } else if (verificationID.length && verificationCode.length ) {
76
+ self = [self initWithProviderID: self .provider verificationID: verificationID verificationCode: verificationCode];
77
+ } else {
78
+ self = nil ;
79
+ }
80
+ return self;
81
+ }
82
+
83
+ - (void )encodeWithCoder : (NSCoder *)aCoder {
84
+ [aCoder encodeObject: self .verificationID forKey: @" verificationID" ];
85
+ [aCoder encodeObject: self .verificationCode forKey: @" verificationCode" ];
86
+ [aCoder encodeObject: self .temporaryProof forKey: @" temporaryProof" ];
87
+ [aCoder encodeObject: self .phoneNumber forKey: @" phoneNumber" ];
88
+ }
89
+
62
90
@end
63
91
64
92
NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
23
23
/* * @class FIRTwitterAuthCredential
24
24
@brief Internal implementation of FIRAuthCredential for Twitter credentials.
25
25
*/
26
- @interface FIRTwitterAuthCredential : FIRAuthCredential
26
+ @interface FIRTwitterAuthCredential : FIRAuthCredential < NSSecureCoding >
27
27
28
28
/* * @property token
29
29
@brief The Twitter OAuth token.
Original file line number Diff line number Diff line change @@ -48,4 +48,22 @@ - (void)prepareVerifyAssertionRequest:(FIRVerifyAssertionRequest *)request {
48
48
request.providerOAuthTokenSecret = _secret;
49
49
}
50
50
51
+ #pragma mark - NSSecureCoding
52
+
53
+ + (BOOL )supportsSecureCoding {
54
+ return YES ;
55
+ }
56
+
57
+ - (nullable instancetype )initWithCoder : (NSCoder *)aDecoder {
58
+ NSString *token = [aDecoder decodeObjectOfClass: [NSString class ] forKey: @" token" ];
59
+ NSString *secret = [aDecoder decodeObjectOfClass: [NSString class ] forKey: @" secret" ];
60
+ self = [self initWithToken: token secret: secret];
61
+ return self;
62
+ }
63
+
64
+ - (void )encodeWithCoder : (NSCoder *)aCoder {
65
+ [aCoder encodeObject: self .token forKey: @" token" ];
66
+ [aCoder encodeObject: self .secret forKey: @" secret" ];
67
+ }
68
+
51
69
@end
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ @implementation FIRAuthCredential
21
21
- (instancetype )init {
22
22
@throw [NSException exceptionWithName: @" Attempt to call unavailable initializer."
23
23
reason: @" This class is an abstract base class. It's init method "
24
- " should not be called directly."
24
+ " should not be called directly."
25
25
userInfo: nil ];
26
26
}
27
27
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
24
24
@brief Implementation of FIRAuthCredential for Phone Auth credentials.
25
25
*/
26
26
NS_SWIFT_NAME (PhoneAuthCredential)
27
- @interface FIRPhoneAuthCredential : FIRAuthCredential
27
+ @interface FIRPhoneAuthCredential : FIRAuthCredential <NSSecureCoding>
28
28
29
29
/* * @fn init
30
30
@brief This class is not supposed to be instantiated directly.
You can’t perform that action at this time.
0 commit comments