-doxygen
[oweals/gnunet.git] / src / identity-provider / identity_provider.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2016 GNUnet e.V.
4
5      GNUnet is free software; you can redistribute it and/or modify
6      it under the terms of the GNU General Public Liceidentity as published
7      by the Free Software Foundation; either version 3, or (at your
8      option) any later version.
9
10      GNUnet is distributed in the hope that it will be useful, but
11      WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13      General Public Liceidentity for more details.
14
15      You should have received a copy of the GNU General Public Liceidentity
16      along with GNUnet; see the file COPYING.  If not, write to the
17      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18      Boston, MA 02110-1301, USA.
19 */
20
21 /**
22  * @author Martin Schanzenbach
23  * @file identity-provider/identity_provider.h
24  *
25  * @brief Common type definitions for the identity provider
26  *        service and API.
27  */
28 #ifndef IDENTITY_PROVIDER_H
29 #define IDENTITY_PROVIDER_H
30
31 #include "gnunet_common.h"
32
33
34 GNUNET_NETWORK_STRUCT_BEGIN
35
36 /**
37  * The token
38  */
39 struct GNUNET_IDENTITY_PROVIDER_Token
40 {
41   /**
42    * The JWT representation of the identity token
43    */
44   char *data;
45 };
46
47 /**
48  * The ticket
49  */
50 struct GNUNET_IDENTITY_PROVIDER_Ticket
51 {
52   /**
53    * The Base64 representation of the ticket
54    */
55   char *data;
56 };
57
58 /**
59  * Answer from service to client after issue operation
60  */
61 struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage
62 {
63   /**
64    * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE
65    */
66   struct GNUNET_MessageHeader header;
67
68   /**
69    * Unique identifier for this request (for key collisions).
70    */
71   uint32_t id GNUNET_PACKED;
72
73   /* followed by 0-terminated label,ticket,token */
74
75 };
76
77
78 /**
79  * Ticket exchange message.
80  */
81 struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage
82 {
83   /**
84    * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE
85    */
86   struct GNUNET_MessageHeader header;
87
88   /**
89    * Unique identifier for this request (for key collisions).
90    */
91   uint32_t id GNUNET_PACKED;
92
93   /**
94    * Nonce found in ticket. NBO
95    * 0 on error.
96    */
97   uint64_t ticket_nonce GNUNET_PACKED;
98
99   /* followed by 0-terminated token */
100
101 };
102
103
104
105 /**
106  * Client requests IdP to issue token.
107  */
108 struct GNUNET_IDENTITY_PROVIDER_IssueMessage
109 {
110   /**
111    * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT
112    */
113   struct GNUNET_MessageHeader header;
114
115   /**
116    * Unique identifier for this request (for key collisions).
117    */
118   uint32_t id GNUNET_PACKED;
119
120
121   /**
122    * Issuer identity private key
123    */
124   struct GNUNET_CRYPTO_EcdsaPrivateKey iss_key;
125
126   /**
127    * Audience public key
128    */
129   struct GNUNET_CRYPTO_EcdsaPublicKey aud_key;
130
131   /**
132    * Nonce
133    */
134   uint64_t nonce;
135
136   /**
137    * Expiration of token in NBO.
138    */
139   struct GNUNET_TIME_AbsoluteNBO expiration;
140
141
142   /* followed by 0-terminated comma-separated scope list */
143
144 };
145
146
147 /**
148  * Use to exchange a ticket for a token
149  */
150 struct GNUNET_IDENTITY_PROVIDER_ExchangeMessage
151 {
152   /**
153    * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT
154    */
155   struct GNUNET_MessageHeader header;
156
157   /**
158    * Unique identifier for this request (for key collisions).
159    */
160   uint32_t id GNUNET_PACKED;
161
162   /**
163    * Audience identity private key
164    */
165   struct GNUNET_CRYPTO_EcdsaPrivateKey aud_privkey;
166
167   /* followed by 0-terminated ticket string */
168
169 };
170
171
172 GNUNET_NETWORK_STRUCT_END
173
174 #endif