Lines 262-302javascript
262 const expires = Math.floor(now().getTime() / 1e3) + validateStorageUrlExpires(expiresInSeconds ?? 3600);
263 const encodedKey = encodeObjectKey(key);
264 const signingKey = binding.signing_key;
265 const payload = `${method}\n${name}\n${encodedKey}\n${expires}`;
266 return hmacHex(utf8(signingKey), payload).then((token) => {
267 return `/_tako/storages/${encodeURIComponent(name)}/${encodedKey}?expires=${expires}&token=${token}`;
270function responseOverrideQuery(options) {
272 if (options.responseContentType) query["response-content-type"] = options.responseContentType;
273 if (options.responseContentDisposition) query["response-content-disposition"] = options.responseContentDisposition;
276function hasImageTransformOptions(options) {
277 return options.width !== void 0 || options.quality !== void 0 || options.format !== void 0;
281//#region src/cache.ts
282const databasePromises = /* @__PURE__ */ new Map();
283const runtimeImport = new Function("specifier", "return import(specifier)");
284async function getCachedValue(key) {
LowEval
Package source references a known benign dynamic code generation pattern.
dist/src-somSF6cl.mjsView on unpkg · L282 285 validateCacheKey(key);
286 const db = await openCacheDatabase();
287 const now = Date.now();
288 const row = db.prepare("SELECT value, expires_at FROM cache_entries WHERE key = ?").get?.(key);
290 if (row.expires_at <= now) {
291 db.prepare("DELETE FROM cache_entries WHERE key = ?").run(key);
294 return JSON.parse(row.value);
296async function putCachedValue(key, value, options) {
297 validateCacheKey(key);
298 validateTtl(options.ttl);
299 const encoded = JSON.stringify(value);
300 if (encoded === void 0) throw new Error("Cache value must be JSON-serializable.");
301 const db = await openCacheDatabase();
302 const now = Date.now();