@routr/common 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth.d.ts +1 -10
- package/dist/auth.js +1 -14
- package/dist/types.d.ts +0 -10
- package/package.json +2 -2
package/dist/auth.d.ts
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AuthChallengeResponse, ResponseType } from "./types";
|
|
2
2
|
export declare const generateNonce: (algorithm?: string) => string;
|
|
3
|
-
export declare const buildAuthChallenge: (request: AuthChallengeRequest) => {
|
|
4
|
-
realm: string;
|
|
5
|
-
scheme: "Digest";
|
|
6
|
-
algorithm: "MD5";
|
|
7
|
-
qop: import("./types").Qop;
|
|
8
|
-
opaque: string;
|
|
9
|
-
stale: boolean;
|
|
10
|
-
nonce: string;
|
|
11
|
-
};
|
|
12
3
|
export declare const calculateAuthResponse: (res: AuthChallengeResponse, credentials: {
|
|
13
4
|
username: string;
|
|
14
5
|
secret: string;
|
package/dist/auth.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createForbideenResponse = exports.createServerInternalErrorResponse = exports.createUnauthorizedResponseWithoutChallenge = exports.createUnauthorizedResponse = exports.getCredentials = exports.calculateAuthResponse = exports.
|
|
6
|
+
exports.createForbideenResponse = exports.createServerInternalErrorResponse = exports.createUnauthorizedResponseWithoutChallenge = exports.createUnauthorizedResponse = exports.getCredentials = exports.calculateAuthResponse = exports.generateNonce = void 0;
|
|
7
7
|
/*
|
|
8
8
|
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
9
9
|
* http://github.com/fonoster/routr
|
|
@@ -29,19 +29,6 @@ const md5hex = (str, algorithm = DEFAULT_ALGORITHM) => crypto_1.default.createHa
|
|
|
29
29
|
const decToHex = (dec) => (dec + Math.pow(16, 8)).toString(16).substr(-8);
|
|
30
30
|
const generateNonce = (algorithm = DEFAULT_ALGORITHM) => md5hex(`${new Date().getTime()}${Math.random()}`, algorithm);
|
|
31
31
|
exports.generateNonce = generateNonce;
|
|
32
|
-
const buildAuthChallenge = (request) => {
|
|
33
|
-
const { realm, scheme, algorithm, qop, opaque, stale } = request;
|
|
34
|
-
return {
|
|
35
|
-
realm,
|
|
36
|
-
scheme,
|
|
37
|
-
algorithm,
|
|
38
|
-
qop,
|
|
39
|
-
opaque,
|
|
40
|
-
stale,
|
|
41
|
-
nonce: (0, exports.generateNonce)(algorithm)
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
exports.buildAuthChallenge = buildAuthChallenge;
|
|
45
32
|
const calculateAuthResponse = (res, credentials) => {
|
|
46
33
|
if (!credentials)
|
|
47
34
|
return null;
|
package/dist/types.d.ts
CHANGED
|
@@ -86,16 +86,6 @@ export interface ObjectProto {
|
|
|
86
86
|
path: string;
|
|
87
87
|
version: string;
|
|
88
88
|
}
|
|
89
|
-
export interface AuthChallengeRequest {
|
|
90
|
-
realm: string;
|
|
91
|
-
domain: string;
|
|
92
|
-
opaque: string;
|
|
93
|
-
stale: boolean;
|
|
94
|
-
nonce: string;
|
|
95
|
-
scheme: AuthorizationScheme;
|
|
96
|
-
algorithm: AuthorizationAlgorithm;
|
|
97
|
-
qop: Qop;
|
|
98
|
-
}
|
|
99
89
|
export interface AuthChallengeResponse {
|
|
100
90
|
realm: string;
|
|
101
91
|
domain: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@routr/common",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Common package",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/routr#readme",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/js-yaml": "^4.0.5"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "704808be190e0fc8b07ceb3d98c15758c5c6c33c"
|
|
59
59
|
}
|