> On 5 Nov 2016, at 23:07, Tim Van Steenburgh 
> <tim.van.steenbu...@canonical.com> wrote:
> 
> Can anyone tell me how the macaroons in ~/.go-cookies are encoded? If I try to
> deserialize the 'Value' value directly (using libmacaroons), I get an 
> 'invalid macaroon'
> error. I also tried base64-decoding the value first, and that didn't work 
> either.

Decoding the cookie values with base64 should work for that.
I just quickly tested that the following works locally with Python3 for 
instance:

import base64, json, os
cookies = json.load(open(os.path.expanduser('~/.go-cookies')))
values = [c['Value'] for c in cookies if c['Name'].startswith('macaroon-') and 
c['Value']]
macaroons = [json.loads(base64.b64decode(value).decode('utf-8')) for value in 
values]

--
Francesco





-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju

Reply via email to