@routr/connect 2.0.8-alpha.39 → 2.0.8-alpha.40
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/handlers.js +1 -1
- package/dist/router.js +1 -1
- package/dist/utils.d.ts +2 -10
- package/dist/utils.js +3 -1
- package/package.json +5 -5
package/dist/handlers.js
CHANGED
@@ -69,7 +69,7 @@ const handleRegister = (apiClient, location) => {
|
|
69
69
|
else if ((0, utils_1.hasXConnectObjectHeader)(request)) {
|
70
70
|
const connectToken = processor_1.Extensions.getHeaderValue(request, common_1.CommonTypes.ExtraHeader.CONNECT_TOKEN);
|
71
71
|
try {
|
72
|
-
const payload = yield jwtVerifier.verify(connectToken);
|
72
|
+
const payload = (yield jwtVerifier.verify(connectToken));
|
73
73
|
if (!payload.allowedMethods.includes(common_1.Method.REGISTER)) {
|
74
74
|
return res.send(common_1.Auth.createForbideenResponse());
|
75
75
|
}
|
package/dist/router.js
CHANGED
@@ -48,7 +48,7 @@ function router(location, apiClient) {
|
|
48
48
|
if ((0, utils_1.hasXConnectObjectHeader)(request)) {
|
49
49
|
const connectToken = processor_1.Extensions.getHeaderValue(request, common_1.CommonTypes.ExtraHeader.CONNECT_TOKEN);
|
50
50
|
try {
|
51
|
-
const payload = yield jwtVerifier.verify(connectToken);
|
51
|
+
const payload = (yield jwtVerifier.verify(connectToken));
|
52
52
|
const domain = yield (0, utils_1.findDomain)(apiClient, payload.domain);
|
53
53
|
if (!payload.allowedMethods.includes(common_1.Method.INVITE)) {
|
54
54
|
return common_1.Auth.createForbideenResponse();
|
package/dist/utils.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { HeaderModifier, MessageRequest, Transport, CommonConnect as CC,
|
1
|
+
import { HeaderModifier, MessageRequest, Transport, CommonConnect as CC, Verifier as V } from "@routr/common";
|
2
2
|
import { RoutingDirection } from "./types";
|
3
3
|
export declare const isKind: (res: CC.RoutableResourceUnion, kind: CC.Kind) => boolean;
|
4
4
|
export declare const findDomain: (apiClient: CC.APIClient, domainUri: string) => Promise<CC.Domain>;
|
@@ -20,13 +20,5 @@ export declare const getSIPURI: (uri: {
|
|
20
20
|
}) => string;
|
21
21
|
export declare const hasXConnectObjectHeader: (req: MessageRequest) => string;
|
22
22
|
export declare const getVerifierImpl: () => {
|
23
|
-
verify: (token: string) => Promise<
|
24
|
-
ref: string;
|
25
|
-
domain: string;
|
26
|
-
domainRef: string;
|
27
|
-
aor: string;
|
28
|
-
aorLink: string;
|
29
|
-
username: string;
|
30
|
-
allowedMethods: Method[];
|
31
|
-
}>;
|
23
|
+
verify: (token: string) => Promise<import("@routr/common/dist/errors").ServiceUnavailableError | V.VerifyResponse>;
|
32
24
|
};
|
package/dist/utils.js
CHANGED
@@ -189,7 +189,6 @@ const getSIPURI = (uri) => uri.user ? `sip:${uri.user}@${uri.host}` : `sip:${uri
|
|
189
189
|
exports.getSIPURI = getSIPURI;
|
190
190
|
const hasXConnectObjectHeader = (req) => processor_1.Extensions.getHeaderValue(req, common_1.CommonTypes.ExtraHeader.CONNECT_TOKEN);
|
191
191
|
exports.hasXConnectObjectHeader = hasXConnectObjectHeader;
|
192
|
-
// TODO: Add support for GRPCVerifier
|
193
192
|
const getVerifierImpl = () => {
|
194
193
|
if (envs_1.CONNECT_VERIFIER_PUBLIC_KEY_PATH) {
|
195
194
|
const publicKey = fs_1.default.readFileSync(envs_1.CONNECT_VERIFIER_PUBLIC_KEY_PATH, "utf8");
|
@@ -199,6 +198,9 @@ const getVerifierImpl = () => {
|
|
199
198
|
})
|
200
199
|
};
|
201
200
|
}
|
201
|
+
else if (envs_1.CONNECT_VERIFIER_ADDR) {
|
202
|
+
return { verify: common_1.Verifier.verifier(envs_1.CONNECT_VERIFIER_ADDR) };
|
203
|
+
}
|
202
204
|
return null;
|
203
205
|
};
|
204
206
|
exports.getVerifierImpl = getVerifierImpl;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@routr/connect",
|
3
|
-
"version": "2.0.8-alpha.
|
3
|
+
"version": "2.0.8-alpha.40",
|
4
4
|
"description": "Default processor",
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
6
6
|
"homepage": "https://github.com/fonoster/routr#readme",
|
@@ -29,9 +29,9 @@
|
|
29
29
|
"@opentelemetry/sdk-trace-base": "^1.0.4",
|
30
30
|
"@opentelemetry/sdk-trace-node": "^1.0.4",
|
31
31
|
"@opentelemetry/semantic-conventions": "^1.0.4",
|
32
|
-
"@routr/common": "^2.0.8-alpha.
|
33
|
-
"@routr/location": "^2.0.8-alpha.
|
34
|
-
"@routr/processor": "^2.0.8-alpha.
|
32
|
+
"@routr/common": "^2.0.8-alpha.40",
|
33
|
+
"@routr/location": "^2.0.8-alpha.40",
|
34
|
+
"@routr/processor": "^2.0.8-alpha.40",
|
35
35
|
"jsonwebtoken": "^9.0.0"
|
36
36
|
},
|
37
37
|
"devDependencies": {
|
@@ -50,5 +50,5 @@
|
|
50
50
|
"bugs": {
|
51
51
|
"url": "https://github.com/fonoster/routr/issues"
|
52
52
|
},
|
53
|
-
"gitHead": "
|
53
|
+
"gitHead": "3ac346a36a43ba06578accf48d7a4adac24a0911"
|
54
54
|
}
|