A universal Subresource Integrity (SRI) utility for Node.js, browsers, Cloudflare Workers, Deno, Bun, and other web-compatible runtimes.
Find a file
2024-09-02 23:30:33 +00:00
.github/workflows fix release workflow 2024-09-03 03:24:35 +09:00
src create subresourceintegrity 2024-09-03 03:14:59 +09:00
test create subresourceintegrity 2024-09-03 03:14:59 +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 0.0.2 2024-09-02 23:30:33 +00:00
package-lock.json Release 0.0.2 2024-09-02 23:30:33 +00:00
package.json Release 0.0.2 2024-09-02 23:30:33 +00:00
README.md rename subresourceintegrity to websri 2024-09-03 03:57:12 +09:00
renovate.json create subresourceintegrity 2024-09-03 03:14:59 +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

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