http-auth-utils
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -0,1 +1,5 @@ | ||
## [3.0.3](https://github.com/nfroidure/http-auth-utils/compare/v3.0.2...v3.0.3) (2022-05-25) | ||
## [3.0.2](https://github.com/nfroidure/http-auth-utils/compare/v3.0.1...v3.0.2) (2021-12-15) | ||
@@ -2,0 +6,0 @@ |
@@ -6,6 +6,2 @@ "use strict"; | ||
}); | ||
exports.parseWWWAuthenticateHeader = parseWWWAuthenticateHeader; | ||
exports.parseAuthorizationHeader = parseAuthorizationHeader; | ||
exports.buildWWWAuthenticateHeader = buildWWWAuthenticateHeader; | ||
exports.buildAuthorizationHeader = buildAuthorizationHeader; | ||
Object.defineProperty(exports, "BASIC", { | ||
@@ -17,15 +13,19 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, "DIGEST", { | ||
Object.defineProperty(exports, "BEARER", { | ||
enumerable: true, | ||
get: function () { | ||
return _digest.default; | ||
return _bearer.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "BEARER", { | ||
Object.defineProperty(exports, "DIGEST", { | ||
enumerable: true, | ||
get: function () { | ||
return _bearer.default; | ||
return _digest.default; | ||
} | ||
}); | ||
exports.buildAuthorizationHeader = buildAuthorizationHeader; | ||
exports.buildWWWAuthenticateHeader = buildWWWAuthenticateHeader; | ||
exports.mechanisms = void 0; | ||
exports.parseAuthorizationHeader = parseAuthorizationHeader; | ||
exports.parseWWWAuthenticateHeader = parseWWWAuthenticateHeader; | ||
@@ -32,0 +32,0 @@ var _yerror = _interopRequireDefault(require("yerror")); |
@@ -82,3 +82,3 @@ /** | ||
} & Partial<BasicAuthorizationData>) | (BasicAuthorizationData & { | ||
hash?: string; | ||
hash?: string | undefined; | ||
})) => string; | ||
@@ -85,0 +85,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
export declare function parseHTTPHeadersQuotedKeyValueSet(contents: string, authorizedKeys: string[], requiredKeys?: any[]): Record<string, string>; | ||
export declare function parseHTTPHeadersQuotedKeyValueSet(contents: string, authorizedKeys: string[], requiredKeys?: string[]): Record<string, string>; | ||
export declare function buildHTTPHeadersQuotedKeyValueSet(data: Record<string, string>, authorizedKeys: string[], requiredKeys?: string[]): string; |
@@ -6,4 +6,4 @@ "use strict"; | ||
}); | ||
exports.buildHTTPHeadersQuotedKeyValueSet = buildHTTPHeadersQuotedKeyValueSet; | ||
exports.parseHTTPHeadersQuotedKeyValueSet = parseHTTPHeadersQuotedKeyValueSet; | ||
exports.buildHTTPHeadersQuotedKeyValueSet = buildHTTPHeadersQuotedKeyValueSet; | ||
@@ -10,0 +10,0 @@ var _yerror = _interopRequireDefault(require("yerror")); |
{ | ||
"name": "http-auth-utils", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Parse, build and deal with HTTP authorization headers.", | ||
@@ -80,31 +80,31 @@ "main": "dist/index", | ||
"devDependencies": { | ||
"@babel/cli": "^7.13.14", | ||
"@babel/core": "^7.13.15", | ||
"@babel/eslint-parser": "^7.13.14", | ||
"@babel/plugin-proposal-class-properties": "^7.13.0", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.13.8", | ||
"@babel/preset-env": "^7.13.15", | ||
"@babel/preset-typescript": "^7.13.0", | ||
"@babel/register": "^7.13.14", | ||
"@types/jest": "^26.0.22", | ||
"@typescript-eslint/eslint-plugin": "^4.21.0", | ||
"@typescript-eslint/parser": "^4.21.0", | ||
"commitizen": "^4.2.3", | ||
"conventional-changelog-cli": "^2.1.1", | ||
"coveralls": "^3.1.0", | ||
"@babel/cli": "^7.17.10", | ||
"@babel/core": "^7.18.2", | ||
"@babel/eslint-parser": "^7.18.2", | ||
"@babel/plugin-proposal-class-properties": "^7.17.12", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.18.0", | ||
"@babel/preset-env": "^7.18.2", | ||
"@babel/preset-typescript": "^7.17.12", | ||
"@babel/register": "^7.17.7", | ||
"@types/jest": "^27.0.2", | ||
"@typescript-eslint/eslint-plugin": "^5.26.0", | ||
"@typescript-eslint/parser": "^5.26.0", | ||
"commitizen": "^4.2.4", | ||
"conventional-changelog-cli": "^2.2.2", | ||
"coveralls": "^3.1.1", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"eslint": "^7.23.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"jest": "^26.6.3", | ||
"jsarch": "^4.0.1", | ||
"jsdoc-to-markdown": "^7.0.1", | ||
"metapak": "^4.0.1", | ||
"metapak-nfroidure": "11.0.7", | ||
"eslint": "^8.16.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"jest": "^28.1.0", | ||
"jsarch": "^5.0.1", | ||
"jsdoc-to-markdown": "^7.1.1", | ||
"metapak": "^4.0.3", | ||
"metapak-nfroidure": "11.2.1", | ||
"neatequal": "^1.0.0", | ||
"prettier": "^2.2.1", | ||
"prettier": "^2.6.2", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.2.4" | ||
"typescript": "^4.7.2" | ||
}, | ||
"dependencies": { | ||
"yerror": "^6.0.0" | ||
"yerror": "^6.0.2" | ||
}, | ||
@@ -111,0 +111,0 @@ "engines": { |
@@ -13,7 +13,2 @@ [//]: # ( ) | ||
[![Coverage Status](https://coveralls.io/repos/github/nfroidure/http-auth-utils/badge.svg?branch=master)](https://coveralls.io/github/nfroidure/http-auth-utils?branch=master) | ||
[![NPM version](https://badge.fury.io/js/http-auth-utils.svg)](https://npmjs.org/package/http-auth-utils) | ||
[![Dependency Status](https://david-dm.org/nfroidure/http-auth-utils.svg)](https://david-dm.org/nfroidure/http-auth-utils) | ||
[![devDependency Status](https://david-dm.org/nfroidure/http-auth-utils/dev-status.svg)](https://david-dm.org/nfroidure/http-auth-utils#info=devDependencies) | ||
[![Package Quality](https://npm.packagequality.com/shield/http-auth-utils.svg)](https://packagequality.com/#?package=http-auth-utils) | ||
[![Code Climate](https://codeclimate.com/github/nfroidure/http-auth-utils.svg)](https://codeclimate.com/github/nfroidure/http-auth-utils) | ||
@@ -20,0 +15,0 @@ |
@@ -83,3 +83,3 @@ import YError from 'yerror'; | ||
export function parseWWWAuthenticateHeader< | ||
T extends Mechanism = typeof BASIC | typeof BEARER | typeof DIGEST | ||
T extends Mechanism = typeof BASIC | typeof BEARER | typeof DIGEST, | ||
>( | ||
@@ -93,3 +93,6 @@ header: string, | ||
} { | ||
let result = null; | ||
let result: { | ||
type: T['type']; | ||
data: ReturnType<T['parseWWWAuthenticateRest']>; | ||
} | null = null; | ||
@@ -105,3 +108,3 @@ authMechanisms.some((authMechanism) => { | ||
header.substr(authMechanism.type.length + 1), | ||
), | ||
) as ReturnType<T['parseWWWAuthenticateRest']>, | ||
}; | ||
@@ -141,3 +144,3 @@ return true; | ||
export function parseAuthorizationHeader< | ||
T extends Mechanism = typeof BASIC | typeof BEARER | typeof DIGEST | ||
T extends Mechanism = typeof BASIC | typeof BEARER | typeof DIGEST, | ||
>( | ||
@@ -151,3 +154,6 @@ header: string, | ||
} { | ||
let result = null; | ||
let result: { | ||
type: T['type']; | ||
data: ReturnType<T['parseAuthorizationRest']>; | ||
} | null = null; | ||
@@ -163,3 +169,3 @@ authMechanisms.some(function (authMechanism) { | ||
header.substr(authMechanism.type.length + 1), | ||
), | ||
) as ReturnType<T['parseAuthorizationRest']>, | ||
}; | ||
@@ -166,0 +172,0 @@ return true; |
@@ -75,3 +75,3 @@ /** | ||
rest, | ||
(AUTHORIZED_WWW_AUTHENTICATE_KEYS as unknown) as string[], | ||
AUTHORIZED_WWW_AUTHENTICATE_KEYS as unknown as string[], | ||
[], | ||
@@ -105,3 +105,3 @@ ) as BearerWWWAuthenticateData; | ||
AUTHORIZED_ERROR_CODES.indexOf( | ||
(data.error as unknown) as BearerAuthorizedErrorCodes, | ||
data.error as unknown as BearerAuthorizedErrorCodes, | ||
) | ||
@@ -113,3 +113,3 @@ ) { | ||
data, | ||
(AUTHORIZED_WWW_AUTHENTICATE_KEYS as unknown) as string[], | ||
AUTHORIZED_WWW_AUTHENTICATE_KEYS as unknown as string[], | ||
[], | ||
@@ -116,0 +116,0 @@ ); |
@@ -23,3 +23,3 @@ import YError from 'yerror'; | ||
authorizedKeys: string[], | ||
requiredKeys = [], | ||
requiredKeys: string[] = [], | ||
): Record<string, string> { | ||
@@ -26,0 +26,0 @@ const matches = contents.trim().match(KEYVALUE_REGEXP); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
3968
325536
682
Updatedyerror@^6.0.2