Ruweave

Ruweave is a library to access to the Mozilla Sync API.

Support

Ruweave support the following versions :

  • Sync 1.1

  • Storage V5

  • Clients V1

  • Bookmarks V2

  • Forms V1

  • History V1

  • Passwords V1

  • Prefs V2

  • Tabs V1

TODO

Example:

> require 'ruweave'
> sync = Ruweave::Sync.new("username", "password", "sync-key")
 => #<Ruweave::Sync.... object with things>
> sync.get_collection(:clients)
 => [#<Ruweave::WBO::Client:0x00000002c75388 @raw={"id"=>"d782r1uf18", "name"=>"marc's Firefox on Linux x86_64",
     "type"=>"desktop"}, @commands=nil, @type="desktop", @name="marc's Firefox on Linux x86_64", @id="d782r1uf18">]
> sync.user_node
 => foo-sync42.services.mozilla.com

Available from Ruweave::Sync:

  • sync-key

  • username, username_hashed

  • password, encryption_key, bulk_key

  • host, user_node

Getting collection or item from a collection

> sync.known_collections
 => {:bookmarks=>"/bookmarks", :history=>"/history", :forms=>"/forms", :prefs=>"/prefs", :tabs=>"/tabs", :passwords=>"/passwords", :clients=>"/clients", :meta_global=>"/meta/global"}
> sync.get_collection(:bookmarks)
 => Return an Array of bookmarks
> sync.get_collection_item(:bookmarks, the_item_id_you_only_want)
 => Return the corresponding item from the collection

Each collections returns a Ruweave::WBO::the-right-object or directly the hash if using a class is not really needed.

Each Ruweave::WBO::object implement all of the keys described in the API docs and an extra method: #raw that will return the raw JSON from the decrypted payload.

See the documentation of Ruweave::WBO for each objects!

To get an unix timestamp or human date, use Time.at(modified.to_i) where modified is the modified field returned by the API (It's an ECMA-262 timestamp, so you need to .to_i it to get an unix timestamp).

GET info

Infos are implemented, use Ruweave::Sync#known_infos and Ruweave::Sync#get_info(:symbol) to get it, it only returns Parsed JSON.

Caveats

  • No unit tests, i've not done the reverse thing for the crypto part to generate random keys to create sample files…

  • Collections nodes are fixed, output from the API are not really consistant, so don't permit “custom paths” for the moment…

Disclaimer

This Third Party client for the Mozilla Sync API was written by Marc 'rhaamo' Lagrange and is not developed or supported by the Mozilla Fundation.

Resources

Contact

My mail is in the headers of the files ;)