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

Commit dd54922

Browse files
committedJan 10, 2020
Update deps. Closes #267. Closes #268
1 parent bbd672b commit dd54922

File tree

8 files changed

+41
-44
lines changed

8 files changed

+41
-44
lines changed
 

‎.npmignore

-5
This file was deleted.

‎.travis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
language: node_js
22

33
node_js:
4-
- "8"
5-
- "10"
64
- "12"
75
- "node"
86

@@ -14,6 +12,7 @@ install:
1412

1513
env:
1614
- HAPI_VERSION="18"
15+
- HAPI_VERSION="19"
1716

1817
os:
1918
- "linux"

‎LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2012-2019, Sideway Inc, and project contributors
1+
Copyright (c) 2012-2020, Sideway Inc, and project contributors
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

‎lib/client.js

+16-16
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ exports.header = function (uri, method, options) {
5151
!method || typeof method !== 'string' ||
5252
!options || typeof options !== 'object') {
5353

54-
throw new Boom('Invalid argument type');
54+
throw new Boom.Boom('Invalid argument type');
5555
}
5656

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

69-
throw new Boom('Invalid credentials');
69+
throw new Boom.Boom('Invalid credentials');
7070
}
7171

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

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

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

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

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

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

190190
const mac = Crypto.calculateMac('response', credentials, artifacts);
191191
if (mac !== serverAuthAttributes.mac) {
192-
throw new Boom('Bad response mac', { decorate: result });
192+
throw new Boom.Boom('Bad response mac', { decorate: result });
193193
}
194194

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

201201
if (!serverAuthAttributes.hash) {
202-
throw new Boom('Missing response hash attribute', { decorate: result });
202+
throw new Boom.Boom('Missing response hash attribute', { decorate: result });
203203
}
204204

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

210210
return result;
@@ -243,7 +243,7 @@ exports.getBewit = function (uri, options) {
243243
typeof options !== 'object' ||
244244
!options.ttlSec) {
245245

246-
throw new Boom('Invalid inputs');
246+
throw new Boom.Boom('Invalid inputs');
247247
}
248248

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

263-
throw new Boom('Invalid credentials');
263+
throw new Boom.Boom('Invalid credentials');
264264
}
265265

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

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

331-
throw new Boom('Invalid inputs');
331+
throw new Boom.Boom('Invalid inputs');
332332
}
333333

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

346-
throw new Boom('Invalid credentials');
346+
throw new Boom.Boom('Invalid credentials');
347347
}
348348

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

353353
// Calculate signature

‎lib/plugin.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const internals = {};
1313
exports.plugin = {
1414
pkg: require('../package.json'),
1515
requirements: {
16-
hapi: '>=17.7.0'
16+
hapi: '>=18.4.0'
1717
},
1818
register: function (server) {
1919

‎lib/server.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ exports.authenticate = async function (req, credentialsFunc, options) {
146146
if (!credentials.key ||
147147
!credentials.algorithm) {
148148

149-
throw new Boom('Invalid credentials', { decorate: result });
149+
throw new Boom.Boom('Invalid credentials', { decorate: result });
150150
}
151151

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

156156
// Calculate MAC
@@ -259,7 +259,7 @@ exports.header = function (credentials, artifacts, options) {
259259
typeof artifacts !== 'object' ||
260260
typeof options !== 'object') {
261261

262-
throw new Boom('Invalid inputs');
262+
throw new Boom.Boom('Invalid inputs');
263263
}
264264

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

276-
throw new Boom('Invalid credentials');
276+
throw new Boom.Boom('Invalid credentials');
277277
}
278278

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

283283
// Calculate payload hash
@@ -408,7 +408,7 @@ exports.authenticateBewit = async function (req, credentialsFunc, options) {
408408
var credentials = await credentialsFunc(bewit.id);
409409
}
410410
catch (err) {
411-
throw new Boom(err, { decorate: { bewit } });
411+
throw new Boom.Boom(err, { decorate: { bewit } });
412412
}
413413

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

423-
throw new Boom('Invalid credentials', { decorate: result });
423+
throw new Boom.Boom('Invalid credentials', { decorate: result });
424424
}
425425

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

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

492-
throw new Boom('Invalid credentials', { decorate: result });
492+
throw new Boom.Boom('Invalid credentials', { decorate: result });
493493
}
494494

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

499499
// Construct artifacts container

‎package.json

+11-8
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,26 @@
44
"version": "7.1.2",
55
"repository": "git://github.com/hapijs/hawk",
66
"main": "lib/index.js",
7+
"files": [
8+
"lib"
9+
],
710
"keywords": [
811
"http",
912
"authentication",
1013
"scheme",
1114
"hawk"
1215
],
1316
"dependencies": {
14-
"@hapi/hoek": "8.x.x",
15-
"@hapi/b64": "4.x.x",
16-
"@hapi/boom": "7.x.x",
17-
"@hapi/cryptiles": "4.x.x",
18-
"@hapi/sntp": "3.x.x"
17+
"@hapi/hoek": "9.x.x",
18+
"@hapi/b64": "5.x.x",
19+
"@hapi/boom": "9.x.x",
20+
"@hapi/cryptiles": "5.x.x",
21+
"@hapi/sntp": "4.x.x"
1922
},
2023
"devDependencies": {
21-
"@hapi/code": "6.x.x",
22-
"@hapi/hapi": "18.x.x",
23-
"@hapi/lab": "20.x.x"
24+
"@hapi/code": "8.x.x",
25+
"@hapi/hapi": "19.x.x",
26+
"@hapi/lab": "22.x.x"
2427
},
2528
"scripts": {
2629
"test": "lab -a @hapi/code -t 100 -L",

‎test/plugin.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ describe('Plugin', () => {
253253

254254
return 'Success';
255255
},
256-
options: { auth: 'default', validate: { query: {} } }
256+
options: { auth: 'default', validate: { query: false } }
257257
});
258258

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

0 commit comments

Comments
 (0)
This repository has been archived.