# sri-toolbox

> Subresource Integrity tools

Latest version **0.2.0** (published 2015-07-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install sri-toolbox
pnpm add sri-toolbox
yarn add sri-toolbox
bun add sri-toolbox
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2015-07-13 |
| First published | 2015-01-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.10.4 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Neftaly Hernandez |
| Maintainers | neftaly |
| Keywords | sri-toolbox, SRI, Subresource Integrity, integrity, security |

## Links

- npm: https://www.npmjs.com/package/sri-toolbox
- Repository: https://github.com/neftaly/npm-sri-toolbox
- Homepage: https://github.com/neftaly/npm-sri-toolbox#readme
- Issues: https://github.com/neftaly/npm-sri-toolbox/issues
- npm.io page: https://npm.io/package/sri-toolbox

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2015-07-13
- 0.1.3 — 2015-03-02
- 0.1.2 — 2015-02-25
- 0.1.1 — 2015-02-25
- 0.1.0 — 2015-02-19
- 0.0.1 — 2015-01-30
- 0.0.0 — 2015-01-14

## README

# sri-toolbox [![Build Status](https://travis-ci.org/neftaly/npm-sri-toolbox.svg?branch=master)](https://travis-ci.org/neftaly/npm-sri-toolbox) [![Coverage Status](https://coveralls.io/repos/neftaly/npm-sri-toolbox/badge.svg?branch=master)](https://coveralls.io/r/neftaly/npm-sri-toolbox?branch=master)

[Subresource Integrity](http://www.w3.org/TR/SRI/) tools.

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

Install
-------
```shell
npm install sri-toolbox
```

Usage
-----
```js
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":
```js
var integrityObject = sriToolbox.generate({
    full: true
}, jquerySourceCode);
//=> object
```
```json
{
    "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.

---
_Source: https://npm.io/package/sri-toolbox · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
