Implement data ack in CADET MQ API
[oweals/gnunet.git] / src / include / gnunet_identity_provider_service.h
index 283c1b40cae808df15f1d829eb864c9164054d1f..e533f6f8cffea8aae9417883e8354cd7b5f438f3 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2016 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2016 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
 */
 
 /**
- * @file include/gnunet_identity_provider_service.h
- * @brief Identity provider service; implements identity provider for GNUnet
  * @author Martin Schanzenbach
  *
- * Egos in GNUnet are ECDSA keys.  You assume an ego by using (signing
- * with) a particular private key.  As GNUnet users are expected to
- * have many egos, we need an identity service to allow users to
- * manage their egos.  The identity service manages the egos (private
- * keys) of the local user; it does NOT manage egos of other users
- * (public keys).  For giving names to other users and manage their
- * public keys securely, we use GNS.
+ * @file
+ * Identity provider service; implements identity provider for GNUnet
  *
- * @defgroup identity-provider service
+ * @defgroup identity-provider  Identity Provider service
  * @{
  */
 #ifndef GNUNET_IDENTITY_PROVIDER_SERVICE_H
@@ -82,7 +75,8 @@ struct GNUNET_IDENTITY_PROVIDER_Operation;
  */
 typedef void
 (*GNUNET_IDENTITY_PROVIDER_ExchangeCallback)(void *cls,
-                            const struct GNUNET_IDENTITY_PROVIDER_Token *token);
+                            const struct GNUNET_IDENTITY_PROVIDER_Token *token,
+                            uint64_t ticket_nonce);
 
 /**
  * Method called when a token has been issued.
@@ -90,14 +84,18 @@ typedef void
  * token
  *
  * @param cls closure
+ * @param grant the label in GNS pointing to the token
  * @param ticket the ticket
+ * @param token the issued token
  * @param name name assigned by the user for this ego,
  *                   NULL if the user just deleted the ego and it
  *                   must thus no longer be used
  */
 typedef void
 (*GNUNET_IDENTITY_PROVIDER_IssueCallback)(void *cls,
-                            const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket);
+                            const char *grant,
+                            const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket,
+                            const struct GNUNET_IDENTITY_PROVIDER_Token *token);
 
 
 /**
@@ -128,7 +126,7 @@ GNUNET_IDENTITY_PROVIDER_issue_token (struct GNUNET_IDENTITY_PROVIDER_Handle *id
                     const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss_key,
          const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
          const char* scope,
-         struct GNUNET_TIME_Absolute *expiration,
+         struct GNUNET_TIME_Absolute expiration,
          uint64_t nonce,
                     GNUNET_IDENTITY_PROVIDER_IssueCallback cb,
                     void *cb_cls);
@@ -177,17 +175,52 @@ GNUNET_IDENTITY_PROVIDER_cancel (struct GNUNET_IDENTITY_PROVIDER_Operation *op);
 /**
  * Convenience API
  */
+
+/**
+ * Destroy token
+ *
+ * @param token the token
+ */
+void
+GNUNET_IDENTITY_PROVIDER_token_destroy(struct GNUNET_IDENTITY_PROVIDER_Token *token);
+
+/**
+ * Returns string representation of token. A JSON-Web-Token.
+ *
+ * @param token the token
+ * @return The JWT (must be freed)
+ */
 char *
 GNUNET_IDENTITY_PROVIDER_token_to_string (const struct GNUNET_IDENTITY_PROVIDER_Token *token);
 
+/**
+ * Returns string representation of ticket. Base64-Encoded
+ *
+ * @param ticket the ticket
+ * @return the Base64-Encoded ticket
+ */
 char *
 GNUNET_IDENTITY_PROVIDER_ticket_to_string (const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket);
 
-
+/**
+ * Created a ticket from a string (Base64 encoded ticket)
+ *
+ * @param input Base64 encoded ticket
+ * @param ticket pointer where the ticket is stored
+ * @return GNUNET_OK
+ */
 int
 GNUNET_IDENTITY_PROVIDER_string_to_ticket (const char* input,
                                            struct GNUNET_IDENTITY_PROVIDER_Ticket **ticket);
 
+/**
+ * Destroys a ticket
+ *
+ * @param ticket the ticket to destroy
+ */
+void
+GNUNET_IDENTITY_PROVIDER_ticket_destroy(struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket);
+
 #if 0                           /* keep Emacsens' auto-indent happy */
 {
 #endif
@@ -195,8 +228,10 @@ GNUNET_IDENTITY_PROVIDER_string_to_ticket (const char* input,
 }
 #endif
 
-/** @} */ /* end of group identity */
 
 /* ifndef GNUNET_IDENTITY_PROVIDER_SERVICE_H */
 #endif
+
+/** @} */ /* end of group identity */
+
 /* end of gnunet_identity_provider_service.h */