ecordell / pymacaroons

A Python Macaroon Library
pymacaroons.readthedocs.org
MIT License
79 stars 23 forks source link

json deserialize raises an exception on missing vid or cl #25

Closed rogpeppe closed 7 years ago

rogpeppe commented 7 years ago

The vid and cl fields are optional in the JSON macaroon format, but JsonSerializer.deserialize raises a missing key exception if a caveat doesn't have them.

Probably the code should be:

verification_key_id=(
                standard_b64decode(c['vid']) if c.get('vid') else None
            ),

(using c.get('vid') rather than c['vid'])

ecordell commented 7 years ago

Fixed in #28