/opt/canhelp/node_modules/hono/dist/utils
NameSizeModeActions
jwt/-0755rm
accept.js56400644editdlrm
basic-auth.js6280644editdlrm
body.js22460644editdlrm
buffer.js20450644editdlrm
color.js7650644editdlrm
compress.js7220644editdlrm
concurrent.js8530644editdlrm
constants.js1020644editdlrm
cookie.js51590644editdlrm
crypto.js11440644editdlrm
encode.js8640644editdlrm
filepath.js10160644editdlrm
handler.js3870644editdlrm
headers.js00644editdlrm
html.js30010644editdlrm
http-status.js00644editdlrm
ipaddr.js27830644editdlrm
mime.js19490644editdlrm
stream.js17940644editdlrm
types.js00644editdlrm
url.js64580644editdlrm
Edit: /opt/canhelp/node_modules/hono/dist/utils/buffer.js (2045B)
// src/utils/buffer.ts import { sha256 } from "./crypto.js"; var equal = (a, b) => { if (a === b) { return true; } if (a.byteLength !== b.byteLength) { return false; } const va = new DataView(a); const vb = new DataView(b); let i = va.byteLength; while (i--) { if (va.getUint8(i) !== vb.getUint8(i)) { return false; } } return true; }; var constantTimeEqualString = (a, b) => { const aLen = a.length; const bLen = b.length; const maxLen = Math.max(aLen, bLen); let out = aLen ^ bLen; for (let i = 0; i < maxLen; i++) { const aChar = i < aLen ? a.charCodeAt(i) : 0; const bChar = i < bLen ? b.charCodeAt(i) : 0; out |= aChar ^ bChar; } return out === 0; }; var timingSafeEqualString = async (a, b, hashFunction) => { if (!hashFunction) { hashFunction = sha256; } const [sa, sb] = await Promise.all([hashFunction(a), hashFunction(b)]); if (sa == null || sb == null || typeof sa !== "string" || typeof sb !== "string") { return false; } const hashEqual = constantTimeEqualString(sa, sb); const originalEqual = constantTimeEqualString(a, b); return hashEqual && originalEqual; }; var timingSafeEqual = async (a, b, hashFunction) => { if (typeof a === "string" && typeof b === "string") { return timingSafeEqualString(a, b, hashFunction); } if (!hashFunction) { hashFunction = sha256; } const [sa, sb] = await Promise.all([hashFunction(a), hashFunction(b)]); if (!sa || !sb || typeof sa !== "string" || typeof sb !== "string") { return false; } return timingSafeEqualString(sa, sb); }; var bufferToString = (buffer) => { if (buffer instanceof ArrayBuffer) { const enc = new TextDecoder("utf-8"); return enc.decode(buffer); } return buffer; }; var bufferToFormData = (arrayBuffer, contentType) => { const response = new Response(arrayBuffer, { headers: { "Content-Type": contentType } }); return response.formData(); }; export { bufferToFormData, bufferToString, equal, timingSafeEqual };