From 596db98bfdf726a32030fac00eb4087c358e7f35 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Wed, 4 Nov 2020 03:01:02 +0100 Subject: [PATCH] Add utils.generateProxyURL --- src/utils.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/utils.js b/src/utils.js index 63f5d52..f755236 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,3 +1,11 @@ +require('dotenv').config() + +const DOIP_PROXY_HOSTNAME = process.env.DOIP_PROXY_HOSTNAME || 'proxy.keyoxide.org' + +const generateProxyURL = (type, url) => { + return `https://${DOIP_PROXY_HOSTNAME}/api/1/get/${type}/${encodeURIComponent(url)}` +} + const generateClaim = (fingerprint, format) => { switch (format) { case 'uri': @@ -14,4 +22,5 @@ const generateClaim = (fingerprint, format) => { } } +exports.generateProxyURL = generateProxyURL exports.generateClaim = generateClaim