summaryrefslogtreecommitdiff
path: root/src/client/Disfluid-0.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/Disfluid-0.h')
-rw-r--r--src/client/Disfluid-0.h143
1 files changed, 143 insertions, 0 deletions
diff --git a/src/client/Disfluid-0.h b/src/client/Disfluid-0.h
index 1344836..b4833c4 100644
--- a/src/client/Disfluid-0.h
+++ b/src/client/Disfluid-0.h
@@ -122,4 +122,147 @@ size_t disfluid_client_get_key_pair (const DisfluidClient * client,
const DisfluidApi * api,
size_t start, size_t max, char *jwk);
+/**
+ * DisfluidAccount:
+ *
+ * An accounts is an ID, issuer, a key pair, and some optional tokens
+ * (ID, access and refresh tokens).
+ */
+struct DisfluidAccount;
+typedef struct DisfluidAccount DisfluidAccount;
+
+/**
+ * disfluid_api_make_account_full:
+ * @api: the context loaded with @disfluid_init.
+ * @account: (out) (transfer full): where to store the allocated account.
+ * @subject: the URI serving the webid.
+ * @issuer: the identity provider URI.
+ * @key_pair: the key pair encoded as a JWK.
+ * @id_token_header: (nullable): the ID token header, or NULL.
+ * @id_token: (nullable): the ID token payload, or NULL.
+ * @access_token: (nullable): the encoded access token, or NULL.
+ * @refresh_token: (nullable): the refresh token, or NULL.
+ *
+ * Create a new account.
+ */
+void disfluid_api_make_account_full (const DisfluidApi * api,
+ DisfluidAccount ** account,
+ const char *subject,
+ const char *issuer,
+ const char *key_pair,
+ const char *id_token_header,
+ const char *id_token,
+ const char *access_token,
+ const char *refresh_token);
+
+/**
+ * disfluid_account_free:
+ * @account: the account to free.
+ *
+ * Delete @account.
+ */
+void disfluid_account_free (DisfluidAccount * account);
+
+/**
+ * disfluid_account_get_subject:
+ * @account: the account whose subject to lookup.
+ * @api: the context API.
+ * @start: how many URL prefix bytes to skip.
+ * @max: how many URL bytes to copy after the skipped prefix.
+ * @subject: (array length=max) (element-type char): where to copy the URL bytes.
+ * Returns: the total number of bytes in the URL.
+ */
+size_t disfluid_account_get_subject (const DisfluidAccount * account,
+ const DisfluidApi * api,
+ size_t start, size_t max, char *subject);
+
+/**
+ * disfluid_account_get_issuer:
+ * @account: the account whose issuer to lookup.
+ * @api: the context API.
+ * @start: how many URL prefix bytes to skip.
+ * @max: how many URL bytes to copy after the skipped prefix.
+ * @issuer: (array length=max) (element-type char): where to copy the URL bytes.
+ * Returns: the total number of bytes in the URL.
+ */
+size_t disfluid_account_get_issuer (const DisfluidAccount * account,
+ const DisfluidApi * api,
+ size_t start, size_t max, char *issuer);
+
+/**
+ * disfluid_account_get_key_pair:
+ * @account: the account whose key pair to dump.
+ * @api: the context API.
+ * @start: how many JWK prefix bytes to skip.
+ * @max: how many JWK bytes to copy after the skipped prefix.
+ * @jwk: (array length=max) (element-type char): where to copy the JWK bytes.
+ * Returns: the total number of bytes in the JWK.
+ */
+size_t disfluid_account_get_key_pair (const DisfluidAccount * account,
+ const DisfluidApi * api,
+ size_t start, size_t max, char *jwk);
+
+/**
+ * disfluid_account_get_id_token_header:
+ * @account: the account whose ID token to lookup.
+ * @api: the context API.
+ * @start: how many JSON prefix bytes to skip.
+ * @max: how many JSON bytes to copy after the skipped prefix.
+ * @header: (array length=max) (element-type char): where to copy the JSON bytes.
+ * Returns: the total number of bytes in the JSON.
+ *
+ * If the account does not have a valid ID token, 0 is returned.
+ */
+size_t disfluid_account_get_id_token_header (const DisfluidAccount * account,
+ const DisfluidApi * api,
+ size_t start, size_t max,
+ char *header);
+
+/**
+ * disfluid_account_get_id_token:
+ * @account: the account whose ID token to lookup.
+ * @api: the context API.
+ * @start: how many JSON prefix bytes to skip.
+ * @max: how many JSON bytes to copy after the skipped prefix.
+ * @token: (array length=max) (element-type char): where to copy the JSON bytes.
+ * Returns: the total number of bytes in the JSON.
+ *
+ * If the account does not have a valid ID token, 0 is returned.
+ */
+size_t disfluid_account_get_id_token (const DisfluidAccount * account,
+ const DisfluidApi * api,
+ size_t start, size_t max, char *token);
+
+/**
+ * disfluid_account_get_access_token:
+ * @account: the account whose access token to lookup.
+ * @api: the context API.
+ * @start: how many JWT prefix bytes to skip.
+ * @max: how many JWT bytes to copy after the skipped prefix.
+ * @token: (array length=max) (element-type char): where to copy the JWT bytes.
+ * Returns: the total number of bytes in the JWT.
+ *
+ * If the account does not have a valid access token, 0 is returned.
+ */
+size_t disfluid_account_get_access_token (const DisfluidAccount * account,
+ const DisfluidApi * api,
+ size_t start, size_t max,
+ char *token);
+
+/**
+ * disfluid_account_get_refresh_token:
+ * @account: the account whose refresh token to lookup.
+ * @api: the context API.
+ * @start: how many prefix bytes to skip.
+ * @max: how many bytes to copy after the skipped prefix.
+ * @token: (array length=max) (element-type char): where to copy the refresh token bytes.
+ * Returns: the total number of bytes in the refresh token.
+ *
+ * If the account does not have a valid refresh token, 0 is returned.
+ */
+size_t disfluid_account_get_refresh_token (const DisfluidAccount * account,
+ const DisfluidApi * api,
+ size_t start, size_t max,
+ char *token);
+
#endif