Comparing version 2.0.1 to 2.0.2
@@ -1,3 +0,1 @@ | ||
var badArgumentsError = new Error('hpkp must be called with a maxAge and at least two SHA-256s (one actually used and another kept as a backup).') | ||
module.exports = function hpkp (passedOptions) { | ||
@@ -18,2 +16,4 @@ var options = parseOptions(passedOptions) | ||
function parseOptions (options) { | ||
var badArgumentsError = new Error('hpkp must be called with a maxAge and at least two SHA-256s (one actually used and another kept as a backup).') | ||
if (!options) { throw badArgumentsError } | ||
@@ -20,0 +20,0 @@ |
@@ -10,3 +10,3 @@ { | ||
"description": "HTTP Public Key Pinning (HPKP) middleware", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"keywords": [ | ||
@@ -27,2 +27,7 @@ "helmet", | ||
"bugs": "https://github.com/helmetjs/hpkp/issues", | ||
"files": [ | ||
"LICENSE", | ||
"README.md", | ||
"index.js" | ||
], | ||
"scripts": { | ||
@@ -34,5 +39,5 @@ "pretest": "standard", | ||
"connect": "^3.7.0", | ||
"mocha": "^8.1.1", | ||
"standard": "^14.3.4", | ||
"supertest": "^4.0.2" | ||
"mocha": "^8.3.2", | ||
"standard": "^16.0.3", | ||
"supertest": "^6.1.3" | ||
}, | ||
@@ -39,0 +44,0 @@ "standard": { |
@@ -1,4 +0,2 @@ | ||
HTTP Public Key Pinning (HPKP) middleware | ||
========================================= | ||
[![Build Status](https://travis-ci.org/helmetjs/hpkp.svg?branch=master)](https://travis-ci.org/helmetjs/hpkp) | ||
# HTTP Public Key Pinning (HPKP) middleware | ||
@@ -14,21 +12,23 @@ **This header has been deprecated citing risks of misuse, and therefore is not recommeded.** This module (`hpkp`) will not receive any new feature development but will still be maintained. | ||
```js | ||
const express = require('express') | ||
const hpkp = require('hpkp') | ||
const express = require("express"); | ||
const hpkp = require("hpkp"); | ||
const app = express() | ||
const app = express(); | ||
const ninetyDaysInSeconds = 7776000 | ||
app.use(hpkp({ | ||
maxAge: ninetyDaysInSeconds, | ||
sha256s: ['AbCdEf123=', 'ZyXwVu456='], | ||
includeSubDomains: true, // optional | ||
reportUri: 'http://example.com', // optional | ||
reportOnly: false, // optional | ||
const ninetyDaysInSeconds = 7776000; | ||
app.use( | ||
hpkp({ | ||
maxAge: ninetyDaysInSeconds, | ||
sha256s: ["AbCdEf123=", "ZyXwVu456="], | ||
includeSubDomains: true, // optional | ||
reportUri: "http://example.com", // optional | ||
reportOnly: false, // optional | ||
// Set the header based on a condition. | ||
// This is optional. | ||
setIf(req, res) { | ||
return req.secure | ||
} | ||
})) | ||
// Set the header based on a condition. | ||
// This is optional. | ||
setIf(req, res) { | ||
return req.secure; | ||
}, | ||
}) | ||
); | ||
``` | ||
@@ -35,0 +35,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5448