cidaas-javascript-sdk 2.4.3 → 2.5.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +5 -3
  2. package/README.md +2 -3
  3. package/package.json +10 -12
  4. package/src/main/authentication/index.ts +223 -0
  5. package/src/main/global.d.ts +10 -0
  6. package/src/main/index.ts +6 -0
  7. package/src/main/web-auth/ConsentService.ts +98 -0
  8. package/src/main/web-auth/Entities.ts +645 -0
  9. package/src/main/web-auth/Helper.ts +75 -0
  10. package/src/main/web-auth/LoginService.ts +248 -0
  11. package/src/main/web-auth/TokenService.ts +196 -0
  12. package/src/main/web-auth/UserService.ts +388 -0
  13. package/src/main/web-auth/VerificationService.ts +267 -0
  14. package/src/main/web-auth/WebAuth.ts +1706 -0
  15. package/types/authentication/index.d.ts +55 -0
  16. package/types/authentication/index.js +262 -0
  17. package/types/index.d.ts +4 -0
  18. package/types/index.js +9 -0
  19. package/types/web-auth/ConsentService.d.ts +59 -0
  20. package/types/web-auth/ConsentService.js +97 -0
  21. package/types/web-auth/Entities.d.ts +567 -0
  22. package/types/web-auth/Entities.js +88 -0
  23. package/types/web-auth/Helper.d.ts +24 -0
  24. package/types/web-auth/Helper.js +89 -0
  25. package/types/web-auth/LoginService.d.ts +102 -0
  26. package/types/web-auth/LoginService.js +248 -0
  27. package/types/web-auth/TokenService.d.ts +48 -0
  28. package/types/web-auth/TokenService.js +210 -0
  29. package/types/web-auth/UserService.d.ts +143 -0
  30. package/types/web-auth/UserService.js +408 -0
  31. package/types/web-auth/VerificationService.d.ts +125 -0
  32. package/types/web-auth/VerificationService.js +273 -0
  33. package/types/web-auth/WebAuth.d.ts +895 -0
  34. package/types/web-auth/WebAuth.js +1767 -0
  35. package/src/main/.gitkeep +0 -0
  36. package/src/main/authentication/index.js +0 -213
  37. package/src/main/index.js +0 -11
  38. package/src/main/web-auth/exception.js +0 -7
  39. package/src/main/web-auth/webauth.js +0 -1899
  40. package/src/test/sum.js +0 -4
  41. package/src/test/test.js +0 -5
  42. package/types/.DS_Store +0 -0
  43. package/types/main/authentication/index.d.ts +0 -15
  44. package/types/main/index.d.ts +0 -5
  45. package/types/main/web-auth/exception.d.ts +0 -7
  46. package/types/main/web-auth/webauth.d.ts +0 -141
  47. package/types/test/sum.d.ts +0 -2
  48. package/types/test/test.d.ts +0 -1
