iOS web browser with a focus on security and privacy
1/*
2 * Endless
3 * Copyright (c) 2014-2015 joshua stein <jcs@jcs.org>
4 *
5 * See LICENSE file for redistribution terms.
6 */
7
8#import <Foundation/Foundation.h>
9
10#define HSTS_HEADER @"Strict-Transport-Security"
11#define HSTS_KEY_EXPIRATION @"expiration"
12#define HSTS_KEY_ALLOW_SUBDOMAINS @"allowSubdomains"
13#define HSTS_KEY_PRELOADED @"preloaded"
14
15/* subclassing NSMutableDictionary is not easy, so we have to use composition */
16
17@interface HSTSCache : NSObject
18{
19 NSMutableDictionary *_dict;
20}
21
22@property NSMutableDictionary *dict;
23
24+ (HSTSCache *)retrieve;
25
26- (void)persist;
27- (NSURL *)rewrittenURI:(NSURL *)URL;
28- (void)parseHSTSHeader:(NSString *)header forHost:(NSString *)host;
29
30/* NSMutableDictionary composition pass-throughs */
31- (id)objectForKey:(id)aKey;
32- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)useAuxiliaryFile;
33- (void)setValue:(id)value forKey:(NSString *)key;
34- (void)removeObjectForKey:(id)aKey;
35- (NSArray *)allKeys;
36
37@end