NSArray *replications = [database replicationsWithURL:[NSURL URLWithString:@"http://my_credentials@my_ip_and_port/my_db"] exclusively:YES];
self.pull = [replications objectAtIndex:0];
[self.pull start];
I assume it is not persistent since I am not setting it so, but I get a 409 conflict at the end of the pull on successive launches so it makes me think that I am creating another replication on top of the previous one. Should I check for its existence before creating it on successive launches? Can someone suggest a better way of doing a pull replication on startup?
+ (CBLModel *) modelForDocument:(CBLDocument *)document encrypted:(BOOL)encrypted {
if(encrypted) {
NSString *encryptionKey = [OTSKeychainHelper keychainStringFromMatchingIdentifier:PROVIDER_ENCRYPTION_KEY];
NSDictionary *dictionary = [OTSCrypter decrypt:document.properties encryptionKey:encryptionKey];
NSError *error;
[document putProperties:dictionary error:&error];
}
return [self modelForDocument:document];
}
I checked the wiki but didn't see anything about the SYNC keyword. I enabled logging with -LOG YES but don't see anything new.
On another note, I would like an opinion on the decryption/encryption that I am using. I have a subclass of CBLMode called OTSCBLModel. It overrides modelForDocument:encrypted: like this:
+ (CBLModel *) modelForDocument:(CBLDocument *)document encrypted:(BOOL)encrypted {
[document putProperties:dictionary error:&error];
What I want is to leave the original in the db encrypted and the in-memory properties unencrypted.
Is there a way to 'putProperties' in the document that does not update the document on disk?
I would rather not put the decryption/encryption in the replicator because I like having the local database contents encrypted.
Further, not all documents are encrypted, so it would have to do it selectively.
BTW, I don't understand your comment about it not being safe. I am loading the document, modifying it with putProperties:error: and (after that) creating the model from it. Instantiating the model does not modify the document. It is already modified by the time I instantiate the model.
I don't understand the role of _changedNames, so I'm not sure where the decryption/encryption should occur:
Could I override the push mechanism in a subclass
and use unsavedModels to get ahold of all of the models/documents that I have loaded and changed, then encrypt them back into the db before invoking the real push?
--
You received this message because you are subscribed to a topic in the Google Groups "Couchbase Mobile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mobile-couchbase/jFADxJ8cV6Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/3FED640E-3C35-43FF-BB62-5B97BAE9713F%40couchbase.com.
- (NSNumber *) dateOfService {
return [self.decryptedProperties objectForKey:@"dateOfService"];
}
- (void) setDateOfService:(NSNumber *)dateOfService {
[self.decryptedProperties setObject:dateOfService forKey:@"dateOfService"];
But my CBLModel subclasses implement accessors to get and set the decryptedDictionary values. So the property names don't get registered as having changed. Is there a good way to tell the CBLModel that a given property has changed?
--
You received this message because you are subscribed to a topic in the Google Groups "Couchbase Mobile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mobile-couchbase/jFADxJ8cV6Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/ACD6E2EA-CF16-40AB-990D-7B94BAC2AB52%40couchbase.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/2E0CB4AF-2C93-4E7F-A5AA-91BF65216F06%40me.com.
Can you point me to the places in the source where I would decrypt during the pull and encrypt during the push?
Also, which target(s) in the CouchbaseLite project should I add my encryption classes to if I will be using the framework on iOS and, potentially, on the Mac?