Spaces:
Runtime error
Runtime error
import crypto from 'crypto'; | |
const keys = new Set<string>(); | |
const generate = () => { | |
let key = crypto.randomUUID(); | |
keys.add(key); | |
return key; | |
}; | |
const revoke = (key: string | undefined) => | |
key && keys.delete(key); | |
const check = (key: string | undefined) => | |
Boolean(key && keys.has(key)); | |
export const proxyKeys = { | |
revoke, | |
generate, | |
check, | |
}; |