开发者

How to access Firefox Sync bookmarks without Firefox

Firefox 4 syncs bookmarks and other settings to a host run by mozilla.

  • How do I access my bookmarks there (without Firefox)?
  • Is there a documented API?

It seems https://developer.mozilla.org/en/Firefox_Sync should contain the neccessary documentation but all links except the first point to empty pages.

I found a script called weave.py here https://github.com/mozilla/weaveclient-python/blob/master/weave.py that is supposed to be able to access those bookmarks but it is unable to use my credentials. It seems to expect usernames without "@" characters.

Is there any documentation out there on how to access Firefox sync data. Preferably with examples.

Right now I don't even know the entry point to this supposed web service.

When I go to https://services.mozilla.com/ I can change my password and pre开发者_开发知识库sumably remove everything.


If you look at https://wiki.mozilla.org/Services/Sync, I think that's the documentation you want. More detail is at https://wiki.mozilla.org/Labs/Weave/Sync/1.1/API.


Indeed, the username is sha1 + base32. Python code:

import base64
import hashlib
base64.b32encode(hashlib.sha1('myemail@gmail.com').digest()).lower()


The WeaveID returned by ID.get("WeaveID").username is indeed SHA-1 hashed and base32 encoded. A nice way to do this in Java is to use Apache Commons Codec, which includes Base32 since version 1.5:

public String getWeaveID(String email) throws UnsupportedEncodingException
{
    byte[] sha = DigestUtils.sha(email.getBytes("UTF-8"));
    Base32 b32 = new Base32(64, new byte[]{ }, false);
    return b32.encodeToString(sha).toLowerCase();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