Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kou029w/websri
A universal Subresource Integrity (SRI) utility for Node.js, browsers, Cloudflare Workers, Deno, Bun, and other web-compatible runtimes.
https://github.com/kou029w/websri
browser bun cloudflare cloudflare-workers deno hashing integrity nodejs security sri subresource-integrity typescript
Last synced: 2 months ago
JSON representation
A universal Subresource Integrity (SRI) utility for Node.js, browsers, Cloudflare Workers, Deno, Bun, and other web-compatible runtimes.
- Host: GitHub
- URL: https://github.com/kou029w/websri
- Owner: kou029w
- Created: 2024-09-02T18:16:01.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-18T07:28:23.000Z (3 months ago)
- Last Synced: 2024-09-29T18:41:02.820Z (3 months ago)
- Topics: browser, bun, cloudflare, cloudflare-workers, deno, hashing, integrity, nodejs, security, sri, subresource-integrity, typescript
- Language: JavaScript
- Homepage:
- Size: 351 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# websri
[![NPM Version](https://img.shields.io/npm/v/websri)](https://www.npmjs.com/package/websri) [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/websri)
`websri` is a universal Subresource Integrity (SRI) utility for Node.js, browsers, Cloudflare Workers, Deno, Bun, and other web-compatible runtimes.
## Usage
Install package:
```sh
# npm
npm install websri# yarn
yarn add websri# pnpm
pnpm add websri# deno
deno add npm:websri# bun
bun add websri
```[Integrity Metadata](https://www.w3.org/TR/SRI/#integrity-metadata):
```ts
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](https://www.jsdocs.io/package/websri)
## FAQ
### What is Subresource Integrity?
[Subresource Integrity (SRI)](https://www.w3.org/TR/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.