cidaas-javascript-sdk 4.3.3 → 5.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +52 -5
  2. package/README.md +109 -93
  3. package/dist/authentication-service/AuthenticationService.d.ts +140 -0
  4. package/dist/authentication-service/AuthenticationService.js +210 -0
  5. package/dist/{authentication/Authentication.model.d.ts → authentication-service/AuthenticationService.model.d.ts} +18 -12
  6. package/dist/{authentication/Authentication.model.js → authentication-service/AuthenticationService.model.js} +2 -2
  7. package/dist/common/Common.model.d.ts +15 -19
  8. package/dist/common/Common.model.js +17 -17
  9. package/dist/common/ConfigUserProvider.d.ts +10 -0
  10. package/dist/common/ConfigUserProvider.js +28 -0
  11. package/dist/common/Helper.d.ts +7 -0
  12. package/dist/common/Helper.js +19 -0
  13. package/dist/common/User.model.d.ts +0 -4
  14. package/dist/consent-service/ConsentService.d.ts +99 -95
  15. package/dist/consent-service/ConsentService.js +125 -122
  16. package/dist/consent-service/ConsentService.model.d.ts +14 -16
  17. package/dist/device-service/DeviceService.d.ts +49 -0
  18. package/dist/device-service/DeviceService.js +79 -0
  19. package/dist/device-service/DeviceService.model.d.ts +6 -0
  20. package/dist/id-validation-service/IdValidationService.d.ts +28 -0
  21. package/dist/id-validation-service/IdValidationService.js +59 -0
  22. package/dist/id-validation-service/IdValidationService.model.d.ts +8 -0
  23. package/dist/id-validation-service/IdValidationService.model.js +2 -0
  24. package/dist/index.d.ts +22 -3
  25. package/dist/index.js +35 -18
  26. package/dist/login-service/LoginService.d.ts +143 -141
  27. package/dist/login-service/LoginService.js +225 -234
  28. package/dist/login-service/LoginService.model.d.ts +7 -51
  29. package/dist/login-service/LoginService.model.js +1 -1
  30. package/dist/public-service/PublicService.d.ts +57 -0
  31. package/dist/public-service/PublicService.js +73 -0
  32. package/dist/public-service/PublicService.model.d.ts +20 -0
  33. package/dist/public-service/PublicService.model.js +2 -0
  34. package/dist/token-service/TokenService.d.ts +104 -138
  35. package/dist/token-service/TokenService.js +164 -219
  36. package/dist/token-service/TokenService.model.d.ts +3 -44
  37. package/dist/token-service/TokenService.model.js +3 -16
  38. package/dist/user-service/UserService.d.ts +381 -315
  39. package/dist/user-service/UserService.js +552 -426
  40. package/dist/user-service/UserService.model.d.ts +48 -14
  41. package/dist/user-service/UserService.model.js +4 -4
  42. package/dist/verification-service/VerificationService.d.ts +281 -223
  43. package/dist/verification-service/VerificationService.js +343 -287
  44. package/dist/verification-service/VerificationService.model.d.ts +4 -5
  45. package/package.json +6 -4
  46. package/dist/authentication/Authentication.d.ts +0 -139
  47. package/dist/authentication/Authentication.js +0 -186
  48. package/dist/web-auth/WebAuth.d.ts +0 -665
  49. package/dist/web-auth/WebAuth.js +0 -955
  50. package/dist/web-auth/webauth.model.d.ts +0 -66
  51. /package/dist/{web-auth/webauth.model.js → device-service/DeviceService.model.js} +0 -0
@@ -1,294 +1,350 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.configureFriendlyName = exports.configureVerification = exports.initiateVerification = exports.authenticateMFA = exports.initiateMFA = exports.checkVerificationTypeConfigured = exports.enrollVerification = exports.getEnrollmentStatus = exports.initiateEnrollment = exports.getAllVerificationList = exports.cancelMFA = exports.getMFAList = exports.verifyAccount = exports.initiateAccountVerification = void 0;
3
+ exports.VerificationService = void 0;
4
4
  const Helper_1 = require("../common/Helper");
