Socket
Socket
Sign inDemoInstall

hawk

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hawk - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

dist/browser.js

2

client.js
'use strict';
module.exports = require('./dist/client');
module.exports = require('./dist/browser');

@@ -54,4 +54,8 @@ 'use strict';

Request('http://127.0.0.1:8000/resource/1?b=1&a=2', (error, response, body) => {
Request('http://127.0.0.1:8000/resource/1?b=1&a=2', (err, response, body) => {
if (err) {
console.log(err);
}
console.log(response.statusCode + ': ' + body);

@@ -65,2 +69,6 @@ });

if (err) {
process.exit(1);
}
const header = Hawk.client.header('http://127.0.0.1:8000/resource/1?b=1&a=2', 'GET', { credentials: credentials, ext: 'and welcome!' });

@@ -75,4 +83,8 @@ const options = {

Request(options, (error, response, body) => {
Request(options, (err, response, body) => {
if (err) {
process.exit(1);
}
const isValid = Hawk.client.authenticate(response, credentials, header.artifacts, { payload: body });

@@ -79,0 +91,0 @@ console.log(response.statusCode + ': ' + body + (isValid ? ' (valid)' : ' (invalid)'));

{
"name": "hawk",
"description": "HTTP Hawk Authentication Scheme",
"version": "4.0.0",
"version": "4.0.1",
"author": "Eran Hammer <eran@hammer.io> (http://hueniverse.com)",

@@ -28,3 +28,3 @@ "repository": "git://github.com/hueniverse/hawk",

"code": "2.x.x",
"lab": "7.x.x"
"lab": "8.x.x"
},

@@ -35,3 +35,3 @@ "babel": {

"scripts": {
"build-client": "mkdir -p dist; babel lib/client.js --out-file dist/client.js",
"build-client": "mkdir -p dist; babel lib/browser.js --out-file dist/browser.js",
"prepublish": "npm run-script build-client",

@@ -38,0 +38,0 @@ "test": "lab -a code -t 100 -L",

@@ -6,7 +6,7 @@ ![hawk Logo](https://raw.github.com/hueniverse/hawk/master/images/hawk.png)

Current version: **3.x**
Current version: **4.x**
Note: 3.x and 2.x are the same exact protocol as 1.1. The version increments reflect changes in the node API.
Note: 4.x, 3.x, and 2.x are the same exact protocol as 1.1. The version increments reflect changes in the node API.
[![Build Status](https://secure.travis-ci.org/hueniverse/hawk.png)](http://travis-ci.org/hueniverse/hawk)
[![Build Status](https://travis-ci.org/hueniverse/hawk.svg?branch=master)](https://travis-ci.org/hueniverse/hawk)

@@ -13,0 +13,0 @@ # Table of Content

@@ -50,2 +50,4 @@ 'use strict';

expect(err).to.not.exist();
const bewit = Browser.client.bewit('http://example.com/resource/4?a=1&b=2', { credentials: credentials1, ttlSec: 60 * 60 * 24 * 365 * 100, ext: 'some-app-data' });

@@ -75,2 +77,4 @@ req.url += '&bewit=' + bewit;

expect(err).to.not.exist();
const bewit = Browser.client.bewit('http://example.com/resource/4?a=1&b=2', { credentials: credentials1, ttlSec: 60 * 60 * 24 * 365 * 100 });

@@ -238,2 +242,4 @@ req.url += '&bewit=' + bewit;

expect(err).to.not.exist();
req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data' }).field;

@@ -267,2 +273,4 @@ expect(req.authorization).to.exist();

expect(err).to.not.exist();
const reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });

@@ -312,2 +320,4 @@ req.headers.authorization = reqHeader.field;

expect(err).to.not.exist();
const reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });

@@ -353,2 +363,4 @@ req.headers.authorization = reqHeader.field;

expect(err).to.not.exist();
req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', localtimeOffsetMsec: 100000 }).field;

@@ -382,2 +394,4 @@ expect(req.authorization).to.exist();

expect(err).to.not.exist();
const reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });

@@ -427,2 +441,4 @@ req.headers.authorization = reqHeader.field;

expect(err).to.not.exist();
const reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });

@@ -465,2 +481,4 @@ req.headers.authorization = reqHeader.field;

expect(err).to.not.exist();
Browser.utils.setNtpOffset(60 * 60 * 1000);

@@ -515,2 +533,4 @@ const header = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data' });

expect(err).to.not.exist();
const localStorage = new Browser.internals.LocalStorage();

@@ -575,2 +595,4 @@

expect(err).to.not.exist();
const reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });

@@ -616,2 +638,4 @@ req.headers.authorization = reqHeader.field;

expect(err).to.not.exist();
req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, payload: 'hola!', ext: 'some-app-data' }).field;

@@ -639,2 +663,4 @@ Hawk.server.authenticate(req, credentialsFunc, {}, (err, credentials2, artifacts) => {

expect(err).to.not.exist();
req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, payload: 'hola!', ext: 'some-app-data' }).field;

@@ -664,2 +690,4 @@ Hawk.server.authenticate(req, credentialsFunc, {}, (err, credentials2, artifacts) => {

expect(err).to.not.exist();
req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', app: 'asd23ased' }).field;

@@ -688,2 +716,4 @@ Hawk.server.authenticate(req, credentialsFunc, {}, (err, credentials2, artifacts) => {

expect(err).to.not.exist();
req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', app: 'asd23ased', dlg: '23434szr3q4d' }).field;

@@ -713,2 +743,4 @@ Hawk.server.authenticate(req, credentialsFunc, {}, (err, credentials2, artifacts) => {

expect(err).to.not.exist();
req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, payload: 'hola!', ext: 'some-app-data' }).field;

@@ -735,2 +767,4 @@ Hawk.server.authenticate(req, credentialsFunc, { payload: 'byebye!' }, (err, credentials2, artifacts) => {

expect(err).to.not.exist();
req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data' }).field;

@@ -1134,2 +1168,4 @@ req.url = '/something/else';

expect(err).to.not.exist();
const auth = Browser.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -1151,2 +1187,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Browser.client.message('example.com', 8080, 'some message', { credentials: credentials, nonce: 'abc123', timestamp: 1398536270957 });

@@ -1164,2 +1202,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Browser.client.message(null, 8080, 'some message', { credentials: credentials });

@@ -1175,2 +1215,4 @@ expect(auth).to.not.exist();

expect(err).to.not.exist();
const auth = Browser.client.message(5, 8080, 'some message', { credentials: credentials });

@@ -1186,2 +1228,4 @@ expect(auth).to.not.exist();

expect(err).to.not.exist();
const auth = Browser.client.message('example.com', 0, 'some message', { credentials: credentials });

@@ -1197,2 +1241,4 @@ expect(auth).to.not.exist();

expect(err).to.not.exist();
const auth = Browser.client.message('example.com', 'a', 'some message', { credentials: credentials });

@@ -1208,2 +1254,4 @@ expect(auth).to.not.exist();

expect(err).to.not.exist();
const auth = Browser.client.message('example.com', 8080, undefined, { credentials: credentials });

@@ -1219,2 +1267,4 @@ expect(auth).to.not.exist();

expect(err).to.not.exist();
const auth = Browser.client.message('example.com', 8080, null, { credentials: credentials });

@@ -1230,2 +1280,4 @@ expect(auth).to.not.exist();

expect(err).to.not.exist();
const auth = Browser.client.message('example.com', 8080, 5, { credentials: credentials });

@@ -1255,2 +1307,4 @@ expect(auth).to.not.exist();

expect(err).to.not.exist();
const creds = Hoek.clone(credentials);

@@ -1268,2 +1322,4 @@ delete creds.id;

expect(err).to.not.exist();
const creds = Hoek.clone(credentials);

@@ -1281,2 +1337,4 @@ delete creds.key;

expect(err).to.not.exist();
const creds = Hoek.clone(credentials);

@@ -1297,2 +1355,4 @@ creds.algorithm = 'blah';

expect(err).to.not.exist();
const tsm = Hawk.crypto.timestampMessage(credentials);

@@ -1308,2 +1368,4 @@ expect(Browser.client.authenticateTimestamp(tsm, credentials)).to.equal(true);

expect(err).to.not.exist();
const offset = Browser.utils.getNtpOffset();

@@ -1321,2 +1383,4 @@ const tsm = Hawk.crypto.timestampMessage(credentials, 10000);

expect(err).to.not.exist();
const tsm = Hawk.crypto.timestampMessage(credentials);

@@ -1323,0 +1387,0 @@ tsm.ts = 4;

@@ -49,2 +49,4 @@ 'use strict';

expect(err).to.not.exist();
req.authorization = Hawk.client.header(Url.parse('http://example.com:8080/resource/4?filter=a'), req.method, { credentials: credentials1, ext: 'some-app-data' }).field;

@@ -78,2 +80,4 @@ expect(req.authorization).to.exist();

expect(err).to.not.exist();
const reqHeader = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });

@@ -119,2 +123,4 @@ req.headers.authorization = reqHeader.field;

expect(err).to.not.exist();
const reqHeader = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });

@@ -160,2 +166,4 @@ req.headers.authorization = reqHeader.field;

expect(err).to.not.exist();
const reqHeader = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });

@@ -201,2 +209,4 @@ req.headers.authorization = reqHeader.field;

expect(err).to.not.exist();
const reqHeader = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });

