mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 14:39:28 -07:00
fix: optimize regexp creation
This commit is contained in:
parent
a9c1ffabfe
commit
7639962521
2 changed files with 6 additions and 5 deletions
|
@ -20,6 +20,8 @@ import { parseProfileJws } from '../asp.js'
|
||||||
|
|
||||||
export const timeout = 5000
|
export const timeout = 5000
|
||||||
|
|
||||||
|
const reURI = /^aspe:([a-zA-Z0-9.\-_]*):([a-zA-Z0-9]*)/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a fetch request
|
* Execute a fetch request
|
||||||
* @function
|
* @function
|
||||||
|
@ -39,7 +41,6 @@ export async function fn (data, opts) {
|
||||||
})
|
})
|
||||||
|
|
||||||
const fetchPromise = new Promise((resolve, reject) => {
|
const fetchPromise = new Promise((resolve, reject) => {
|
||||||
const reURI = /^aspe:([a-zA-Z0-9.\-_]*):([a-zA-Z0-9]*)/
|
|
||||||
const match = data.aspeUri.match(reURI)
|
const match = data.aspeUri.match(reURI)
|
||||||
|
|
||||||
if (!data.aspeUri || !reURI.test(data.aspeUri) || !isFQDN(match[1])) {
|
if (!data.aspeUri || !reURI.test(data.aspeUri) || !isFQDN(match[1])) {
|
||||||
|
|
|
@ -18,15 +18,15 @@ import { ServiceProvider } from '../serviceProvider.js'
|
||||||
|
|
||||||
export const reURI = /^(.*)/
|
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
|
* @function
|
||||||
* @param {string} uri
|
* @param {string} uri
|
||||||
*/
|
*/
|
||||||
export function processURI (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 reURI = null
|
||||||
let mode = null
|
let mode = null
|
||||||
let match = null
|
let match = null
|
||||||
|
|
Loading…
Reference in a new issue