A universal Subresource Integrity (SRI) utility for Node.js, browsers, Cloudflare Workers, Deno, Bun, and other web-compatible runtimes.
Find a file
renovate[bot] 09960e348d
Some checks failed
test / Node.js v20 (push) Has been cancelled
test / Node.js v22 (push) Has been cancelled
test / Deno (push) Has been cancelled
test / Bun (push) Has been cancelled
Update dependency tsx to v4.19.3 (#19)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-01 10:34:19 +00:00
.github/workflows Update actions/setup-node digest to 1d0ff46 (#18) 2025-03-01 06:05:23 +00:00
runtime Rename Integrity-metadata.test.ts to integrity-metadata.test.ts 2024-09-05 20:32:40 +09:00
src Fixed "Maximum call stack size exceeded" error when using IntegrityMetadataSet#strongest 2025-02-19 17:14:01 +09:00
test Update tests to assert expected output structure for IntegrityMetadataSet 2025-02-19 17:19:45 +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 Release 1.0.1 2025-02-19 08:21:04 +00:00
package-lock.json Update dependency tsx to v4.19.3 (#19) 2025-03-01 10:34:19 +00:00
package.json Update dependency tsx to v4.19.3 (#19) 2025-03-01 10:34:19 +00:00
README.md update package manager commands 2024-09-18 16:28:15 +09:00
renovate.json set up monthly renovations 2024-09-06 10:11:57 +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 add websri

# deno
deno add npm:websri

# bun
bun add 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.