Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sri-toolbox

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sri-toolbox

Subresource Integrity tools

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
103K
decreased by-6.29%
Maintainers
1
Weekly downloads
 
Created
Source

sri-toolbox Build Status Coverage Status

Subresource Integrity tools.

SemVer note: As the SRI spec has not yet been finalized, minor releases < 1.0.0 will contain breaking changes.

Install

npm install sri-toolbox

Usage

var sriToolbox = require("sri-toolbox");

var jquerySourceCode = file("jquery-1.10.2.min.js");

var integrity = sriToolbox.generate({
    algorithms: ["sha256"]
}, jquerySourceCode);
//=> "sha256-C6CB9UYIS9UJeqinPHWTHVqh/E1uhG5Twh+Y5qFQmYg="

You may also access the data used to build the integrity attribute, using the option "full":

var integrityObject = sriToolbox.generate({
    full: true
}, jquerySourceCode);
//=> object
{
    "hashes": {
        "sha256": "C6CB9UYIS9UJeqinPHWTHVqh/E1uhG5Twh+Y5qFQmYg="
    },
    "integrity": "sha256-C6CB9UYIS9UJeqinPHWTHVqh/E1uhG5Twh+Y5qFQmYg="
}

API

generate

Generate creates a Sub-resource Integrity attribute from a data string.

Options

Key: type name = default

  • array algorithms = ["sha256"]
    List of hashing algorithms

  • string delimiter = " "
    Integrity attribute delimiter

  • boolean full = false
    Return a string if false, object if true. See example.

Keywords

FAQs

Package last updated on 13 Jul 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc