File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed
FirebaseAuth/Sources/MultiFactor Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -179,8 +179,7 @@ - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder {
179
179
self = [self init ];
180
180
if (self) {
181
181
NSArray <FIRMultiFactorInfo *> *enrolledFactors =
182
- [aDecoder decodeObjectOfClass: [NSArray <FIRMultiFactorInfo *> class]
183
- forKey: kEnrolledFactorsCodingKey ];
182
+ [aDecoder decodeObjectForKey: kEnrolledFactorsCodingKey ];
184
183
_enrolledFactors = enrolledFactors;
185
184
_user = [aDecoder decodeObjectOfClass: [FIRUser class ] forKey: kUserCodingKey ];
186
185
}
Original file line number Diff line number Diff line change @@ -30,6 +30,14 @@ NS_ASSUME_NONNULL_BEGIN
30
30
31
31
- (instancetype )initWithProto : (FIRAuthProtoMFAEnrollment *)proto ;
32
32
33
+ #pragma mark - NSSecureCoding
34
+ // Note that we're not able to indicate FIRMultiFactorInfo conforming to NSSecureCoding in an
35
+ // internal header file, so the following NSSecureCoding methods are explicitly declared.
36
+
37
+ - (nullable instancetype )initWithCoder : (NSCoder *)aDecoder ;
38
+
39
+ - (void )encodeWithCoder : (NSCoder *)aCoder ;
40
+
33
41
@end
34
42
35
43
NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change 23
23
#import " FirebaseAuth/Sources/Backend/RPC/Proto/FIRAuthProtoMFAEnrollment.h"
24
24
#import " FirebaseAuth/Sources/MultiFactor/FIRMultiFactorInfo+Internal.h"
25
25
26
+ static NSString *kPhoneNumberCodingKey = @" phoneNumber" ;
27
+
26
28
extern NSString *const FIRPhoneMultiFactorID;
27
29
28
30
@implementation FIRPhoneMultiFactorInfo
@@ -36,6 +38,25 @@ - (instancetype)initWithProto:(FIRAuthProtoMFAEnrollment *)proto {
36
38
return self;
37
39
}
38
40
41
+ #pragma mark - NSSecureCoding
42
+
43
+ + (BOOL )supportsSecureCoding {
44
+ return YES ;
45
+ }
46
+
47
+ - (nullable instancetype )initWithCoder : (NSCoder *)aDecoder {
48
+ self = [super initWithCoder: aDecoder];
49
+ if (self) {
50
+ _phoneNumber = [aDecoder decodeObjectOfClass: [NSString class ] forKey: kPhoneNumberCodingKey ];
51
+ }
52
+ return self;
53
+ }
54
+
55
+ - (void )encodeWithCoder : (NSCoder *)aCoder {
56
+ [super encodeWithCoder: aCoder];
57
+ [aCoder encodeObject: _phoneNumber forKey: kPhoneNumberCodingKey ];
58
+ }
59
+
39
60
@end
40
61
41
62
#endif
You can’t perform that action at this time.
0 commit comments