Changes

Jump to: navigation, search

CloudServices/Sync/FxSync/Developer/ClientAPI

97 bytes removed, 22:09, 24 September 2010
Writing a Record class
A Record object is a wrapper around a single instance of whatever data it is that you are syncing -- a single bookmark in the case of the bookmark engine, a single browser tab in the case of the tab engine, and so on.
There's a class called <tt>CryptoWrapper</tt> defined in <tt>weaveservices/sync/modules/base_records/crypto.js</tt>, which handles all the encryption and decryption of your record for you. All you have to do is write a class that extends <tt>CryptoWrapper</tt> and maintains a property called <tt>cleartext</tt>. <tt>cleartext</tt> must be a JSON-dictionary-style object; put into it all values that you want to have encrypted, stored on the server, decrypted, and synced up.
You may find it useful to write getters and setters for various properties of your Record class.
<pre>
function FooRecord(uri) { thisCryptoWrapper._FooRecord_initcall(this, uri);
}
FooRecord.prototype = {
__proto__: CryptoWrapper.prototype,
_logname: "Record.Foo",
 
_FooRecord_init: function FooItem_init(uri) {
this._CryptoWrap_init(uri);
this.cleartext = {};
},
get bar() this.cleartext.bar,
Canmove, confirm
725
edits

Navigation menu