A universal Subresource Integrity (SRI) utility for Node.js, browsers, Cloudflare Workers, Deno, Bun, and other web-compatible runtimes.
Find a file
Kohei Watanabe d7ab327e56
Some checks are pending
test / Node.js v20 (push) Waiting to run
test / Node.js v22 (push) Waiting to run
test / Deno (push) Waiting to run
test / Bun (push) Waiting to run
reference W3C SRI spec
2024-09-17 19:10:43 +09:00
.github/workflows Pin dependencies 2024-09-04 23:11:20 +09:00
runtime Rename Integrity-metadata.test.ts to integrity-metadata.test.ts 2024-09-05 20:32:40 +09:00
src reference W3C SRI spec 2024-09-17 19:10:43 +09:00
test add integrity-metadata tests 2024-09-17 19:08:56 +09:00
.gitignore create subresourceintegrity 2024-09-03 03:14:59 +09:00
.release-it.json create subresourceintegrity 2024-09-03 03:14:59 +09:00
CHANGELOG.md update changelog 2024-09-09 19:28:19 +09:00
package-lock.json Update dependency @types/node to v22.5.4 2024-09-05 01:24:31 +00:00
package.json add keywords to package.json 2024-09-05 19:37:01 +09:00
README.md test with deno and bun 2024-09-03 09:55:39 +09:00
renovate.json set up monthly renovations 2024-09-06 10:11:57 +09:00
tsup.config.ts create subresourceintegrity 2024-09-03 03:14:59 +09:00

websri

NPM Version jsDocs.io

websri is a universal Subresource Integrity (SRI) utility for Node.js, browsers, Cloudflare Workers, Deno, Bun, and other web-compatible runtimes.

Usage

Install package:

# npm
npm install websri

# yarn
yarn add websri

# pnpm
pnpm install websri

# deno
deno add npm:websri

# bun
bun install websri

Integrity Metadata:

import { createIntegrityMetadata } from "websri";

const res = new Response("Hello, world!");
const data = await res.arrayBuffer();
const integrityMetadata = await createIntegrityMetadata("sha256", data);

console.log(integrityMetadata.toString());
// sha256-MV9b23bQeMQ7isAGTkoBZGErH853yGk0W/yUx1iU7dM=

Documentation

API Reference

FAQ

What is Subresource Integrity?

Subresource Integrity (SRI) is a security feature that allows user agents to verify that a fetched resource has not been manipulated unexpectedly.

License

websri is released under the MIT License.