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 {
179179 self = [self init ];
180180 if (self) {
181181 NSArray <FIRMultiFactorInfo *> *enrolledFactors =
182- [aDecoder decodeObjectOfClass: [NSArray <FIRMultiFactorInfo *> class]
183- forKey: kEnrolledFactorsCodingKey ];
182+ [aDecoder decodeObjectForKey: kEnrolledFactorsCodingKey ];
184183 _enrolledFactors = enrolledFactors;
185184 _user = [aDecoder decodeObjectOfClass: [FIRUser class ] forKey: kUserCodingKey ];
186185 }
Original file line number Diff line number Diff line change @@ -30,6 +30,14 @@ NS_ASSUME_NONNULL_BEGIN
3030
3131- (instancetype )initWithProto : (FIRAuthProtoMFAEnrollment *)proto ;
3232
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+
3341@end
3442
3543NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change 2323#import " FirebaseAuth/Sources/Backend/RPC/Proto/FIRAuthProtoMFAEnrollment.h"
2424#import " FirebaseAuth/Sources/MultiFactor/FIRMultiFactorInfo+Internal.h"
2525
26+ static NSString *kPhoneNumberCodingKey = @" phoneNumber" ;
27+
2628extern NSString *const FIRPhoneMultiFactorID;
2729
2830@implementation FIRPhoneMultiFactorInfo
@@ -36,6 +38,25 @@ - (instancetype)initWithProto:(FIRAuthProtoMFAEnrollment *)proto {
3638 return self;
3739}
3840
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+
3960@end
4061
4162#endif
You can’t perform that action at this time.
0 commit comments