When we import a macaroon, we note the version that
we imported it as and use the same version for export,
which prevents version 2 macaroons being serialized
in version 1 format (which is not capable of serializing
all version 2 macaroons).
We change the API so that all entry points that previously
required Uint8Array now accept a string too, which is
encoded as utf-8.
Also, we standardize on "bits" and "bytes" as synonyms
for "bitArray" and "Uint8Array" throughout, and use
them consistently throughout the code. To avoid confusion
as to which variable or field holds which of the three possible
types for some byte data, we use suffixes throughout
(bits, bytes, or str, indicating bitArray, byteArray and
string respectively).
We also change the tests so that no tests rely on internal
implementation details.
When we import a macaroon, we note the version that we imported it as and use the same version for export, which prevents version 2 macaroons being serialized in version 1 format (which is not capable of serializing all version 2 macaroons).
We change the API so that all entry points that previously required Uint8Array now accept a string too, which is encoded as utf-8.
Also, we standardize on "bits" and "bytes" as synonyms for "bitArray" and "Uint8Array" throughout, and use them consistently throughout the code. To avoid confusion as to which variable or field holds which of the three possible types for some byte data, we use suffixes throughout (bits, bytes, or str, indicating bitArray, byteArray and string respectively).
We also change the tests so that no tests rely on internal implementation details.