go-macaroon / js-macaroon

Javascript implementation of macaroons
BSD 3-Clause "New" or "Revised" License
41 stars 22 forks source link

Importing a JSON Macaroon with a missing version causes the import to fail. #38

Closed nickrobison-usds closed 5 years ago

nickrobison-usds commented 5 years ago

Currently the go-macaroon library does not set the version field when exporting the V2 JSON format. This patch simply checks that if the field is not empty, that it's equal to 2. Otherwise, it fails.

A unit test has been added and npm run test passes.

hatched commented 5 years ago

@nickrobison-usds thanks for continuing to work on this. While we haven't yet set up CI on this I can see that it'll fail the lint check. Could you please run npm run lint and resolve those issues.

Thanks!

nickrobison-usds commented 5 years ago

Fixed! Apologies, my editor is a bit screwed up right now.

hatched commented 5 years ago

Thanks again @nickrobison-usds