diff --git a/src/fetcher/aspe.js b/src/fetcher/aspe.js index 4775db1..7668c78 100644 --- a/src/fetcher/aspe.js +++ b/src/fetcher/aspe.js @@ -20,6 +20,8 @@ import { parseProfileJws } from '../asp.js' export const timeout = 5000 +const reURI = /^aspe:([a-zA-Z0-9.\-_]*):([a-zA-Z0-9]*)/ + /** * Execute a fetch request * @function @@ -39,7 +41,6 @@ export async function fn (data, opts) { }) const fetchPromise = new Promise((resolve, reject) => { - const reURI = /^aspe:([a-zA-Z0-9.\-_]*):([a-zA-Z0-9]*)/ const match = data.aspeUri.match(reURI) if (!data.aspeUri || !reURI.test(data.aspeUri) || !isFQDN(match[1])) { diff --git a/src/serviceProviders/openpgp.js b/src/serviceProviders/openpgp.js index 2852dc8..beddbc2 100644 --- a/src/serviceProviders/openpgp.js +++ b/src/serviceProviders/openpgp.js @@ -18,15 +18,15 @@ import { ServiceProvider } from '../serviceProvider.js' export const reURI = /^(.*)/ +const reURIHkp = /^openpgp4fpr:(?:0x)?([a-zA-Z0-9.\-_]*)/ +const reURIWkdDirect = /^https:\/\/(.*)\/.well-known\/openpgpkey\/hu\/([a-zA-Z0-9]*)(?:\?l=(.*))?/ +const reURIWkdAdvanced = /^https:\/\/(openpgpkey.*)\/.well-known\/openpgpkey\/(.*)\/hu\/([a-zA-Z0-9]*)(?:\?l=(.*))?/ + /** * @function * @param {string} uri */ export function processURI (uri) { - const reURIHkp = /^openpgp4fpr:(?:0x)?([a-zA-Z0-9.\-_]*)/ - const reURIWkdDirect = /^https:\/\/(.*)\/.well-known\/openpgpkey\/hu\/([a-zA-Z0-9]*)(?:\?l=(.*))?/ - const reURIWkdAdvanced = /^https:\/\/(openpgpkey.*)\/.well-known\/openpgpkey\/(.*)\/hu\/([a-zA-Z0-9]*)(?:\?l=(.*))?/ - let reURI = null let mode = null let match = null