aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/oidc_helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/reclaim/oidc_helper.c')
-rw-r--r--src/reclaim/oidc_helper.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/reclaim/oidc_helper.c b/src/reclaim/oidc_helper.c
index ad2839200..b48738cc4 100644
--- a/src/reclaim/oidc_helper.c
+++ b/src/reclaim/oidc_helper.c
@@ -757,15 +757,28 @@ OIDC_build_token_response (const char *access_token,
757 * Generate a new access token 757 * Generate a new access token
758 */ 758 */
759char * 759char *
760OIDC_access_token_new () 760OIDC_access_token_new (const struct GNUNET_RECLAIM_Ticket *ticket)
761{ 761{
762 char *access_token; 762 char *access_token;
763 uint64_t random_number;
764 763
765 random_number = 764 GNUNET_STRINGS_base64_encode (ticket,
766 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_NONCE, UINT64_MAX); 765 sizeof(*ticket),
767 GNUNET_STRINGS_base64_encode (&random_number,
768 sizeof(uint64_t),
769 &access_token); 766 &access_token);
770 return access_token; 767 return access_token;
771} 768}
769
770
771/**
772 * Parse an access token
773 */
774int
775OIDC_access_token_parse (const char*token,
776 struct GNUNET_RECLAIM_Ticket **ticket)
777{
778 if (sizeof (struct GNUNET_RECLAIM_Ticket) !=
779 GNUNET_STRINGS_base64_decode (token,
780 strlen (token),
781 (void**) ticket))
782 return GNUNET_SYSERR;
783 return GNUNET_OK;
784}