Page
Library
Module
Module type
Parameter
Class
Class type
Source
Macaroons.Sval create : location:string -> key:string -> id:string -> tval location : t -> stringlocation m is the location of m (if any).
val identifier : t -> stringidentifier m is the identifier of m.
val signature : t -> stringsignature m is the signature of m.
add_first_party_caveat m cid adds a caveat which will be discharged by the target service. See verify.
add_third_party_caveat m ~key ~location cid adds a caveat that will be discharged by a third-party. The third party is to produce, upon request, a macaroon proving that the caveat has been discharged. This hypothetical macaroon must be minted with root key key. See verify.
prepare_for_request m d should be invoke for each discharge macaroon d associated to the main authorizing macaroon m before sending them off the target service for verification. It binds the the signatures of d and m together making it impossible for a malicious third party to maliciously re-use d to discharge third-party caveats of m.
val serialize : t -> stringserialize m converts the macaroon m into a base64-string suitable for transmission over the network. Its inverse is deserialize.
val deserialize : string -> [ `Ok of t | `Error of int * deserialize_error ]deserialize m is the inverse of serialize.
val pp : Format.formatter -> t -> unitpp ppf m prints a user-readable description of the macaroon m for debugging purposes.
verify m ~key ~check d verifies whether all the caveats of m hold. key must be the key used with create. check is called to verify all first-party caveats. d is a list of discharge macaroons used to verify third-party cavests. Each element of d must have been previously bound with m using prepare_for_request.