@bwi-mentorspaces/application-utils-npm 0.0.60 → 0.0.62
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/calendar/cronofy/cronofy.api.d.ts +23 -2
- package/calendar/cronofy/cronofy.api.js +36 -0
- package/calendar/cronofy/cronofy.api.js.map +1 -1
- package/calendar/cronofy/models/_/cronofy.data.d.ts +21 -0
- package/calendar/cronofy/models/index.d.ts +2 -2
- package/chat/stream/models/_/event.data.d.ts +8 -0
- package/deployment/_/serverless.d.ts +3 -2
- package/deployment/_/serverless.js.map +1 -1
- package/package.json +1 -1
- package/session/ms.live/ms.live.api.js +0 -3
- package/session/ms.live/ms.live.api.js.map +1 -1
- package/session/ms.live/ms.live.auth.d.ts +2 -2
- package/session/ms.live/ms.live.auth.js +9 -9
- package/session/ms.live/ms.live.auth.js.map +1 -1
- package/utils/_/encryptor.js +6 -10
- package/utils/_/encryptor.js.map +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ICronofyAccessToken, ICronofyApplicationCalendar, ICronofyConfig, ICronofyElementTokenParams, ICronofyElementTokenResponse } from "./models";
|
|
2
|
-
import { ICronofyAvailabilityRulesPostParams } from "./models/_/cronofy.data";
|
|
1
|
+
import { ICronofyAccessToken, ICronofyApplicationCalendar, ICronofyConfig, ICronofyElementTokenParams, ICronofyElementTokenResponse, ICronofyListCalendarProfileResponse } from "./models";
|
|
2
|
+
import { ICronofyAvailabilityRulesPostParams, ICronofyCreateEventParams, ICronofyDeleteEventParams } from "./models/_/cronofy.data";
|
|
3
3
|
export declare class CronofyAPI {
|
|
4
4
|
private _cronofy;
|
|
5
5
|
constructor(config: ICronofyConfig);
|
|
@@ -45,4 +45,25 @@ export declare class CronofyAPI {
|
|
|
45
45
|
* @returns {Promise<boolean>} Returns true if the request was successful
|
|
46
46
|
*/
|
|
47
47
|
upsertAvailabilityRule(accessToken: string, params: ICronofyAvailabilityRulesPostParams): Promise<boolean>;
|
|
48
|
+
/**
|
|
49
|
+
* Fetch user's calendar profile
|
|
50
|
+
*
|
|
51
|
+
* @param {string} accessToken The Cronofy calendar access token
|
|
52
|
+
* @returns {Promise<ICronofyListCalendarProfileResponse[]>} Returns the user's calendar profile list
|
|
53
|
+
*/
|
|
54
|
+
getUserCalendarProfile(accessToken: string): Promise<ICronofyListCalendarProfileResponse[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Create or update a Cronofy calendar event.
|
|
57
|
+
*
|
|
58
|
+
* @param {ICronofyCreateEventParams} params Parameters for the Cronofy availability rules POST API
|
|
59
|
+
* @returns {Promise<boolean>} Returns true if the request was successful
|
|
60
|
+
*/
|
|
61
|
+
upsertCalendarEvent(accessToken: string, params: ICronofyCreateEventParams): Promise<boolean>;
|
|
62
|
+
/**
|
|
63
|
+
* Delete a Cronofy calendar event.
|
|
64
|
+
*
|
|
65
|
+
* @param {ICronofyDeleteEventParams} params Parameters for the Cronofy availability rules POST API
|
|
66
|
+
* @returns {Promise<boolean>} Returns true if the request was successful
|
|
67
|
+
*/
|
|
68
|
+
deleteCalendarEvent(accessToken: string, params: ICronofyDeleteEventParams): Promise<boolean>;
|
|
48
69
|
}
|
|
@@ -110,6 +110,42 @@ let CronofyAPI = class CronofyAPI {
|
|
|
110
110
|
return res && res.availability_rule && res && res.availability_rule.availability_rule_id;
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Fetch user's calendar profile
|
|
115
|
+
*
|
|
116
|
+
* @param {string} accessToken The Cronofy calendar access token
|
|
117
|
+
* @returns {Promise<ICronofyListCalendarProfileResponse[]>} Returns the user's calendar profile list
|
|
118
|
+
*/
|
|
119
|
+
getUserCalendarProfile(accessToken) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
const res = yield this._cronofy.listCalendars({ access_token: accessToken });
|
|
122
|
+
return res.calendars;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Create or update a Cronofy calendar event.
|
|
127
|
+
*
|
|
128
|
+
* @param {ICronofyCreateEventParams} params Parameters for the Cronofy availability rules POST API
|
|
129
|
+
* @returns {Promise<boolean>} Returns true if the request was successful
|
|
130
|
+
*/
|
|
131
|
+
upsertCalendarEvent(accessToken, params) {
|
|
132
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
const res = yield this._cronofy.createEvent(Object.assign({ access_token: accessToken }, params));
|
|
134
|
+
return res;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Delete a Cronofy calendar event.
|
|
139
|
+
*
|
|
140
|
+
* @param {ICronofyDeleteEventParams} params Parameters for the Cronofy availability rules POST API
|
|
141
|
+
* @returns {Promise<boolean>} Returns true if the request was successful
|
|
142
|
+
*/
|
|
143
|
+
deleteCalendarEvent(accessToken, params) {
|
|
144
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
const res = yield this._cronofy.deleteEvent(Object.assign({ access_token: accessToken }, params));
|
|
146
|
+
return res;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
113
149
|
};
|
|
114
150
|
CronofyAPI = __decorate([
|
|
115
151
|
(0, tsyringe_1.injectable)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cronofy.api.js","sourceRoot":"","sources":["../../../calendar/cronofy/cronofy.api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAA8B;AAC9B,uCAAsC;
|
|
1
|
+
{"version":3,"file":"cronofy.api.js","sourceRoot":"","sources":["../../../calendar/cronofy/cronofy.api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAA8B;AAC9B,uCAAsC;AAiB/B,IAAM,UAAU,GAAhB,MAAM,UAAU;IAGnB,YAAY,MAAsB;QAC9B,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAO,CAAC;YACxB,SAAS,EAAE,MAAM,CAAC,QAAQ;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AAC,OAAO,CAAC,CAAC;QACrD,CAAC;KAAA;IAED;;;;;OAKG;IACU,sBAAsB,CAAC,WAAmB,EAAE,MAA2C;;YAChG,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,sBAAsB,iBAAG,YAAY,EAAE,WAAW,IAAK,MAAM,EAAG,CAAC;YACjG,OAAO,GAAG,IAAI,GAAG,CAAC,iBAAiB,IAAI,GAAG,IAAI,GAAG,CAAC,iBAAiB,CAAC,oBAAoB,CAAC;QAC7F,CAAC;KAAA;IAED;;;;;OAKG;IACU,sBAAsB,CAAC,WAAmB;;YACnD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC;YAC7E,OAAO,GAAG,CAAC,SAAS,CAAC;QACzB,CAAC;KAAA;IAED;;;;;OAKG;IACU,mBAAmB,CAAC,WAAmB,EAAE,MAAiC;;YACnF,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,iBAAG,YAAY,EAAE,WAAW,IAAK,MAAM,EAAG,CAAC;YACtF,OAAO,GAAG,CAAC;QACf,CAAC;KAAA;IAED;;;;;OAKG;IACU,mBAAmB,CAAC,WAAmB,EAAE,MAAiC;;YACnF,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,iBAAG,YAAY,EAAE,WAAW,IAAK,MAAM,EAAG,CAAC;YACtF,OAAO,GAAG,CAAC;QACf,CAAC;KAAA;CACJ,CAAA;AAnHY,UAAU;IADtB,IAAA,qBAAU,GAAE;;GACA,UAAU,CAmHtB;AAnHY,gCAAU"}
|
|
@@ -33,6 +33,9 @@ export interface ICronofyApplicationCalendar {
|
|
|
33
33
|
profile_name: string;
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
+
export interface ICronofyListCalendarProfileResponse {
|
|
37
|
+
calendar_id: string;
|
|
38
|
+
}
|
|
36
39
|
/**
|
|
37
40
|
* Cronofy Element Token Request Parameters data interface
|
|
38
41
|
*/
|
|
@@ -68,3 +71,21 @@ export interface ICronofyAvailabilityRulesWeeklyPeriod {
|
|
|
68
71
|
start_time: string;
|
|
69
72
|
end_time: string;
|
|
70
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Cronofy create/update calendar event post request parameters interface
|
|
76
|
+
*/
|
|
77
|
+
export interface ICronofyCreateEventParams {
|
|
78
|
+
calendar_id: string;
|
|
79
|
+
event_id: string;
|
|
80
|
+
summary: string;
|
|
81
|
+
description: string;
|
|
82
|
+
start: Date;
|
|
83
|
+
end: Date;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Cronofy delete calendar event delete request parameters interface
|
|
87
|
+
*/
|
|
88
|
+
export interface ICronofyDeleteEventParams {
|
|
89
|
+
calendar_id: string;
|
|
90
|
+
event_id: string;
|
|
91
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ICronofyConfig } from "./_/cronofy.config";
|
|
2
|
-
import { ICronofyAccessToken, ICronofyElementTokenParams, ICronofyElementTokenResponse, ICronofyApplicationCalendar, ICronofyAvailabilityRulesPostParams, ICronofyAvailabilityRulesWeeklyPeriod } from "./_/cronofy.data";
|
|
3
|
-
export { ICronofyAccessToken, ICronofyConfig, ICronofyElementTokenParams, ICronofyElementTokenResponse, ICronofyApplicationCalendar, ICronofyAvailabilityRulesPostParams, ICronofyAvailabilityRulesWeeklyPeriod };
|
|
2
|
+
import { ICronofyAccessToken, ICronofyElementTokenParams, ICronofyElementTokenResponse, ICronofyApplicationCalendar, ICronofyAvailabilityRulesPostParams, ICronofyAvailabilityRulesWeeklyPeriod, ICronofyCreateEventParams, ICronofyDeleteEventParams, ICronofyListCalendarProfileResponse } from "./_/cronofy.data";
|
|
3
|
+
export { ICronofyAccessToken, ICronofyConfig, ICronofyElementTokenParams, ICronofyElementTokenResponse, ICronofyApplicationCalendar, ICronofyAvailabilityRulesPostParams, ICronofyAvailabilityRulesWeeklyPeriod, ICronofyCreateEventParams, ICronofyDeleteEventParams, ICronofyListCalendarProfileResponse };
|
|
@@ -32,6 +32,7 @@ export interface IEventTypesData {
|
|
|
32
32
|
channelRef: string;
|
|
33
33
|
ref: string;
|
|
34
34
|
id: number;
|
|
35
|
+
sessionType: string | null;
|
|
35
36
|
};
|
|
36
37
|
[CustomEventType.SessionInvited]: {
|
|
37
38
|
title: string;
|
|
@@ -42,7 +43,9 @@ export interface IEventTypesData {
|
|
|
42
43
|
channelRef: string;
|
|
43
44
|
sessionRef: string;
|
|
44
45
|
sessionId: number;
|
|
46
|
+
sessionType: string | null;
|
|
45
47
|
attendeeType: string;
|
|
48
|
+
attendeeRef?: string;
|
|
46
49
|
};
|
|
47
50
|
[CustomEventType.SessionRSVP]: {
|
|
48
51
|
title: string;
|
|
@@ -53,6 +56,7 @@ export interface IEventTypesData {
|
|
|
53
56
|
channelRef: string;
|
|
54
57
|
sessionRef: string;
|
|
55
58
|
sessionId: number;
|
|
59
|
+
sessionType: string | null;
|
|
56
60
|
attendeeType: string;
|
|
57
61
|
};
|
|
58
62
|
[CustomEventType.SessionDeclined]: {
|
|
@@ -64,6 +68,7 @@ export interface IEventTypesData {
|
|
|
64
68
|
channelRef: string;
|
|
65
69
|
sessionRef: string;
|
|
66
70
|
sessionId: number;
|
|
71
|
+
sessionType: string | null;
|
|
67
72
|
attendeeType: string;
|
|
68
73
|
};
|
|
69
74
|
[CustomEventType.SessionUpdated]: {
|
|
@@ -75,6 +80,7 @@ export interface IEventTypesData {
|
|
|
75
80
|
channelRef: string;
|
|
76
81
|
ref: string;
|
|
77
82
|
id: number;
|
|
83
|
+
sessionType: string | null;
|
|
78
84
|
};
|
|
79
85
|
[CustomEventType.SessionCanceled]: {
|
|
80
86
|
title: string;
|
|
@@ -85,6 +91,7 @@ export interface IEventTypesData {
|
|
|
85
91
|
channelRef: string;
|
|
86
92
|
ref: string;
|
|
87
93
|
id: number;
|
|
94
|
+
sessionType: string | null;
|
|
88
95
|
};
|
|
89
96
|
[CustomEventType.SessionStarting]: {
|
|
90
97
|
title: string;
|
|
@@ -95,6 +102,7 @@ export interface IEventTypesData {
|
|
|
95
102
|
channelRef: string;
|
|
96
103
|
sessionRef: string;
|
|
97
104
|
sessionId: number;
|
|
105
|
+
sessionType: string | null;
|
|
98
106
|
attendeeType: string;
|
|
99
107
|
twilioRef: string;
|
|
100
108
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="express-serve-static-core" />
|
|
2
|
+
import { APIGatewayProxyEventV2, Context, APIGatewayProxyResultV2 } from "aws-lambda";
|
|
2
3
|
/**
|
|
3
4
|
* Serverless handler declarations
|
|
4
5
|
*/
|
|
5
6
|
interface IServerless {
|
|
6
|
-
handler:
|
|
7
|
+
handler: (event: APIGatewayProxyEventV2, context: Context) => Promise<APIGatewayProxyResultV2>;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
10
|
* Serverless Handler implementation
|
|
@@ -19,6 +20,6 @@ export declare class Serverless implements IServerless {
|
|
|
19
20
|
* handler getter
|
|
20
21
|
* @returns {Handler} serverless handler
|
|
21
22
|
*/
|
|
22
|
-
get handler():
|
|
23
|
+
get handler(): (event: APIGatewayProxyEventV2, context: Context) => Promise<import("aws-lambda").APIGatewayProxyStructuredResultV2>;
|
|
23
24
|
}
|
|
24
25
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverless.js","sourceRoot":"","sources":["../../../deployment/_/serverless.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"serverless.js","sourceRoot":"","sources":["../../../deployment/_/serverless.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,sEAAsD;AAUtD;;GAEG;AACH,MAAa,UAAU;IAGnB;;;OAGG;IACH,YAAY,GAAwB;QAChC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IACpB,CAAC;IAED,kBAAkB;IAClB;;;OAGG;IACH,IAAI,OAAO;QACP,MAAM,OAAO,GAAY,IAAA,yBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,OAAO,CAAO,KAA6B,EAAE,OAAgB,EAAE,EAAE;YAC7D,MAAM,MAAM,GAA4B,MAAM,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACtE,OAAO,MAAM,CAAC;QAClB,CAAC,CAAA,CAAC;IACN,CAAC;CACJ;AAvBD,gCAuBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bwi-mentorspaces/application-utils-npm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.62",
|
|
4
4
|
"description": "Mentor Spaces npm packages for reusable models, utils, and abstracted, commonly used processes for DB Repo, Logging, etc.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Mentor Spaces",
|
|
@@ -36,7 +36,6 @@ let MSLiveAPI = class MSLiveAPI extends ms_live_base_1.MSLiveBase {
|
|
|
36
36
|
super();
|
|
37
37
|
_MSLiveAPI_instances.add(this);
|
|
38
38
|
_MSLiveAPI_axiosInstance.set(this, void 0);
|
|
39
|
-
/* eslint-disable */
|
|
40
39
|
_MSLiveAPI_msLiveAuthInstance.set(this, void 0);
|
|
41
40
|
this._config = config;
|
|
42
41
|
// Set Axios baseURL to 100ms API BaseURI
|
|
@@ -73,7 +72,6 @@ let MSLiveAPI = class MSLiveAPI extends ms_live_base_1.MSLiveBase {
|
|
|
73
72
|
}
|
|
74
73
|
};
|
|
75
74
|
_MSLiveAPI_axiosInstance = new WeakMap(), _MSLiveAPI_msLiveAuthInstance = new WeakMap(), _MSLiveAPI_instances = new WeakSet(), _MSLiveAPI_configureAxios = function _MSLiveAPI_configureAxios() {
|
|
76
|
-
/* eslint-disable */
|
|
77
75
|
__classPrivateFieldGet(this, _MSLiveAPI_axiosInstance, "f").interceptors.request.use((config) => {
|
|
78
76
|
// Add Authorization on every request made using the Management token
|
|
79
77
|
config.headers = {
|
|
@@ -83,7 +81,6 @@ _MSLiveAPI_axiosInstance = new WeakMap(), _MSLiveAPI_msLiveAuthInstance = new We
|
|
|
83
81
|
};
|
|
84
82
|
return config;
|
|
85
83
|
}, (error) => Promise.reject(error));
|
|
86
|
-
/* eslint-disable */
|
|
87
84
|
__classPrivateFieldGet(this, _MSLiveAPI_axiosInstance, "f").interceptors.response.use((response) => {
|
|
88
85
|
return response;
|
|
89
86
|
}, (error) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ms.live.api.js","sourceRoot":"","sources":["../../../session/ms.live/ms.live.api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"ms.live.api.js","sourceRoot":"","sources":["../../../session/ms.live/ms.live.api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA4F;AAC5F,uCAAsC;AAEtC,iDAA4C;AAC5C,iDAA4C;AAC5C,iDAA4C;AAM5C,8CAA8C;AAEvC,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,yBAAU;IAOrC,YAAY,MAAqB;QAC7B,KAAK,EAAE,CAAC;;QAJZ,2CAA8B;QAC9B,gDAAgC;QAI5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,yCAAyC;QACzC,uBAAA,IAAI,4BAAkB,eAAK,CAAC,MAAM,CAC9B;YACI,OAAO,EAAE,2BAA2B;YACpC,OAAO,EAAE,CAAC,GAAG,KAAK;SACrB,CAAC,MAAA,CAAC;QAEP,uBAAA,IAAI,uDAAgB,MAApB,IAAI,CAAkB,CAAC;QACvB,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IAED;;;OAGG;IACK,IAAI;QACR,KAAK,CAAC,IAAI,GAAG,IAAI,yBAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE1C,0CAA0C;QAC1C,IAAI,CAAC,WAAW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EACzB;YACE,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;YACrD,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC;YAE9B,0DAA0D;YAC1D,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,SAAS,GAAG,uBAAA,IAAI,qCAAoB,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;YAC/G,IAAI;gBACA,OAAO,IAAA,eAAK,EAAC,eAAe,CAAC,CAAC;aACjC;YAAC,OAAO,KAAK,EAAE;gBACZ,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;aACrC;SACJ;QACD,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC,CACJ,CAAC;AACN,CAAC;AAtFQ,SAAS;IADrB,IAAA,qBAAU,GAAE;;GACA,SAAS,CAuFrB;AAvFY,8BAAS;AAyFtB,MAAM,CAAC,OAAO,GAAG,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -42,7 +42,7 @@ export declare class MSLiveAuth implements IMSLiveAuth {
|
|
|
42
42
|
* @returns {void} promise of type void
|
|
43
43
|
*/
|
|
44
44
|
init(msLiveAccessKey: string, msLiveSecretKey: string): void;
|
|
45
|
-
getManagementToken(forceNew
|
|
46
|
-
getAuthToken(
|
|
45
|
+
getManagementToken(forceNew?: boolean): string;
|
|
46
|
+
getAuthToken(roomId: string, userId: string, role: string): string;
|
|
47
47
|
}
|
|
48
48
|
export {};
|
|
@@ -13,14 +13,15 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
13
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
14
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
15
|
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
16
19
|
var _MSLiveAuth_instances, _MSLiveAuth_signPayloadToToken, _MSLiveAuth_isTokenExpired;
|
|
17
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
21
|
exports.MSLiveAuth = void 0;
|
|
19
22
|
const tsyringe_1 = require("tsyringe");
|
|
20
|
-
|
|
21
|
-
const jwt = require('jsonwebtoken');
|
|
23
|
+
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
22
24
|
const uuid_1 = require("uuid");
|
|
23
|
-
/* eslint-disable */
|
|
24
25
|
/**
|
|
25
26
|
* MSLive Auth implementation
|
|
26
27
|
*/
|
|
@@ -59,11 +60,11 @@ let MSLiveAuth = class MSLiveAuth {
|
|
|
59
60
|
return this._managementToken;
|
|
60
61
|
}
|
|
61
62
|
// Generate new Auth token for a peer
|
|
62
|
-
getAuthToken(
|
|
63
|
+
getAuthToken(roomId, userId, role) {
|
|
63
64
|
const payload = {
|
|
64
65
|
access_key: this._msLiveAccessKey,
|
|
65
|
-
room_id:
|
|
66
|
-
user_id:
|
|
66
|
+
room_id: roomId,
|
|
67
|
+
user_id: userId,
|
|
67
68
|
role: role,
|
|
68
69
|
type: 'app',
|
|
69
70
|
version: 2,
|
|
@@ -74,16 +75,15 @@ let MSLiveAuth = class MSLiveAuth {
|
|
|
74
75
|
}
|
|
75
76
|
};
|
|
76
77
|
_MSLiveAuth_instances = new WeakSet(), _MSLiveAuth_signPayloadToToken = function _MSLiveAuth_signPayloadToToken(payload) {
|
|
77
|
-
const token =
|
|
78
|
+
const token = jsonwebtoken_1.default.sign(payload, this._msLiveSecretKey, {
|
|
78
79
|
algorithm: 'HS256',
|
|
79
80
|
expiresIn: '24h',
|
|
80
81
|
jwtid: (0, uuid_1.v4)()
|
|
81
82
|
});
|
|
82
|
-
/* eslint-disable */
|
|
83
83
|
return token;
|
|
84
84
|
}, _MSLiveAuth_isTokenExpired = function _MSLiveAuth_isTokenExpired(token) {
|
|
85
85
|
try {
|
|
86
|
-
const { exp } =
|
|
86
|
+
const { exp } = jsonwebtoken_1.default.decode(token, { json: true });
|
|
87
87
|
const buffer = 30; // generate new if it's going to expire soon
|
|
88
88
|
const currTimeSeconds = Math.floor(Date.now() / 1000);
|
|
89
89
|
return !exp || exp + buffer < currTimeSeconds;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ms.live.auth.js","sourceRoot":"","sources":["../../../session/ms.live/ms.live.auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ms.live.auth.js","sourceRoot":"","sources":["../../../session/ms.live/ms.live.auth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,uCAAsC;AAEtC,gEAA+B;AAC/B,+BAAoC;AA0CpC;;GAEG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAU;IAMnB;;;OAGG;IACH,YAAY,MAAqB;;QAC7B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;OAKG;IACH,IAAI,CAAC,eAAuB,EAAE,eAAuB;QACjD,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;QACxC,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;QACxC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC;IA6BD,sDAAsD;IACtD,kBAAkB,CAAC,QAAkB;QACjC,IAAI,QAAQ,IAAI,uBAAA,IAAI,yDAAgB,MAApB,IAAI,EAAiB,IAAI,CAAC,gBAAgB,CAAC,EAAE;YACzD,MAAM,OAAO,GAAG;gBACZ,UAAU,EAAE,IAAI,CAAC,gBAAgB;gBACjC,IAAI,EAAE,YAAY;gBAClB,OAAO,EAAE,CAAC;gBACV,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE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GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,IAAI,GAAG,GAAG,MAAM,GAAG,eAAe,CAAC;KACjD;IAAC,OAAO,GAAG,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;KACf;AACL,CAAC;AAnDQ,UAAU;IADtB,IAAA,qBAAU,GAAE;;GACA,UAAU,CAkFtB;AAlFY,gCAAU;AAoFvB,MAAM,CAAC,OAAO,GAAG,EAAE,UAAU,EAAE,CAAC"}
|
package/utils/_/encryptor.js
CHANGED
|
@@ -39,12 +39,10 @@ class Encryptor {
|
|
|
39
39
|
* @returns {string} encrypted value
|
|
40
40
|
*/
|
|
41
41
|
static encrypt(type, value, key) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return Crypto.AES.encrypt(value, key).toString();
|
|
45
|
-
default:
|
|
46
|
-
return Crypto.AES.encrypt(value, key).toString();
|
|
42
|
+
if (type === 0 /* EncryptionType.AES */) {
|
|
43
|
+
return Crypto.AES.encrypt(value, key).toString();
|
|
47
44
|
}
|
|
45
|
+
return Crypto.AES.encrypt(value, key).toString();
|
|
48
46
|
}
|
|
49
47
|
/**
|
|
50
48
|
* Method that decrypts a value
|
|
@@ -54,12 +52,10 @@ class Encryptor {
|
|
|
54
52
|
* @returns {string} decrypted value
|
|
55
53
|
*/
|
|
56
54
|
static decrypt(type, cipher, key) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return Crypto.AES.decrypt(cipher, key).toString(Crypto.enc.Utf8);
|
|
60
|
-
default:
|
|
61
|
-
return Crypto.AES.decrypt(cipher, key).toString(Crypto.enc.Utf8);
|
|
55
|
+
if (type === 0 /* EncryptionType.AES */) {
|
|
56
|
+
return Crypto.AES.decrypt(cipher, key).toString(Crypto.enc.Utf8);
|
|
62
57
|
}
|
|
58
|
+
return Crypto.AES.decrypt(cipher, key).toString(Crypto.enc.Utf8);
|
|
63
59
|
}
|
|
64
60
|
}
|
|
65
61
|
exports.Encryptor = Encryptor;
|
package/utils/_/encryptor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryptor.js","sourceRoot":"","sources":["../../../utils/_/encryptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAoC;AAGpC;;;;GAIG;AACH,MAAsB,SAAS;IAC3B;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CAAC,IAAoB,EAAE,KAAa,EAAE,GAAW;QAC3D,
|
|
1
|
+
{"version":3,"file":"encryptor.js","sourceRoot":"","sources":["../../../utils/_/encryptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAoC;AAGpC;;;;GAIG;AACH,MAAsB,SAAS;IAC3B;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CAAC,IAAoB,EAAE,KAAa,EAAE,GAAW;QAC3D,IAAI,IAAI,+BAAuB,EAAE;YAC7B,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC;SACpD;QACD,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC;IACrD,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CAAC,IAAoB,EAAE,MAAc,EAAE,GAAW;QAC5D,IAAI,IAAI,+BAAuB,EAAE;YAC7B,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SACpE;QACD,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrE,CAAC;CACJ;AA5BD,8BA4BC"}
|