@@ -238,2 +248,4 @@ req.headers.authorization = reqHeader.field;

expect(err).to.not.exist();
req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, payload: 'hola!', ext: 'some-app-data' }).field;

@@ -261,2 +273,4 @@ Hawk.server.authenticate(req, credentialsFunc, {}, (err, credentials2, artifacts) => {

expect(err).to.not.exist();
req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, payload: 'hola!', ext: 'some-app-data' }).field;

@@ -286,2 +300,4 @@ Hawk.server.authenticate(req, credentialsFunc, {}, (err, credentials2, artifacts) => {

expect(err).to.not.exist();
req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, payload: 'hola!', ext: 'some-app-data' }).field;

@@ -309,2 +325,4 @@ Hawk.server.authenticate(req, credentialsFunc, { payload: 'hola!' }, (err, credentials2, artifacts) => {

expect(err).to.not.exist();
req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', app: 'asd23ased' }).field;

@@ -333,2 +351,4 @@ Hawk.server.authenticate(req, credentialsFunc, {}, (err, credentials2, artifacts) => {

expect(err).to.not.exist();
req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', app: 'asd23ased', dlg: '23434szr3q4d' }).field;

@@ -358,2 +378,4 @@ Hawk.server.authenticate(req, credentialsFunc, {}, (err, credentials2, artifacts) => {

expect(err).to.not.exist();
req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, payload: 'hola!', ext: 'some-app-data' }).field;

@@ -380,2 +402,4 @@ Hawk.server.authenticate(req, credentialsFunc, { payload: 'byebye!' }, (err, credentials2, artifacts) => {

expect(err).to.not.exist();
req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data' }).field;

@@ -382,0 +406,0 @@ req.url = '/something/else';

@@ -980,2 +980,4 @@ 'use strict';

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -997,2 +999,4 @@ delete auth.ts;

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -1014,2 +1018,4 @@ delete auth.nonce;

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -1031,2 +1037,4 @@ delete auth.hash;

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -1051,2 +1059,4 @@

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -1071,2 +1081,4 @@ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -1088,2 +1100,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -1105,2 +1119,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -1122,2 +1138,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1, localtimeOffsetMsec: 100000 });

@@ -1138,2 +1156,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -1156,2 +1176,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -1173,2 +1195,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -1195,2 +1219,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -1217,2 +1243,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -1239,2 +1267,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -1261,2 +1291,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -1283,2 +1315,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message(null, 8080, 'some message', { credentials: credentials });

@@ -1301,2 +1335,4 @@ expect(auth).to.not.exist();

expect(err).to.not.exist();
const creds = Hoek.clone(credentials);

@@ -1303,0 +1339,0 @@ creds.algorithm = 'blah';

@@ -50,2 +50,4 @@ 'use strict';

expect(err).to.not.exist();
const bewit = Hawk.uri.getBewit('http://example.com/resource/4?a=1&b=2', { credentials: credentials1, ttlSec: 60 * 60 * 24 * 365 * 100, ext: 'some-app-data' });

@@ -75,2 +77,4 @@ req.url += '&bewit=' + bewit;

expect(err).to.not.exist();
const bewit = Hawk.uri.getBewit('http://example.com/resource/4?a=1&b=2', { credentials: credentials1, ttlSec: 60 * 60 * 24 * 365 * 100 });

@@ -164,2 +168,4 @@ req.url += '&bewit=' + bewit;

expect(err).to.not.exist();
const req = {

@@ -603,2 +609,4 @@ method: 'POST',

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -620,2 +628,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -637,2 +647,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -654,2 +666,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1, localtimeOffsetMsec: 100000 });

@@ -670,2 +684,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -688,2 +704,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -705,2 +723,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -727,2 +747,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -749,2 +771,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -771,2 +795,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -793,2 +819,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });

@@ -815,2 +843,4 @@ expect(auth).to.exist();

expect(err).to.not.exist();
const auth = Hawk.client.message(null, 8080, 'some message', { credentials: credentials1 });

@@ -833,2 +863,4 @@ expect(auth).to.not.exist();

expect(err).to.not.exist();
const creds = Hoek.clone(credentials1);

@@ -835,0 +867,0 @@ creds.algorithm = 'blah';

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