aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_identity_service.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-06-25 13:52:15 +0000
committerChristian Grothoff <christian@grothoff.org>2013-06-25 13:52:15 +0000
commitd8e10eda1f8dcf1bd81847b0e7bac188ddd357d8 (patch)
tree6a4db5bd3a3a5abc812b25392e59c98ae529dc3b /src/include/gnunet_identity_service.h
parent68d80cd244808c4b15f330e9eb2af04e386c7321 (diff)
downloadgnunet-d8e10eda1f8dcf1bd81847b0e7bac188ddd357d8.tar.gz
gnunet-d8e10eda1f8dcf1bd81847b0e7bac188ddd357d8.zip
-proposing identity service API
Diffstat (limited to 'src/include/gnunet_identity_service.h')
-rw-r--r--src/include/gnunet_identity_service.h210
1 files changed, 210 insertions, 0 deletions
diff --git a/src/include/gnunet_identity_service.h b/src/include/gnunet_identity_service.h
new file mode 100644
index 000000000..d796bddac
--- /dev/null
+++ b/src/include/gnunet_identity_service.h
@@ -0,0 +1,210 @@
1/*
2 This file is part of GNUnet.
3 (C) 2013 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License 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 License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file include/gnunet_identity_service.h
23 * @brief Identity service; implements identity management for GNUnet
24 * @author Christian Grothoff
25 *
26 * Identities in GNUnet are ECDSA keys. You assume an identity by
27 * using (signing with) a particular private key. As GNUnet users are
28 * expected to have many pseudonyms, we need an identity service to
29 * allow users to manage their pseudonyms. The identity service
30 * manages the pseudonyms (private keys) of the local user; it does
31 * NOT manage identities of other users (public keys). For giving
32 * names to other users and manage their public keys securely, we
33 * use GADS/GNS.
34 */
35#ifndef GNUNET_IDENTITY_SERVICE_H
36#define GNUNET_IDENTITY_SERVICE_H
37
38#ifdef __cplusplus
39extern "C"
40{
41#if 0 /* keep Emacsens' auto-indent happy */
42}
43#endif
44#endif
45
46#include "gnunet_util_lib.h"
47
48
49/**
50 * Version number of GNUnet Identity API.
51 */
52#define GNUNET_IDENTITY_VERSION 0x00000000
53
54/**
55 * Handle to access the identity service.
56 */
57struct GNUNET_IDENTITY_Handle;
58
59/**
60 * Handle for a pseudonym.
61 */
62struct GNUNET_IDENTITY_Pseudonym;
63
64
65/**
66 * Obtain the ECC key associated with a pseudonym.
67 *
68 * @param pseudonym the pseudonym
69 * @return associated ECC key, valid as long as the pseudonym is valid
70 */
71const struct GNUNET_CRYPTO_EccPrivateKey *
72GNUNET_IDENTITY_pseudonym_get_key (struct GNUNET_IDENTITY_Pseudonym *pseudonym);
73
74
75/**
76 * Method called to inform about the pseudonyms of
77 * this peer.
78 *
79 * When used with 'GNUNET_IDENTITY_connect', this function is
80 * initially called for all pseudonyms and then again whenever a
81 * pseudonym's identifier changes or if it is deleted. At the end of
82 * the initial pass over all pseudonyms, the function is once called
83 * with 'NULL' for 'pseu'. That does NOT mean that the callback won't
84 * be invoked in the future or that there was an error.
85 *
86 * When used with 'GNUNET_IDENTITY_create' or 'GNUNET_IDENTITY_get',
87 * this function is only called ONCE, and 'NULL' being passed in
88 * 'pseu' does indicate an error (i.e. name is taken or no default
89 * value is known). If 'pseu' is non-NULL and if '*ctx'
90 * is set in those callbacks, the value WILL be passed to a subsequent
91 * call to the identity callback of 'GNUNET_IDENTITY_connect' (if
92 * that one was not NULL).
93 *
94 * @param cls closure
95 * @param pseu pseudonym handle
96 * @param pseu_ctx context for application to store data for this pseudonym
97 * (during the lifetime of this process, initially NULL)
98 * @param identifier identifier assigned by the user for this pseudonym,
99 * NULL if the user just deleted the pseudonym and it
100 * must thus no longer be used
101 */
102typedef void (*GNUNET_IDENTITY_Callback)(void *cls,
103 struct GNUNET_IDENTITY_Pseudonym *pseu,
104 void **ctx,
105 const char *identifier);
106
107
108/**
109 * Connect to the identity service.
110 *
111 * @param cfg Configuration to contact the identity service.
112 * @param cb function to call on all identity events, can be NULL
113 * @param cb_cls closure for 'cb'
114 * @return handle to communicate with identity service
115 */
116struct GNUNET_IDENTITY_Handle *
117GNUNET_IDENTITY_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
118 GNUNET_IDENTITY_Callback cb,
119 void *cb_cls);
120
121
122/**
123 * Obtain the identity that is currently preferred/default
124 * for a service.
125 *
126 * @param id identity service to query
127 * @param service_name for which service is an identity wanted
128 * @param cb function to call with the result (will only be called once)
129 * @param cb_cls closure for cb
130 * @return handle to abort the operation
131 */
132struct GNUNET_IDENTITY_Operation *
133GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *id,
134 const char *service_name,
135 GNUNET_IDENTITY_Callback cb,
136 void *cb_cls);
137
138
139/**
140 * Function called once the requested operation has
141 * been completed.
142 *
143 * @param cls closure
144 * @param emsg NULL on success, otherwise an error message
145 */
146typedef void (*GNUNET_IDENTITY_Continuation)(void *cls,
147 const char *emsg);
148
149
150/**
151 * Set the preferred/default identity for a service.
152 *
153 * @param id identity service to inform
154 * @param service_name for which service is an identity set
155 * @param pseu new default identity to be set for this service
156 * @param cont function to call once the operation finished
157 * @return handle to abort the operation
158 */
159struct GNUNET_IDENTITY_Operation *
160GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *id,
161 const char *service_name,
162 struct GNUNET_IDENTITY_Pseudonym *pseu,
163 GNUNET_IDENTITY_Continuation cont,
164 void *cont_cls);
165
166
167/**
168 * Disconnect from identity service.
169 *
170 * @param id identity service to disconnect
171 */
172void
173GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *id);
174
175
176/**
177 * Create a new identity with the given identifier.
178 *
179 * @param id identity service to use
180 * @param identifier desired identifier
181 * @param cb function to call with the result (will only be called once)
182 * @param cb_cls closure for cb
183 * @return handle to abort the operation
184 */
185struct GNUNET_IDENTITY_Operation *
186GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id,
187 const char *identifier,
188 GNUNET_IDENTITY_Callback cb,
189 void *cb_cls);
190
191
192/**
193 * Cancel an identity operation.
194 *
195 * @param op operation to cancel
196 */
197void
198GNUNET_IDENITY_cancel (struct GNUNET_IDENTITY_Operation *op);
199
200
201#if 0 /* keep Emacsens' auto-indent happy */
202{
203#endif
204#ifdef __cplusplus
205}
206#endif
207
208/* ifndef GNUNET_IDENTITY_SERVICE_H */
209#endif
210/* end of gnunet_identity_service.h */