- fix
[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   /* followed by 0-terminated label,ticket,token */
69
70 };
71
72
73 /**
74  * Ticket exchange message.
75  */
76 struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage
77 {
78   /**
79    * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE
80    */
81   struct GNUNET_MessageHeader header;
82
83   /**
84    * Nonce found in ticket. NBO
85    * 0 on error.
86    */
87   uint64_t ticket_nonce GNUNET_PACKED;
88
89   /* followed by 0-terminated token */
90
91 };
92
93
94
95 /**
96  * Client requests IdP to issue token.
97  */
98 struct GNUNET_IDENTITY_PROVIDER_IssueMessage
99 {
100   /**
101    * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT
102    */
103   struct GNUNET_MessageHeader header;
104
105   /**
106    * Issuer identity private key
107    */
108   struct GNUNET_CRYPTO_EcdsaPrivateKey iss_key;
109
110   /**
111    * Audience public key
112    */
113   struct GNUNET_CRYPTO_EcdsaPublicKey aud_key;
114
115   /**
116    * Nonce
117    */
118   uint64_t nonce;
119
120   /**
121    * Expiration of token in NBO.
122    */
123   struct GNUNET_TIME_AbsoluteNBO expiration;
124
125
126   /* followed by 0-terminated comma-separated scope list */
127
128 };
129
130
131 /**
132  * Use to exchange a ticket for a token
133  */
134 struct GNUNET_IDENTITY_PROVIDER_ExchangeMessage
135 {
136   /**
137    * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT
138    */
139   struct GNUNET_MessageHeader header;
140   
141   /**
142    * Audience identity private key
143    */
144   struct GNUNET_CRYPTO_EcdsaPrivateKey aud_privkey;
145
146   /* followed by 0-terminated ticket string */
147
148 };
149
150
151 GNUNET_NETWORK_STRUCT_END
152
153 #endif