IOSAD-172 Separate method for checking expiry IOSAD-172
authorDirk Zimmermann <dz@pep.security>
Mon, 29 Jun 2020 16:39:43 +0200
branchIOSAD-172
changeset 152931d653b765af
parent 1528 32e6a448a551
child 1530 9947a905a79d
IOSAD-172 Separate method for checking expiry
pEpObjCAdapter/PEPPassphraseCache.m
     1.1 --- a/pEpObjCAdapter/PEPPassphraseCache.m	Mon Jun 29 16:39:43 2020 +0200
     1.2 +++ b/pEpObjCAdapter/PEPPassphraseCache.m	Mon Jun 29 16:39:43 2020 +0200
     1.3 @@ -139,4 +139,17 @@
     1.4      });
     1.5  }
     1.6  
     1.7 +- (BOOL)isExpiredPassphraseEntry:(PEPPassphraseCacheEntry *)passphraseEntry
     1.8 +{
     1.9 +    NSDate *now = [NSDate date];
    1.10 +    NSDate *minimum = [now dateByAddingTimeInterval:-self.timeout];
    1.11 +    NSTimeInterval minimumTimeInterval = [minimum timeIntervalSinceReferenceDate];
    1.12 +
    1.13 +    if ([passphraseEntry.dateAdded timeIntervalSinceReferenceDate] < minimumTimeInterval) {
    1.14 +        return YES;
    1.15 +    }
    1.16 +
    1.17 +    return NO;
    1.18 +}
    1.19 +
    1.20  @end