summaryrefslogtreecommitdiff
path: root/base64.h
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2022-09-14 18:19:14 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2022-09-14 18:19:14 +0800
commit306cf74eb0101a12b51549866a4d60296618ee0b (patch)
tree89fe13b234f40f97de84cdb6610bcd11e1d47a88 /base64.h
OAuth part
The minimum to pass all authentications and arrive at the embedded app index. This library is to be used with shopify-app-template-c for now, as it assumes the existence of shopify.app.toml in the parent directory, and index.html in the frontend directory.
Diffstat (limited to 'base64.h')
-rw-r--r--base64.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/base64.h b/base64.h
new file mode 100644
index 0000000..8533af1
--- /dev/null
+++ b/base64.h
@@ -0,0 +1,13 @@
+#include <gnutls/gnutls.h>
+
+static inline void base64_decode(unsigned char *host, char **decoded_host)
+{
+ gnutls_datum_t result;
+ gnutls_base64_decode2(&(gnutls_datum_t){
+ host,
+ strlen((const char *)host)
+ }, &result);
+ *decoded_host = malloc(result.size + 1);
+ strlcpy(*decoded_host, (const char *)result.data, result.size + 1);
+ gnutls_free(result.data);
+}