// MarshalBinary marshals the macaroon into binary format.
// This is the same as Marshal but without the base64 encoding.
func (m *Macaroon) MarshalBinary() ([]byte, error) {
	var merr C.enum_macaroon_returncode
	b64data := make([]byte, C.macaroon_serialize_size_hint(m.m))
	rc := C.macaroon_serialize(m.m, cbuf(b64data), C.size_t(len(b64data)), &merr)
	if rc < 0 {
		return nil, macaroonError(merr)
	}
	return base64Decode(b64data)
}
// Marshal returns the macaroon marshaled as for
// m.MarshalBinary, but also encapsulated in URL-safe
// base64 with no padding.
func (m *Macaroon) Marshal() (string, error) {
	var err C.enum_macaroon_returncode

	n := C.macaroon_serialize_size_hint(m.m)
	buf := make([]byte, n)
	data := cBytes(buf)

	sz := C.macaroon_serialize(m.m, data, n, &err)
	if sz < 0 {
		return "", macaroonError(err)
	}
	buf = bytes.TrimRight(buf, nuls)
	return string(buf), nil
}