Socket
Socket
Sign inDemoInstall

ssri

Package Overview
Dependencies
2
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ssri

Simple Subresource Integrity library -- generates, parses, and unparses integrity strings.


Version published
Weekly downloads
29M
increased by5.95%
Maintainers
1
Install size
658 kB
Created
Weekly downloads
 

Package description

What is ssri?

The ssri npm package is used for parsing, manipulating, serializing, generating, and verifying Subresource Integrity (SRI) hashes. SRI is a security feature that enables browsers to verify that resources they fetch (for example, from a CDN) are delivered without unexpected manipulation. It works by allowing you to provide a cryptographic hash that a fetched resource must match.

What are ssri's main functionalities?

Generating SRI Hashes

This feature allows you to generate SRI hashes from a given data input. The example code demonstrates how to create an SRI hash using the SHA-384 algorithm.

const ssri = require('ssri');
const integrity = ssri.fromData('some data to hash', {algorithms: ['sha384']});
console.log(integrity.toString());

Parsing SRI Hashes

This feature is used to parse an existing SRI hash string into an object that can be easily manipulated. The example code shows how to parse an SRI hash.

const ssri = require('ssri');
const integrity = ssri.parse('sha384-...');
console.log(integrity);

Verifying SRI Hashes

This feature allows you to verify that a piece of data matches a given SRI hash. The example code demonstrates how to verify the integrity of data against an SRI hash.

const ssri = require('ssri');
const data = 'some data to verify';
const sri = 'sha384-...';
ssri.checkData(data, sri).then(() => {
  console.log('Integrity verified');
}).catch(error => {
  console.log('Integrity verification failed');
});

Other packages similar to ssri

Changelog

Source

10.0.1 (2022-12-07)

Dependencies

  • 4f6ba1e #64 bump minipass from 3.3.6 to 4.0.0

Readme

Source

ssri npm version license Travis AppVeyor Coverage Status

ssri, short for Simple Subresource Integrity, is a Node.js utility for parsing, unparsing, and generating Subresource Integrity hashes.

Install

$ npm install --save ssri

Table of Contents

Example

const ssri = require('ssri')
// TODO

Features

  • Parses and unparses SRI strings.
  • Generates SRI strings from direct data or Streams.
  • Optional use of reserved option expression syntax

Contributing

The ssri team enthusiastically welcomes contributions and project participation! There's a bunch of things you can do if you want to contribute! The Contributor Guide has all the information you need for everything from reporting bugs to contributing entire new features. Please don't hesitate to jump in if you'd like to, or even ask us questions if something isn't clear.

API

Keywords

FAQs

Last updated on 23 Mar 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc