Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
Update deps. Closes #267. Closes #268
Browse files Browse the repository at this point in the history
  • Loading branch information
hueniverse committed Jan 10, 2020
1 parent bbd672b commit dd54922
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 44 deletions.
5 changes: 0 additions & 5 deletions .npmignore

This file was deleted.

3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: node_js

node_js:
- "8"
- "10"
- "12"
- "node"

Expand All @@ -14,6 +12,7 @@ install:

env:
- HAPI_VERSION="18"
- HAPI_VERSION="19"

os:
- "linux"
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2012-2019, Sideway Inc, and project contributors
Copyright (c) 2012-2020, Sideway Inc, and project contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
32 changes: 16 additions & 16 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ exports.header = function (uri, method, options) {
!method || typeof method !== 'string' ||
!options || typeof options !== 'object') {

throw new Boom('Invalid argument type');
throw new Boom.Boom('Invalid argument type');
}

// Application time
Expand All @@ -66,11 +66,11 @@ exports.header = function (uri, method, options) {
!credentials.key ||
!credentials.algorithm) {

throw new Boom('Invalid credentials');
throw new Boom.Boom('Invalid credentials');
}

if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
throw new Boom('Unknown algorithm');
throw new Boom.Boom('Unknown algorithm');
}

// Parse URI
Expand Down Expand Up @@ -150,7 +150,7 @@ exports.authenticate = function (res, credentials, artifacts, options) {
var wwwAttributes = Utils.parseAuthorizationHeader(res.headers['www-authenticate'], ['ts', 'tsm', 'error']);
}
catch (err) {
throw new Boom('Invalid WWW-Authenticate header');
throw new Boom.Boom('Invalid WWW-Authenticate header');
}

result.headers['www-authenticate'] = wwwAttributes;
Expand All @@ -160,7 +160,7 @@ exports.authenticate = function (res, credentials, artifacts, options) {
if (wwwAttributes.ts) {
const tsm = Crypto.calculateTsMac(wwwAttributes.ts, credentials);
if (tsm !== wwwAttributes.tsm) {
throw new Boom('Invalid server timestamp hash', { decorate: result });
throw new Boom.Boom('Invalid server timestamp hash', { decorate: result });
}
}
}
Expand All @@ -169,7 +169,7 @@ exports.authenticate = function (res, credentials, artifacts, options) {

if (!res.headers['server-authorization']) {
if (options.required) {
throw new Boom('Missing Server-Authorization header', { decorate: result });
throw new Boom.Boom('Missing Server-Authorization header', { decorate: result });
}

return result;
Expand All @@ -179,7 +179,7 @@ exports.authenticate = function (res, credentials, artifacts, options) {
var serverAuthAttributes = Utils.parseAuthorizationHeader(res.headers['server-authorization'], ['mac', 'ext', 'hash']);
}
catch (err) {
throw new Boom('Invalid Server-Authorization header', { decorate: result });
throw new Boom.Boom('Invalid Server-Authorization header', { decorate: result });
}

result.headers['server-authorization'] = serverAuthAttributes;
Expand All @@ -189,7 +189,7 @@ exports.authenticate = function (res, credentials, artifacts, options) {

const mac = Crypto.calculateMac('response', credentials, artifacts);
if (mac !== serverAuthAttributes.mac) {
throw new Boom('Bad response mac', { decorate: result });
throw new Boom.Boom('Bad response mac', { decorate: result });
}

if (options.payload === null ||
Expand All @@ -199,12 +199,12 @@ exports.authenticate = function (res, credentials, artifacts, options) {
}

if (!serverAuthAttributes.hash) {
throw new Boom('Missing response hash attribute', { decorate: result });
throw new Boom.Boom('Missing response hash attribute', { decorate: result });
}

const calculatedHash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, res.headers['content-type']);
if (calculatedHash !== serverAuthAttributes.hash) {
throw new Boom('Bad response payload mac', { decorate: result });
throw new Boom.Boom('Bad response payload mac', { decorate: result });
}

return result;
Expand Down Expand Up @@ -243,7 +243,7 @@ exports.getBewit = function (uri, options) {
typeof options !== 'object' ||
!options.ttlSec) {

throw new Boom('Invalid inputs');
throw new Boom.Boom('Invalid inputs');
}

const ext = (options.ext === null || options.ext === undefined ? '' : options.ext); // Zero is valid value
Expand All @@ -260,11 +260,11 @@ exports.getBewit = function (uri, options) {
!credentials.key ||
!credentials.algorithm) {

throw new Boom('Invalid credentials');
throw new Boom.Boom('Invalid credentials');
}

if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
throw new Boom('Unknown algorithm');
throw new Boom.Boom('Unknown algorithm');
}

// Parse URI
Expand Down Expand Up @@ -328,7 +328,7 @@ exports.message = function (host, port, message, options) {
message === null || message === undefined || typeof message !== 'string' ||
typeof options !== 'object') {

throw new Boom('Invalid inputs');
throw new Boom.Boom('Invalid inputs');
}

// Application time
Expand All @@ -343,11 +343,11 @@ exports.message = function (host, port, message, options) {
!credentials.key ||
!credentials.algorithm) {

throw new Boom('Invalid credentials');
throw new Boom.Boom('Invalid credentials');
}

if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
throw new Boom('Unknown algorithm');
throw new Boom.Boom('Unknown algorithm');
}

// Calculate signature
Expand Down
2 changes: 1 addition & 1 deletion lib/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const internals = {};
exports.plugin = {
pkg: require('../package.json'),
requirements: {
hapi: '>=17.7.0'
hapi: '>=18.4.0'
},
register: function (server) {

Expand Down
20 changes: 10 additions & 10 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ exports.authenticate = async function (req, credentialsFunc, options) {
if (!credentials.key ||
!credentials.algorithm) {

throw new Boom('Invalid credentials', { decorate: result });
throw new Boom.Boom('Invalid credentials', { decorate: result });
}

if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
throw new Boom('Unknown algorithm', { decorate: result });
throw new Boom.Boom('Unknown algorithm', { decorate: result });
}

// Calculate MAC
Expand Down Expand Up @@ -259,7 +259,7 @@ exports.header = function (credentials, artifacts, options) {
typeof artifacts !== 'object' ||
typeof options !== 'object') {

throw new Boom('Invalid inputs');
throw new Boom.Boom('Invalid inputs');
}

artifacts = Hoek.clone(artifacts);
Expand All @@ -273,11 +273,11 @@ exports.header = function (credentials, artifacts, options) {
!credentials.key ||
!credentials.algorithm) {

throw new Boom('Invalid credentials');
throw new Boom.Boom('Invalid credentials');
}

if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
throw new Boom('Unknown algorithm');
throw new Boom.Boom('Unknown algorithm');
}

// Calculate payload hash
Expand Down Expand Up @@ -408,7 +408,7 @@ exports.authenticateBewit = async function (req, credentialsFunc, options) {
var credentials = await credentialsFunc(bewit.id);
}
catch (err) {
throw new Boom(err, { decorate: { bewit } });
throw new Boom.Boom(err, { decorate: { bewit } });
}

if (!credentials) {
Expand All @@ -420,11 +420,11 @@ exports.authenticateBewit = async function (req, credentialsFunc, options) {
if (!credentials.key ||
!credentials.algorithm) {

throw new Boom('Invalid credentials', { decorate: result });
throw new Boom.Boom('Invalid credentials', { decorate: result });
}

if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
throw new Boom('Unknown algorithm', { decorate: result });
throw new Boom.Boom('Unknown algorithm', { decorate: result });
}

// Calculate MAC
Expand Down Expand Up @@ -489,11 +489,11 @@ exports.authenticateMessage = async function (host, port, message, authorization
if (!credentials.key ||
!credentials.algorithm) {

throw new Boom('Invalid credentials', { decorate: result });
throw new Boom.Boom('Invalid credentials', { decorate: result });
}

if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
throw new Boom('Unknown algorithm', { decorate: result });
throw new Boom.Boom('Unknown algorithm', { decorate: result });
}

// Construct artifacts container
Expand Down
19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,26 @@
"version": "7.1.2",
"repository": "git://github.com/hapijs/hawk",
"main": "lib/index.js",
"files": [
"lib"
],
"keywords": [
"http",
"authentication",
"scheme",
"hawk"
],
"dependencies": {
"@hapi/hoek": "8.x.x",
"@hapi/b64": "4.x.x",
"@hapi/boom": "7.x.x",
"@hapi/cryptiles": "4.x.x",
"@hapi/sntp": "3.x.x"
"@hapi/hoek": "9.x.x",
"@hapi/b64": "5.x.x",
"@hapi/boom": "9.x.x",
"@hapi/cryptiles": "5.x.x",
"@hapi/sntp": "4.x.x"
},
"devDependencies": {
"@hapi/code": "6.x.x",
"@hapi/hapi": "18.x.x",
"@hapi/lab": "20.x.x"
"@hapi/code": "8.x.x",
"@hapi/hapi": "19.x.x",
"@hapi/lab": "22.x.x"
},
"scripts": {
"test": "lab -a @hapi/code -t 100 -L",
Expand Down
2 changes: 1 addition & 1 deletion test/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ describe('Plugin', () => {

return 'Success';
},
options: { auth: 'default', validate: { query: {} } }
options: { auth: 'default', validate: { query: false } }
});

const authHeader = hawkHeader('john', '/hawkValidate?a=1');
Expand Down

0 comments on commit dd54922

Please sign in to comment.