Socket
Socket
Sign inDemoInstall

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 - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

.travis.yml

61

generate.js

@@ -1,9 +0,17 @@

/*
sri-toolbox.generate
4/*
sri-toolbox-generate
*/
"use strict";
var serialize = require("rfc6920-toolbox").serialize;
var R = require("ramda");
var rfc6920Toolbox = require("rfc6920-toolbox");
var defaults = R.mixin({
algorithms: ["sha-256"],
authority: "",
parameters: {},
delimiter: " ",
serialize: true
});
/*

@@ -13,28 +21,26 @@ Functionality

var array = function (string, options) {
// Defaults
options = {
algorithms: options.algorithms || ["sha-256"],
authority: options.authority || "",
parameters: options.parameters || {}
}; // TODO: Mixin
return options.algorithms.slice(0) // Array clone
.map(function (algorithm) {
return serialize({
authority: options.authority,
algorithm: algorithm,
data: string,
paramaters: options.parameters
});
var array = R.curry(function (options, dataString) {
return R.map(function (algorithm) {
return rfc6920Toolbox.serialize({
authority: options.authority,
algorithm: algorithm,
digest: rfc6920Toolbox.digest(algorithm, dataString),
parameters: options.parameters
});
};
}, options.algorithms);
});
var string = function (string, options) {
// Defaults
options.delimiter = options.delimiter || " "; // TODO: Mixin
return array(options).join(options.delimiter);
};
var string = R.curry(function (options, dataString) {
return array(options, dataString).join(options.delimiter);
});
var main = R.curry(function (options, dataString) {
options = defaults(options);
if (options.serialize) return string(options, dataString);
return array(options, string);
});
/*

@@ -45,6 +51,3 @@ Exports

if (typeof module !== "undefined") {
module.exports = {
array: array,
string: string
};
module.exports = main;
}
{
"name": "sri-toolbox",
"version": "0.0.0",
"version": "0.0.1",
"description": "Subresource Integrity tools",

@@ -12,9 +12,10 @@ "author": {

"type": "git",
"url": "git://github.com/neftaly/npm-sri-toolbox.git"
"url": "https://github.com/neftaly/npm-sri-toolbox.git"
},
"main": "sri-toolbox",
"main": "main",
"scripts": {
"test": "expresso"
"test": "mocha"
},
"keywords": [
"sri-toolbox",
"SRI",

@@ -26,6 +27,7 @@ "Subresource Integrity",

"dependencies": {
"rfc6920-toolbox": "0.x.x"
"ramda": "~0.8.0",
"rfc6920-toolbox": "0.1.1"
},
"devDependencies": {
"expresso": "0.9.2"
"mocha": "~2.1.0"
},

@@ -32,0 +34,0 @@ "engines": {

@@ -1,4 +0,5 @@

# sri-toolbox
[Subresource Integrity](http://www.w3.org/TR/SRI/) toolbox.
# sri-toolbox [![Build Status](https://travis-ci.org/neftaly/npm-sri-toolbox.svg?branch=master)](https://travis-ci.org/neftaly/npm-sri-toolbox)
[Subresource Integrity](http://www.w3.org/TR/SRI/) tools.
Install

@@ -10,2 +11,32 @@ -------

Usage
-----
```javascript
var sriToolbox = require("sri-toolbox");
sriToolbox({ options }, data); //=> result
```
**Note:** this module supports [currying](http://fr.umio.us/favoring-curry/).
```javascript
var sriToolboxer = sriToolbox({ option });
sriToolboxer(data); //=> result
```
Options
-------
Key: type **name** *= default*
* type **name** *= value*
Description
---
Example

@@ -12,0 +43,0 @@ -------

Sorry, the diff of this file is not supported yet

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