5
- /**
6
- * To initiate the account verification, call **initiateAccountVerification()**. This will send verification code email or sms or ivr based on the verificationMedium you mentioned.
7
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/cgans5erj5alg-init-account-verification for more details.
8
- * @example
9
- * ```js
10
- * cidaas.initiateAccountVerification({
11
- * verificationMedium: 'email',
12
- * requestId: 'your requestId',
13
- * processingType: ProcessingType.CODE,
14
- * email: 'your email'
15
- * }).then(function (response) {
16
- * // the response will give you account verification details.
17
- * }).catch(function(ex) {
18
- * // your failure code here
19
- * });
20
- * ```
21
- */
22
- function initiateAccountVerification(options) {
23
- try {
24
- const url = window.webAuthSettings.authority + "/verification-srv/account/initiate";
25
- const form = Helper_1.Helper.createForm(url, options);
26
- document.body.appendChild(form);
27
- form.submit();
5
+ class VerificationService {
6
+ constructor(configUserProvider) {
7
+ this.config = configUserProvider.getConfig();
8
+ this.userManager = configUserProvider.getUserManager();
28
9
  }
29
- catch (ex) {
30
- throw new Helper_1.CustomException(String(ex), 417);
10
+ /**
11
+ * To initiate the account verification, call **initiateAccountVerification()**. This will send verification code email or sms or ivr based on the verificationMedium you mentioned.
12
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/cgans5erj5alg-init-account-verification for more details.
13
+ * @example
14
+ * ```js
15
+ * cidaasVerificationService.initiateAccountVerification({
16
+ * verificationMedium: 'email',
17
+ * requestId: 'your requestId',
18
+ * processingType: ProcessingType.Code,
19
+ * email: 'your email'
20
+ * }).then(function (response) {
21
+ * // the response will give you account verification details.
22
+ * }).catch(function(ex) {
23
+ * // your failure code here
24
+ * });
25
+ * ```
26
+ */
27
+ initiateAccountVerification(options) {
28
+ try {
29
+ const url = this.config.authority + "/verification-srv/account/initiate";
30
+ const form = Helper_1.Helper.createForm(url, options);
31
+ document.body.appendChild(form);
32
+ form.submit();
33
+ }
34
+ catch (ex) {
35
+ throw new Helper_1.CustomException(String(ex), 417);
36
+ }
31
37
  }
32
- }
33
- exports.initiateAccountVerification = initiateAccountVerification;
34
- /**
35
- * To complete the verification, call **verifyAccount()**.
36
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/r8h9mvavvw2e6-verify-account for more details.
37
- * @example
38
- * ```js
39
- * cidaas.verifyAccount({
40
- * accvid: 'your accvid', // which you will get on initiate account verification response
41
- * code: 'your code in email or sms or ivr'
42
- * }).then(function (response) {
43
- * // the response will give you account verification ID and unique code.
44
- * }).catch(function(ex) {
45
- * // your failure code here
46
- * });
47
- * ```
48
- */
49
- function verifyAccount(options, headers) {
50
- const _serviceURL = window.webAuthSettings.authority + "/verification-srv/account/verify";
51
- return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", undefined, headers);
52
- }
53
- exports.verifyAccount = verifyAccount;
54
- /**
55
- * To get all configured multi factor authentication, call **getMFAList()**.
56
- *
57
- * As Parameter, you need to pass request id & one of the following: email or mobile phone or username.
58
- *
59
- * In case you are in prelogin page and don't have user information yet (such as mfa-required & account-verification page), you could pass
60
- * request id & masked sub (one of the following: sub or q), depends on which one is available in the query parameter generated by cidaas.
61
- *
62
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/ee688a9c52b63-list-of-configured-verification-methods for more details.
63
- * @example
64
- * ```js
65
- * cidaas.getMFAList({
66
- * request_id: 'your request id',
67
- * email: 'your email'
68
- * }).then(function (response) {
69
- * // the response will give you list of configured multi factor authentication
70
- * }).catch(function(ex) {
71
- * // your failure code here
72
- * });
73
- * ```
74
- */
75
- function getMFAList(options, headers) {
76
- const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/public/configured/list";
77
- return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", undefined, headers);
78
- }
79
- exports.getMFAList = getMFAList;
80
- /**
81
- * to cancel mfa process, call **cancelMFA()**.
82
- * @example
83
- * ```js
84
- * cidaas.cancelMFA({
85
- * exchange_id: 'exchange id from initiateMFA() response',
86
- * reason: 'reason of mfa cancelation',
87
- * type: 'authentication type e.g. email'
88
- * }).then(function (response) {
89
- * // your success code here
90
- * }).catch(function(ex) {
91
- * // your failure code here
92
- * });
93
- * ```
94
- */
95
- function cancelMFA(options, headers) {
96
- const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/cancel/" + options.type;
97
- return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST", undefined, headers);
98
- }
99
- exports.cancelMFA = cancelMFA;
100
- /**
101
- * To get list of all verification type configured, call **getAllVerificationList()**. access_token must be passed as function parameter.
102
- * @example
103
- * ```js
104
- * const access_token = "your access token";
105
- *
106
- * cidaas.getAllVerificationList(access_token)
107
- * .then(function (response) {
108
- * // type your code here
109
- * })
110
- * .catch(function (ex) {
111
- * // your failure code here
112
- * });
113
- * ```
114
- */
115
- function getAllVerificationList(access_token, headers) {
116
- const _serviceURL = `${window.webAuthSettings.authority}/verification-srv/config/list`;
117
- return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, undefined, "GET", access_token, headers);
118
- }
119
- exports.getAllVerificationList = getAllVerificationList;
120
- /**
121
- * To initiate enrollment of new multi factor authentication, call **initiateEnrollment()**.
122
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/f85aef6754714-initiate-physical-verification-setup for more details.
123
- * @example
124
- * ```js
125
- * const access_token = "your access token";
126
- * const options = {
127
- * verification_type: 'one of verification_type such as fido2, face, ivr',
128
- * deviceInfo: {
129
- * deviceId: '',
130
- * location: {lat: '', lon: ''}
131
- * }
132
- * }
133
- *
134
- * cidaas.initiateEnrollment(options, access_token)
135
- * .then(function (response) {
136
- * // type your code here
137
- * })
138
- * .catch(function (ex) {
139
- * // your failure code here
140
- * });
141
- * ```
142
- */
143
- function initiateEnrollment(options, accessToken) {
144
- const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/initiate/" + options.verification_type;
145
- return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST", accessToken);
146
- }
147
- exports.initiateEnrollment = initiateEnrollment;
148
- /**
149
- * to get the status of MFA enrollment, call **getEnrollmentStatus()**.
150
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/b06447d02d8e0-get-status-of-physical-verification-setup-configuration for more details.
151
- * @example
152
- * ```js
153
- * cidaas.getEnrollmentStatus('statusId from initiateEnrollment()', 'your access token')
154
- * .then(function (response) {
155
- * // type your code here
156
- * })
157
- * .catch(function (ex) {
158
- * // your failure code here
159
- * });
160
- * ```
161
- */
162
- function getEnrollmentStatus(status_id, accessToken, headers) {
163
- const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/notification/status/" + status_id;
164
- return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, undefined, "POST", accessToken, headers);
165
- }
166
- exports.getEnrollmentStatus = getEnrollmentStatus;
167
- /**
168
- * to finish enrollment process of new multi factor authentication, call **enrollVerification()**.
169
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/20ec76e937b27-enroll-physical-verification-setup for more details.
170
- * @example
171
- * ```js
172
- * const fidoPayload = {
173
- * sub: 'your sub',
174
- * exchange_id: 'exchange_id from initiateEnrollment()',
175
- * verification_type: 'fido2',
176
- * fido2_client_response: {
177
- * client_response: 'client_response from doing fido process',
178
- * fidoRequestId: 'fidoRequestId from initiateEnrollment',
179
- * }
180
- * }
181
- * cidaas.enrollVerification(fidoPayload)
182
- * .then(function (response) {
183
- * // type your code here
184
- * })
185
- * .catch(function (ex) {
186
- * // your failure code here
187
- * });
188
- * ```
189
- */
190
- function enrollVerification(options) {
191
- const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/enroll/" + options.verification_type;
192
- return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
193
- }
194
- exports.enrollVerification = enrollVerification;
195
- /**
196
- * to see details of configured verification type, call **checkVerificationTypeConfigured()**.
197
- * @example
198
- * ```js
199
- * cidaas.checkVerificationTypeConfigured({
200
- * request_id: 'your request id',
201
- * email: 'your email',
202
- * verification_type: 'email'
203
- * }).then(function (response) {
204
- * // type your code here
205
- * })
206
- * .catch(function (ex) {
207
- * // your failure code here
208
- * });
209
- * ```
210
- */
211
- function checkVerificationTypeConfigured(options) {
212
- const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/public/configured/check/" + options.verification_type;
213
- return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
214
- }
215
- exports.checkVerificationTypeConfigured = checkVerificationTypeConfigured;
216
- /**
217
- * to initiate multi factor auhentication, call **initiateMFA()**.
218
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/2a3ea581bb249-initiate-verification for more details.
219
- * @example
220
- * ```js
221
- * const access_token = "your access token";
222
- * const options = {
223
- * request_id: 'your request id',
224
- * usage_type: 'PASSWORDLESS_AUTHENTICATION',
225
- * type: 'email'
226
- * email: 'your email'
227
- * }
228
- * }
229
- *
230
- * cidaas.initiateMFA(options, access_token)
231
- * .then(function (response) {
232
- * // type your code here
233
- * })
234
- * .catch(function (ex) {
235
- * // your failure code here
236
- * });
237
- * ```
238
- */
239
- function initiateMFA(options, accessToken, headers) {
240
- const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/initiate/" + options.type;
241
- // BREAKING TODO: remove accessToken parameter in the next major release
242
- if (accessToken) {
243
- return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", accessToken, headers);
38
+ /**
39
+ * To complete the verification, call **verifyAccount()**.
40
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/r8h9mvavvw2e6-verify-account for more details.
41
+ * @example
42
+ * ```js
43
+ * cidaasVerificationService.verifyAccount({
44
+ * accvid: 'your accvid', // which you will get on initiate account verification response
45
+ * code: 'your code in email or sms or ivr'
46
+ * }).then(function (response) {
47
+ * // the response will give you account verification ID and unique code.
48
+ * }).catch(function(ex) {
49
+ * // your failure code here
50
+ * });
51
+ * ```
52
+ */
53
+ verifyAccount(options, headers) {
54
+ const _serviceURL = this.config.authority + "/verification-srv/account/verify";
55
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", undefined, headers);
56
+ }
57
+ /**
58
+ * To get all configured multi factor authentication, call **getMFAList()**.
59
+ *
60
+ * As Parameter, you need to pass request id & one of the following: email or mobile phone or username.
61
+ *
62
+ * In case you are in prelogin page and don't have user information yet (such as mfa-required & account-verification page), you could pass
63
+ * request id & masked sub (one of the following: sub or q), depends on which one is available in the query parameter generated by cidaas.
64
+ *
65
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/ee688a9c52b63-list-of-configured-verification-methods for more details.
66
+ * @example
67
+ * ```js
68
+ * cidaasVerificationService.getMFAList({
69
+ * request_id: 'your request id',
70
+ * email: 'your email'
71
+ * }).then(function (response) {
72
+ * // the response will give you list of configured multi factor authentication
73
+ * }).catch(function(ex) {
74
+ * // your failure code here
75
+ * });
76
+ * ```
77
+ */
78
+ getMFAList(options, headers) {
79
+ const _serviceURL = this.config.authority + "/verification-srv/v2/setup/public/configured/list";
80
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", undefined, headers);
81
+ }
82
+ /**
83
+ * to cancel mfa process, call **cancelMFA()**.
84
+ * @example
85
+ * ```js
86
+ * cidaasVerificationService.cancelMFA({
87
+ * exchange_id: 'exchange id from initiateMFA() response',
88
+ * reason: 'reason of mfa cancelation',
89
+ * type: 'authentication type e.g. email'
90
+ * }).then(function (response) {
91
+ * // your success code here
92
+ * }).catch(function(ex) {
93
+ * // your failure code here
94
+ * });
95
+ * ```
96
+ */
97
+ cancelMFA(options, headers) {
98
+ const _serviceURL = this.config.authority + "/verification-srv/v2/authenticate/cancel/" + options.type;
99
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST", undefined, headers);
100
+ }
101
+ /**
102
+ * To get list of all verification type configured, call **getAllVerificationList()**. access_token must be passed as function parameter.
103
+ * @example
104
+ * ```js
105
+ * cidaasVerificationService.getAllVerificationList()
106
+ * .then(function (response) {
107
+ * // type your code here
108
+ * })
109
+ * .catch(function (ex) {
110
+ * // your failure code here
111
+ * });
112
+ * ```
113
+ */
114
+ getAllVerificationList(access_token, headers) {
115
+ const _serviceURL = `${this.config.authority}/verification-srv/config/list`;
116
+ if (access_token) {
117
+ return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, undefined, "GET", access_token, headers);
118
+ }
119
+ return Helper_1.Helper.getAccessTokenFromUserStorage(this.userManager).then((accessToken) => {
120
+ return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, undefined, "GET", accessToken, headers);
121
+ });
122
+ }
123
+ /**
124
+ * To initiate enrollment of new multi factor authentication, call **initiateEnrollment()**.
125
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/f85aef6754714-initiate-physical-verification-setup for more details.
126
+ * @example
127
+ * ```js
128
+ * const options = {
129
+ * verification_type: 'one of verification_type such as fido2, face, ivr',
130
+ * deviceInfo: {
131
+ * deviceId: '',
132
+ * location: {lat: '', lon: ''}
133
+ * }
134
+ * }
135
+ *
136
+ * cidaasVerificationService.initiateEnrollment(options)
137
+ * .then(function (response) {
138
+ * // type your code here
139
+ * })
140
+ * .catch(function (ex) {
141
+ * // your failure code here
142
+ * });
143
+ * ```
144
+ */
145
+ initiateEnrollment(options, access_token) {
146
+ const _serviceURL = this.config.authority + "/verification-srv/v2/setup/initiate/" + options.verification_type;
147
+ if (access_token) {
148
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST", access_token);
149
+ }
150
+ return Helper_1.Helper.getAccessTokenFromUserStorage(this.userManager).then((accessToken) => {
151
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST", accessToken);
152
+ });
153
+ }
154
+ /**
155
+ * to get the status of MFA enrollment, call **getEnrollmentStatus()**.
156
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/b06447d02d8e0-get-status-of-physical-verification-setup-configuration for more details.
157
+ * @example
158
+ * ```js
159
+ * cidaasVerificationService.getEnrollmentStatus('statusId from initiateEnrollment()')
160
+ * .then(function (response) {
161
+ * // type your code here
162
+ * })
163
+ * .catch(function (ex) {
164
+ * // your failure code here
165
+ * });
166
+ * ```
167
+ */
168
+ getEnrollmentStatus(status_id, access_token, headers) {
169
+ const _serviceURL = this.config.authority + "/verification-srv/v2/notification/status/" + status_id;
170
+ if (access_token) {
171
+ return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, undefined, "POST", access_token, headers);
172
+ }
173
+ return Helper_1.Helper.getAccessTokenFromUserStorage(this.userManager).then((accessToken) => {
174
+ return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, undefined, "POST", accessToken, headers);
175
+ });
176
+ }
177
+ /**
178
+ * to finish enrollment process of new multi factor authentication, call **enrollVerification()**.
179
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/20ec76e937b27-enroll-physical-verification-setup for more details.
180
+ * @example
181
+ * ```js
182
+ * const fidoPayload = {
183
+ * sub: 'your sub',
184
+ * exchange_id: 'exchange_id from initiateEnrollment()',
185
+ * verification_type: 'fido2',
186
+ * fido2_client_response: {
187
+ * client_response: 'client_response from doing fido process',
188
+ * fidoRequestId: 'fidoRequestId from initiateEnrollment',
189
+ * }
190
+ * }
191
+ * cidaasVerificationService.enrollVerification(fidoPayload)
192
+ * .then(function (response) {
193
+ * // type your code here
194
+ * })
195
+ * .catch(function (ex) {
196
+ * // your failure code here
197
+ * });
198
+ * ```
199
+ */
200
+ enrollVerification(options) {
201
+ const _serviceURL = this.config.authority + "/verification-srv/v2/setup/enroll/" + options.verification_type;
202
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
203
+ }
204
+ /**
205
+ * to see details of configured verification type, call **checkVerificationTypeConfigured()**.
206
+ * @example
207
+ * ```js
208
+ * cidaasVerificationService.checkVerificationTypeConfigured({
209
+ * request_id: 'your request id',
210
+ * email: 'your email',
211
+ * verification_type: 'email'
212
+ * }).then(function (response) {
213
+ * // type your code here
214
+ * })
215
+ * .catch(function (ex) {
216
+ * // your failure code here
217
+ * });
218
+ * ```
219
+ */
220
+ checkVerificationTypeConfigured(options) {
221
+ const _serviceURL = this.config.authority + "/verification-srv/v2/setup/public/configured/check/" + options.verification_type;
222
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
223
+ }
224
+ /**
225
+ * to initiate multi factor auhentication, call **initiateMFA()**.
226
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/2a3ea581bb249-initiate-verification for more details.
227
+ * @example
228
+ * ```js
229
+ * const options = {
230
+ * request_id: 'your request id',
231
+ * usage_type: 'PASSWORDLESS_AUTHENTICATION',
232
+ * type: 'email'
233
+ * email: 'your email'
234
+ * }
235
+ * }
236
+ *
237
+ * cidaasVerificationService.initiateMFA(options)
238
+ * .then(function (response) {
239
+ * // type your code here
240
+ * })
241
+ * .catch(function (ex) {
242
+ * // your failure code here
243
+ * });
244
+ * ```
245
+ */
246
+ initiateMFA(options, headers) {
247
+ const _serviceURL = this.config.authority + "/verification-srv/v2/authenticate/initiate/" + options.type;
248
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", undefined, headers);
249
+ }
250
+ /**
251
+ * to authenticate with multi factor auhentication, call **authenticateMFA()**.
252
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/1aa38936252d6-perform-the-authentication-method for more details.
253
+ * @example
254
+ * ```js
255
+ * cidaasVerificationService.authenticateMFA({
256
+ * type: 'email',
257
+ * client_id: 'your client id',
258
+ * exchange_id: exchange id from initiateMFA(),
259
+ * pass_code: 'code to authenticate'
260
+ * }).then(function (response) {
261
+ * // type your code here
262
+ * })
263
+ * .catch(function (ex) {
264
+ * // your failure code here
265
+ * });
266
+ * ```
267
+ */
268
+ authenticateMFA(options, headers) {
269
+ const _serviceURL = this.config.authority + "/verification-srv/v2/authenticate/authenticate/" + options.type;
270
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST", undefined, headers);
271
+ }
272
+ /**
273
+ * to initiate verification process, call **initiateVerification**
274
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/odmtzu2e53f5k-initiate-verification-enrollment for more details.
275
+ * @example
276
+ * ```js
277
+ * const options = {
278
+ * mobile_number: 'your mobile number',
279
+ * }
280
+ * }
281
+ * const trackId = 'your track id'
282
+ * const method = 'email'
283
+ *
284
+ * cidaasVerificationService.initiateVerification(options, trackId, method)
285
+ * .then(function (response) {
286
+ * // type your code here
287
+ * })
288
+ * .catch(function (ex) {
289
+ * // your failure code here
290
+ * });
291
+ * ```
292
+ */
293
+ initiateVerification(options, trackId, method) {
294
+ const serviceURL = this.config.authority + '/verification-actions-srv/setup/' + method + '/initiate/' + trackId;
295
+ return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'POST');
296
+ }
297
+ /**
298
+ * to finish configuring verification process, call **configureVerification**
299
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/vurqjgv46yyid-initiate-verification-setup-authenticate for more details.
300
+ * @example
301
+ * ```js
302
+ * const options = {
303
+ * exchange_id: 'your exchange id';
304
+ * sub: 'your sub;
305
+ * pass_code: 'your pass code';
306
+ * }
307
+ * }
308
+ * const method = 'email'
309
+ *
310
+ * cidaasVerificationService.initiateVerification(options, method)
311
+ * .then(function (response) {
312
+ * // type your code here
313
+ * })
314
+ * .catch(function (ex) {
315
+ * // your failure code here
316
+ * });
317
+ * ```
318
+ */
319
+ configureVerification(options, method) {
320
+ const serviceURL = this.config.authority + '/verification-actions-srv/setup/' + method + '/verification';
321
+ return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'POST');
322
+ }
323
+ /**
324
+ * to configure friendly name, call **configureFriendlyName**
325
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/f0i458vm5zo6z-add-a-friendly-name for more details.
326
+ * @example
327
+ * ```js
328
+ * const options = {
329
+ * sub: 'your sub;
330
+ * friendly_name: 'your friendly name';
331
+ * }
332
+ * }
333
+ * const trackId = 'your track id'
334
+ * const method = 'email'
335
+ *
336
+ * cidaasVerificationService.configureFriendlyName(options, trackId, method)
337
+ * .then(function (response) {
338
+ * // type your code here
339
+ * })
340
+ * .catch(function (ex) {
341
+ * // your failure code here
342
+ * });
343
+ * ```
344
+ */
345
+ configureFriendlyName(options, trackId, method) {
346
+ const serviceURL = this.config.authority + '/verification-actions-srv/setup/users/friendlyname/' + method.toUpperCase() + '/' + trackId;
347
+ return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'PUT');
244
348
  }
