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?

On Feb 14, 2014, at 5:05 PM, Alan McKean <[email protected]> wrote:

> Your suggestions sound pretty straightforward, and I will give it a go, but 
> if I am going to hack the source code, perhaps I should do as you suggested 
> early on in the thread:
> 
> 'I think the real solution is going to be to hack some hooks into the 
> replicator so that it can decrypt docs before adding them to the local db and 
> encrypt them before uploading them. I don't have the bandwidth to do this 
> right now, but I can offer advice if you want to do it.'
> 
> Can you point me to the places in the source where I would decrypt during the 
> pull and encrypt during the push? Then I can decide which modifications I 
> would rather put in. I think that kind of modification would be generally 
> more useful, even if it does leave the iOS db unencrypted. But as you pointed 
> out, the file system is encrypted anyway.
> 
> 
> On Feb 14, 2014, at 4:31 PM, Jens Alfke <[email protected]> wrote:
> 
>> 
>> On Feb 14, 2014, at 1:05 PM, Alan McKean <[email protected]> wrote:
>> 
>>> 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?
>> 
>> This doesn't sound like a good direction to go in -- you're working against 
>> the grain of CBLModel. Trying to make this work will get more and more hacky.
>> 
>> Instead, try what I suggested earlier -- decode the document properties on 
>> their way into the model. There are two CBLModel methods that access 
>> _document.properties. Change those into calls to a new overrideable method, 
>> call it -documentProperties, that by default returns _document.properties.
>> 
>> So change both occurrences of
>>     NSMutableDictionary* properties = [_document.properties mutableCopy];
>> to
>>     NSMutableDictionary* properties = self.documentProperties;
>> 
>> and implement the method like this:
>>      - (NSMutableDictionary*) documentProperties {
>>              return [_document.properties mutableCopy];
>>      }
>> 
>> Then you can override -documentProperties to decrypt the properties and 
>> return those. (I made the method return an NSMutableDictionary to reduce the 
>> amount of copying going on; if you're assembling a dictionary you'll 
>> probably have a mutable instance already, and both the callers want a 
>> mutable dictionary anyway.)
>> 
>> If this works for you, I can add it into CBLModel, especially if you send a 
>> pull request with a unit test :)
>> 
>> --Jens
>> 
>> -- 
>> 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 
>> [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/mobile-couchbase/ACD6E2EA-CF16-40AB-990D-7B94BAC2AB52%40couchbase.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 
> -- 
> 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 
> [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/mobile-couchbase/2E0CB4AF-2C93-4E7F-A5AA-91BF65216F06%40me.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/6EFCA44E-6091-41D2-B073-BE9BF52799C3%40me.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to