UNPKG

@pedwise/next-firebase-auth-edge

Version:

Next.js 13 Firebase Authentication for Edge and server runtimes. Dedicated for Next 13 server components. Compatible with Next.js middleware.

36 lines 1.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WebApiResponseCache = exports.getResponseCache = void 0; const CERT_CACHE_KEY = "publicKeys"; let responseCache; function getResponseCache() { if (!responseCache) { return (responseCache = new WebApiResponseCache()); } return responseCache; } exports.getResponseCache = getResponseCache; class WebApiResponseCache { constructor() { this.cache = null; } async getCache() { if (!this.cache) { if (typeof caches === "undefined") { return undefined; } return (this.cache = await caches.open(CERT_CACHE_KEY)); } return this.cache; } async put(url, response) { const cache = await this.getCache(); await (cache === null || cache === void 0 ? void 0 : cache.put(url, response)); } async get(url) { const cache = await this.getCache(); return cache === null || cache === void 0 ? void 0 : cache.match(url); } } exports.WebApiResponseCache = WebApiResponseCache; //# sourceMappingURL=response-cache.js.map