Add remaining documentation
[libcontrac.git] / include / contrac / dtk.h
1 /** \ingroup DailyTracingKey
2 * @file
3 * @author David Llewellyn-Jones <david@flypig.co.uk>
4 * @version $(VERSION)
5 *
6 * @section LICENSE
7 *
8 * Copyright David Llewellyn-Jones, 2020
9 * Released under the GPLv2.
10 *
11 * @brief Daily Tracing Key functionality
12 * @section DESCRIPTION
13 *
14 * This class is used to generate and manage the Daily Tracing Key (DTK). It's
15 * largely internal. The functionality from \ref Contrac should generally be
16 * used in preference to this.
17 *
18 */
19
20 /** \addtogroup DailyTracingKey
21 * @{
22 */
23
24 #ifndef __DTK_H
25 #define __DTK_H
26
27 // Includes
28
29 // Defines
30
31 /**
32 * The size in bytes of a DTK in binary format.
33 *
34 */
35 #define DTK_SIZE (16)
36
37 /**
38 * The size in bytes of a DTK in base64 format, not including the null
39 * terminator.
40 *
41 */
42 #define DTK_SIZE_BASE64 (24)
43
44 // Structures
45
46 /**
47 * An opaque structure for representing a DTK.
48 *
49 * The internal structure can be found in dtk.c
50 */
51 typedef struct _Dtk Dtk;
52
53 // Function prototypes
54
55 Dtk * dtk_new();
56 void dtk_delete(Dtk * data);
57
58 bool dtk_generate_daily_key(Dtk * data, Contrac const * contrac, uint32_t day_number);
59 unsigned char const * dtk_get_daily_key(Dtk const * data);
60 uint32_t dtk_get_day_number(Dtk const * data);
61 void dtk_assign(Dtk * data, unsigned char const * dtk_bytes, uint32_t day_number);
62
63 // Function definitions
64
65 #endif // __DTK_H
66
67 /** @} addtogroup DailyTracingKey */
68