Format & lint

This commit is contained in:
Andras Schmelczer 2026-04-25 17:55:46 +01:00
parent fefac224b0
commit 7f62273e72
179 changed files with 2210 additions and 1319 deletions

View file

@ -1,8 +1,8 @@
export async function hash(content: Uint8Array): Promise<string> {
const digest = await crypto.subtle.digest(
"SHA-256",
content as Uint8Array<ArrayBuffer>
);
// Copy into a fresh ArrayBuffer-backed Uint8Array so the buffer type
// matches `BufferSource`/`Uint8Array<ArrayBuffer>` expected by digest.
const owned = new Uint8Array(content);
const digest = await crypto.subtle.digest("SHA-256", owned);
const bytes = new Uint8Array(digest);
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
}