cidaas-javascript-sdk 3.1.4 → 4.0.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.
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
14
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
15
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -38,7 +49,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
49
  exports.__esModule = true;
39
50
  exports.WebAuth = void 0;
40
51
  var oidc_client_ts_1 = require("oidc-client-ts");
41
- var CryptoJS = require("crypto-js");
42
52
  var authentication_1 = require("../authentication");
43
53
  var Helper_1 = require("./Helper");
44
54
  var LoginService_1 = require("./LoginService");
@@ -55,12 +65,6 @@ var WebAuth = /** @class */ (function () {
55
65
  if (!settings.scope) {
56
66
  settings.scope = "email openid profile mobile";
57
67
  }
58
- if (!settings.mode) {
59
- settings.mode = 'redirect';
60
- }
61
- if (!settings.cidaas_version) {
62
- settings.cidaas_version = 2;
63
- }
64
68
  var usermanager = new oidc_client_ts_1.UserManager(settings);
65
69
  window.webAuthSettings = settings;
66
70
  window.usermanager = usermanager;
@@ -74,14 +78,6 @@ var WebAuth = /** @class */ (function () {
74
78
  console.log(ex);
75
79
  }
76
80
  }
77
- /**
78
- * @param string
79
- * @returns
80
- */
81
- WebAuth.prototype.base64URL = function (string) {
82
- return string.toString(CryptoJS.enc.Base64).replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
83
- };
84
- ;
85
81
  // prototype methods
86
82
  /**
87
83
  * login
@@ -91,23 +87,49 @@ var WebAuth = /** @class */ (function () {
91
87
  if (!window.webAuthSettings && !window.authentication) {
92
88
  throw new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
93
89
  }
94
- switch (window.webAuthSettings.mode) {
95
- case 'redirect':
96
- window.authentication.redirectSignIn('login');
97
- break;
98
- case 'window':
99
- window.authentication.popupSignIn();
100
- break;
101
- case 'silent':
102
- window.authentication.silentSignIn();
103
- break;
90
+ window.authentication.loginOrRegisterWithBrowser('login');
91
+ }
92
+ catch (ex) {
93
+ console.log(ex);
94
+ }
95
+ };
96
+ ;
97
+ /**
98
+ * popupSignIn
99
+ */
100
+ WebAuth.prototype.popupSignIn = function () {
101
+ try {
102
+ if (!window.webAuthSettings && !window.authentication) {
103
+ throw new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
104
104
  }
105
+ window.authentication.popupSignIn();
105
106
  }
106
107
  catch (ex) {
107
108
  console.log(ex);
108
109
  }
109
110
  };
110
111
  ;
112
+ /**
113
+ * silentSignIn
114
+ */
115
+ WebAuth.prototype.silentSignIn = function () {
116
+ return new Promise(function (resolve, reject) {
117
+ try {
118
+ if (!window.webAuthSettings && !window.authentication) {
119
+ throw new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
120
+ }
121
+ window.authentication.silentSignIn().then(function (user) {
122
+ resolve(user);
123
+ })["catch"](function (ex) {
124
+ reject(ex);
125
+ });
126
+ }
127
+ catch (ex) {
128
+ console.log(ex);
129
+ }
130
+ });
131
+ };
132
+ ;
111
133
  /**
112
134
  * register
113
135
  */
@@ -116,17 +138,7 @@ var WebAuth = /** @class */ (function () {
116
138
  if (!window.webAuthSettings && !window.authentication) {
117
139
  throw new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
118
140
  }
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
- }
141
+ window.authentication.loginOrRegisterWithBrowser('register');
130
142
  }
131
143
  catch (ex) {
132
144
  console.log(ex);
@@ -143,25 +155,29 @@ var WebAuth = /** @class */ (function () {
143
155
  if (!window.webAuthSettings && !window.authentication) {
144
156
  throw new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
145
157
  }
146
- switch (window.webAuthSettings.mode) {
147
- case 'redirect':
148
- window.authentication.redirectSignInCallback().then(function (user) {
149
- resolve(user);
150
- })["catch"](function (ex) {
151
- reject(ex);
152
- });
153
- break;
154
- case 'window':
155
- window.authentication.popupSignInCallback();
156
- break;
157
- case 'silent':
158
- window.authentication.silentSignInCallbackV2().then(function (data) {
159
- resolve(data);
160
- })["catch"](function (error) {
161
- reject(error);
162
- });
163
- break;
158
+ window.authentication.loginCallback().then(function (user) {
159
+ resolve(user);
160
+ })["catch"](function (ex) {
161
+ reject(ex);
162
+ });
163
+ }
164
+ catch (ex) {
165
+ console.log(ex);
166
+ }
167
+ });
168
+ };
169
+ ;
170
+ /**
171
+ * popup signin callback
172
+ * @returns
173
+ */
174
+ WebAuth.prototype.popupSignInCallback = function () {
175
+ return new Promise(function (resolve, reject) {
176
+ try {
177
+ if (!window.webAuthSettings && !window.authentication) {
178
+ throw new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
164
179
  }
180
+ window.authentication.popupSignInCallback();
165
181
  }
166
182
  catch (ex) {
167
183
  console.log(ex);
@@ -170,9 +186,38 @@ var WebAuth = /** @class */ (function () {
170
186
  };
171
187
  ;
172
188
  /**
173
- * get user info
189
+ * silent signin callback
174
190
  * @returns
175
191
  */
192
+ WebAuth.prototype.silentSignInCallback = function () {
193
+ return new Promise(function (resolve, reject) {
194
+ try {
195
+ if (!window.webAuthSettings && !window.authentication) {
196
+ throw new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
197
+ }
198
+ window.authentication.silentSignInCallback().then(function (data) {
199
+ resolve(data);
200
+ })["catch"](function (error) {
201
+ reject(error);
202
+ });
203
+ }
204
+ catch (ex) {
205
+ console.log(ex);
206
+ }
207
+ });
208
+ };
209
+ ;
210
+ /**
211
+ * To get the user profile information by using oidc-client-ts library, call **getUserInfo()**. This will return the basic user profile details along with groups, roles and whatever scopes you mentioned in the options.
212
+ * @example
213
+ * ```js
214
+ * cidaas.getUserInfo().then(function (response) {
215
+ * // the response will give you profile details.
216
+ * }).catch(function(ex) {
217
+ * // your failure code here
218
+ * });;
219
+ * ```
220
+ */
176
221
  WebAuth.prototype.getUserInfo = function () {
177
222
  return __awaiter(this, void 0, void 0, function () {
178
223
  var e_1;
@@ -195,7 +240,7 @@ var WebAuth = /** @class */ (function () {
195
240
  };
196
241
  ;
197
242
  /**
198
- * logout
243
+ * logout by using oidc-client-ts library
199
244
  * @returns
200
245
  */
201
246
  WebAuth.prototype.logout = function () {
@@ -204,21 +249,10 @@ var WebAuth = /** @class */ (function () {
204
249
  if (!window.webAuthSettings && !window.authentication) {
205
250
  throw new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
206
251
  }
207
- if (window.webAuthSettings.mode == 'redirect') {
208
- window.authentication.redirectSignOut().then(function (result) {
209
- resolve(result);
210
- return;
211
- });
212
- }
213
- else if (window.webAuthSettings.mode == 'window') {
214
- window.authentication.popupSignOut();
215
- }
216
- else if (window.webAuthSettings.mode == 'silent') {
217
- window.authentication.redirectSignOut();
218
- }
219
- else {
220
- resolve(undefined);
221
- }
252
+ window.authentication.logout().then(function (result) {
253
+ resolve(result);
254
+ return;
255
+ });
222
256
  }
223
257
  catch (ex) {
224
258
  reject(ex);
@@ -227,26 +261,16 @@ var WebAuth = /** @class */ (function () {
227
261
  };
228
262
  ;
229
263
  /**
230
- * logout callback
264
+ * popup signout
231
265
  * @returns
232
266
  */
233
- WebAuth.prototype.logoutCallback = function () {
267
+ WebAuth.prototype.popupSignOut = function () {
234
268
  return new Promise(function (resolve, reject) {
235
269
  try {
236
270
  if (!window.webAuthSettings && !window.authentication) {
237
271
  throw new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
238
272
  }
239
- if (window.webAuthSettings.mode == 'redirect') {
240
- window.authentication.redirectSignOutCallback().then(function (resp) {
241
- resolve(resp);
242
- });
243
- }
244
- else if (window.webAuthSettings.mode == 'window') {
245
- window.authentication.popupSignOutCallback();
246
- }
247
- else if (window.webAuthSettings.mode == 'silent') {
248
- window.authentication.redirectSignOutCallback();
249
- }
273
+ window.authentication.popupSignOut();
250
274
  }
251
275
  catch (ex) {
252
276
  reject(ex);
@@ -255,79 +279,36 @@ var WebAuth = /** @class */ (function () {
255
279
  };
256
280
  ;
257
281
  /**
258
- * get login url
282
+ * logout callback
259
283
  * @returns
260
284
  */
261
- WebAuth.prototype.getLoginURL = function () {
262
- var _this = this;
263
- var loginUrl;
264
- var finish = false;
265
- (function () { return __awaiter(_this, void 0, void 0, function () {
266
- var e_2;
267
- return __generator(this, function (_a) {
268
- switch (_a.label) {
269
- case 0:
270
- _a.trys.push([0, 2, , 3]);
271
- return [4 /*yield*/, window.usermanager._client.getSignInRedirectUrl()];
272
- case 1:
273
- loginUrl = _a.sent();
274
- return [3 /*break*/, 3];
275
- case 2:
276
- e_2 = _a.sent();
277
- //TODO: define Error handling
278
- console.log(e_2);
279
- return [3 /*break*/, 3];
280
- case 3:
281
- finish = true;
282
- return [2 /*return*/];
285
+ WebAuth.prototype.logoutCallback = function () {
286
+ return new Promise(function (resolve, reject) {
287
+ try {
288
+ if (!window.webAuthSettings && !window.authentication) {
289
+ throw new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
283
290
  }
284
- });
285
- }); })();
286
- while (!finish) { } // A simple synchronous loop to wait async call is finish
287
- return loginUrl;
291
+ window.authentication.logoutCallback().then(function (resp) {
292
+ resolve(resp);
293
+ });
294
+ }
295
+ catch (ex) {
296
+ reject(ex);
297
+ }
298
+ });
288
299
  };
289
300
  ;
290
301
  /**
291
- * get request id
302
+ * popup signout callback
292
303
  * @returns
293
304
  */
294
- WebAuth.prototype.getRequestId = function () {
305
+ WebAuth.prototype.popupSignOutCallback = function () {
295
306
  return new Promise(function (resolve, reject) {
296
307
  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);
308
+ if (!window.webAuthSettings && !window.authentication) {
309
+ throw new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
329
310
  }
330
- http.send(JSON.stringify(bodyParams));
311
+ window.authentication.popupSignOutCallback();
331
312
  }
332
313
  catch (ex) {
333
314
  reject(ex);
@@ -336,27 +317,74 @@ var WebAuth = /** @class */ (function () {
336
317
  };
337
318
  ;
338
319
  /**
339
- * get missing fields
340
- * @param options
341
- * @returns
320
+ * To get the generated login url, call **getLoginURL()**. This will call authz service and generate login url to be used.
321
+ * @example
322
+ * ```js
323
+ * cidaas.getLoginURL().then(function (response) {
324
+ * // the response will give you login url.
325
+ * }).catch(function(ex) {
326
+ * // your failure code here
327
+ * });;
328
+ * ```
342
329
  */
343
- WebAuth.prototype.getMissingFields = function (options) {
344
- var _serviceURL = window.webAuthSettings.authority + "/public-srv/public/trackinfo/" + options.requestId + "/" + options.trackId;
345
- return Helper_1.Helper.createPostPromise(undefined, _serviceURL, false, "GET");
330
+ WebAuth.prototype.getLoginURL = function (state) {
331
+ return new Promise(function (resolve, reject) {
332
+ try {
333
+ window.usermanager._client.createSigninRequest({ state: state }).then(function (signinRequest) {
334
+ resolve(signinRequest.url);
335
+ return;
336
+ });
337
+ }
338
+ catch (e) {
339
+ reject(e);
340
+ }
341
+ });
346
342
  };
347
343
  ;
348
344
  /**
349
- * get Tenant info
350
- * @returns
345
+ * Each and every proccesses starts with requestId, it is an entry point to login or register. For getting the requestId, call **getRequestId()**.
346
+ * @example
347
+ * ```js
348
+ * cidaas.getRequestId().then(function (response) {
349
+ * // the response will give you request id.
350
+ * }).catch(function(ex) {
351
+ * // your failure code here
352
+ * });;
353
+ * ```
354
+ */
355
+ WebAuth.prototype.getRequestId = function () {
356
+ var _a, _b;
357
+ var ui_locales = window.webAuthSettings.ui_locales;
358
+ var options = __assign({ 'client_id': window.webAuthSettings.client_id, 'redirect_uri': window.webAuthSettings.redirect_uri, 'response_type': (_a = window.webAuthSettings.response_type) !== null && _a !== void 0 ? _a : 'token', "response_mode": (_b = window.webAuthSettings.response_mode) !== null && _b !== void 0 ? _b : 'fragment', "scope": window.webAuthSettings.scope, "nonce": new Date().getTime().toString() }, (ui_locales && { ui_locales: ui_locales } || {}));
359
+ var serviceURL = window.webAuthSettings.authority + '/authz-srv/authrequest/authz/generate';
360
+ return Helper_1.Helper.createHttpPromise(options, serviceURL, false, "POST");
361
+ };
362
+ ;
363
+ /**
364
+ * To get the tenant basic information, call **getTenantInfo()**. This will return the basic tenant details such as tenant name and allowed login with types (Email, Mobile, Username).
365
+ * @example
366
+ * ```js
367
+ * cidaas.getTenantInfo().then(function (response) {
368
+ * // the response will give you tenant details
369
+ * }).catch(function(ex) {
370
+ * // your failure code here
371
+ * });;
372
+ * ```
351
373
  */
352
374
  WebAuth.prototype.getTenantInfo = function () {
353
375
  var _serviceURL = window.webAuthSettings.authority + "/public-srv/tenantinfo/basic";
354
- return Helper_1.Helper.createPostPromise(undefined, _serviceURL, false, "GET");
376
+ return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
355
377
  };
356
378
  ;
357
379
  /**
358
- * logout api call
359
- * @param options
380
+ * To logout the user by using cidaas internal api, call **logoutUser()**.
381
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/3b5ce6a54bf29-logout for more details.
382
+ * @example
383
+ * ```js
384
+ * cidaas.logoutUser({
385
+ * access_token : 'your accessToken'
386
+ * });
387
+ * ```
360
388
  */
361
389
  WebAuth.prototype.logoutUser = function (options) {
362
390
  try {
@@ -368,157 +396,120 @@ var WebAuth = /** @class */ (function () {
368
396
  };
369
397
  ;
370
398
  /**
371
- * get Client Info
372
- * @param options
373
- * @returns
399
+ * To get the client basic information, call **getClientInfo()**. This will return the basic client details such as client name and its details.
400
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/dc8a6cfb28abb-public-page-information for more details.
401
+ * @example
402
+ * ```js
403
+ * cidaas.getClientInfo({
404
+ * requestId: 'your requestId',
405
+ * }).then(function (resp) {
406
+ * // the response will give you client info.
407
+ * }).catch(function(ex) {
408
+ * // your failure code here
409
+ * });
410
+ * ```
374
411
  */
375
412
  WebAuth.prototype.getClientInfo = function (options) {
376
413
  var _serviceURL = window.webAuthSettings.authority + "/public-srv/public/" + options.requestId;
377
- return Helper_1.Helper.createPostPromise(undefined, _serviceURL, false, "GET");
414
+ return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
378
415
  };
379
416
  ;
380
417
  /**
381
- * get all devices associated to the client
382
- * @param options
383
- * @returns
418
+ * To get all devices information associated to the client, call **getDevicesInfo()**
419
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/2a2feed70303c-get-device-by-user for more details.
420
+ * @example
421
+ * ```js
422
+ * const options = {};
423
+ * const accessToken = 'your access token';
424
+ * cidaas.getDevicesInfo(options, accessToken).then(function (resp) {
425
+ * // the response will give you devices informations.
426
+ * }).catch(function(ex) {
427
+ * // your failure code here
428
+ * });
429
+ * ```
384
430
  */
385
- WebAuth.prototype.getDevicesInfo = function (options) {
431
+ WebAuth.prototype.getDevicesInfo = function (options, accessToken) {
386
432
  options.userAgent = window.navigator.userAgent;
387
433
  var _serviceURL = window.webAuthSettings.authority + "/device-srv/devices";
388
434
  if (window.navigator.userAgent) {
389
- return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "GET");
435
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "GET", accessToken);
390
436
  }
391
- return Helper_1.Helper.createPostPromise(undefined, _serviceURL, false, "GET");
392
- };
393
- ;
394
- /**
395
- * delete a device
396
- * @param options
397
- * @returns
398
- */
399
- WebAuth.prototype.deleteDevice = function (options) {
437
+ return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET", accessToken);
438
+ };
439
+ ;
440
+ /**
441
+ * To delete device associated to the client, call **deleteDevice()**
442
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/3d44ad903d6e8-logout-the-user-for-a-device for more details.
443
+ * @example
444
+ * ```js
445
+ * const options = {
446
+ * device_id: 'id of device associated to the client.' // call **getDevicesInfo()** to get List of device ids and its details.
447
+ * };
448
+ * const accessToken = 'your access token';
449
+ * cidaas.deleteDevice(options, accessToken).then(function (resp) {
450
+ * // your success code
451
+ * }).catch(function(ex) {
452
+ * // your failure code
453
+ * });
454
+ * ```
455
+ */
456
+ WebAuth.prototype.deleteDevice = function (options, accessToken) {
400
457
  var _serviceURL = window.webAuthSettings.authority + "/device-srv/device/" + options.device_id;
401
458
  options.userAgent = window.navigator.userAgent;
402
459
  if (window.navigator.userAgent) {
403
- return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "DELETE");
460
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "DELETE", accessToken);
404
461
  }
405
- return Helper_1.Helper.createPostPromise(undefined, _serviceURL, false, "DELETE");
462
+ return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "DELETE", accessToken);
406
463
  };
407
464
  ;
408
465
  /**
409
- * get Registration setup
410
- * @param options
411
- * @returns
466
+ * To handle registration, first you need the registration fields. To get the registration fields, call **getRegistrationSetup()**. This will return the fields that has to be needed while registration.
467
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/4eae72956f65a-registration-field-setup for more details.
468
+ * @example
469
+ * ```js
470
+ * cidaas.getRegistrationSetup({
471
+ * requestId: 'your requestId',
472
+ * acceptlanguage: 'your locale' // optional example: de-de, en-US
473
+ * }).then(function (resp) {
474
+ * // the response will give you fields that are required.
475
+ * }).catch(function(ex) {
476
+ * // your failure code here
477
+ * });
478
+ * ```
412
479
  */
413
480
  WebAuth.prototype.getRegistrationSetup = function (options) {
414
- return new Promise(function (resolve, reject) {
415
- try {
416
- var http = new XMLHttpRequest();
417
- var _serviceURL = window.webAuthSettings.authority + "/registration-setup-srv/public/list?acceptlanguage=" + options.acceptlanguage + "&requestId=" + options.requestId;
418
- http.onreadystatechange = function () {
419
- if (http.readyState == 4) {
420
- if (http.responseText) {
421
- var parsedResponse = JSON.parse(http.responseText);
422
- if (parsedResponse && parsedResponse.data && parsedResponse.data.length > 0) {
423
- var registrationFields = parsedResponse.data;
424
- }
425
- resolve(parsedResponse);
426
- }
427
- else {
428
- resolve(false);
429
- }
430
- }
431
- };
432
- http.open("GET", _serviceURL, true);
433
- http.setRequestHeader("Content-type", "application/json");
434
- if (window.localeSettings) {
435
- http.setRequestHeader("accept-language", window.localeSettings);
436
- }
437
- http.send();
438
- }
439
- catch (ex) {
440
- reject(ex);
441
- }
442
- });
443
- };
444
- ;
445
- /**
446
- * get unreviewed devices
447
- * @param access_token
448
- * @param sub
449
- * @returns
450
- */
451
- WebAuth.prototype.getUnreviewedDevices = function (access_token, sub) {
452
- var _serviceURL = window.webAuthSettings.authority + "/reports-srv/device/unreviewlist/" + sub;
453
- return Helper_1.Helper.createPostPromise(undefined, _serviceURL, false, "GET", access_token);
454
- };
455
- ;
456
- /**
457
- * get reviewed devices
458
- * @param access_token
459
- * @param sub
460
- * @returns
461
- */
462
- WebAuth.prototype.getReviewedDevices = function (access_token, sub) {
463
- var _serviceURL = window.webAuthSettings.authority + "/reports-srv/device/reviewlist/" + sub;
464
- return Helper_1.Helper.createPostPromise(undefined, _serviceURL, false, "GET", access_token);
481
+ var serviceURL = window.webAuthSettings.authority + '/registration-setup-srv/public/list?acceptlanguage=' + options.acceptlanguage + '&requestId=' + options.requestId;
482
+ return Helper_1.Helper.createHttpPromise(undefined, serviceURL, false, 'GET');
483
+ };
484
+ ;
485
+ /**
486
+ * to generate device info, call **createDeviceInfo()**.
487
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/9b5a892afaf0b-create-device-info for more details.
488
+ * @example
489
+ * ```js
490
+ * cidaas.createDeviceInfo().then(function (resp) {
491
+ * // your success code
492
+ * }).catch(function(ex) {
493
+ * // your failure code
494
+ * });
495
+ * ```
496
+ */
497
+ WebAuth.prototype.createDeviceInfo = function () {
498
+ var value = ('; ' + document.cookie).split("; cidaas_dr=").pop().split(';')[0];
499
+ if (!value) {
500
+ var options = {
501
+ userAgent: window.navigator.userAgent
502
+ };
503
+ var serviceURL = window.webAuthSettings.authority + '/device-srv/deviceinfo';
504
+ return Helper_1.Helper.createHttpPromise(options, serviceURL, false, 'POST');
505
+ }
465
506
  };
466
507
  ;
467
508
  /**
468
- * review device
509
+ * get the user profile information
469
510
  * @param options
470
- * @param access_token
471
511
  * @returns
472
512
  */
473
- WebAuth.prototype.reviewDevice = function (options, access_token) {
474
- var _serviceURL = window.webAuthSettings.authority + "/reports-srv/device/updatereview";
475
- return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "PUT", access_token);
476
- };
477
- ;
478
- /**
479
- * get device info
480
- * @returns
481
- */
482
- WebAuth.prototype.getDeviceInfo = function () {
483
- var _this = this;
484
- return new Promise(function (resolve, reject) {
485
- try {
486
- var value = ('; ' + document.cookie).split("; cidaas_dr=").pop().split(';')[0];
487
- var options = { userAgent: "" };
488
- if (!value) {
489
- (function () { return __awaiter(_this, void 0, void 0, function () {
490
- var http, _serviceURL;
491
- return __generator(this, function (_a) {
492
- options.userAgent = window.navigator.userAgent;
493
- http = new XMLHttpRequest();
494
- _serviceURL = window.webAuthSettings.authority + "/device-srv/deviceinfo";
495
- http.onreadystatechange = function () {
496
- if (http.readyState == 4) {
497
- resolve(JSON.parse(http.responseText));
498
- }
499
- };
500
- http.open("POST", _serviceURL, true);
501
- http.setRequestHeader("Content-type", "application/json");
502
- if (window.localeSettings) {
503
- http.setRequestHeader("accept-language", window.localeSettings);
504
- }
505
- http.send(JSON.stringify(options));
506
- return [2 /*return*/];
507
- });
508
- }); })();
509
- }
510
- }
511
- catch (ex) {
512
- reject(ex);
513
- }
514
- });
515
- };
516
- ;
517
- /**
518
- * get user info
519
- * @param options
520
- * @returns
521
- */
522
513
  WebAuth.prototype.getUserProfile = function (options) {
523
514
  return UserService_1.UserService.getUserProfile(options);
524
515
  };
@@ -558,24 +549,6 @@ var WebAuth = /** @class */ (function () {
558
549
  LoginService_1.LoginService.loginWithCredentials(options);
559
550
  };
560
551
  ;
561
- /**
562
- * login with username and password and return response
563
- * @param options
564
- * @returns
565
- */
566
- WebAuth.prototype.loginWithCredentialsAsynFn = function (options) {
567
- return __awaiter(this, void 0, void 0, function () {
568
- return __generator(this, function (_a) {
569
- switch (_a.label) {
570
- case 0: return [4 /*yield*/, LoginService_1.LoginService.loginWithCredentialsAsynFn(options)];
571
- case 1:
572
- _a.sent();
573
- return [2 /*return*/];
574
- }
575
- });
576
- });
577
- };
578
- ;
579
552
  /**
580
553
  * login with social
581
554
  * @param options
@@ -618,8 +591,8 @@ var WebAuth = /** @class */ (function () {
618
591
  * @param options
619
592
  * @returns
620
593
  */
621
- WebAuth.prototype.getCommunicationStatus = function (options) {
622
- return UserService_1.UserService.getCommunicationStatus(options);
594
+ WebAuth.prototype.getCommunicationStatus = function (options, headers) {
595
+ return UserService_1.UserService.getCommunicationStatus(options, headers);
623
596
  };
624
597
  ;
625
598
  /**
@@ -631,22 +604,6 @@ var WebAuth = /** @class */ (function () {
631
604
  VerificationService_1.VerificationService.initiateAccountVerification(options);
632
605
  };
633
606
  ;
634
- /**
635
- * initiate verification and return response
636
- * @param options
637
- * @returns
638
- */
639
- WebAuth.prototype.initiateAccountVerificationAsynFn = function (options) {
640
- return __awaiter(this, void 0, void 0, function () {
641
- return __generator(this, function (_a) {
642
- switch (_a.label) {
643
- case 0: return [4 /*yield*/, VerificationService_1.VerificationService.initiateAccountVerificationAsynFn(options)];
644
- case 1: return [2 /*return*/, _a.sent()];
645
- }
646
- });
647
- });
648
- };
649
- ;
650
607
  /**
651
608
  * verify account
652
609
  * @param options
@@ -682,21 +639,21 @@ var WebAuth = /** @class */ (function () {
682
639
  };
683
640
  ;
684
641
  /**
685
- * get mfa list v2
642
+ * get mfa list
686
643
  * @param options
687
644
  * @returns
688
645
  */
689
- WebAuth.prototype.getMFAListV2 = function (options) {
690
- return VerificationService_1.VerificationService.getMFAListV2(options);
646
+ WebAuth.prototype.getMFAList = function (options) {
647
+ return VerificationService_1.VerificationService.getMFAList(options);
691
648
  };
692
649
  ;
693
650
  /**
694
- * cancel mfa v2
651
+ * cancel mfa
695
652
  * @param options
696
653
  * @returns
697
654
  */
698
- WebAuth.prototype.cancelMFAV2 = function (options) {
699
- return VerificationService_1.VerificationService.cancelMFAV2(options);
655
+ WebAuth.prototype.cancelMFA = function (options) {
656
+ return VerificationService_1.VerificationService.cancelMFA(options);
700
657
  };
701
658
  ;
702
659
  /**
@@ -712,17 +669,17 @@ var WebAuth = /** @class */ (function () {
712
669
  * @param options
713
670
  * @returns
714
671
  */
715
- WebAuth.prototype.getConsentDetailsV2 = function (options) {
716
- return ConsentService_1.ConsentService.getConsentDetailsV2(options);
672
+ WebAuth.prototype.getConsentDetails = function (options) {
673
+ return ConsentService_1.ConsentService.getConsentDetails(options);
717
674
  };
718
675
  ;
719
676
  /**
720
- * accept consent v2
677
+ * accept consent
721
678
  * @param options
722
679
  * @returns
723
680
  */
724
- WebAuth.prototype.acceptConsentV2 = function (options) {
725
- return ConsentService_1.ConsentService.acceptConsentV2(options);
681
+ WebAuth.prototype.acceptConsent = function (options) {
682
+ return ConsentService_1.ConsentService.acceptConsent(options);
726
683
  };
727
684
  ;
728
685
  /**
@@ -730,8 +687,8 @@ var WebAuth = /** @class */ (function () {
730
687
  * @param options
731
688
  * @returns
732
689
  */
733
- WebAuth.prototype.getScopeConsentDetails = function (options) {
734
- return TokenService_1.TokenService.getScopeConsentDetails(options);
690
+ WebAuth.prototype.loginPrecheck = function (options) {
691
+ return TokenService_1.TokenService.loginPrecheck(options);
735
692
  };
736
693
  ;
737
694
  /**
@@ -739,8 +696,8 @@ var WebAuth = /** @class */ (function () {
739
696
  * @param options
740
697
  * @returns
741
698
  */
742
- WebAuth.prototype.getScopeConsentVersionDetailsV2 = function (options) {
743
- return ConsentService_1.ConsentService.getScopeConsentVersionDetailsV2(options);
699
+ WebAuth.prototype.getConsentVersionDetails = function (options) {
700
+ return ConsentService_1.ConsentService.getConsentVersionDetails(options);
744
701
  };
745
702
  ;
746
703
  /**
@@ -752,14 +709,6 @@ var WebAuth = /** @class */ (function () {
752
709
  return ConsentService_1.ConsentService.acceptScopeConsent(options);
753
710
  };
754
711
  ;
755
- /**
756
- * scope consent continue login
757
- * @param options
758
- */
759
- WebAuth.prototype.scopeConsentContinue = function (options) {
760
- LoginService_1.LoginService.scopeConsentContinue(options);
761
- };
762
- ;
763
712
  /**
764
713
  * accept claim Consent
765
714
  * @param options
@@ -769,14 +718,6 @@ var WebAuth = /** @class */ (function () {
769
718
  return ConsentService_1.ConsentService.acceptClaimConsent(options);
770
719
  };
771
720
  ;
772
- /**
773
- * claim consent continue login
774
- * @param options
775
- */
776
- WebAuth.prototype.claimConsentContinue = function (options) {
777
- LoginService_1.LoginService.claimConsentContinue(options);
778
- };
779
- ;
780
721
  /**
781
722
  * revoke claim Consent
782
723
  * @param options
@@ -859,16 +800,29 @@ var WebAuth = /** @class */ (function () {
859
800
  };
860
801
  ;
861
802
  /**
862
- * get user activities
863
- * @param options
864
- * @param access_token
865
- * @returns
803
+ * To get user activities, call **getUserActivities()**.
804
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/346141453781e-get-user-activities for more details.
805
+ * @example
806
+ * ```js
807
+ * const options = {
808
+ * sub: 'your sub',
809
+ * dateFilter: {
810
+ * from_date: 'date in UTC format',
811
+ * to:date: 'date in UTC format'
812
+ * }
813
+ * };
814
+ * const accessToken = 'your access token';
815
+ * cidaas.getUserActivities(options, accessToken).then(function (resp) {
816
+ * // your success code
817
+ * }).catch(function(ex) {
818
+ * // your failure code
819
+ * });
820
+ * ```
866
821
  */
867
- WebAuth.prototype.getUserActivities = function (options, access_token) {
868
- var _serviceURL = window.webAuthSettings.authority + "/useractivity-srv/latestactivity";
869
- return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST", access_token);
822
+ WebAuth.prototype.getUserActivities = function (options, accessToken) {
823
+ var serviceURL = window.webAuthSettings.authority + '/activity-streams-srv/user-activities';
824
+ return Helper_1.Helper.createHttpPromise(options, serviceURL, false, 'POST', accessToken);
870
825
  };
871
- ;
872
826
  /**
873
827
  * @param access_token
874
828
  * @returns
@@ -918,24 +872,40 @@ var WebAuth = /** @class */ (function () {
918
872
  };
919
873
  ;
920
874
  /**
921
- * image upload
922
- * @param options
923
- * @param access_token
924
- * @returns
925
- */
875
+ * To change profile image, call **updateProfileImage()**.
876
+ * @example
877
+ * ```js
878
+ * const options = {
879
+ * image_key: 'id for your image e.g. user sub',
880
+ * photo: yourImageFile,
881
+ * filename: 'name of your image file'
882
+ * };
883
+ * const accessToken = 'your access token';
884
+ * cidaas.updateProfileImage(options, accessToken).then(function (resp) {
885
+ * // your success code
886
+ * }).catch(function(ex) {
887
+ * // your failure code
888
+ * });
889
+ * ```
890
+ */
926
891
  WebAuth.prototype.updateProfileImage = function (options, access_token) {
927
- var _serviceURL = window.webAuthSettings.authority + "/image-srv/profile/upload";
928
- return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST", access_token);
929
- };
930
- ;
931
- /**
932
- * updateSuggestMFA
933
- * @param track_id
934
- * @param options
935
- * @returns
936
- */
937
- WebAuth.prototype.updateSuggestMFA = function (track_id, options) {
938
- return TokenService_1.TokenService.updateSuggestMFA(track_id, options);
892
+ var serviceURL = window.webAuthSettings.authority + "/image-srv/profile/upload";
893
+ var form = document.createElement('form');
894
+ form.action = serviceURL;
895
+ form.method = 'POST';
896
+ var image_key = document.createElement('input');
897
+ image_key.setAttribute('type', 'hidden');
898
+ image_key.setAttribute('name', 'image_key');
899
+ form.appendChild(image_key);
900
+ var photo = document.createElement('input');
901
+ photo.setAttribute('type', 'file');
902
+ photo.setAttribute('hidden', 'true');
903
+ photo.setAttribute("name", "photo");
904
+ form.appendChild(photo);
905
+ var formdata = new FormData(form);
906
+ formdata.set('image_key', options.image_key);
907
+ formdata.set('photo', options.photo, options.filename);
908
+ return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'POST', access_token, null, formdata);
939
909
  };
940
910
  ;
941
911
  /**
@@ -943,17 +913,8 @@ var WebAuth = /** @class */ (function () {
943
913
  * @param options
944
914
  * @returns
945
915
  */
946
- WebAuth.prototype.enrollVerification = function (options) {
947
- return VerificationService_1.VerificationService.enrollVerification(options);
948
- };
949
- ;
950
- /**
951
- * @deprecated This function is no longer supported, instead use {this.updateStatus()}
952
- * @param status_id
953
- * @returns
954
- */
955
- WebAuth.prototype.updateSocket = function (status_id) {
956
- return VerificationService_1.VerificationService.updateStatus(status_id);
916
+ WebAuth.prototype.initiateEnrollment = function (options, accessToken) {
917
+ return VerificationService_1.VerificationService.initiateEnrollment(options, accessToken);
957
918
  };
958
919
  ;
959
920
  /**
@@ -961,17 +922,17 @@ var WebAuth = /** @class */ (function () {
961
922
  * @param status_id
962
923
  * @returns
963
924
  */
964
- WebAuth.prototype.updateStatus = function (status_id) {
965
- return VerificationService_1.VerificationService.updateStatus(status_id);
925
+ WebAuth.prototype.getEnrollmentStatus = function (status_id, accessToken) {
926
+ return VerificationService_1.VerificationService.getEnrollmentStatus(status_id, accessToken);
966
927
  };
967
928
  ;
968
929
  /**
969
- * setupFidoVerification
930
+ * enrollVerification
970
931
  * @param options
971
932
  * @returns
972
933
  */
973
- WebAuth.prototype.setupFidoVerification = function (options) {
974
- return VerificationService_1.VerificationService.setupFidoVerification(options);
934
+ WebAuth.prototype.enrollVerification = function (options) {
935
+ return VerificationService_1.VerificationService.enrollVerification(options);
975
936
  };
976
937
  ;
977
938
  /**
@@ -993,12 +954,12 @@ var WebAuth = /** @class */ (function () {
993
954
  };
994
955
  ;
995
956
  /**
996
- * getMissingFieldsLogin
957
+ * getMissingFields
997
958
  * @param trackId
998
959
  * @returns
999
960
  */
1000
- WebAuth.prototype.getMissingFieldsLogin = function (trackId) {
1001
- return TokenService_1.TokenService.getMissingFieldsLogin(trackId);
961
+ WebAuth.prototype.getMissingFields = function (trackId) {
962
+ return TokenService_1.TokenService.getMissingFields(trackId);
1002
963
  };
1003
964
  ;
1004
965
  /**
@@ -1012,13 +973,11 @@ var WebAuth = /** @class */ (function () {
1012
973
  };
1013
974
  ;
1014
975
  /**
1015
- * loginAfterRegister
1016
- * @param options
976
+ * device code flow - initiate
1017
977
  */
1018
- WebAuth.prototype.loginAfterRegister = function (options) {
1019
- LoginService_1.LoginService.loginAfterRegister(options);
978
+ WebAuth.prototype.initiateDeviceCode = function (clientId) {
979
+ return TokenService_1.TokenService.initiateDeviceCode(clientId);
1020
980
  };
1021
- ;
1022
981
  /**
1023
982
  * device code flow - verify
1024
983
  * @param code
@@ -1043,526 +1002,28 @@ var WebAuth = /** @class */ (function () {
1043
1002
  window.localeSettings = acceptLanguage;
1044
1003
  };
1045
1004
  /**
1046
- * initiate mfa v2
1005
+ * initiate mfa
1047
1006
  * @param options
1048
1007
  * @returns
1049
1008
  */
1050
- WebAuth.prototype.initiateMFAV2 = function (options) {
1051
- return VerificationService_1.VerificationService.initiateMFAV2(options);
1052
- };
1053
- ;
1054
- /**
1055
- * initiateVerification
1056
- * @param options
1057
- */
1058
- WebAuth.prototype.initiateVerification = function (options) {
1059
- options.type = options.verification_type;
1060
- this.initiateMFAV2(options);
1061
- };
1062
- ;
1063
- /**
1064
- * initiate email v2
1065
- * @param options
1066
- */
1067
- WebAuth.prototype.initiateEmailV2 = function (options) {
1068
- options.type = "email";
1069
- this.initiateMFAV2(options);
1070
- };
1071
- ;
1072
- /**
1073
- * initiate sms v2
1074
- * @param options
1075
- */
1076
- WebAuth.prototype.initiateSMSV2 = function (options) {
1077
- options.type = "sms";
1078
- this.initiateMFAV2(options);
1009
+ WebAuth.prototype.initiateMFA = function (options, accessToken) {
1010
+ return VerificationService_1.VerificationService.initiateMFA(options, accessToken);
1079
1011
  };
1080
1012
  ;
1081
1013
  /**
1082
- * initiate ivr v2
1014
+ * authenticate mfa
1083
1015
  * @param options
1084
- */
1085
- WebAuth.prototype.initiateIVRV2 = function (options) {
1086
- options.type = "ivr";
1087
- this.initiateMFAV2(options);
1088
- };
1089
- ;
1090
- /**
1091
- * initiate backupcode v2
1092
- * @param options
1093
- */
1094
- WebAuth.prototype.initiateBackupcodeV2 = function (options) {
1095
- options.type = "backupcode";
1096
- this.initiateMFAV2(options);
1097
- };
1098
- ;
1099
- /**
1100
- * initiate totp v2
1101
- * @param options
1102
- */
1103
- WebAuth.prototype.initiateTOTPV2 = function (options) {
1104
- options.type = "totp";
1105
- this.initiateMFAV2(options);
1106
- };
1107
- ;
1108
- /**
1109
- * initiate pattern v2
1110
- * @param options
1111
- */
1112
- WebAuth.prototype.initiatePatternV2 = function (options) {
1113
- options.type = "pattern";
1114
- this.initiateMFAV2(options);
1115
- };
1116
- ;
1117
- /**
1118
- * initiate touchid v2
1119
- * @param options
1120
- */
1121
- WebAuth.prototype.initiateTouchIdV2 = function (options) {
1122
- options.type = "touchid";
1123
- this.initiateMFAV2(options);
1124
- };
1125
- ;
1126
- /**
1127
- * initiate smart push v2
1128
- * @param options
1129
- */
1130
- WebAuth.prototype.initiateSmartPushV2 = function (options) {
1131
- options.type = "push";
1132
- this.initiateMFAV2(options);
1133
- };
1134
- ;
1135
- /**
1136
- * initiate face v2
1137
- * @param options
1138
- */
1139
- WebAuth.prototype.initiateFaceV2 = function (options) {
1140
- options.type = "face";
1141
- this.initiateMFAV2(options);
1142
- };
1143
- ;
1144
- /**
1145
- * initiate voice v2
1146
- * @param options
1147
- */
1148
- WebAuth.prototype.initiateVoiceV2 = function (options) {
1149
- options.type = "voice";
1150
- this.initiateMFAV2(options);
1151
- };
1152
- ;
1153
- /**
1154
- * @deprecated
1155
- * @param options
1156
- * @param verificationType
1157
1016
  * @returns
1158
1017
  */
1159
- WebAuth.prototype.initiateMfaV1 = function (options, verificationType) {
1160
- return VerificationService_1.VerificationService.initiateMfaV1(options, verificationType);
1161
- };
1162
- /**
1163
- * @deprecated
1164
- * initiate email - v1
1165
- * @param options
1166
- */
1167
- WebAuth.prototype.initiateEmail = function (options) {
1168
- var verificationType = "EMAIL";
1169
- this.initiateMfaV1(options, verificationType);
1170
- };
1171
- ;
1172
- /**
1173
- * @deprecated
1174
- * initiate SMS - v1
1175
- * @param options
1176
- */
1177
- WebAuth.prototype.initiateSMS = function (options) {
1178
- var verificationType = "SMS";
1179
- this.initiateMfaV1(options, verificationType);
1180
- };
1181
- ;
1182
- /**
1183
- * @deprecated
1184
- * initiate IVR - v1
1185
- * @param options
1186
- */
1187
- WebAuth.prototype.initiateIVR = function (options) {
1188
- var verificationType = "IVR";
1189
- this.initiateMfaV1(options, verificationType);
1190
- };
1191
- ;
1192
- /**
1193
- * @deprecated
1194
- * initiate backup code - v1
1195
- * @param options
1196
- */
1197
- WebAuth.prototype.initiateBackupcode = function (options) {
1198
- var verificationType = "BACKUPCODE";
1199
- this.initiateMfaV1(options, verificationType);
1018
+ WebAuth.prototype.authenticateMFA = function (options) {
1019
+ return VerificationService_1.VerificationService.authenticateMFA(options);
1200
1020
  };
1201
1021
  ;
1202
1022
  /**
1203
- * @deprecated
1204
- * initiate TOTP - v1
1205
- * @param options
1206
- */
1207
- WebAuth.prototype.initiateTOTP = function (options) {
1208
- var verificationType = "TOTP";
1209
- this.initiateMfaV1(options, verificationType);
1210
- };
1211
- ;
1212
- /**
1213
- * @deprecated
1214
- * initiate pattern - v1
1215
- * @param options
1216
- */
1217
- WebAuth.prototype.initiatePattern = function (options) {
1218
- var verificationType = "PATTERN";
1219
- this.initiateMfaV1(options, verificationType);
1220
- };
1221
- ;
1222
- /**
1223
- * @deprecated
1224
- * initiate touchid - v1
1225
- * @param options
1226
- */
1227
- WebAuth.prototype.initiateTouchId = function (options) {
1228
- var verificationType = "TOUCHID";
1229
- this.initiateMfaV1(options, verificationType);
1230
- };
1231
- ;
1232
- /**
1233
- * @deprecated
1234
- * initiate push - v1
1235
- * @param options
1236
- */ WebAuth.prototype.initiateSmartPush = function (options) {
1237
- var verificationType = "PUSH";
1238
- this.initiateMfaV1(options, verificationType);
1239
- };
1240
- ;
1241
- /**
1242
- * @deprecated
1243
- * initiate face - v1
1244
- * @param options
1245
- */
1246
- WebAuth.prototype.initiateFace = function (options) {
1247
- var verificationType = "FACE";
1248
- this.initiateMfaV1(options, verificationType);
1249
- };
1250
- ;
1251
- /**
1252
- * @deprecated
1253
- * initiate Voice - v1
1254
- * @param options
1255
- */
1256
- WebAuth.prototype.initiateVoice = function (options) {
1257
- var verificationType = "VOICE";
1258
- this.initiateMfaV1(options, verificationType);
1259
- };
1260
- ;
1261
- /**
1262
- * authenticate mfa v2
1263
- * @param options
1264
- * @returns
1265
- */
1266
- WebAuth.prototype.authenticateMFAV2 = function (options) {
1267
- return VerificationService_1.VerificationService.authenticateMFAV2(options);
1268
- };
1269
- ;
1270
- /**
1271
- * authenticateVerification
1272
- * @param options
1273
- */
1274
- WebAuth.prototype.authenticateVerification = function (options) {
1275
- options.type = options.verification_type;
1276
- this.authenticateMFAV2(options);
1277
- };
1278
- ;
1279
- /**
1280
- * authenticate email v2
1281
- * @param options
1282
- */
1283
- WebAuth.prototype.authenticateEmailV2 = function (options) {
1284
- options.type = "email";
1285
- this.authenticateMFAV2(options);
1286
- };
1287
- ;
1288
- /**
1289
- * authenticate sms v2
1290
- * @param options
1291
- */
1292
- WebAuth.prototype.authenticateSMSV2 = function (options) {
1293
- options.type = "sms";
1294
- this.authenticateMFAV2(options);
1295
- };
1296
- ;
1297
- /**
1298
- * authenticate ivr v2
1299
- * @param options
1300
- */
1301
- WebAuth.prototype.authenticateIVRV2 = function (options) {
1302
- options.type = "ivr";
1303
- this.authenticateMFAV2(options);
1304
- };
1305
- ;
1306
- /**
1307
- * authenticate backupcode v2
1308
- * @param options
1309
- */
1310
- WebAuth.prototype.authenticateBackupcodeV2 = function (options) {
1311
- options.type = "backupcode";
1312
- this.authenticateMFAV2(options);
1313
- };
1314
- ;
1315
- /**
1316
- * authenticate totp v2
1317
- * @param options
1318
- */
1319
- WebAuth.prototype.authenticateTOTPV2 = function (options) {
1320
- options.type = "totp";
1321
- this.authenticateMFAV2(options);
1322
- };
1323
- ;
1324
- /**
1325
- * authenticateVerification form type (for face)
1326
- * @param options
1327
- * @returns
1328
- */
1329
- WebAuth.prototype.authenticateFaceVerification = function (options) {
1330
- return VerificationService_1.VerificationService.authenticateFaceVerification(options);
1331
- };
1332
- ;
1333
- /**
1334
- * @deprecated
1335
- * setup verification - v1
1336
- * @param options
1337
- * @param access_token
1338
- * @param verificationType
1339
- * @returns
1340
- */
1341
- WebAuth.prototype.setupVerificationV1 = function (options, access_token, verificationType) {
1342
- return VerificationService_1.VerificationService.setupVerificationV1(options, access_token, verificationType);
1343
- };
1344
- /**
1345
- * @deprecated
1346
- * setup email - v1
1347
- * @param options
1348
- * @param access_token
1349
- */
1350
- WebAuth.prototype.setupEmail = function (options, access_token) {
1351
- var verificationType = "EMAIL";
1352
- this.setupVerificationV1(options, access_token, verificationType);
1353
- };
1354
- ;
1355
- /**
1356
- * @deprecated
1357
- * setup sms - v1
1358
- * @param options
1359
- * @param access_token
1360
- */
1361
- WebAuth.prototype.setupSMS = function (options, access_token) {
1362
- var verificationType = "SMS";
1363
- this.setupVerificationV1(options, access_token, verificationType);
1364
- };
1365
- ;
1366
- /**
1367
- * @deprecated
1368
- * setup ivr - v1
1369
- * @param options
1370
- * @param access_token
1371
- */
1372
- WebAuth.prototype.setupIVR = function (options, access_token) {
1373
- var verificationType = "IVR";
1374
- this.setupVerificationV1(options, access_token, verificationType);
1375
- };
1376
- ;
1377
- /**
1378
- * @deprecated
1379
- * setup backupcode - v1
1380
- * @param options
1381
- * @param access_token
1382
- */
1383
- WebAuth.prototype.setupBackupcode = function (options, access_token) {
1384
- var verificationType = "BACKUPCODE";
1385
- this.setupVerificationV1(options, access_token, verificationType);
1386
- };
1387
- ;
1388
- /**
1389
- * @deprecated
1390
- * setup totp - v1
1391
- * @param options
1392
- * @param access_token
1393
- */
1394
- WebAuth.prototype.setupTOTP = function (options, access_token) {
1395
- var verificationType = "TOTP";
1396
- this.setupVerificationV1(options, access_token, verificationType);
1397
- };
1398
- ;
1399
- /**
1400
- * @deprecated
1401
- * setup pattern - v1
1402
- * @param options
1403
- * @param access_token
1404
- */
1405
- WebAuth.prototype.setupPattern = function (options, access_token) {
1406
- var verificationType = "PATTERN";
1407
- this.setupVerificationV1(options, access_token, verificationType);
1408
- };
1409
- ;
1410
- /**
1411
- * @deprecated
1412
- * setup touch - v1
1413
- * @param options
1414
- * @param access_token
1415
- */
1416
- WebAuth.prototype.setupTouchId = function (options, access_token) {
1417
- var verificationType = "TOUCHID";
1418
- this.setupVerificationV1(options, access_token, verificationType);
1419
- };
1420
- ;
1421
- /**
1422
- * @deprecated
1423
- * setup smart push - v1
1424
- * @param options
1425
- * @param access_token
1426
- */
1427
- WebAuth.prototype.setupSmartPush = function (options, access_token) {
1428
- var verificationType = "PUSH";
1429
- this.setupVerificationV1(options, access_token, verificationType);
1430
- };
1431
- ;
1432
- /**
1433
- * @deprecated
1434
- * setup face - v1
1435
- * @param options
1436
- * @param access_token
1437
- */
1438
- WebAuth.prototype.setupFace = function (options, access_token) {
1439
- var verificationType = "FACE";
1440
- this.setupVerificationV1(options, access_token, verificationType);
1441
- };
1442
- ;
1443
- /**
1444
- * @deprecated
1445
- * setup voice - v1
1446
- * @param options
1447
- * @param access_token
1448
- */
1449
- WebAuth.prototype.setupVoice = function (options, access_token) {
1450
- var verificationType = "VOICE";
1451
- this.setupVerificationV1(options, access_token, verificationType);
1452
- };
1453
- ;
1454
- /**
1455
- * @deprecated
1456
- * enroll verification - v1
1457
- * @param options
1458
- * @param access_token
1459
- * @param verificationType
1460
- * @returns
1461
- */
1462
- WebAuth.prototype.enrollVerificationV1 = function (options, access_token, verificationType) {
1463
- return VerificationService_1.VerificationService.enrollVerificationV1(options, access_token, verificationType);
1464
- };
1465
- /**
1466
- * @deprecated
1467
- * enroll email - v1
1468
- * @param options
1469
- * @param access_token
1470
- */
1471
- WebAuth.prototype.enrollEmail = function (options, access_token) {
1472
- var verificationType = "EMAIL";
1473
- this.enrollVerificationV1(options, access_token, verificationType);
1474
- };
1475
- ;
1476
- /**
1477
- * @deprecated
1478
- * enroll SMS - v1
1479
- * @param options
1480
- * @param access_token
1481
- */
1482
- WebAuth.prototype.enrollSMS = function (options, access_token) {
1483
- var verificationType = "SMS";
1484
- this.enrollVerificationV1(options, access_token, verificationType);
1485
- };
1486
- ;
1487
- /**
1488
- * @deprecated
1489
- * enroll IVR - v1
1490
- * @param options
1491
- * @param access_token
1492
- */
1493
- WebAuth.prototype.enrollIVR = function (options, access_token) {
1494
- var verificationType = "IVR";
1495
- this.enrollVerificationV1(options, access_token, verificationType);
1496
- };
1497
- ;
1498
- /**
1499
- * @deprecated
1500
- * enroll TOTP - v1
1501
- * @param options
1502
- * @param access_token
1503
- */
1504
- WebAuth.prototype.enrollTOTP = function (options, access_token) {
1505
- var verificationType = "TOTP";
1506
- this.enrollVerificationV1(options, access_token, verificationType);
1507
- };
1508
- ;
1509
- /**
1510
- * @deprecated
1511
- * authenticate mfa - v1
1512
- * @param verificationType
1513
- * @returns
1514
- */
1515
- WebAuth.prototype.authenticateMfaV1 = function (options, verificationType) {
1516
- return VerificationService_1.VerificationService.authenticateMfaV1(options, verificationType);
1517
- };
1518
- /**
1519
- * @deprecated
1520
- * authenticate email - v1
1521
- * @param options
1522
- */
1523
- WebAuth.prototype.authenticateEmail = function (options) {
1524
- var verificationType = "EMAIL";
1525
- this.authenticateMfaV1(options, verificationType);
1526
- };
1527
- ;
1528
- /**
1529
- * @deprecated
1530
- * authenticate sms - v1
1531
- * @param options
1532
- */
1533
- WebAuth.prototype.authenticateSMS = function (options) {
1534
- var verificationType = "SMS";
1535
- this.authenticateMfaV1(options, verificationType);
1536
- };
1537
- ;
1538
- /**
1539
- * @deprecated
1540
- * authenticate ivr - v1
1541
- * @param options
1542
- */
1543
- WebAuth.prototype.authenticateIVR = function (options) {
1544
- var verificationType = "IVR";
1545
- this.authenticateMfaV1(options, verificationType);
1546
- };
1547
- ;
1548
- /**
1549
- * @deprecated
1550
- * authenticate totp - v1
1551
- * @param options
1552
- */
1553
- WebAuth.prototype.authenticateTOTP = function (options) {
1554
- var verificationType = "TOTP";
1555
- this.authenticateMfaV1(options, verificationType);
1556
- };
1557
- ;
1558
- /**
1559
- * @deprecated
1560
- * authenticate backupcode - v1
1561
- * @param options
1023
+ * offline token check
1562
1024
  */
1563
- WebAuth.prototype.authenticateBackupcode = function (options) {
1564
- var verificationType = "BACKUPCODE";
1565
- this.authenticateMfaV1(options, verificationType);
1025
+ WebAuth.prototype.offlineTokenCheck = function (accessToken) {
1026
+ return TokenService_1.TokenService.offlineTokenCheck(accessToken);
1566
1027
  };
1567
1028
  ;
1568
1029
  return WebAuth;