an initial commit of a simple property list based store has been merged. It can be used using the regular store interface just passing a PLIST type during creation.
A simple example storing e.g. an otp secret
// initalize plist store (if the file does not exist it will be created)
AGDataManager* manager = [AGDataManager manager];
id<AGStore> plistStore = [manager store:^(id<AGStoreConfig> config) {
[config setName:@"secrets"]; // will be used as the filename for the plist
[config setType:@"PLIST"];
}];
// the object to save
NSDictionary *otp = [NSDictionary dictionaryWithObjectsAndKeys:@"19a01df0281afcdbe", @"otp", @"1", @"id", nil];
// save it
[plistStore save:otp success:^(id object) {
STAssertNotNil(object, @"object should not be nil");
} failure:^(NSError *error) {
NSLog(@"error: %@", error);
}];
//... at some later time
// initialize store from file
id<AGStore> plistStore = [manager store:^(id<AGStoreConfig> config) {
[config setName:@"secrets"];
[config setType:@"PLIST"];
}];
// read the otp
[plistStore read:@"1" success:^(id object) {
NSLog(@"otp secret is: %@", [object objectForKey:@"otp");
} failure:^(NSError *error) {
NSLog(@"error: %@", error);
}];