245
- return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", undefined, headers);
246
- }
247
- exports.initiateMFA = initiateMFA;
248
- /**
249
- * to authenticate with multi factor auhentication, call **authenticateMFA()**.
250
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/1aa38936252d6-perform-the-authentication-method for more details.
251
- * @example
252
- * ```js
253
- * cidaas.authenticateMFA({
254
- * type: 'email',
255
- * client_id: 'your client id',
256
- * exchange_id: exchange id from initiateMFA(),
257
- * pass_code: 'code to authenticate'
258
- * }).then(function (response) {
259
- * // type your code here
260
- * })
261
- * .catch(function (ex) {
262
- * // your failure code here
263
- * });
264
- * ```
265
- */
266
- function authenticateMFA(options, headers) {
267
- const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/authenticate/" + options.type;
268
- return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST", undefined, headers);
269
- }
270
- exports.authenticateMFA = authenticateMFA;
271
- /**
272
- * to initiate verification process, call **initiateVerification**
273
- */
274
- function initiateVerification(options, trackId, method) {
275
- const serviceURL = window.webAuthSettings.authority + '/verification-actions-srv/setup/' + method + '/initiate/' + trackId;
276
- return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'POST');
277
- }
278
- exports.initiateVerification = initiateVerification;
279
- /**
280
- * to finish configuring verification process, call **configureVerification**
281
- */
282
- function configureVerification(options, method) {
283
- const serviceURL = window.webAuthSettings.authority + '/verification-actions-srv/setup/' + method + '/verification';
284
- return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'POST');
285
- }
286
- exports.configureVerification = configureVerification;
287
- /**
288
- * to configure friendly name, call **configureFriendlyName**
289
- */
290
- function configureFriendlyName(options, trackId, method) {
291
- const serviceURL = window.webAuthSettings.authority + '/verification-actions-srv/setup/users/friendlyname/' + method.toUpperCase() + '/' + trackId;
292
- return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'PUT');
293
349
  }
294
- exports.configureFriendlyName = configureFriendlyName;
350
+ exports.VerificationService = VerificationService;