blob: d6e7b072353e188d119bc52f7d487edce0045321 [file] [log] [blame]
Vitaly Buka7d29a5a2016-01-27 14:21:37 -08001// Copyright 2015 The Weave Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef LIBUWEAVE_SRC_MACAROON_CAVEAT_INTERNAL_H_
6#define LIBUWEAVE_SRC_MACAROON_CAVEAT_INTERNAL_H_
7
8#include <stdbool.h>
9#include <stddef.h>
10#include <stdint.h>
11
12#include "src/macaroon.h"
13#include "src/macaroon_caveat.h"
14
15bool uw_macaroon_caveat_sign_(const uint8_t* key,
16 size_t key_len,
17 const UwMacaroonContext* context,
18 const UwMacaroonCaveat* caveat,
19 uint8_t* mac_tag,
20 size_t mac_tag_size);
21
22typedef struct {
Vitaly Buka08be74d2016-02-02 15:25:09 -080023 uint32_t issued_time; // 0 when invalid or not set.
Vitaly Buka7d29a5a2016-01-27 14:21:37 -080024} UwMacaroonValidationState;
25
26bool uw_macaroon_caveat_init_validation_state_(
27 UwMacaroonValidationState* state);
28
29bool uw_macaroon_caveat_validate_(const UwMacaroonCaveat* caveat,
30 const UwMacaroonContext* context,
31 UwMacaroonValidationState* state,
32 UwMacaroonValidationResult* result);
33
34bool uw_macaroon_caveat_get_value_uint_(const UwMacaroonCaveat* caveat,
35 uint32_t* unsigned_int);
36bool uw_macaroon_caveat_get_value_bstr_(const UwMacaroonCaveat* caveat,
37 const uint8_t** str,
38 size_t* str_len);
39
40#endif // LIBUWEAVE_SRC_MACAROON_CAVEAT_INTERNAL_H_