go-macaroon / macaroon

A native Go implementation of macaroons
BSD 3-Clause "New" or "Revised" License
182 stars 24 forks source link

update API in preparation for format changes #10

Closed rogpeppe closed 8 years ago

rogpeppe commented 8 years ago

This changes the internal representation so that we don't use the binary encoding directly.

We also change the API so that third party caveat ids and the macaroon id itself are []byte not string, and relax the length constraints which will only apply when marshaling to the old binary format.

This breaks the API, so we make a new API version (v2-unstable); we will probably change it further in subsequent PRs.

Benchmark changes:

benchmark                    old ns/op     new ns/op     delta
BenchmarkNew-4               9843          7429          -24.53%
BenchmarkAddCaveat-4         5581          5488          -1.67%
BenchmarkVerifyLarge-4       139496        140105        +0.44%
BenchmarkVerifySmall-4       9284          9366          +0.88%
BenchmarkMarshalJSON-4       4326          4578          +5.83%
BenchmarkUnmarshalJSON-4     9228          8675          -5.99%
mhilton commented 8 years ago

:+1:

mattyw commented 8 years ago

:+1: