Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage helps? #8

Open
robertdbailey opened this issue Jul 1, 2016 · 3 comments
Open

Usage helps? #8

robertdbailey opened this issue Jul 1, 2016 · 3 comments

Comments

@robertdbailey
Copy link

robertdbailey commented Jul 1, 2016

Hi Roger, thanks for your work on macaroons! I'm trying to take a serialized macaroon generated via libmacaroons using python and verify it using a node app. I noticed you also helped with libmacaroons, so I was perhaps naively assuming they can work together in a decentralized system. Is there a way to do this? (Any "caveats" ? ;)

Using the python cli:

>>> import macaroons
>>> secret = 'this is our super secret key; only we should know it'
>>> public = 'we used our secret key'
>>> location = 'http://mybank/'
>>> M = macaroons.create(location, secret, public)
>>> M.serialize()
'MDAxY2xvY2F0aW9uIGh0dHA6Ly9teWJhbmsvCjAwMjZpZGVudGlmaWVyIHdlIHVzZWQgb3VyIHNlY3JldCBrZXkKMDAyZnNpZ25hdHVyZSDj2eApCFJsTAA5rhURQRXZf91ovyujebNCqvD2F9BVLwo'

Using the nodejs cli:

> var Macaroon = require('macaroon');
> Macaroon
{ newMacaroon: [Function],
  import: [Function],
  export: [Function],
  discharge: [Function] }
> Macaroon.import('MDAxY2xvY2F0aW9uIGh0dHA6Ly9teWJhbmsvCjAwMjZpZGVudGlmaWVyIHdlIHVzZWQgb3VyIHNlY3JldCBrZXkKMDAyZnNpZ25hdHVyZSDj2eApCFJsTAA5rhURQRXZf91ovyujebNCqvD2F9BVLwo');
TypeError: Cannot read property 'replace' of undefined

I can just do this:
> m = Macaroon.import({'location': 'http://mybank/', 'identifier': 'we used our secret key', 'cid': 'account = 3735928559', 'signature': '1efe4763f290dbce0c1d08477367e11f4eee456a64933cf662d79772dbb82128'});

...but of course I don't want to pass that json-encoded string around. Is there a way to deserialize in nodejs a macaroon that was serialized using the python cli? Are there any usage examples out there? Thanks and regards

@rogpeppe
Copy link
Member

Unfortunately we don't currently support the binary encoding format in js-macaroon. It wouldn't be hard - it just wasn't a priority for us as we haven't been using the binary format in production up until now.

@emschwartz
Copy link
Contributor

I think this issue was resolved, right?

@rogpeppe
Copy link
Member

Not entirely resolved yet. The js-macaroon library doesn't yet support the V1 binary format. It's not hard to do - just not got around to it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants