Skip to content

Commit 66b61ce

Browse files
committed
refactor(sri): sriOf -> computeIntegrity (matches the HTML attr name)
1 parent 11e7080 commit 66b61ce

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

scripts/walkthrough.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ function applyBasePath(html: string, basePath: string, slug: string): string {
153153
}
154154

155155
/** Build the `sha384-<base64>` SRI attribute value for a byte stream. */
156-
function sriOf(bytes: Uint8Array): string {
156+
function computeIntegrity(bytes: Uint8Array): string {
157157
return `sha384-${cryptoHash('sha384', bytes, 'base64')}`
158158
}
159159

@@ -175,7 +175,7 @@ async function sriForUrl(url: string, cacheDir: string): Promise<string> {
175175
if (!res.ok) {
176176
throw new Error(`SRI fetch ${url} → HTTP ${res.status}`)
177177
}
178-
const integrity = sriOf(new Uint8Array(await res.arrayBuffer()))
178+
const integrity = computeIntegrity(new Uint8Array(await res.arrayBuffer()))
179179
mkdirSync(cacheDir, { recursive: true })
180180
writeFileSync(cachePath, integrity + '\n')
181181
return integrity

0 commit comments

Comments
 (0)