A universal Subresource Integrity (SRI) utility for Node.js, browsers, Cloudflare Workers, Deno, Bun, and other web-compatible runtimes.
Find a file
2024-09-03 03:34:59 +09: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 update changelog 2024-09-03 03:34:59 +09:00
package-lock.json create subresourceintegrity 2024-09-03 03:14:59 +09:00
package.json create subresourceintegrity 2024-09-03 03:14:59 +09:00
README.md create subresourceintegrity 2024-09-03 03:14:59 +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

subresourceintegrity

NPM Version jsDocs.io

subresourceintegrity is a utility designed for Subresource Integrity that works across various web-interoperable runtimes, including Node.js, browsers, Cloudflare Workers, Deno, Bun, and others.

Usage

Install package:

# npm
npm install subresourceintegrity

# yarn
yarn add subresourceintegrity

# pnpm
pnpm install subresourceintegrity

# bun
bun install subresourceintegrity

Integrity Metadata:

import { createIntegrityMetadata } from "subresourceintegrity";

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

subresourceintegrity is released under the MIT License.