@@ -0,0 +1,1767 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ exports.__esModule = true;
39
+ exports.WebAuth = void 0;
40
+ var oidc_client_ts_1 = require("oidc-client-ts");
41
+ var CryptoJS = require("crypto-js");
42
+ var fingerprintjs_1 = require("@fingerprintjs/fingerprintjs");
43
+ var authentication_1 = require("../authentication");
44
+ var Helper_1 = require("./Helper");
45
+ var LoginService_1 = require("./LoginService");
46
+ var UserService_1 = require("./UserService");
47
+ var TokenService_1 = require("./TokenService");
48
+ var VerificationService_1 = require("./VerificationService");
49
+ var ConsentService_1 = require("./ConsentService");
50
+ var WebAuth = /** @class */ (function () {
51
+ function WebAuth(settings) {
52
+ try {
53
+ var usermanager = new oidc_client_ts_1.UserManager(settings);
54
+ window.webAuthSettings = settings;
55
+ window.usermanager = usermanager;
56
+ window.localeSettings = null;
57
+ window.authentication = new authentication_1.Authentication(window.webAuthSettings, window.usermanager);
58
+ window.usermanager.events.addSilentRenewError(function (error) {
59
+ throw new Helper_1.CustomException("Error while renewing silent login", 500);
60
+ });
61
+ if (!settings.mode) {
62
+ window.webAuthSettings.mode = 'redirect';
63
+ }
64
+ }
65
+ catch (ex) {
66
+ console.log(ex);
67
+ }
68
+ }
69
+ /**
70
+ * generate code verifier
71
+ */
72
+ WebAuth.prototype.generateCodeVerifier = function () {
73
+ this.code_verifier = crypto.randomUUID().replace(/-/g, "");
74
+ };
75
+ ;
76
+ /**
77
+ * @param code_verifier
78
+ * @returns
79
+ */
80
+ WebAuth.prototype.generateCodeChallenge = function (code_verifier) {
81
+ return this.base64URL(CryptoJS.SHA256(code_verifier));
82
+ };
83
+ ;
84
+ /**
85
+ * @param string
86
+ * @returns
87
+ */
88
+ WebAuth.prototype.base64URL = function (string) {
89
+ return string.toString(CryptoJS.enc.Base64).replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
90
+ };
91
+ ;
92
+ // prototype methods
93
+ /**
94
+ * login
95
+ */
96
+ WebAuth.prototype.loginWithBrowser = function () {
97
+ try {
98
+ if (!window.webAuthSettings && !window.authentication) {
99
+ throw new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
100
+ }
101
+ switch (window.webAuthSettings.mode) {
102
+ case 'redirect':
103
+ window.authentication.redirectSignIn('register');
104
+ break;
105
+ case 'window':
106
+ window.authentication.popupSignIn();
107
+ break;
108
+ case 'silent':
109
+ window.authentication.silentSignIn();
110
+ break;
111
+ }
112
+ }
113
+ catch (ex) {
114
+ console.log(ex);
115
+ }
116
+ };
117
+ ;
118
+ /**
119
+ * register
120
+ */
121
+ WebAuth.prototype.registerWithBrowser = function () {
122
+ try {
123
+ if (!window.webAuthSettings && !window.authentication) {
124
+ throw new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
125
+ }
126
+ switch (window.webAuthSettings.mode) {
127
+ case 'redirect':
128
+ window.authentication.redirectSignIn('register');
129
+ break;
130
+ case 'window':
131
+ window.authentication.popupSignIn();
132
+ break;
133
+ case 'silent':
134
+ window.authentication.silentSignIn();
135
+ break;
136
+ }
137
+ }
138
+ catch (ex) {
139
+ console.log(ex);
140
+ }
141
+ };
142
+ ;
143
+ /**
144
+ * login callback
145
+ * @returns
146
+ */
147
+ WebAuth.prototype.loginCallback = function () {
148
+ return new Promise(function (resolve, reject) {
149
+ try {
150
+ if (!window.webAuthSettings && !window.authentication) {
151
+ throw new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
152
+ }
153
+ switch (window.webAuthSettings.mode) {
154
+ case 'redirect':
155
+ window.authentication.redirectSignInCallback().then(function (user) {
156
+ resolve(user);
157
+ })["catch"](function (ex) {
158
+ reject(ex);
159
+ });
160
+ break;
161
+ case 'window':
162
+ window.authentication.popupSignInCallback();
163
+ break;
164
+ case 'silent':
165
+ window.authentication.silentSignInCallbackV2().then(function (data) {
166
+ resolve(data);
167
+ })["catch"](function (error) {
168
+ reject(error);
169
+ });
170
+ break;
171
+ }
172
+ }
173
+ catch (ex) {
174
+ console.log(ex);
175
+ }
176
+ });
177
+ };
178
+ ;
179
+ /**
180
+ * get user info
181
+ * @returns
182
+ */
183
+ WebAuth.prototype.getUserInfo = function () {
184
+ return __awaiter(this, void 0, void 0, function () {
185
+ var e_1;
186
+ return __generator(this, function (_a) {
187
+ switch (_a.label) {
188
+ case 0:
189
+ _a.trys.push([0, 4, , 5]);
190
+ if (!window.usermanager) return [3 /*break*/, 2];
191
+ return [4 /*yield*/, window.usermanager.getUser()];
192
+ case 1: return [2 /*return*/, _a.sent()];
193
+ case 2: throw new Helper_1.CustomException("UserManager cannot be empty", 417);
194
+ case 3: return [3 /*break*/, 5];
195
+ case 4:
196
+ e_1 = _a.sent();
197
+ throw e_1;
198
+ case 5: return [2 /*return*/];
199
+ }
200
+ });
201
+ });
202
+ };
203
+ ;
204
+ /**
205
+ * logout
206
+ * @returns
207
+ */
208
+ WebAuth.prototype.logout = function () {
209
+ return new Promise(function (resolve, reject) {
210
+ try {
211
+ if (!window.webAuthSettings && !window.authentication) {
212
+ throw new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
213
+ }
214
+ if (window.webAuthSettings.mode == 'redirect') {
215
+ window.authentication.redirectSignOut().then(function (result) {
216
+ resolve(result);
217
+ return;
218
+ });
219
+ }
220
+ else if (window.webAuthSettings.mode == 'window') {
221
+ window.authentication.popupSignOut();
222
+ }
223
+ else if (window.webAuthSettings.mode == 'silent') {
224
+ window.authentication.redirectSignOut();
225
+ }
226
+ else {
227
+ resolve(undefined);
228
+ }
229
+ }
230
+ catch (ex) {
231
+ reject(ex);
232
+ }
233
+ });
234
+ };
235
+ ;
236
+ /**
237
+ * logout callback
238
+ * @returns
239
+ */
240
+ WebAuth.prototype.logoutCallback = function () {
241
+ return new Promise(function (resolve, reject) {
242
+ try {
243
+ if (!window.webAuthSettings && !window.authentication) {
244
+ throw new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
245
+ }
246
+ if (window.webAuthSettings.mode == 'redirect') {
247
+ window.authentication.redirectSignOutCallback().then(function (resp) {
248
+ resolve(resp);
249
+ });
250
+ }
251
+ else if (window.webAuthSettings.mode == 'window') {
252
+ window.authentication.popupSignOutCallback();
253
+ }
254
+ else if (window.webAuthSettings.mode == 'silent') {
255
+ window.authentication.redirectSignOutCallback();
256
+ }
257
+ }
258
+ catch (ex) {
259
+ reject(ex);
260
+ }
261
+ });
262
+ };
263
+ ;
264
+ /**
265
+ * get login url
266
+ * @returns
267
+ */
268
+ WebAuth.prototype.getLoginURL = function () {
269
+ var settings = window.webAuthSettings;
270
+ if (!settings.response_type) {
271
+ settings.response_type = "code";
272
+ }
273
+ if (!settings.scope) {
274
+ settings.scope = "email openid profile mobile";
275
+ }
276
+ this.generateCodeVerifier();
277
+ var loginURL = settings.authority + "/authz-srv/authz?client_id=" + settings.client_id;
278
+ loginURL += "&redirect_uri=" + settings.redirect_uri;
279
+ loginURL += "&nonce=" + new Date().getTime().toString();
280
+ loginURL += "&response_type=" + settings.response_type;
281
+ loginURL += "&code_challenge=" + this.generateCodeChallenge(this.code_verifier);
282
+ loginURL += "&code_challenge_method=S256";
283
+ if (settings.response_mode && settings.response_mode == 'query') {
284
+ loginURL += "&response_mode=" + settings.response_mode;
285
+ }
286
+ loginURL += "&scope=" + settings.scope;
287
+ return loginURL;
288
+ };
289
+ ;
290
+ /**
291
+ * get request id
292
+ * @returns
293
+ */
294
+ WebAuth.prototype.getRequestId = function () {
295
+ return new Promise(function (resolve, reject) {
296
+ try {
297
+ var respone_type = window.webAuthSettings.response_type;
298
+ if (!respone_type) {
299
+ respone_type = "token";
300
+ }
301
+ var response_mode = window.webAuthSettings.response_mode;
302
+ if (!response_mode) {
303
+ response_mode = "fragment";
304
+ }
305
+ var bodyParams = {
306
+ "client_id": window.webAuthSettings.client_id,
307
+ "redirect_uri": window.webAuthSettings.redirect_uri,
308
+ "response_type": respone_type,
309
+ "response_mode": response_mode,
310
+ "scope": window.webAuthSettings.scope,
311
+ "nonce": new Date().getTime().toString()
312
+ };
313
+ var http = new XMLHttpRequest();
314
+ var _serviceURL = window.webAuthSettings.authority + "/authz-srv/authrequest/authz/generate";
315
+ http.onreadystatechange = function () {
316
+ if (http.readyState == 4) {
317
+ if (http.responseText) {
318
+ resolve(JSON.parse(http.responseText));
319
+ }
320
+ else {
321
+ resolve(false);
322
+ }
323
+ }
324
+ };
325
+ http.open("POST", _serviceURL, true);
326
+ http.setRequestHeader("Content-type", "application/json");
327
+ if (window.localeSettings) {
328
+ http.setRequestHeader("accept-language", window.localeSettings);
329
+ }
330
+ http.send(JSON.stringify(bodyParams));
331
+ }
332
+ catch (ex) {
333
+ reject(ex);
334
+ }
335
+ });
336
+ };
337
+ ;
338
+ /**
339
+ * get missing fields
340
+ * @param options
341
+ * @returns
342
+ */
343
+ WebAuth.prototype.getMissingFields = function (options) {
344
+ return new Promise(function (resolve, reject) {
345
+ try {
346
+ var http = new XMLHttpRequest();
347
+ var _serviceURL = window.webAuthSettings.authority + "/public-srv/public/trackinfo/" + options.requestId + "/" + options.trackId;
348
+ http.onreadystatechange = function () {
349
+ if (http.readyState == 4) {
350
+ if (http.responseText) {
351
+ resolve(JSON.parse(http.responseText));
352
+ }
353
+ else {
354
+ resolve(false);
355
+ }
356
+ }
357
+ };
358
+ http.open("GET", _serviceURL, true);
359
+ http.setRequestHeader("Content-type", "application/json");
360
+ if (window.localeSettings) {
361
+ http.setRequestHeader("accept-language", window.localeSettings);
362
+ }
363
+ http.send();
364
+ }
365
+ catch (ex) {
366
+ reject(ex);
367
+ }
368
+ });
369
+ };
370
+ ;
371
+ /**
372
+ * get Tenant info
373
+ * @returns
374
+ */
375
+ WebAuth.prototype.getTenantInfo = function () {
376
+ return new Promise(function (resolve, reject) {
377
+ try {
378
+ var http = new XMLHttpRequest();
379
+ var _serviceURL = window.webAuthSettings.authority + "/public-srv/tenantinfo/basic";
380
+ http.onreadystatechange = function () {
381
+ if (http.readyState == 4) {
382
+ if (http.responseText) {
383
+ resolve(JSON.parse(http.responseText));
384
+ }
385
+ else {
386
+ resolve(false);
387
+ }
388
+ }
389
+ };
390
+ http.open("GET", _serviceURL, true);
391
+ http.setRequestHeader("Content-type", "application/json");
392
+ if (window.localeSettings) {
393
+ http.setRequestHeader("accept-language", window.localeSettings);
394
+ }
395
+ http.send();
396
+ }
397
+ catch (ex) {
398
+ reject(ex);
399
+ }
400
+ });
401
+ };
402
+ ;
403
+ /**
404
+ * logout api call
405
+ * @param options
406
+ */
407
+ WebAuth.prototype.logoutUser = function (options) {
408
+ try {
409
+ window.location.href = window.webAuthSettings.authority + "/session/end_session?access_token_hint=" + options.access_token + "&post_logout_redirect_uri=" + window.webAuthSettings.post_logout_redirect_uri;
410
+ }
411
+ catch (ex) {
412
+ throw new Helper_1.CustomException(ex, 417);
413
+ }
414
+ };
415
+ ;
416
+ /**
417
+ * get Client Info
418
+ * @param options
419
+ * @returns
420
+ */
421
+ WebAuth.prototype.getClientInfo = function (options) {
422
+ return new Promise(function (resolve, reject) {
423
+ try {
424
+ var http = new XMLHttpRequest();
425
+ var _serviceURL = window.webAuthSettings.authority + "/public-srv/public/" + options.requestId;
426
+ http.onreadystatechange = function () {
427
+ if (http.readyState == 4) {
428
+ if (http.responseText) {
429
+ resolve(JSON.parse(http.responseText));
430
+ }
431
+ else {
432
+ resolve(false);
433
+ }
434
+ }
435
+ };
436
+ http.open("GET", _serviceURL, true);
437
+ http.setRequestHeader("Content-type", "application/json");
438
+ if (window.localeSettings) {
439
+ http.setRequestHeader("accept-language", window.localeSettings);
440
+ }
441
+ http.send();
442
+ }
443
+ catch (ex) {
444
+ reject(ex);
445
+ }
446
+ });
447
+ };
448
+ ;
449
+ /**
450
+ * get all devices associated to the client
451
+ * @param options
452
+ * @returns
453
+ */
454
+ WebAuth.prototype.getDevicesInfo = function (options) {
455
+ return new Promise(function (resolve, reject) {
456
+ try {
457
+ var http = new XMLHttpRequest();
458
+ var _serviceURL = window.webAuthSettings.authority + "/device-srv/devices";
459
+ options.userAgent = window.navigator.userAgent;
460
+ http.onreadystatechange = function () {
461
+ if (http.readyState == 4) {
462
+ if (http.responseText) {
463
+ resolve(JSON.parse(http.responseText));
464
+ }
465
+ else {
466
+ resolve(false);
467
+ }
468
+ }
469
+ };
470
+ http.open("GET", _serviceURL, true);
471
+ http.setRequestHeader("Content-type", "application/json");
472
+ if (window.localeSettings) {
473
+ http.setRequestHeader("accept-language", window.localeSettings);
474
+ }
475
+ if (window.navigator.userAgent) {
476
+ http.send(JSON.stringify(options));
477
+ }
478
+ http.send();
479
+ }
480
+ catch (ex) {
481
+ reject(ex);
482
+ }
483
+ });
484
+ };
485
+ ;
486
+ /**
487
+ * delete a device
488
+ * @param options
489
+ * @returns
490
+ */
491
+ WebAuth.prototype.deleteDevice = function (options) {
492
+ return new Promise(function (resolve, reject) {
493
+ try {
494
+ var http = new XMLHttpRequest();
495
+ var _serviceURL = window.webAuthSettings.authority + "/device-srv/device/" + options.device_id;
496
+ options.userAgent = window.navigator.userAgent;
497
+ http.onreadystatechange = function () {
498
+ if (http.readyState == 4) {
499
+ if (http.responseText) {
500
+ resolve(JSON.parse(http.responseText));
501
+ }
502
+ else {
503
+ resolve(false);
504
+ }
505
+ }
506
+ };
507
+ http.open("DELETE", _serviceURL, true);
508
+ http.setRequestHeader("Content-type", "application/json");
509
+ if (window.localeSettings) {
510
+ http.setRequestHeader("accept-language", window.localeSettings);
511
+ }
512
+ if (window.navigator.userAgent) {
513
+ http.send(JSON.stringify(options));
514
+ }
515
+ http.send();
516
+ }
517
+ catch (ex) {
518
+ reject(ex);
519
+ }
520
+ });
521
+ };
522
+ ;
523
+ /**
524
+ * get Registration setup
525
+ * @param options
526
+ * @returns
527
+ */
528
+ WebAuth.prototype.getRegistrationSetup = function (options) {
529
+ return new Promise(function (resolve, reject) {
530
+ try {
531
+ var http = new XMLHttpRequest();
532
+ var _serviceURL = window.webAuthSettings.authority + "/registration-setup-srv/public/list?acceptlanguage=" + options.acceptlanguage + "&requestId=" + options.requestId;
533
+ http.onreadystatechange = function () {
534
+ if (http.readyState == 4) {
535
+ if (http.responseText) {
536
+ var parsedResponse = JSON.parse(http.responseText);
537
+ if (parsedResponse && parsedResponse.data && parsedResponse.data.length > 0) {
538
+ var registrationFields = parsedResponse.data;
539
+ }
540
+ resolve(parsedResponse);
541
+ }
542
+ else {
543
+ resolve(false);
544
+ }
545
+ }
546
+ };
547
+ http.open("GET", _serviceURL, true);
548
+ http.setRequestHeader("Content-type", "application/json");
549
+ if (window.localeSettings) {
550
+ http.setRequestHeader("accept-language", window.localeSettings);
551
+ }
552
+ http.send();
553
+ }
554
+ catch (ex) {
555
+ reject(ex);
556
+ }
557
+ });
558
+ };
559
+ ;
560
+ /**
561
+ * get unreviewed devices
562
+ * @param access_token
563
+ * @param sub
564
+ * @returns
565
+ */
566
+ WebAuth.prototype.getUnreviewedDevices = function (access_token, sub) {
567
+ return new Promise(function (resolve, reject) {
568
+ try {
569
+ var http = new XMLHttpRequest();
570
+ var _serviceURL = window.webAuthSettings.authority + "/reports-srv/device/unreviewlist/" + sub;
571
+ http.onreadystatechange = function () {
572
+ if (http.readyState == 4) {
573
+ if (http.responseText) {
574
+ resolve(JSON.parse(http.responseText));
575
+ }
576
+ else {
577
+ resolve(false);
578
+ }
579
+ }
580
+ };
581
+ http.open("GET", _serviceURL, true);
582
+ http.setRequestHeader("Content-type", "application/json");
583
+ http.setRequestHeader("Authorization", "Bearer ".concat(access_token));
584
+ if (window.localeSettings) {
585
+ http.setRequestHeader("accept-language", window.localeSettings);
586
+ }
587
+ http.send();
588
+ }
589
+ catch (ex) {
590
+ throw new Helper_1.CustomException(ex, 417);
591
+ }
592
+ });
593
+ };
594
+ ;
595
+ /**
596
+ * get reviewed devices
597
+ * @param access_token
598
+ * @param sub
599
+ * @returns
600
+ */
601
+ WebAuth.prototype.getReviewedDevices = function (access_token, sub) {
602
+ return new Promise(function (resolve, reject) {
603
+ try {
604
+ var http = new XMLHttpRequest();
605
+ var _serviceURL = window.webAuthSettings.authority + "/reports-srv/device/reviewlist/" + sub;
606
+ http.onreadystatechange = function () {
607
+ if (http.readyState == 4) {
608
+ if (http.responseText) {
609
+ resolve(JSON.parse(http.responseText));
610
+ }
611
+ else {
612
+ resolve(false);
613
+ }
614
+ }
615
+ };
616
+ http.open("GET", _serviceURL, true);
617
+ http.setRequestHeader("Content-type", "application/json");
618
+ http.setRequestHeader("Authorization", "Bearer ".concat(access_token));
619
+ if (window.localeSettings) {
620
+ http.setRequestHeader("accept-language", window.localeSettings);
621
+ }
622
+ http.send();
623
+ }
624
+ catch (ex) {
625
+ throw new Helper_1.CustomException(ex, 417);
626
+ }
627
+ });
628
+ };
629
+ ;
630
+ /**
631
+ * review device
632
+ * @param options
633
+ * @param access_token
634
+ * @returns
635
+ */
636
+ WebAuth.prototype.reviewDevice = function (options, access_token) {
637
+ return new Promise(function (resolve, reject) {
638
+ try {
639
+ var http = new XMLHttpRequest();
640
+ var _serviceURL = window.webAuthSettings.authority + "/reports-srv/device/updatereview";
641
+ http.onreadystatechange = function () {
642
+ if (http.readyState == 4) {
643
+ if (http.responseText) {
644
+ resolve(JSON.parse(http.responseText));
645
+ }
646
+ else {
647
+ resolve(false);
648
+ }
649
+ }
650
+ };
651
+ http.open("PUT", _serviceURL, true);
652
+ http.setRequestHeader("Content-type", "application/json");
653
+ http.setRequestHeader("Authorization", "Bearer ".concat(access_token));
654
+ if (window.localeSettings) {
655
+ http.setRequestHeader("accept-language", window.localeSettings);
656
+ }
657
+ http.send(JSON.stringify(options));
658
+ }
659
+ catch (ex) {
660
+ throw new Helper_1.CustomException(ex, 417);
661
+ }
662
+ });
663
+ };
664
+ ;
665
+ /**
666
+ * get device info
667
+ * @returns
668
+ */
669
+ WebAuth.prototype.getDeviceInfo = function () {
670
+ var _this = this;
671
+ return new Promise(function (resolve, reject) {
672
+ try {
673
+ var value = ('; ' + document.cookie).split("; cidaas_dr=").pop().split(';')[0];
674
+ var fpPromise = fingerprintjs_1["default"].load();
675
+ var options = { fingerprint: "", userAgent: "" };
676
+ if (!value) {
677
+ (function () { return __awaiter(_this, void 0, void 0, function () {
678
+ var fp, result, http, _serviceURL;
679
+ return __generator(this, function (_a) {
680
+ switch (_a.label) {
681
+ case 0: return [4 /*yield*/, fpPromise];
682
+ case 1:
683
+ fp = _a.sent();
684
+ return [4 /*yield*/, fp.get()];
685
+ case 2:
686
+ result = _a.sent();
687
+ options.fingerprint = result.visitorId;
688
+ options.userAgent = window.navigator.userAgent;
689
+ http = new XMLHttpRequest();
690
+ _serviceURL = window.webAuthSettings.authority + "/device-srv/deviceinfo";
691
+ http.onreadystatechange = function () {
692
+ if (http.readyState == 4) {
693
+ resolve(JSON.parse(http.responseText));
694
+ }
695
+ };
696
+ http.open("POST", _serviceURL, true);
697
+ http.setRequestHeader("Content-type", "application/json");
698
+ if (window.localeSettings) {
699
+ http.setRequestHeader("accept-language", window.localeSettings);
700
+ }
701
+ http.send(JSON.stringify(options));
702
+ return [2 /*return*/];
703
+ }
704
+ });
705
+ }); })();
706
+ }
707
+ }
708
+ catch (ex) {
709
+ reject(ex);
710
+ }
711
+ });
712
+ };
713
+ ;
714
+ /**
715
+ * get user info
716
+ * @param options
717
+ * @returns
718
+ */
719
+ WebAuth.prototype.getUserProfile = function (options) {
720
+ return UserService_1.UserService.getUserProfile(options);
721
+ };
722
+ ;
723
+ /**
724
+ * renew token using refresh token
725
+ * @param options
726
+ * @returns
727
+ */
728
+ WebAuth.prototype.renewToken = function (options) {
729
+ return TokenService_1.TokenService.renewToken(options);
730
+ };
731
+ ;
732
+ /**
733
+ * get access token from code
734
+ * @param options
735
+ * @returns
736
+ */
737
+ WebAuth.prototype.getAccessToken = function (options) {
738
+ return TokenService_1.TokenService.getAccessToken(options);
739
+ };
740
+ ;
741
+ /**
742
+ * validate access token
743
+ * @param options
744
+ * @returns
745
+ */
746
+ WebAuth.prototype.validateAccessToken = function (options) {
747
+ return TokenService_1.TokenService.validateAccessToken(options);
748
+ };
749
+ ;
750
+ /**
751
+ * login with username and password
752
+ * @param options
753
+ */
754
+ WebAuth.prototype.loginWithCredentials = function (options) {
755
+ LoginService_1.LoginService.loginWithCredentials(options);
756
+ };
757
+ ;
758
+ /**
759
+ * login with username and password and return response
760
+ * @param options
761
+ * @returns
762
+ */
763
+ WebAuth.prototype.loginWithCredentialsAsynFn = function (options) {
764
+ return __awaiter(this, void 0, void 0, function () {
765
+ return __generator(this, function (_a) {
766
+ switch (_a.label) {
767
+ case 0: return [4 /*yield*/, LoginService_1.LoginService.loginWithCredentialsAsynFn(options)];
768
+ case 1:
769
+ _a.sent();
770
+ return [2 /*return*/];
771
+ }
772
+ });
773
+ });
774
+ };
775
+ ;
776
+ /**
777
+ * login with social
778
+ * @param options
779
+ * @param queryParams
780
+ */
781
+ WebAuth.prototype.loginWithSocial = function (options, queryParams) {
782
+ LoginService_1.LoginService.loginWithSocial(options, queryParams);
783
+ };
784
+ ;
785
+ /**
786
+ * register with social
787
+ * @param options
788
+ * @param queryParams
789
+ */
790
+ WebAuth.prototype.registerWithSocial = function (options, queryParams) {
791
+ LoginService_1.LoginService.registerWithSocial(options, queryParams);
792
+ };
793
+ ;
794
+ /**
795
+ * register user
796
+ * @param options
797
+ * @param headers
798
+ * @returns
799
+ */
800
+ WebAuth.prototype.register = function (options, headers) {
801
+ return UserService_1.UserService.register(options, headers);
802
+ };
803
+ ;
804
+ /**
805
+ * get invite info
806
+ * @param options
807
+ * @returns
808
+ */
809
+ WebAuth.prototype.getInviteUserDetails = function (options) {
810
+ return UserService_1.UserService.getInviteUserDetails(options);
811
+ };
812
+ ;
813
+ /**
814
+ * get Communication status
815
+ * @param options
816
+ * @returns
817
+ */
818
+ WebAuth.prototype.getCommunicationStatus = function (options) {
819
+ return UserService_1.UserService.getCommunicationStatus(options);
820
+ };
821
+ ;
822
+ /**
823
+ * initiate verification
824
+ * @param options
825
+ * @returns
826
+ */
827
+ WebAuth.prototype.initiateAccountVerification = function (options) {
828
+ VerificationService_1.VerificationService.initiateAccountVerification(options);
829
+ };
830
+ ;
831
+ /**
832
+ * initiate verification and return response
833
+ * @param options
834
+ * @returns
835
+ */
836
+ WebAuth.prototype.initiateAccountVerificationAsynFn = function (options) {
837
+ return __awaiter(this, void 0, void 0, function () {
838
+ return __generator(this, function (_a) {
839
+ switch (_a.label) {
840
+ case 0: return [4 /*yield*/, VerificationService_1.VerificationService.initiateAccountVerificationAsynFn(options)];
841
+ case 1: return [2 /*return*/, _a.sent()];
842
+ }
843
+ });
844
+ });
845
+ };
846
+ ;
847
+ /**
848
+ * verify account
849
+ * @param options
850
+ * @returns
851
+ */
852
+ WebAuth.prototype.verifyAccount = function (options) {
853
+ return VerificationService_1.VerificationService.verifyAccount(options);
854
+ };
855
+ ;
856
+ /**
857
+ * initiate reset password
858
+ * @param options
859
+ * @returns
860
+ */
861
+ WebAuth.prototype.initiateResetPassword = function (options) {
862
+ return UserService_1.UserService.initiateResetPassword(options);
863
+ };
864
+ ;
865
+ /**
866
+ * handle reset password
867
+ * @param options
868
+ */
869
+ WebAuth.prototype.handleResetPassword = function (options) {
870
+ UserService_1.UserService.handleResetPassword(options);
871
+ };
872
+ ;
873
+ /**
874
+ * reset password
875
+ * @param options
876
+ */
877
+ WebAuth.prototype.resetPassword = function (options) {
878
+ UserService_1.UserService.resetPassword(options);
879
+ };
880
+ ;
881
+ /**
882
+ * get mfa list v2
883
+ * @param options
884
+ * @returns
885
+ */
886
+ WebAuth.prototype.getMFAListV2 = function (options) {
887
+ return VerificationService_1.VerificationService.getMFAListV2(options);
888
+ };
889
+ ;
890
+ /**
891
+ * cancel mfa v2
892
+ * @param options
893
+ * @returns
894
+ */
895
+ WebAuth.prototype.cancelMFAV2 = function (options) {
896
+ return VerificationService_1.VerificationService.cancelMFAV2(options);
897
+ };
898
+ ;
899
+ /**
900
+ * passwordless login
901
+ * @param options
902
+ */
903
+ WebAuth.prototype.passwordlessLogin = function (options) {
904
+ LoginService_1.LoginService.passwordlessLogin(options);
905
+ };
906
+ ;
907
+ /**
908
+ * get user consent details
909
+ * @param options
910
+ * @returns
911
+ */
912
+ WebAuth.prototype.getConsentDetailsV2 = function (options) {
913
+ return ConsentService_1.ConsentService.getConsentDetailsV2(options);
914
+ };
915
+ ;
916
+ /**
917
+ * accept consent v2
918
+ * @param options
919
+ * @returns
920
+ */
921
+ WebAuth.prototype.acceptConsentV2 = function (options) {
922
+ return ConsentService_1.ConsentService.acceptConsentV2(options);
923
+ };
924
+ ;
925
+ /**
926
+ * get scope consent details
927
+ * @param options
928
+ * @returns
929
+ */
930
+ WebAuth.prototype.getScopeConsentDetails = function (options) {
931
+ return TokenService_1.TokenService.getScopeConsentDetails(options);
932
+ };
933
+ ;
934
+ /**
935
+ * get scope consent version details
936
+ * @param options
937
+ * @returns
938
+ */
939
+ WebAuth.prototype.getScopeConsentVersionDetailsV2 = function (options) {
940
+ return ConsentService_1.ConsentService.getScopeConsentVersionDetailsV2(options);
941
+ };
942
+ ;
943
+ /**
944
+ * accept scope Consent
945
+ * @param options
946
+ * @returns
947
+ */
948
+ WebAuth.prototype.acceptScopeConsent = function (options) {
949
+ return ConsentService_1.ConsentService.acceptScopeConsent(options);
950
+ };
951
+ ;
952
+ /**
953
+ * scope consent continue login
954
+ * @param options
955
+ */
956
+ WebAuth.prototype.scopeConsentContinue = function (options) {
957
+ LoginService_1.LoginService.scopeConsentContinue(options);
958
+ };
959
+ ;
960
+ /**
961
+ * accept claim Consent
962
+ * @param options
963
+ * @returns
964
+ */
965
+ WebAuth.prototype.acceptClaimConsent = function (options) {
966
+ return ConsentService_1.ConsentService.acceptClaimConsent(options);
967
+ };
968
+ ;
969
+ /**
970
+ * claim consent continue login
971
+ * @param options
972
+ */
973
+ WebAuth.prototype.claimConsentContinue = function (options) {
974
+ LoginService_1.LoginService.claimConsentContinue(options);
975
+ };
976
+ ;
977
+ /**
978
+ * revoke claim Consent
979
+ * @param options
980
+ * @returns
981
+ */
982
+ WebAuth.prototype.revokeClaimConsent = function (options) {
983
+ return ConsentService_1.ConsentService.revokeClaimConsent(options);
984
+ };
985
+ ;
986
+ /**
987
+ * get Deduplication details
988
+ * @param options
989
+ * @returns
990
+ */
991
+ WebAuth.prototype.getDeduplicationDetails = function (options) {
992
+ return UserService_1.UserService.getDeduplicationDetails(options);
993
+ };
994
+ ;
995
+ /**
996
+ * deduplication login
997
+ * @param options
998
+ */
999
+ WebAuth.prototype.deduplicationLogin = function (options) {
1000
+ UserService_1.UserService.deduplicationLogin(options);
1001
+ };
1002
+ ;
1003
+ /**
1004
+ * register Deduplication
1005
+ * @param options
1006
+ * @returns
1007
+ */
1008
+ WebAuth.prototype.registerDeduplication = function (options) {
1009
+ return UserService_1.UserService.registerDeduplication(options);
1010
+ };
1011
+ ;
1012
+ /**
1013
+ * accepts any as the request
1014
+ * consent continue login
1015
+ * @param options
1016
+ */
1017
+ WebAuth.prototype.consentContinue = function (options) {
1018
+ LoginService_1.LoginService.consentContinue(options);
1019
+ };
1020
+ ;
1021
+ /**
1022
+ * mfa continue login
1023
+ * @param options
1024
+ */
1025
+ WebAuth.prototype.mfaContinue = function (options) {
1026
+ LoginService_1.LoginService.mfaContinue(options);
1027
+ };
1028
+ ;
1029
+ /**
1030
+ * change password continue
1031
+ * @param options
1032
+ */
1033
+ WebAuth.prototype.firstTimeChangePassword = function (options) {
1034
+ LoginService_1.LoginService.firstTimeChangePassword(options);
1035
+ };
1036
+ ;
1037
+ /**
1038
+ * change password
1039
+ * @param options
1040
+ * @param access_token
1041
+ * @returns
1042
+ */
1043
+ WebAuth.prototype.changePassword = function (options, access_token) {
1044
+ return UserService_1.UserService.changePassword(options, access_token);
1045
+ };
1046
+ ;
1047
+ /**
1048
+ * update profile
1049
+ * @param options
1050
+ * @param access_token
1051
+ * @param sub
1052
+ * @returns
1053
+ */
1054
+ WebAuth.prototype.updateProfile = function (options, access_token, sub) {
1055
+ return UserService_1.UserService.updateProfile(options, access_token, sub);
1056
+ };
1057
+ ;
1058
+ /**
1059
+ * get user activities
1060
+ * @param options
1061
+ * @param access_token
1062
+ * @returns
1063
+ */
1064
+ WebAuth.prototype.getUserActivities = function (options, access_token) {
1065
+ var _serviceURL = window.webAuthSettings.authority + "/useractivity-srv/latestactivity";
1066
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, false, access_token);
1067
+ };
1068
+ ;
1069
+ /**
1070
+ * @param access_token
1071
+ * @returns
1072
+ */
1073
+ WebAuth.prototype.getAllVerificationList = function (access_token) {
1074
+ return VerificationService_1.VerificationService.getAllVerificationList(access_token);
1075
+ };
1076
+ ;
1077
+ /**
1078
+ * initiate link accoount
1079
+ * @param options
1080
+ * @param access_token
1081
+ * @returns
1082
+ */
1083
+ WebAuth.prototype.initiateLinkAccount = function (options, access_token) {
1084
+ return UserService_1.UserService.initiateLinkAccount(options, access_token);
1085
+ };
1086
+ ;
1087
+ /**
1088
+ * complete link accoount
1089
+ * @param options
1090
+ * @param access_token
1091
+ * @returns
1092
+ */
1093
+ WebAuth.prototype.completeLinkAccount = function (options, access_token) {
1094
+ return UserService_1.UserService.completeLinkAccount(options, access_token);
1095
+ };
1096
+ ;
1097
+ /**
1098
+ * get linked users
1099
+ * @param access_token
1100
+ * @param sub
1101
+ * @returns
1102
+ */
1103
+ WebAuth.prototype.getLinkedUsers = function (access_token, sub) {
1104
+ return UserService_1.UserService.getLinkedUsers(access_token, sub);
1105
+ };
1106
+ ;
1107
+ /**
1108
+ * unlink accoount
1109
+ * @param access_token
1110
+ * @param identityId
1111
+ * @returns
1112
+ */
1113
+ WebAuth.prototype.unlinkAccount = function (access_token, identityId) {
1114
+ return UserService_1.UserService.unlinkAccount(access_token, identityId);
1115
+ };
1116
+ ;
1117
+ /**
1118
+ * image upload
1119
+ * @param options
1120
+ * @param access_token
1121
+ * @returns
1122
+ */
1123
+ WebAuth.prototype.updateProfileImage = function (options, access_token) {
1124
+ var _serviceURL = window.webAuthSettings.authority + "/image-srv/profile/upload";
1125
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, false, access_token);
1126
+ };
1127
+ ;
1128
+ /**
1129
+ * updateSuggestMFA
1130
+ * @param track_id
1131
+ * @param options
1132
+ * @returns
1133
+ */
1134
+ WebAuth.prototype.updateSuggestMFA = function (track_id, options) {
1135
+ return TokenService_1.TokenService.updateSuggestMFA(track_id, options);
1136
+ };
1137
+ ;
1138
+ /**
1139
+ * enrollVerification
1140
+ * @param options
1141
+ * @returns
1142
+ */
1143
+ WebAuth.prototype.enrollVerification = function (options) {
1144
+ return VerificationService_1.VerificationService.enrollVerification(options);
1145
+ };
1146
+ ;
1147
+ /**
1148
+ * @deprecated This function is no longer supported, instead use {this.updateStatus()}
1149
+ * @param status_id
1150
+ * @returns
1151
+ */
1152
+ WebAuth.prototype.updateSocket = function (status_id) {
1153
+ return VerificationService_1.VerificationService.updateStatus(status_id);
1154
+ };
1155
+ ;
1156
+ /**
1157
+ * update the status of notification
1158
+ * @param status_id
1159
+ * @returns
1160
+ */
1161
+ WebAuth.prototype.updateStatus = function (status_id) {
1162
+ return VerificationService_1.VerificationService.updateStatus(status_id);
1163
+ };
1164
+ ;
1165
+ /**
1166
+ * setupFidoVerification
1167
+ * @param options
1168
+ * @returns
1169
+ */
1170
+ WebAuth.prototype.setupFidoVerification = function (options) {
1171
+ return VerificationService_1.VerificationService.setupFidoVerification(options);
1172
+ };
1173
+ ;
1174
+ /**
1175
+ * checkVerificationTypeConfigured
1176
+ * @param options
1177
+ * @returns
1178
+ */
1179
+ WebAuth.prototype.checkVerificationTypeConfigured = function (options) {
1180
+ return VerificationService_1.VerificationService.checkVerificationTypeConfigured(options);
1181
+ };
1182
+ ;
1183
+ /**
1184
+ * deleteUserAccount
1185
+ * @param options
1186
+ * @returns
1187
+ */
1188
+ WebAuth.prototype.deleteUserAccount = function (options) {
1189
+ return UserService_1.UserService.deleteUserAccount(options);
1190
+ };
1191
+ ;
1192
+ /**
1193
+ * getMissingFieldsLogin
1194
+ * @param trackId
1195
+ * @returns
1196
+ */
1197
+ WebAuth.prototype.getMissingFieldsLogin = function (trackId) {
1198
+ return TokenService_1.TokenService.getMissingFieldsLogin(trackId);
1199
+ };
1200
+ ;
1201
+ /**
1202
+ * progressiveRegistration
1203
+ * @param options
1204
+ * @param headers
1205
+ * @returns
1206
+ */
1207
+ WebAuth.prototype.progressiveRegistration = function (options, headers) {
1208
+ return LoginService_1.LoginService.progressiveRegistration(options, headers);
1209
+ };
1210
+ ;
1211
+ /**
1212
+ * loginAfterRegister
1213
+ * @param options
1214
+ */
1215
+ WebAuth.prototype.loginAfterRegister = function (options) {
1216
+ LoginService_1.LoginService.loginAfterRegister(options);
1217
+ };
1218
+ ;
1219
+ /**
1220
+ * device code flow - verify
1221
+ * @param code
1222
+ */
1223
+ WebAuth.prototype.deviceCodeVerify = function (code) {
1224
+ TokenService_1.TokenService.deviceCodeVerify(code);
1225
+ };
1226
+ /**
1227
+ * check if an user exists
1228
+ * @param options
1229
+ * @returns
1230
+ */
1231
+ WebAuth.prototype.userCheckExists = function (options) {
1232
+ return UserService_1.UserService.userCheckExists(options);
1233
+ };
1234
+ ;
1235
+ /**
1236
+ * To set accept language
1237
+ * @param acceptLanguage
1238
+ */
1239
+ WebAuth.prototype.setAcceptLanguageHeader = function (acceptLanguage) {
1240
+ window.localeSettings = acceptLanguage;
1241
+ };
1242
+ /**
1243
+ * initiate mfa v2
1244
+ * @param options
1245
+ * @returns
1246
+ */
1247
+ WebAuth.prototype.initiateMFAV2 = function (options) {
1248
+ return VerificationService_1.VerificationService.initiateMFAV2(options);
1249
+ };
1250
+ ;
1251
+ /**
1252
+ * initiateVerification
1253
+ * @param options
1254
+ */
1255
+ WebAuth.prototype.initiateVerification = function (options) {
1256
+ options.type = options.verification_type;
1257
+ this.initiateMFAV2(options);
1258
+ };
1259
+ ;
1260
+ /**
1261
+ * initiate email v2
1262
+ * @param options
1263
+ */
1264
+ WebAuth.prototype.initiateEmailV2 = function (options) {
1265
+ options.type = "email";
1266
+ this.initiateMFAV2(options);
1267
+ };
1268
+ ;
1269
+ /**
1270
+ * initiate sms v2
1271
+ * @param options
1272
+ */
1273
+ WebAuth.prototype.initiateSMSV2 = function (options) {
1274
+ options.type = "sms";
1275
+ this.initiateMFAV2(options);
1276
+ };
1277
+ ;
1278
+ /**
1279
+ * initiate ivr v2
1280
+ * @param options
1281
+ */
1282
+ WebAuth.prototype.initiateIVRV2 = function (options) {
1283
+ options.type = "ivr";
1284
+ this.initiateMFAV2(options);
1285
+ };
1286
+ ;
1287
+ /**
1288
+ * initiate backupcode v2
1289
+ * @param options
1290
+ */
1291
+ WebAuth.prototype.initiateBackupcodeV2 = function (options) {
1292
+ options.type = "backupcode";
1293
+ this.initiateMFAV2(options);
1294
+ };
1295
+ ;
1296
+ /**
1297
+ * initiate totp v2
1298
+ * @param options
1299
+ */
1300
+ WebAuth.prototype.initiateTOTPV2 = function (options) {
1301
+ options.type = "totp";
1302
+ this.initiateMFAV2(options);
1303
+ };
1304
+ ;
1305
+ /**
1306
+ * initiate pattern v2
1307
+ * @param options
1308
+ */
1309
+ WebAuth.prototype.initiatePatternV2 = function (options) {
1310
+ options.type = "pattern";
1311
+ this.initiateMFAV2(options);
1312
+ };
1313
+ ;
1314
+ /**
1315
+ * initiate touchid v2
1316
+ * @param options
1317
+ */
1318
+ WebAuth.prototype.initiateTouchIdV2 = function (options) {
1319
+ options.type = "touchid";
1320
+ this.initiateMFAV2(options);
1321
+ };
1322
+ ;
1323
+ /**
1324
+ * initiate smart push v2
1325
+ * @param options
1326
+ */
1327
+ WebAuth.prototype.initiateSmartPushV2 = function (options) {
1328
+ options.type = "push";
1329
+ this.initiateMFAV2(options);
1330
+ };
1331
+ ;
1332
+ /**
1333
+ * initiate face v2
1334
+ * @param options
1335
+ */
1336
+ WebAuth.prototype.initiateFaceV2 = function (options) {
1337
+ options.type = "face";
1338
+ this.initiateMFAV2(options);
1339
+ };
1340
+ ;
1341
+ /**
1342
+ * initiate voice v2
1343
+ * @param options
1344
+ */
1345
+ WebAuth.prototype.initiateVoiceV2 = function (options) {
1346
+ options.type = "voice";
1347
+ this.initiateMFAV2(options);
1348
+ };
1349
+ ;
1350
+ /**
1351
+ * @deprecated
1352
+ * @param options
1353
+ * @param verificationType
1354
+ * @returns
1355
+ */
1356
+ WebAuth.prototype.initiateMfaV1 = function (options, verificationType) {
1357
+ return VerificationService_1.VerificationService.initiateMfaV1(options, verificationType);
1358
+ };
1359
+ /**
1360
+ * @deprecated
1361
+ * initiate email - v1
1362
+ * @param options
1363
+ */
1364
+ WebAuth.prototype.initiateEmail = function (options) {
1365
+ var verificationType = "EMAIL";
1366
+ this.initiateMfaV1(options, verificationType);
1367
+ };
1368
+ ;
1369
+ /**
1370
+ * @deprecated
1371
+ * initiate SMS - v1
1372
+ * @param options
1373
+ */
1374
+ WebAuth.prototype.initiateSMS = function (options) {
1375
+ var verificationType = "SMS";
1376
+ this.initiateMfaV1(options, verificationType);
1377
+ };
1378
+ ;
1379
+ /**
1380
+ * @deprecated
1381
+ * initiate IVR - v1
1382
+ * @param options
1383
+ */
1384
+ WebAuth.prototype.initiateIVR = function (options) {
1385
+ var verificationType = "IVR";
1386
+ this.initiateMfaV1(options, verificationType);
1387
+ };
1388
+ ;
1389
+ /**
1390
+ * @deprecated
1391
+ * initiate backup code - v1
1392
+ * @param options
1393
+ */
1394
+ WebAuth.prototype.initiateBackupcode = function (options) {
1395
+ var verificationType = "BACKUPCODE";
1396
+ this.initiateMfaV1(options, verificationType);
1397
+ };
1398
+ ;
1399
+ /**
1400
+ * @deprecated
1401
+ * initiate TOTP - v1
1402
+ * @param options
1403
+ */
1404
+ WebAuth.prototype.initiateTOTP = function (options) {
1405
+ var verificationType = "TOTP";
1406
+ this.initiateMfaV1(options, verificationType);
1407
+ };
1408
+ ;
1409
+ /**
1410
+ * @deprecated
1411
+ * initiate pattern - v1
1412
+ * @param options
1413
+ */
1414
+ WebAuth.prototype.initiatePattern = function (options) {
1415
+ var verificationType = "PATTERN";
1416
+ this.initiateMfaV1(options, verificationType);
1417
+ };
1418
+ ;
1419
+ /**
1420
+ * @deprecated
1421
+ * initiate touchid - v1
1422
+ * @param options
1423
+ */
1424
+ WebAuth.prototype.initiateTouchId = function (options) {
1425
+ var verificationType = "TOUCHID";
1426
+ this.initiateMfaV1(options, verificationType);
1427
+ };
1428
+ ;
1429
+ /**
1430
+ * @deprecated
1431
+ * initiate push - v1
1432
+ * @param options
1433
+ */ WebAuth.prototype.initiateSmartPush = function (options) {
1434
+ var verificationType = "PUSH";
1435
+ this.initiateMfaV1(options, verificationType);
1436
+ };
1437
+ ;
1438
+ /**
1439
+ * @deprecated
1440
+ * initiate face - v1
1441
+ * @param options
1442
+ */
1443
+ WebAuth.prototype.initiateFace = function (options) {
1444
+ var verificationType = "FACE";
1445
+ this.initiateMfaV1(options, verificationType);
1446
+ };
1447
+ ;
1448
+ /**
1449
+ * @deprecated
1450
+ * initiate Voice - v1
1451
+ * @param options
1452
+ */
1453
+ WebAuth.prototype.initiateVoice = function (options) {
1454
+ var verificationType = "VOICE";
1455
+ this.initiateMfaV1(options, verificationType);
1456
+ };
1457
+ ;
1458
+ /**
1459
+ * authenticate mfa v2
1460
+ * @param options
1461
+ * @returns
1462
+ */
1463
+ WebAuth.prototype.authenticateMFAV2 = function (options) {
1464
+ return VerificationService_1.VerificationService.authenticateMFAV2(options);
1465
+ };
1466
+ ;
1467
+ /**
1468
+ * authenticateVerification
1469
+ * @param options
1470
+ */
1471
+ WebAuth.prototype.authenticateVerification = function (options) {
1472
+ options.type = options.verification_type;
1473
+ this.authenticateMFAV2(options);
1474
+ };
1475
+ ;
1476
+ /**
1477
+ * authenticate email v2
1478
+ * @param options
1479
+ */
1480
+ WebAuth.prototype.authenticateEmailV2 = function (options) {
1481
+ options.type = "email";
1482
+ this.authenticateMFAV2(options);
1483
+ };
1484
+ ;
1485
+ /**
1486
+ * authenticate sms v2
1487
+ * @param options
1488
+ */
1489
+ WebAuth.prototype.authenticateSMSV2 = function (options) {
1490
+ options.type = "sms";
1491
+ this.authenticateMFAV2(options);
1492
+ };
1493
+ ;
1494
+ /**
1495
+ * authenticate ivr v2
1496
+ * @param options
1497
+ */
1498
+ WebAuth.prototype.authenticateIVRV2 = function (options) {
1499
+ options.type = "ivr";
1500
+ this.authenticateMFAV2(options);
1501
+ };
1502
+ ;
1503
+ /**
1504
+ * authenticate backupcode v2
1505
+ * @param options
1506
+ */
1507
+ WebAuth.prototype.authenticateBackupcodeV2 = function (options) {
1508
+ options.type = "backupcode";
1509
+ this.authenticateMFAV2(options);
1510
+ };
1511
+ ;
1512
+ /**
1513
+ * authenticate totp v2
1514
+ * @param options
1515
+ */
1516
+ WebAuth.prototype.authenticateTOTPV2 = function (options) {
1517
+ options.type = "totp";
1518
+ this.authenticateMFAV2(options);
1519
+ };
1520
+ ;
1521
+ /**
1522
+ * authenticateVerification form type (for face)
1523
+ * @param options
1524
+ * @returns
1525
+ */
1526
+ WebAuth.prototype.authenticateFaceVerification = function (options) {
1527
+ return VerificationService_1.VerificationService.authenticateFaceVerification(options);
1528
+ };
1529
+ ;
1530
+ /**
1531
+ * @deprecated
1532
+ * setup verification - v1
1533
+ * @param options
1534
+ * @param access_token
1535
+ * @param verificationType
1536
+ * @returns
1537
+ */
1538
+ WebAuth.prototype.setupVerificationV1 = function (options, access_token, verificationType) {
1539
+ return VerificationService_1.VerificationService.setupVerificationV1(options, access_token, verificationType);
1540
+ };
1541
+ /**
1542
+ * @deprecated
1543
+ * setup email - v1
1544
+ * @param options
1545
+ * @param access_token
1546
+ */
1547
+ WebAuth.prototype.setupEmail = function (options, access_token) {
1548
+ var verificationType = "EMAIL";
1549
+ this.setupVerificationV1(options, access_token, verificationType);
1550
+ };
1551
+ ;
1552
+ /**
1553
+ * @deprecated
1554
+ * setup sms - v1
1555
+ * @param options
1556
+ * @param access_token
1557
+ */
1558
+ WebAuth.prototype.setupSMS = function (options, access_token) {
1559
+ var verificationType = "SMS";
1560
+ this.setupVerificationV1(options, access_token, verificationType);
1561
+ };
1562
+ ;
1563
+ /**
1564
+ * @deprecated
1565
+ * setup ivr - v1
1566
+ * @param options
1567
+ * @param access_token
1568
+ */
1569
+ WebAuth.prototype.setupIVR = function (options, access_token) {
1570
+ var verificationType = "IVR";
1571
+ this.setupVerificationV1(options, access_token, verificationType);
1572
+ };
1573
+ ;
1574
+ /**
1575
+ * @deprecated
1576
+ * setup backupcode - v1
1577
+ * @param options
1578
+ * @param access_token
1579
+ */
1580
+ WebAuth.prototype.setupBackupcode = function (options, access_token) {
1581
+ var verificationType = "BACKUPCODE";
1582
+ this.setupVerificationV1(options, access_token, verificationType);
1583
+ };
1584
+ ;
1585
+ /**
1586
+ * @deprecated
1587
+ * setup totp - v1
1588
+ * @param options
1589
+ * @param access_token
1590
+ */
1591
+ WebAuth.prototype.setupTOTP = function (options, access_token) {
1592
+ var verificationType = "TOTP";
1593
+ this.setupVerificationV1(options, access_token, verificationType);
1594
+ };
1595
+ ;
1596
+ /**
1597
+ * @deprecated
1598
+ * setup pattern - v1
1599
+ * @param options
1600
+ * @param access_token
1601
+ */
1602
+ WebAuth.prototype.setupPattern = function (options, access_token) {
1603
+ var verificationType = "PATTERN";
1604
+ this.setupVerificationV1(options, access_token, verificationType);
1605
+ };
1606
+ ;
1607
+ /**
1608
+ * @deprecated
1609
+ * setup touch - v1
1610
+ * @param options
1611
+ * @param access_token
1612
+ */
1613
+ WebAuth.prototype.setupTouchId = function (options, access_token) {
1614
+ var verificationType = "TOUCHID";
1615
+ this.setupVerificationV1(options, access_token, verificationType);
1616
+ };
1617
+ ;
1618
+ /**
1619
+ * @deprecated
1620
+ * setup smart push - v1
1621
+ * @param options
1622
+ * @param access_token
1623
+ */
1624
+ WebAuth.prototype.setupSmartPush = function (options, access_token) {
1625
+ var verificationType = "PUSH";
1626
+ this.setupVerificationV1(options, access_token, verificationType);
1627
+ };
1628
+ ;
1629
+ /**
1630
+ * @deprecated
1631
+ * setup face - v1
1632
+ * @param options
1633
+ * @param access_token
1634
+ */
1635
+ WebAuth.prototype.setupFace = function (options, access_token) {
1636
+ var verificationType = "FACE";
1637
+ this.setupVerificationV1(options, access_token, verificationType);
1638
+ };
1639
+ ;
1640
+ /**
1641
+ * @deprecated
1642
+ * setup voice - v1
1643
+ * @param options
1644
+ * @param access_token
1645
+ */
1646
+ WebAuth.prototype.setupVoice = function (options, access_token) {
1647
+ var verificationType = "VOICE";
1648
+ this.setupVerificationV1(options, access_token, verificationType);
1649
+ };
1650
+ ;
1651
+ /**
1652
+ * @deprecated
1653
+ * enroll verification - v1
1654
+ * @param options
1655
+ * @param access_token
1656
+ * @param verificationType
1657
+ * @returns
1658
+ */
1659
+ WebAuth.prototype.enrollVerificationV1 = function (options, access_token, verificationType) {
1660
+ return VerificationService_1.VerificationService.enrollVerificationV1(options, access_token, verificationType);
1661
+ };
1662
+ /**
1663
+ * @deprecated
1664
+ * enroll email - v1
1665
+ * @param options
1666
+ * @param access_token
1667
+ */
1668
+ WebAuth.prototype.enrollEmail = function (options, access_token) {
1669
+ var verificationType = "EMAIL";
1670
+ this.enrollVerificationV1(options, access_token, verificationType);
1671
+ };
1672
+ ;
1673
+ /**
1674
+ * @deprecated
1675
+ * enroll SMS - v1
1676
+ * @param options
1677
+ * @param access_token
1678
+ */
1679
+ WebAuth.prototype.enrollSMS = function (options, access_token) {
1680
+ var verificationType = "SMS";
1681
+ this.enrollVerificationV1(options, access_token, verificationType);
1682
+ };
1683
+ ;
1684
+ /**
1685
+ * @deprecated
1686
+ * enroll IVR - v1
1687
+ * @param options
1688
+ * @param access_token
1689
+ */
1690
+ WebAuth.prototype.enrollIVR = function (options, access_token) {
1691
+ var verificationType = "IVR";
1692
+ this.enrollVerificationV1(options, access_token, verificationType);
1693
+ };
1694
+ ;
1695
+ /**
1696
+ * @deprecated
1697
+ * enroll TOTP - v1
1698
+ * @param options
1699
+ * @param access_token
1700
+ */
1701
+ WebAuth.prototype.enrollTOTP = function (options, access_token) {
1702
+ var verificationType = "TOTP";
1703
+ this.enrollVerificationV1(options, access_token, verificationType);
1704
+ };
1705
+ ;
1706
+ /**
1707
+ * @deprecated
1708
+ * authenticate mfa - v1
1709
+ * @param verificationType
1710
+ * @returns
1711
+ */
1712
+ WebAuth.prototype.authenticateMfaV1 = function (options, verificationType) {
1713
+ return VerificationService_1.VerificationService.authenticateMfaV1(options, verificationType);
1714
+ };
1715
+ /**
1716
+ * @deprecated
1717
+ * authenticate email - v1
1718
+ * @param options
1719
+ */
1720
+ WebAuth.prototype.authenticateEmail = function (options) {
1721
+ var verificationType = "EMAIL";
1722
+ this.authenticateMfaV1(options, verificationType);
1723
+ };
1724
+ ;
1725
+ /**
1726
+ * @deprecated
1727
+ * authenticate sms - v1
1728
+ * @param options
1729
+ */
1730
+ WebAuth.prototype.authenticateSMS = function (options) {
1731
+ var verificationType = "SMS";
1732
+ this.authenticateMfaV1(options, verificationType);
1733
+ };
1734
+ ;
1735
+ /**
1736
+ * @deprecated
1737
+ * authenticate ivr - v1
1738
+ * @param options
1739
+ */
1740
+ WebAuth.prototype.authenticateIVR = function (options) {
1741
+ var verificationType = "IVR";
1742
+ this.authenticateMfaV1(options, verificationType);
1743
+ };
1744
+ ;
1745
+ /**
1746
+ * @deprecated
1747
+ * authenticate backupcode - v1
1748
+ * @param options
1749
+ */
1750
+ WebAuth.prototype.authenticateBackupcode = function (options) {
1751
+ var verificationType = "BACKUPCODE";
1752
+ this.authenticateMfaV1(options, verificationType);
1753
+ };
1754
+ ;
1755
+ /**
1756
+ * @deprecated
1757
+ * authenticate totp - v1
1758
+ * @param options
1759
+ */
1760
+ WebAuth.prototype.authenticateTOTP = function (options) {
1761
+ var verificationType = "TOTP";
1762
+ this.authenticateMfaV1(options, verificationType);
1763
+ };
1764
+ ;
1765
+ return WebAuth;
1766
+ }());
1767
+ exports.WebAuth = WebAuth;