cidaas-javascript-sdk 2.4.3 → 2.5.1

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