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.0.1
  • Source
  • npm
  • Socket score

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

sri-toolbox Build Status

Subresource Integrity tools.

Install

npm install sri-toolbox

Usage

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

sriToolbox({ options }, data); //=> result

Note: this module supports currying.

var sriToolboxer = sriToolbox({ option });

sriToolboxer(data); //=> result

Options

Key: type name = default

  • type name = value
    Description

Example

element1.integrity = sri.generate.string(jquerySourceCode);

element2.integrity = sri.generate.string(
    jquerySourceCode,
    {
        algorithms: [
            "sha-256",
            "sha-512"
        ],
        authority: "code.jquery.com",
        delimiter: " \n",
        parameters: {
            "ct": "text/javascript"
        }
    },
    " \n"
);

API

generate

Functions responsible for Subresource Integrity ni-URI generation


generate.array (required data, optional options)

Returns ["string"...].
Generate an array of ni-URI strings.

generate.string (required data, optional options)

Returns "string...".
Generate a delimited string of ni-URI's.


data:
String to be hashed

options:

  • algorithms: ["name"...]
    Default: ["sha-256"]

    Array of RFC6920 Digest Algorithms

    Digest Algorithm: The name of the digest algorithm, as specified in the IANA registry defined in Section 9.4. For example, [ "sha-256", "sha-512" ]

  • authority: "hostname"
    Default: ""

    RFC6920 Authority value

    Authority: The optional authority component may assist applications in accessing the object named by an ni-URI. There is no default value for the authority field. (See Section 3.2.2 of [RFC3986] for details.) While ni names with and without an authority differ syntactically from ni names with different authorities, all three refer to the same object if and only if the digest algorithm, length, and value are the same.

  • delimiter: "delimiter"
    Default: " "

    generate.string ni-URI delimiter.

  • parameters: { "name": "value" }
    Default: { }

    Deserialized list of RFC6920 Query Parameters
    For example, a content-type specifier: { "ct": "text/plain" }

Keywords

FAQs

Package last updated on 30 Jan 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