sri-toolbox
Subresource Integrity tools
Last updated 11 years ago by neftaly .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install sri-toolbox 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 0.2.0                                ...           latest (11 years ago)

7 Versions

  • 0.2.0                                ...           11 years ago
  • 0.1.3                                ...           12 years ago
  • 0.1.2                                ...           12 years ago
  • 0.1.1                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
  • 0.0.1                                ...           12 years ago
  • 0.0.0                                ...           12 years ago
Maintainers (1)
Downloads
Total 26
Today 0
This Week 7
This Month 17
Last Day 0
Last Week 2
Last Month 0
Dependencies (0)
None
Dev Dependencies (3)
Dependents (0)
None

© 2010 - cnpmjs.org x YWFE | Home | YWFE