cidaas-javascript-sdk 3.1.3 → 3.1.4
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/CHANGELOG.md +2 -2
- package/dist/authentication/index.d.ts +55 -0
- package/{src/main/authentication/index.ts → dist/authentication/index.js} +127 -88
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/web-auth/ConsentService.d.ts +59 -0
- package/dist/web-auth/ConsentService.js +73 -0
- package/dist/web-auth/Entities.d.ts +533 -0
- package/dist/web-auth/Entities.js +78 -0
- package/dist/web-auth/Helper.d.ts +24 -0
- package/dist/web-auth/Helper.js +89 -0
- package/dist/web-auth/LoginService.d.ts +103 -0
- package/dist/web-auth/LoginService.js +248 -0
- package/dist/web-auth/TokenService.d.ts +48 -0
- package/dist/web-auth/TokenService.js +160 -0
- package/dist/web-auth/UserService.d.ts +143 -0
- package/dist/web-auth/UserService.js +311 -0
- package/dist/web-auth/VerificationService.d.ts +125 -0
- package/dist/web-auth/VerificationService.js +251 -0
- package/dist/web-auth/WebAuth.d.ts +882 -0
- package/dist/web-auth/WebAuth.js +1570 -0
- package/package.json +7 -8
- package/src/main/global.d.ts +0 -10
- package/src/main/index.ts +0 -6
- package/src/main/web-auth/ConsentService.ts +0 -76
- package/src/main/web-auth/Entities.ts +0 -610
- package/src/main/web-auth/Helper.ts +0 -75
- package/src/main/web-auth/LoginService.ts +0 -249
- package/src/main/web-auth/TokenService.ts +0 -106
- package/src/main/web-auth/UserService.ts +0 -297
- package/src/main/web-auth/VerificationService.ts +0 -247
- package/src/main/web-auth/WebAuth.ts +0 -1516
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.UserService = void 0;
|
|
4
|
+
var Helper_1 = require("./Helper");
|
|
5
|
+
var UserService;
|
|
6
|
+
(function (UserService) {
|
|
7
|
+
/**
|
|
8
|
+
* get user info
|
|
9
|
+
* @param options
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
function getUserProfile(options) {
|
|
13
|
+
if (!options.access_token) {
|
|
14
|
+
throw new Helper_1.CustomException("access_token cannot be empty", 417);
|
|
15
|
+
}
|
|
16
|
+
var _serviceURL = window.webAuthSettings.authority + "/users-srv/userinfo";
|
|
17
|
+
return Helper_1.Helper.createPostPromise(undefined, _serviceURL, undefined, "GET", options.access_token);
|
|
18
|
+
}
|
|
19
|
+
UserService.getUserProfile = getUserProfile;
|
|
20
|
+
;
|
|
21
|
+
/**
|
|
22
|
+
* register user
|
|
23
|
+
* @param options
|
|
24
|
+
* @param headers
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
function register(options, headers) {
|
|
28
|
+
return new Promise(function (resolve, reject) {
|
|
29
|
+
try {
|
|
30
|
+
var http = new XMLHttpRequest();
|
|
31
|
+
var _serviceURL = window.webAuthSettings.authority + "/users-srv/register";
|
|
32
|
+
if (options.invite_id) {
|
|
33
|
+
_serviceURL = _serviceURL + "?invite_id=" + options.invite_id;
|
|
34
|
+
}
|
|
35
|
+
http.onreadystatechange = function () {
|
|
36
|
+
if (http.readyState == 4) {
|
|
37
|
+
if (http.responseText) {
|
|
38
|
+
resolve(JSON.parse(http.responseText));
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
resolve(false);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
http.open("POST", _serviceURL, true);
|
|
46
|
+
http.setRequestHeader("Content-type", "application/json");
|
|
47
|
+
http.setRequestHeader("requestId", headers.requestId);
|
|
48
|
+
if (headers.captcha) {
|
|
49
|
+
http.setRequestHeader("captcha", headers.captcha);
|
|
50
|
+
}
|
|
51
|
+
if (headers.acceptlanguage) {
|
|
52
|
+
http.setRequestHeader("accept-language", headers.acceptlanguage);
|
|
53
|
+
}
|
|
54
|
+
else if (window.localeSettings) {
|
|
55
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
56
|
+
}
|
|
57
|
+
if (headers.bot_captcha_response) {
|
|
58
|
+
http.setRequestHeader("bot_captcha_response", headers.bot_captcha_response);
|
|
59
|
+
}
|
|
60
|
+
if (headers.trackId) {
|
|
61
|
+
http.setRequestHeader("trackid", headers.trackId);
|
|
62
|
+
}
|
|
63
|
+
http.send(JSON.stringify(options));
|
|
64
|
+
}
|
|
65
|
+
catch (ex) {
|
|
66
|
+
reject(ex);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
UserService.register = register;
|
|
71
|
+
;
|
|
72
|
+
/**
|
|
73
|
+
* get invite info
|
|
74
|
+
* @param options
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
function getInviteUserDetails(options) {
|
|
78
|
+
var _serviceURL = window.webAuthSettings.authority + "/users-srv/invite/info/" + options.invite_id;
|
|
79
|
+
return Helper_1.Helper.createPostPromise(undefined, _serviceURL, false, "GET");
|
|
80
|
+
}
|
|
81
|
+
UserService.getInviteUserDetails = getInviteUserDetails;
|
|
82
|
+
;
|
|
83
|
+
/**
|
|
84
|
+
* get Communication status
|
|
85
|
+
* @param options
|
|
86
|
+
* @returns
|
|
87
|
+
*/
|
|
88
|
+
function getCommunicationStatus(options) {
|
|
89
|
+
return new Promise(function (resolve, reject) {
|
|
90
|
+
try {
|
|
91
|
+
var http = new XMLHttpRequest();
|
|
92
|
+
var _serviceURL = window.webAuthSettings.authority + "/users-srv/user/communication/status/" + options.sub;
|
|
93
|
+
http.onreadystatechange = function () {
|
|
94
|
+
if (http.readyState == 4) {
|
|
95
|
+
if (http.responseText) {
|
|
96
|
+
resolve(JSON.parse(http.responseText));
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
resolve(false);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
http.open("GET", _serviceURL, true);
|
|
104
|
+
http.setRequestHeader("Content-type", "application/json");
|
|
105
|
+
if (options.requestId) {
|
|
106
|
+
http.setRequestHeader("requestId", options.requestId);
|
|
107
|
+
}
|
|
108
|
+
if (window.localeSettings) {
|
|
109
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
110
|
+
}
|
|
111
|
+
http.send();
|
|
112
|
+
}
|
|
113
|
+
catch (ex) {
|
|
114
|
+
reject(ex);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
UserService.getCommunicationStatus = getCommunicationStatus;
|
|
119
|
+
;
|
|
120
|
+
/**
|
|
121
|
+
* initiate reset password
|
|
122
|
+
* @param options
|
|
123
|
+
* @returns
|
|
124
|
+
*/
|
|
125
|
+
function initiateResetPassword(options) {
|
|
126
|
+
var _serviceURL = window.webAuthSettings.authority + "/users-srv/resetpassword/initiate";
|
|
127
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST");
|
|
128
|
+
}
|
|
129
|
+
UserService.initiateResetPassword = initiateResetPassword;
|
|
130
|
+
;
|
|
131
|
+
/**
|
|
132
|
+
* handle reset password
|
|
133
|
+
* @param options
|
|
134
|
+
*/
|
|
135
|
+
function handleResetPassword(options) {
|
|
136
|
+
try {
|
|
137
|
+
var url = window.webAuthSettings.authority + "/users-srv/resetpassword/validatecode";
|
|
138
|
+
if (window.webAuthSettings.cidaas_version > 2) {
|
|
139
|
+
var form = Helper_1.Helper.createForm(url, options);
|
|
140
|
+
document.body.appendChild(form);
|
|
141
|
+
form.submit();
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
return Helper_1.Helper.createPostPromise(options, url, false, "POST");
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
catch (ex) {
|
|
148
|
+
throw new Helper_1.CustomException(ex, 417);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
UserService.handleResetPassword = handleResetPassword;
|
|
152
|
+
;
|
|
153
|
+
/**
|
|
154
|
+
* reset password
|
|
155
|
+
* @param options
|
|
156
|
+
*/
|
|
157
|
+
function resetPassword(options) {
|
|
158
|
+
var url = window.webAuthSettings.authority + "/users-srv/resetpassword/accept";
|
|
159
|
+
try {
|
|
160
|
+
if (window.webAuthSettings.cidaas_version > 2) {
|
|
161
|
+
var form = Helper_1.Helper.createForm(url, options);
|
|
162
|
+
document.body.appendChild(form);
|
|
163
|
+
form.submit();
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
return Helper_1.Helper.createPostPromise(options, url, false, "POST");
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
catch (ex) {
|
|
170
|
+
throw new Helper_1.CustomException(ex, 417);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
UserService.resetPassword = resetPassword;
|
|
174
|
+
;
|
|
175
|
+
/**
|
|
176
|
+
* get Deduplication details
|
|
177
|
+
* @param options
|
|
178
|
+
* @returns
|
|
179
|
+
*/
|
|
180
|
+
function getDeduplicationDetails(options) {
|
|
181
|
+
var _serviceURL = window.webAuthSettings.authority + "/users-srv/deduplication/info/" + options.trackId;
|
|
182
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "GET", undefined);
|
|
183
|
+
}
|
|
184
|
+
UserService.getDeduplicationDetails = getDeduplicationDetails;
|
|
185
|
+
;
|
|
186
|
+
/**
|
|
187
|
+
* deduplication login
|
|
188
|
+
* @param options
|
|
189
|
+
*/
|
|
190
|
+
function deduplicationLogin(options) {
|
|
191
|
+
try {
|
|
192
|
+
var form = document.createElement('form');
|
|
193
|
+
form.action = window.webAuthSettings.authority + "/users-srv/deduplication/login/redirection?trackId=" + options.trackId + "&requestId=" + options.requestId + "&sub=" + options.sub;
|
|
194
|
+
form.method = 'POST';
|
|
195
|
+
document.body.appendChild(form);
|
|
196
|
+
form.submit();
|
|
197
|
+
}
|
|
198
|
+
catch (ex) {
|
|
199
|
+
throw new Helper_1.CustomException(ex, 417);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
UserService.deduplicationLogin = deduplicationLogin;
|
|
203
|
+
;
|
|
204
|
+
/**
|
|
205
|
+
* register Deduplication
|
|
206
|
+
* @param options
|
|
207
|
+
* @returns
|
|
208
|
+
*/
|
|
209
|
+
function registerDeduplication(options) {
|
|
210
|
+
var _serviceURL = window.webAuthSettings.authority + "/users-srv/deduplication/register/" + options.trackId;
|
|
211
|
+
return Helper_1.Helper.createPostPromise(undefined, _serviceURL, undefined, "POST");
|
|
212
|
+
}
|
|
213
|
+
UserService.registerDeduplication = registerDeduplication;
|
|
214
|
+
;
|
|
215
|
+
/**
|
|
216
|
+
* change password
|
|
217
|
+
* @param options
|
|
218
|
+
* @param access_token
|
|
219
|
+
* @returns
|
|
220
|
+
*/
|
|
221
|
+
function changePassword(options, access_token) {
|
|
222
|
+
var _serviceURL = window.webAuthSettings.authority + "/users-srv/changepassword";
|
|
223
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST", access_token);
|
|
224
|
+
}
|
|
225
|
+
UserService.changePassword = changePassword;
|
|
226
|
+
;
|
|
227
|
+
/**
|
|
228
|
+
* update profile
|
|
229
|
+
* @param options
|
|
230
|
+
* @param access_token
|
|
231
|
+
* @param sub
|
|
232
|
+
* @returns
|
|
233
|
+
*/
|
|
234
|
+
function updateProfile(options, access_token, sub) {
|
|
235
|
+
var _serviceURL = window.webAuthSettings.authority + "/users-srv/user/profile/" + sub;
|
|
236
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "PUT", access_token);
|
|
237
|
+
}
|
|
238
|
+
UserService.updateProfile = updateProfile;
|
|
239
|
+
;
|
|
240
|
+
/**
|
|
241
|
+
* initiate link accoount
|
|
242
|
+
* @param options
|
|
243
|
+
* @param access_token
|
|
244
|
+
* @returns
|
|
245
|
+
*/
|
|
246
|
+
function initiateLinkAccount(options, access_token) {
|
|
247
|
+
options.user_name_type = 'email';
|
|
248
|
+
var _serviceURL = window.webAuthSettings.authority + "/users-srv/user/link/initiate";
|
|
249
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST", access_token);
|
|
250
|
+
}
|
|
251
|
+
UserService.initiateLinkAccount = initiateLinkAccount;
|
|
252
|
+
;
|
|
253
|
+
/**
|
|
254
|
+
* complete link accoount
|
|
255
|
+
* @param options
|
|
256
|
+
* @param access_token
|
|
257
|
+
* @returns
|
|
258
|
+
*/
|
|
259
|
+
function completeLinkAccount(options, access_token) {
|
|
260
|
+
var _serviceURL = window.webAuthSettings.authority + "/users-srv/user/link/complete";
|
|
261
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST", access_token);
|
|
262
|
+
}
|
|
263
|
+
UserService.completeLinkAccount = completeLinkAccount;
|
|
264
|
+
;
|
|
265
|
+
/**
|
|
266
|
+
* get linked users
|
|
267
|
+
* @param access_token
|
|
268
|
+
* @param sub
|
|
269
|
+
* @returns
|
|
270
|
+
*/
|
|
271
|
+
function getLinkedUsers(access_token, sub) {
|
|
272
|
+
var _serviceURL = window.webAuthSettings.authority + "/users-srv/userinfo/social/" + sub;
|
|
273
|
+
return Helper_1.Helper.createPostPromise(undefined, _serviceURL, false, "POST", access_token);
|
|
274
|
+
}
|
|
275
|
+
UserService.getLinkedUsers = getLinkedUsers;
|
|
276
|
+
;
|
|
277
|
+
/**
|
|
278
|
+
* unlink accoount
|
|
279
|
+
* @param access_token
|
|
280
|
+
* @param identityId
|
|
281
|
+
* @returns
|
|
282
|
+
*/
|
|
283
|
+
function unlinkAccount(access_token, identityId) {
|
|
284
|
+
var _serviceURL = window.webAuthSettings.authority + "/users-srv/user/unlink/" + identityId;
|
|
285
|
+
return Helper_1.Helper.createPostPromise(undefined, _serviceURL, false, "POST", access_token);
|
|
286
|
+
}
|
|
287
|
+
UserService.unlinkAccount = unlinkAccount;
|
|
288
|
+
;
|
|
289
|
+
/**
|
|
290
|
+
* deleteUserAccount
|
|
291
|
+
* @param options
|
|
292
|
+
* @returns
|
|
293
|
+
*/
|
|
294
|
+
function deleteUserAccount(options) {
|
|
295
|
+
var _serviceURL = window.webAuthSettings.authority + "/users-srv/user/unregister/scheduler/schedule/" + options.sub;
|
|
296
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, undefined, "POST", options.access_token);
|
|
297
|
+
}
|
|
298
|
+
UserService.deleteUserAccount = deleteUserAccount;
|
|
299
|
+
;
|
|
300
|
+
/**
|
|
301
|
+
* check if an user exists from users-actions-srv
|
|
302
|
+
* @param options
|
|
303
|
+
* @returns
|
|
304
|
+
*/
|
|
305
|
+
function userCheckExists(options) {
|
|
306
|
+
var _serviceURL = window.webAuthSettings.authority + "/useractions-srv/userexistence/" + options.requestId + "?webfinger=" + options.webfinger + "&rememberMe=" + options.rememberMe;
|
|
307
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, undefined, "POST");
|
|
308
|
+
}
|
|
309
|
+
UserService.userCheckExists = userCheckExists;
|
|
310
|
+
;
|
|
311
|
+
})(UserService = exports.UserService || (exports.UserService = {}));
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { IConfiguredListRequestEntity, IInitVerificationAuthenticationRequestEntity, FidoSetupEntity, IEnrollVerificationSetupRequestEntity, IAuthVerificationAuthenticationRequestEntity, FaceVerificationAuthenticationRequestEntity, AccountVerificationRequestEntity } from "./Entities";
|
|
2
|
+
export declare namespace VerificationService {
|
|
3
|
+
/**
|
|
4
|
+
* initiate verification
|
|
5
|
+
* @param options
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
function initiateAccountVerification(options: AccountVerificationRequestEntity): void;
|
|
9
|
+
/**
|
|
10
|
+
* initiate verification and return response
|
|
11
|
+
* @param options
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
function initiateAccountVerificationAsynFn(options: AccountVerificationRequestEntity): Promise<Response>;
|
|
15
|
+
/**
|
|
16
|
+
* verify account
|
|
17
|
+
* @param options
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
function verifyAccount(options: {
|
|
21
|
+
accvid: string;
|
|
22
|
+
code: string;
|
|
23
|
+
}): Promise<unknown>;
|
|
24
|
+
/**
|
|
25
|
+
* get mfa list v2
|
|
26
|
+
* @param options
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
function getMFAListV2(options: IConfiguredListRequestEntity): Promise<unknown>;
|
|
30
|
+
/**
|
|
31
|
+
* cancel mfa v2
|
|
32
|
+
* @param options
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
function cancelMFAV2(options: {
|
|
36
|
+
exchange_id: string;
|
|
37
|
+
reason: string;
|
|
38
|
+
type: string;
|
|
39
|
+
}): Promise<unknown>;
|
|
40
|
+
/**
|
|
41
|
+
* @param access_token
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
function getAllVerificationList(access_token: string): Promise<unknown>;
|
|
45
|
+
/**
|
|
46
|
+
* enrollVerification
|
|
47
|
+
* @param options
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
function enrollVerification(options: IEnrollVerificationSetupRequestEntity): Promise<unknown>;
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated This function is no longer supported, instead use {this.updateStatus()}
|
|
53
|
+
* @param status_id
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
function updateSocket(status_id: string): Promise<unknown>;
|
|
57
|
+
/**
|
|
58
|
+
* update the status of notification
|
|
59
|
+
* @param status_id
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
function updateStatus(status_id: string): Promise<unknown>;
|
|
63
|
+
/**
|
|
64
|
+
* setupFidoVerification
|
|
65
|
+
* @param options
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
function setupFidoVerification(options: FidoSetupEntity): Promise<unknown>;
|
|
69
|
+
/**
|
|
70
|
+
* checkVerificationTypeConfigured
|
|
71
|
+
* @param options
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
74
|
+
function checkVerificationTypeConfigured(options: IConfiguredListRequestEntity): Promise<unknown>;
|
|
75
|
+
/**
|
|
76
|
+
* initiate mfa v2
|
|
77
|
+
* @param options
|
|
78
|
+
* @returns
|
|
79
|
+
*/
|
|
80
|
+
function initiateMFAV2(options: IInitVerificationAuthenticationRequestEntity): Promise<unknown>;
|
|
81
|
+
/**
|
|
82
|
+
* @deprecated
|
|
83
|
+
* @param options
|
|
84
|
+
* @param verificationType
|
|
85
|
+
* @returns
|
|
86
|
+
*/
|
|
87
|
+
function initiateMfaV1(options: any, verificationType: string): Promise<unknown>;
|
|
88
|
+
/**
|
|
89
|
+
* authenticate mfa v2
|
|
90
|
+
* @param options
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
93
|
+
function authenticateMFAV2(options: IAuthVerificationAuthenticationRequestEntity): Promise<unknown>;
|
|
94
|
+
/**
|
|
95
|
+
* authenticateVerification form type (for face)
|
|
96
|
+
* @param options
|
|
97
|
+
* @returns
|
|
98
|
+
*/
|
|
99
|
+
function authenticateFaceVerification(options: FaceVerificationAuthenticationRequestEntity): Promise<unknown>;
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated
|
|
102
|
+
* setup verification - v1
|
|
103
|
+
* @param options
|
|
104
|
+
* @param access_token
|
|
105
|
+
* @param verificationType
|
|
106
|
+
* @returns
|
|
107
|
+
*/
|
|
108
|
+
function setupVerificationV1(options: any, access_token: string, verificationType: string): Promise<unknown>;
|
|
109
|
+
/**
|
|
110
|
+
* @deprecated
|
|
111
|
+
* enroll verification - v1
|
|
112
|
+
* @param options
|
|
113
|
+
* @param access_token
|
|
114
|
+
* @param verificationType
|
|
115
|
+
* @returns
|
|
116
|
+
*/
|
|
117
|
+
function enrollVerificationV1(options: any, access_token: string, verificationType: string): Promise<unknown>;
|
|
118
|
+
/**
|
|
119
|
+
* @deprecated
|
|
120
|
+
* authenticate mfa - v1
|
|
121
|
+
* @param verificationType
|
|
122
|
+
* @returns
|
|
123
|
+
*/
|
|
124
|
+
function authenticateMfaV1(options: any, verificationType: string): Promise<unknown>;
|
|
125
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.VerificationService = void 0;
|
|
4
|
+
var Helper_1 = require("./Helper");
|
|
5
|
+
var VerificationService;
|
|
6
|
+
(function (VerificationService) {
|
|
7
|
+
/**
|
|
8
|
+
* initiate verification
|
|
9
|
+
* @param options
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
function initiateAccountVerification(options) {
|
|
13
|
+
try {
|
|
14
|
+
var url = window.webAuthSettings.authority + "/verification-srv/account/initiate";
|
|
15
|
+
var form = Helper_1.Helper.createForm(url, options);
|
|
16
|
+
document.body.appendChild(form);
|
|
17
|
+
form.submit();
|
|
18
|
+
}
|
|
19
|
+
catch (ex) {
|
|
20
|
+
throw new Helper_1.CustomException(ex, 417);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
VerificationService.initiateAccountVerification = initiateAccountVerification;
|
|
24
|
+
;
|
|
25
|
+
/**
|
|
26
|
+
* initiate verification and return response
|
|
27
|
+
* @param options
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
function initiateAccountVerificationAsynFn(options) {
|
|
31
|
+
try {
|
|
32
|
+
var searchParams = new URLSearchParams(options);
|
|
33
|
+
var response = fetch(window.webAuthSettings.authority + "/verification-srv/account/initiate", {
|
|
34
|
+
method: "POST",
|
|
35
|
+
redirect: "follow",
|
|
36
|
+
body: searchParams.toString(),
|
|
37
|
+
headers: {
|
|
38
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return response;
|
|
42
|
+
}
|
|
43
|
+
catch (ex) {
|
|
44
|
+
throw new Helper_1.CustomException(ex, 417);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
VerificationService.initiateAccountVerificationAsynFn = initiateAccountVerificationAsynFn;
|
|
48
|
+
;
|
|
49
|
+
/**
|
|
50
|
+
* verify account
|
|
51
|
+
* @param options
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
function verifyAccount(options) {
|
|
55
|
+
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/account/verify";
|
|
56
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST");
|
|
57
|
+
}
|
|
58
|
+
VerificationService.verifyAccount = verifyAccount;
|
|
59
|
+
;
|
|
60
|
+
/**
|
|
61
|
+
* get mfa list v2
|
|
62
|
+
* @param options
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
function getMFAListV2(options) {
|
|
66
|
+
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/public/configured/list";
|
|
67
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST");
|
|
68
|
+
}
|
|
69
|
+
VerificationService.getMFAListV2 = getMFAListV2;
|
|
70
|
+
;
|
|
71
|
+
/**
|
|
72
|
+
* cancel mfa v2
|
|
73
|
+
* @param options
|
|
74
|
+
* @returns
|
|
75
|
+
*/
|
|
76
|
+
function cancelMFAV2(options) {
|
|
77
|
+
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/cancel/" + options.type;
|
|
78
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, undefined, "POST");
|
|
79
|
+
}
|
|
80
|
+
VerificationService.cancelMFAV2 = cancelMFAV2;
|
|
81
|
+
;
|
|
82
|
+
/**
|
|
83
|
+
* @param access_token
|
|
84
|
+
* @returns
|
|
85
|
+
*/
|
|
86
|
+
function getAllVerificationList(access_token) {
|
|
87
|
+
var _serviceURL = "".concat(window.webAuthSettings.authority, "/verification-srv/config/list");
|
|
88
|
+
return Helper_1.Helper.createPostPromise(undefined, _serviceURL, undefined, "GET", access_token);
|
|
89
|
+
}
|
|
90
|
+
VerificationService.getAllVerificationList = getAllVerificationList;
|
|
91
|
+
;
|
|
92
|
+
/**
|
|
93
|
+
* enrollVerification
|
|
94
|
+
* @param options
|
|
95
|
+
* @returns
|
|
96
|
+
*/
|
|
97
|
+
function enrollVerification(options) {
|
|
98
|
+
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/enroll/" + options.verification_type;
|
|
99
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, undefined, "POST");
|
|
100
|
+
}
|
|
101
|
+
VerificationService.enrollVerification = enrollVerification;
|
|
102
|
+
;
|
|
103
|
+
/**
|
|
104
|
+
* @deprecated This function is no longer supported, instead use {this.updateStatus()}
|
|
105
|
+
* @param status_id
|
|
106
|
+
* @returns
|
|
107
|
+
*/
|
|
108
|
+
function updateSocket(status_id) {
|
|
109
|
+
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/notification/status/" + status_id;
|
|
110
|
+
return Helper_1.Helper.createPostPromise(undefined, _serviceURL, undefined, "POST");
|
|
111
|
+
}
|
|
112
|
+
VerificationService.updateSocket = updateSocket;
|
|
113
|
+
;
|
|
114
|
+
/**
|
|
115
|
+
* update the status of notification
|
|
116
|
+
* @param status_id
|
|
117
|
+
* @returns
|
|
118
|
+
*/
|
|
119
|
+
function updateStatus(status_id) {
|
|
120
|
+
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/notification/status/" + status_id;
|
|
121
|
+
return Helper_1.Helper.createPostPromise(undefined, _serviceURL, undefined, "POST");
|
|
122
|
+
}
|
|
123
|
+
VerificationService.updateStatus = updateStatus;
|
|
124
|
+
;
|
|
125
|
+
/**
|
|
126
|
+
* setupFidoVerification
|
|
127
|
+
* @param options
|
|
128
|
+
* @returns
|
|
129
|
+
*/
|
|
130
|
+
function setupFidoVerification(options) {
|
|
131
|
+
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/initiate/suggestmfa/" + options.verification_type;
|
|
132
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, undefined, "POST");
|
|
133
|
+
}
|
|
134
|
+
VerificationService.setupFidoVerification = setupFidoVerification;
|
|
135
|
+
;
|
|
136
|
+
/**
|
|
137
|
+
* checkVerificationTypeConfigured
|
|
138
|
+
* @param options
|
|
139
|
+
* @returns
|
|
140
|
+
*/
|
|
141
|
+
function checkVerificationTypeConfigured(options) {
|
|
142
|
+
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/public/configured/check/" + options.verification_type;
|
|
143
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, undefined, "POST");
|
|
144
|
+
}
|
|
145
|
+
VerificationService.checkVerificationTypeConfigured = checkVerificationTypeConfigured;
|
|
146
|
+
;
|
|
147
|
+
/**
|
|
148
|
+
* initiate mfa v2
|
|
149
|
+
* @param options
|
|
150
|
+
* @returns
|
|
151
|
+
*/
|
|
152
|
+
function initiateMFAV2(options) {
|
|
153
|
+
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/initiate/" + options.type;
|
|
154
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST");
|
|
155
|
+
}
|
|
156
|
+
VerificationService.initiateMFAV2 = initiateMFAV2;
|
|
157
|
+
;
|
|
158
|
+
/**
|
|
159
|
+
* @deprecated
|
|
160
|
+
* @param options
|
|
161
|
+
* @param verificationType
|
|
162
|
+
* @returns
|
|
163
|
+
*/
|
|
164
|
+
function initiateMfaV1(options, verificationType) {
|
|
165
|
+
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/" + verificationType.toLowerCase() + "/initiate";
|
|
166
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST");
|
|
167
|
+
}
|
|
168
|
+
VerificationService.initiateMfaV1 = initiateMfaV1;
|
|
169
|
+
/**
|
|
170
|
+
* authenticate mfa v2
|
|
171
|
+
* @param options
|
|
172
|
+
* @returns
|
|
173
|
+
*/
|
|
174
|
+
function authenticateMFAV2(options) {
|
|
175
|
+
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/authenticate/" + options.type;
|
|
176
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, undefined, "POST");
|
|
177
|
+
}
|
|
178
|
+
VerificationService.authenticateMFAV2 = authenticateMFAV2;
|
|
179
|
+
;
|
|
180
|
+
/**
|
|
181
|
+
* authenticateVerification form type (for face)
|
|
182
|
+
* @param options
|
|
183
|
+
* @returns
|
|
184
|
+
*/
|
|
185
|
+
function authenticateFaceVerification(options) {
|
|
186
|
+
return new Promise(function (resolve, reject) {
|
|
187
|
+
try {
|
|
188
|
+
var http = new XMLHttpRequest();
|
|
189
|
+
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/authenticate/face";
|
|
190
|
+
http.onreadystatechange = function () {
|
|
191
|
+
if (http.readyState == 4) {
|
|
192
|
+
if (http.responseText) {
|
|
193
|
+
resolve(JSON.parse(http.responseText));
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
resolve(undefined);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
http.open("POST", _serviceURL, true);
|
|
201
|
+
http.setRequestHeader("Content-type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");
|
|
202
|
+
if (window.localeSettings) {
|
|
203
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
204
|
+
}
|
|
205
|
+
http.send(JSON.stringify(options));
|
|
206
|
+
}
|
|
207
|
+
catch (ex) {
|
|
208
|
+
reject(ex);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
VerificationService.authenticateFaceVerification = authenticateFaceVerification;
|
|
213
|
+
;
|
|
214
|
+
/**
|
|
215
|
+
* @deprecated
|
|
216
|
+
* setup verification - v1
|
|
217
|
+
* @param options
|
|
218
|
+
* @param access_token
|
|
219
|
+
* @param verificationType
|
|
220
|
+
* @returns
|
|
221
|
+
*/
|
|
222
|
+
function setupVerificationV1(options, access_token, verificationType) {
|
|
223
|
+
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/" + verificationType.toLowerCase() + "/setup";
|
|
224
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST", access_token);
|
|
225
|
+
}
|
|
226
|
+
VerificationService.setupVerificationV1 = setupVerificationV1;
|
|
227
|
+
/**
|
|
228
|
+
* @deprecated
|
|
229
|
+
* enroll verification - v1
|
|
230
|
+
* @param options
|
|
231
|
+
* @param access_token
|
|
232
|
+
* @param verificationType
|
|
233
|
+
* @returns
|
|
234
|
+
*/
|
|
235
|
+
function enrollVerificationV1(options, access_token, verificationType) {
|
|
236
|
+
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/" + verificationType.toLowerCase() + "/enroll";
|
|
237
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST", access_token);
|
|
238
|
+
}
|
|
239
|
+
VerificationService.enrollVerificationV1 = enrollVerificationV1;
|
|
240
|
+
/**
|
|
241
|
+
* @deprecated
|
|
242
|
+
* authenticate mfa - v1
|
|
243
|
+
* @param verificationType
|
|
244
|
+
* @returns
|
|
245
|
+
*/
|
|
246
|
+
function authenticateMfaV1(options, verificationType) {
|
|
247
|
+
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/" + verificationType.toLowerCase() + "/authenticate";
|
|
248
|
+
return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST");
|
|
249
|
+
}
|
|
250
|
+
VerificationService.authenticateMfaV1 = authenticateMfaV1;
|
|
251
|
+
})(VerificationService = exports.VerificationService || (exports.VerificationService = {}));
|