IQryptParse lets you transparently make queries to Parse service without explicitly encrypt/decrypt values. You can query encrypted values and get PFObjects through IQryptPFQuery class which is derived from PFQuery class. The following methods are overridden and they encrypt values passed before they are sent to Parse service:

  • whereKey(key: String, equalTo object: AnyObject)
  • whereKey(key: String, notEqualTo object: AnyObject)
  • whereKey(key: String, greaterThan object: AnyObject)
  • whereKey(key: String, greaterThanOrEqualTo object: AnyObject)
  • whereKey(key: String, lessThan object: AnyObject)
  • whereKey(key: String, lessThanOrEqualTo object: AnyObject)
  • whereKey(key: String, containedIn array: [AnyObject])
  • whereKey(key: String, containsAllObjectsInArray array: [AnyObject])
  • whereKey(key: String, notContainedIn array: [AnyObject])

Example:

    var query = IQryptPFQuery(className: "Armor")
        query.whereKey("myIntField", equalTo : 30);
        //30 value is encrypted first and then the encrypted value is sent to the Parse service

        let objs = try query.findObjects();
        for o in objs
        {
             //do something with object
        }

Different encryption schemes allows different query types:

  • OPE - order preserving encryption - lets you do following types of queries:

    • whereKey(key: String, equalTo object: AnyObject)
    • whereKey(key: String, notEqualTo object: AnyObject)
    • whereKey(key: String, greaterThan object: AnyObject)
    • whereKey(key: String, greaterThanOrEqualTo object: AnyObject)
    • whereKey(key: String, lessThan object: AnyObject)
    • whereKey(key: String, lessThanOrEqualTo object: AnyObject)
    • whereKey(key: String, containedIn array: [AnyObject])
    • whereKey(key: String, containsAllObjectsInArray array: [AnyObject])
    • whereKey(key: String, notContainedIn array: [AnyObject])
  • DET - deterministic encryption - lets you do following types of queries:

    • whereKey(key: String, equalTo object: AnyObject)
    • whereKey(key: String, notEqualTo object: AnyObject)
    • whereKey(key: String, containedIn array: [AnyObject])
    • whereKey(key: String, containsAllObjectsInArray array: [AnyObject])
    • whereKey(key: String, notContainedIn array: [AnyObject])
  • RND - randomized encryption - does now allow any types of queries.

You can find more information about queries on Parse documentation.