cidaas-javascript-sdk 4.2.4 → 4.3.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 (54) hide show
  1. package/CHANGELOG.md +41 -2
  2. package/README.md +9 -6
  3. package/dist/authentication/{index.d.ts → Authentication.d.ts} +2 -2
  4. package/dist/authentication/{index.js → Authentication.js} +2 -9
  5. package/dist/common/Common.model.d.ts +41 -0
  6. package/dist/common/Common.model.js +26 -0
  7. package/dist/{web-auth → common}/Helper.d.ts +6 -6
  8. package/dist/{web-auth → common}/Helper.js +10 -10
  9. package/dist/common/JwtHelper.d.ts +8 -0
  10. package/dist/{web-auth → common}/JwtHelper.js +8 -8
  11. package/dist/common/User.model.d.ts +134 -0
  12. package/dist/common/User.model.js +2 -0
  13. package/dist/consent-service/ConsentService.d.ts +97 -0
  14. package/dist/consent-service/ConsentService.js +127 -0
  15. package/dist/consent-service/ConsentService.model.d.ts +102 -0
  16. package/dist/consent-service/ConsentService.model.js +2 -0
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/login-service/LoginService.d.ts +143 -0
  20. package/dist/login-service/LoginService.js +247 -0
  21. package/dist/login-service/LoginService.model.d.ts +142 -0
  22. package/dist/login-service/LoginService.model.js +13 -0
  23. package/dist/token-service/TokenService.d.ts +139 -0
  24. package/dist/token-service/TokenService.js +242 -0
  25. package/dist/token-service/TokenService.model.d.ts +149 -0
  26. package/dist/token-service/TokenService.model.js +43 -0
  27. package/dist/user-service/UserService.d.ts +317 -0
  28. package/dist/user-service/UserService.js +451 -0
  29. package/dist/user-service/UserService.model.d.ts +142 -0
  30. package/dist/user-service/UserService.model.js +10 -0
  31. package/dist/verification-service/VerificationService.d.ts +219 -0
  32. package/dist/verification-service/VerificationService.js +288 -0
  33. package/dist/verification-service/VerificationService.model.d.ts +158 -0
  34. package/dist/verification-service/VerificationService.model.js +2 -0
  35. package/dist/web-auth/WebAuth.d.ts +138 -178
  36. package/dist/web-auth/WebAuth.js +183 -177
  37. package/dist/web-auth/webauth.model.d.ts +66 -0
  38. package/dist/web-auth/webauth.model.js +2 -0
  39. package/package.json +2 -2
  40. package/dist/web-auth/ConsentService.d.ts +0 -123
  41. package/dist/web-auth/ConsentService.js +0 -136
  42. package/dist/web-auth/Entities.d.ts +0 -516
  43. package/dist/web-auth/Entities.js +0 -69
  44. package/dist/web-auth/JwtHelper.d.ts +0 -7
  45. package/dist/web-auth/LoginService.d.ts +0 -165
  46. package/dist/web-auth/LoginService.js +0 -246
  47. package/dist/web-auth/TokenService.d.ts +0 -143
  48. package/dist/web-auth/TokenService.js +0 -249
  49. package/dist/web-auth/UserService.d.ts +0 -345
  50. package/dist/web-auth/UserService.js +0 -471
  51. package/dist/web-auth/VerificationService.d.ts +0 -224
  52. package/dist/web-auth/VerificationService.js +0 -278
  53. /package/dist/authentication/{authentication.model.d.ts → Authentication.model.d.ts} +0 -0
  54. /package/dist/authentication/{authentication.model.js → Authentication.model.js} +0 -0
@@ -0,0 +1,219 @@
1
+ import { HTTPRequestHeader } from "../common/Common.model";
2
+ import { AuthenticateMFARequest, CancelMFARequest, CheckVerificationTypeConfiguredRequest, ConfigureFriendlyNameRequest, ConfigureVerificationRequest, EnrollVerificationRequest, GetMFAListRequest, InitiateAccountVerificationRequest, InitiateEnrollmentRequest, InitiateMFARequest, InitiateVerificationRequest, VerifyAccountRequest } from "./VerificationService.model";
3
+ /**
4
+ * To initiate the account verification, call **initiateAccountVerification()**. This will send verification code email or sms or ivr based on the verificationMedium you mentioned.
5
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/cgans5erj5alg-init-account-verification for more details.
6
+ * @example
7
+ * ```js
8
+ * cidaas.initiateAccountVerification({
9
+ * verificationMedium: 'email',
10
+ * requestId: 'your requestId',
11
+ * processingType: ProcessingType.CODE,
12
+ * email: 'your email'
13
+ * }).then(function (response) {
14
+ * // the response will give you account verification details.
15
+ * }).catch(function(ex) {
16
+ * // your failure code here
17
+ * });
18
+ * ```
19
+ */
20
+ export declare function initiateAccountVerification(options: InitiateAccountVerificationRequest): void;
21
+ /**
22
+ * To complete the verification, call **verifyAccount()**.
23
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/r8h9mvavvw2e6-verify-account for more details.
24
+ * @example
25
+ * ```js
26
+ * cidaas.verifyAccount({
27
+ * accvid: 'your accvid', // which you will get on initiate account verification response
28
+ * code: 'your code in email or sms or ivr'
29
+ * }).then(function (response) {
30
+ * // the response will give you account verification ID and unique code.
31
+ * }).catch(function(ex) {
32
+ * // your failure code here
33
+ * });
34
+ * ```
35
+ */
36
+ export declare function verifyAccount(options: VerifyAccountRequest, headers?: HTTPRequestHeader): Promise<any>;
37
+ /**
38
+ * To get all configured multi factor authentication, call **getMFAList()**.
39
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/ee688a9c52b63-list-of-configured-verification-methods for more details.
40
+ * @example
41
+ * ```js
42
+ * cidaas.getMFAList({
43
+ * request_id: 'your request id',
44
+ * email: 'your email'
45
+ * }).then(function (response) {
46
+ * // the response will give you list of configured multi factor authentication
47
+ * }).catch(function(ex) {
48
+ * // your failure code here
49
+ * });
50
+ * ```
51
+ */
52
+ export declare function getMFAList(options: GetMFAListRequest, headers?: HTTPRequestHeader): Promise<any>;
53
+ /**
54
+ * to cancel mfa process, call **cancelMFA()**.
55
+ * @example
56
+ * ```js
57
+ * cidaas.cancelMFA({
58
+ * exchange_id: 'exchange id from initiateMFA() response',
59
+ * reason: 'reason of mfa cancelation',
60
+ * type: 'authentication type e.g. email'
61
+ * }).then(function (response) {
62
+ * // your success code here
63
+ * }).catch(function(ex) {
64
+ * // your failure code here
65
+ * });
66
+ * ```
67
+ */
68
+ export declare function cancelMFA(options: CancelMFARequest, headers?: HTTPRequestHeader): Promise<any>;
69
+ /**
70
+ * To get list of all verification type configured, call **getAllVerificationList()**. access_token must be passed as function parameter.
71
+ * @example
72
+ * ```js
73
+ * const access_token = "your access token";
74
+ *
75
+ * cidaas.getAllVerificationList(access_token)
76
+ * .then(function (response) {
77
+ * // type your code here
78
+ * })
79
+ * .catch(function (ex) {
80
+ * // your failure code here
81
+ * });
82
+ * ```
83
+ */
84
+ export declare function getAllVerificationList(access_token: string, headers?: HTTPRequestHeader): Promise<any>;
85
+ /**
86
+ * To initiate enrollment of new multi factor authentication, call **initiateEnrollment()**.
87
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/f85aef6754714-initiate-physical-verification-setup for more details.
88
+ * @example
89
+ * ```js
90
+ * const access_token = "your access token";
91
+ * const options = {
92
+ * verification_type: 'one of verification_type such as fido2, face, ivr',
93
+ * deviceInfo: {
94
+ * deviceId: '',
95
+ * location: {lat: '', lon: ''}
96
+ * }
97
+ * }
98
+ *
99
+ * cidaas.initiateEnrollment(options, access_token)
100
+ * .then(function (response) {
101
+ * // type your code here
102
+ * })
103
+ * .catch(function (ex) {
104
+ * // your failure code here
105
+ * });
106
+ * ```
107
+ */
108
+ export declare function initiateEnrollment(options: InitiateEnrollmentRequest, accessToken: string): Promise<any>;
109
+ /**
110
+ * to get the status of MFA enrollment, call **getEnrollmentStatus()**.
111
+ * 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.
112
+ * @example
113
+ * ```js
114
+ * cidaas.getEnrollmentStatus('statusId from initiateEnrollment()', 'your access token')
115
+ * .then(function (response) {
116
+ * // type your code here
117
+ * })
118
+ * .catch(function (ex) {
119
+ * // your failure code here
120
+ * });
121
+ * ```
122
+ */
123
+ export declare function getEnrollmentStatus(status_id: string, accessToken: string, headers?: HTTPRequestHeader): Promise<any>;
124
+ /**
125
+ * to finish enrollment process of new multi factor authentication, call **enrollVerification()**.
126
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/20ec76e937b27-enroll-physical-verification-setup for more details.
127
+ * @example
128
+ * ```js
129
+ * const fidoPayload = {
130
+ * sub: 'your sub',
131
+ * exchange_id: 'exchange_id from initiateEnrollment()',
132
+ * verification_type: 'fido2',
133
+ * fido2_client_response: {
134
+ * client_response: 'client_response from doing fido process',
135
+ * fidoRequestId: 'fidoRequestId from initiateEnrollment',
136
+ * }
137
+ * }
138
+ * cidaas.enrollVerification(fidoPayload)
139
+ * .then(function (response) {
140
+ * // type your code here
141
+ * })
142
+ * .catch(function (ex) {
143
+ * // your failure code here
144
+ * });
145
+ * ```
146
+ */
147
+ export declare function enrollVerification(options: EnrollVerificationRequest): Promise<any>;
148
+ /**
149
+ * to see details of configured verification type, call **checkVerificationTypeConfigured()**.
150
+ * @example
151
+ * ```js
152
+ * cidaas.checkVerificationTypeConfigured({
153
+ * request_id: 'your request id',
154
+ * email: 'your email',
155
+ * verification_type: 'email'
156
+ * }).then(function (response) {
157
+ * // type your code here
158
+ * })
159
+ * .catch(function (ex) {
160
+ * // your failure code here
161
+ * });
162
+ * ```
163
+ */
164
+ export declare function checkVerificationTypeConfigured(options: CheckVerificationTypeConfiguredRequest): Promise<any>;
165
+ /**
166
+ * to initiate multi factor auhentication, call **initiateMFA()**.
167
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/2a3ea581bb249-initiate-verification for more details.
168
+ * @example
169
+ * ```js
170
+ * const access_token = "your access token";
171
+ * const options = {
172
+ * request_id: 'your request id',
173
+ * usage_type: 'PASSWORDLESS_AUTHENTICATION',
174
+ * type: 'email'
175
+ * email: 'your email'
176
+ * }
177
+ * }
178
+ *
179
+ * cidaas.initiateMFA(options, access_token)
180
+ * .then(function (response) {
181
+ * // type your code here
182
+ * })
183
+ * .catch(function (ex) {
184
+ * // your failure code here
185
+ * });
186
+ * ```
187
+ */
188
+ export declare function initiateMFA(options: InitiateMFARequest, accessToken?: string, headers?: HTTPRequestHeader): Promise<any>;
189
+ /**
190
+ * to authenticate with multi factor auhentication, call **authenticateMFA()**.
191
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/1aa38936252d6-perform-the-authentication-method for more details.
192
+ * @example
193
+ * ```js
194
+ * cidaas.authenticateMFA({
195
+ * type: 'email',
196
+ * client_id: 'your client id',
197
+ * exchange_id: exchange id from initiateMFA(),
198
+ * pass_code: 'code to authenticate'
199
+ * }).then(function (response) {
200
+ * // type your code here
201
+ * })
202
+ * .catch(function (ex) {
203
+ * // your failure code here
204
+ * });
205
+ * ```
206
+ */
207
+ export declare function authenticateMFA(options: AuthenticateMFARequest, headers?: HTTPRequestHeader): Promise<any>;
208
+ /**
209
+ * to initiate verification process, call **initiateVerification**
210
+ */
211
+ export declare function initiateVerification(options: InitiateVerificationRequest, trackId: string, method: string): Promise<any>;
212
+ /**
213
+ * to finish configuring verification process, call **configureVerification**
214
+ */
215
+ export declare function configureVerification(options: ConfigureVerificationRequest, method: string): Promise<any>;
216
+ /**
217
+ * to configure friendly name, call **configureFriendlyName**
218
+ */
219
+ export declare function configureFriendlyName(options: ConfigureFriendlyNameRequest, trackId: string, method: string): Promise<any>;
@@ -0,0 +1,288 @@
1
+ "use strict";
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;
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();
28
+ }
29
+ catch (ex) {
30
+ throw new Helper_1.CustomException(String(ex), 417);
31
+ }
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
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/ee688a9c52b63-list-of-configured-verification-methods for more details.
57
+ * @example
58
+ * ```js
59
+ * cidaas.getMFAList({
60
+ * request_id: 'your request id',
61
+ * email: 'your email'
62
+ * }).then(function (response) {
63
+ * // the response will give you list of configured multi factor authentication
64
+ * }).catch(function(ex) {
65
+ * // your failure code here
66
+ * });
67
+ * ```
68
+ */
69
+ function getMFAList(options, headers) {
70
+ const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/public/configured/list";
71
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", undefined, headers);
72
+ }
73
+ exports.getMFAList = getMFAList;
74
+ /**
75
+ * to cancel mfa process, call **cancelMFA()**.
76
+ * @example
77
+ * ```js
78
+ * cidaas.cancelMFA({
79
+ * exchange_id: 'exchange id from initiateMFA() response',
80
+ * reason: 'reason of mfa cancelation',
81
+ * type: 'authentication type e.g. email'
82
+ * }).then(function (response) {
83
+ * // your success code here
84
+ * }).catch(function(ex) {
85
+ * // your failure code here
86
+ * });
87
+ * ```
88
+ */
89
+ function cancelMFA(options, headers) {
90
+ const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/cancel/" + options.type;
91
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST", undefined, headers);
92
+ }
93
+ exports.cancelMFA = cancelMFA;
94
+ /**
95
+ * To get list of all verification type configured, call **getAllVerificationList()**. access_token must be passed as function parameter.
96
+ * @example
97
+ * ```js
98
+ * const access_token = "your access token";
99
+ *
100
+ * cidaas.getAllVerificationList(access_token)
101
+ * .then(function (response) {
102
+ * // type your code here
103
+ * })
104
+ * .catch(function (ex) {
105
+ * // your failure code here
106
+ * });
107
+ * ```
108
+ */
109
+ function getAllVerificationList(access_token, headers) {
110
+ const _serviceURL = `${window.webAuthSettings.authority}/verification-srv/config/list`;
111
+ return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, undefined, "GET", access_token, headers);
112
+ }
113
+ exports.getAllVerificationList = getAllVerificationList;
114
+ /**
115
+ * To initiate enrollment of new multi factor authentication, call **initiateEnrollment()**.
116
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/f85aef6754714-initiate-physical-verification-setup for more details.
117
+ * @example
118
+ * ```js
119
+ * const access_token = "your access token";
120
+ * const options = {
121
+ * verification_type: 'one of verification_type such as fido2, face, ivr',
122
+ * deviceInfo: {
123
+ * deviceId: '',
124
+ * location: {lat: '', lon: ''}
125
+ * }
126
+ * }
127
+ *
128
+ * cidaas.initiateEnrollment(options, access_token)
129
+ * .then(function (response) {
130
+ * // type your code here
131
+ * })
132
+ * .catch(function (ex) {
133
+ * // your failure code here
134
+ * });
135
+ * ```
136
+ */
137
+ function initiateEnrollment(options, accessToken) {
138
+ const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/initiate/" + options.verification_type;
139
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST", accessToken);
140
+ }
141
+ exports.initiateEnrollment = initiateEnrollment;
142
+ /**
143
+ * to get the status of MFA enrollment, call **getEnrollmentStatus()**.
144
+ * 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.
145
+ * @example
146
+ * ```js
147
+ * cidaas.getEnrollmentStatus('statusId from initiateEnrollment()', 'your access token')
148
+ * .then(function (response) {
149
+ * // type your code here
150
+ * })
151
+ * .catch(function (ex) {
152
+ * // your failure code here
153
+ * });
154
+ * ```
155
+ */
156
+ function getEnrollmentStatus(status_id, accessToken, headers) {
157
+ const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/notification/status/" + status_id;
158
+ return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, undefined, "POST", accessToken, headers);
159
+ }
160
+ exports.getEnrollmentStatus = getEnrollmentStatus;
161
+ /**
162
+ * to finish enrollment process of new multi factor authentication, call **enrollVerification()**.
163
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/20ec76e937b27-enroll-physical-verification-setup for more details.
164
+ * @example
165
+ * ```js
166
+ * const fidoPayload = {
167
+ * sub: 'your sub',
168
+ * exchange_id: 'exchange_id from initiateEnrollment()',
169
+ * verification_type: 'fido2',
170
+ * fido2_client_response: {
171
+ * client_response: 'client_response from doing fido process',
172
+ * fidoRequestId: 'fidoRequestId from initiateEnrollment',
173
+ * }
174
+ * }
175
+ * cidaas.enrollVerification(fidoPayload)
176
+ * .then(function (response) {
177
+ * // type your code here
178
+ * })
179
+ * .catch(function (ex) {
180
+ * // your failure code here
181
+ * });
182
+ * ```
183
+ */
184
+ function enrollVerification(options) {
185
+ const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/enroll/" + options.verification_type;
186
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
187
+ }
188
+ exports.enrollVerification = enrollVerification;
189
+ /**
190
+ * to see details of configured verification type, call **checkVerificationTypeConfigured()**.
191
+ * @example
192
+ * ```js
193
+ * cidaas.checkVerificationTypeConfigured({
194
+ * request_id: 'your request id',
195
+ * email: 'your email',
196
+ * verification_type: 'email'
197
+ * }).then(function (response) {
198
+ * // type your code here
199
+ * })
200
+ * .catch(function (ex) {
201
+ * // your failure code here
202
+ * });
203
+ * ```
204
+ */
205
+ function checkVerificationTypeConfigured(options) {
206
+ const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/public/configured/check/" + options.verification_type;
207
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
208
+ }
209
+ exports.checkVerificationTypeConfigured = checkVerificationTypeConfigured;
210
+ /**
211
+ * to initiate multi factor auhentication, call **initiateMFA()**.
212
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/2a3ea581bb249-initiate-verification for more details.
213
+ * @example
214
+ * ```js
215
+ * const access_token = "your access token";
216
+ * const options = {
217
+ * request_id: 'your request id',
218
+ * usage_type: 'PASSWORDLESS_AUTHENTICATION',
219
+ * type: 'email'
220
+ * email: 'your email'
221
+ * }
222
+ * }
223
+ *
224
+ * cidaas.initiateMFA(options, access_token)
225
+ * .then(function (response) {
226
+ * // type your code here
227
+ * })
228
+ * .catch(function (ex) {
229
+ * // your failure code here
230
+ * });
231
+ * ```
232
+ */
233
+ function initiateMFA(options, accessToken, headers) {
234
+ const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/initiate/" + options.type;
235
+ // BREAKING TODO: remove accessToken parameter in the next major release
236
+ if (accessToken) {
237
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", accessToken, headers);
238
+ }
239
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", undefined, headers);
240
+ }
241
+ exports.initiateMFA = initiateMFA;
242
+ /**
243
+ * to authenticate with multi factor auhentication, call **authenticateMFA()**.
244
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/1aa38936252d6-perform-the-authentication-method for more details.
245
+ * @example
246
+ * ```js
247
+ * cidaas.authenticateMFA({
248
+ * type: 'email',
249
+ * client_id: 'your client id',
250
+ * exchange_id: exchange id from initiateMFA(),
251
+ * pass_code: 'code to authenticate'
252
+ * }).then(function (response) {
253
+ * // type your code here
254
+ * })
255
+ * .catch(function (ex) {
256
+ * // your failure code here
257
+ * });
258
+ * ```
259
+ */
260
+ function authenticateMFA(options, headers) {
261
+ const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/authenticate/" + options.type;
262
+ return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST", undefined, headers);
263
+ }
264
+ exports.authenticateMFA = authenticateMFA;
265
+ /**
266
+ * to initiate verification process, call **initiateVerification**
267
+ */
268
+ function initiateVerification(options, trackId, method) {
269
+ const serviceURL = window.webAuthSettings.authority + '/verification-actions-srv/setup/' + method + '/initiate/' + trackId;
270
+ return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'POST');
271
+ }
272
+ exports.initiateVerification = initiateVerification;
273
+ /**
274
+ * to finish configuring verification process, call **configureVerification**
275
+ */
276
+ function configureVerification(options, method) {
277
+ const serviceURL = window.webAuthSettings.authority + '/verification-actions-srv/setup/' + method + '/verification';
278
+ return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'POST');
279
+ }
280
+ exports.configureVerification = configureVerification;
281
+ /**
282
+ * to configure friendly name, call **configureFriendlyName**
283
+ */
284
+ function configureFriendlyName(options, trackId, method) {
285
+ const serviceURL = window.webAuthSettings.authority + '/verification-actions-srv/setup/users/friendlyname/' + method.toUpperCase() + '/' + trackId;
286
+ return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'PUT');
287
+ }
288
+ exports.configureFriendlyName = configureFriendlyName;
@@ -0,0 +1,158 @@
1
+ import { ProcessingType } from "../common/Common.model";
2
+ export interface InitiateAccountVerificationRequest {
3
+ /** email of user */
4
+ email?: string;
5
+ /** mobile number of user */
6
+ mobile?: string;
7
+ /** phone number of user */
8
+ phone?: string;
9
+ /** username of user */
10
+ username?: string;
11
+ /** described which medium (email, mobile, username) to be used for verifying user */
12
+ verificationMedium?: string;
13
+ /**
14
+ * can be either CODE, LINK, or GENERAL
15
+ * BREAKING TODO: change type to ProcessingType only in next major version
16
+ * */
17
+ processingType?: ProcessingType | string;
18
+ /** Request id returned from the authorization call */
19
+ requestId?: string;
20
+ /** Unique identifier of client app, can be found in app setting under admin ui */
21
+ client_id?: string;
22
+ /** Specify the url where the user needs to be redirected after successful login */
23
+ redirect_uri?: string;
24
+ /** response type expected for the process */
25
+ response_type?: string;
26
+ /** Subject (User) identifier */
27
+ sub?: string;
28
+ /** Refers to a template or predefined message/key associated with the opt-in reminder. */
29
+ templateKey?: string;
30
+ /** name of user */
31
+ name?: string;
32
+ /** Response language, which is configured in cidaas admin ui */
33
+ accept_language?: string;
34
+ }
35
+ export interface VerifyAccountRequest {
36
+ /** accvid will be given after initiate account verification process */
37
+ accvid: string;
38
+ /** code which has been sent to predetermined verification medium */
39
+ code: string;
40
+ }
41
+ export interface GetMFAListRequest {
42
+ /** email of user */
43
+ email: string;
44
+ /** Request id returned from the authorization call */
45
+ request_id: string;
46
+ }
47
+ export interface CancelMFARequest {
48
+ /** comes from initiate MFA process */
49
+ exchange_id: string;
50
+ /** reason of cancellation */
51
+ reason: string;
52
+ /** MFA type */
53
+ type: string;
54
+ }
55
+ export interface InitiateEnrollmentRequest {
56
+ /** type of MFA to be used for verification */
57
+ verification_type: string;
58
+ /** details of the device */
59
+ deviceInfo?: DeviceInfo;
60
+ }
61
+ export interface EnrollVerificationRequest {
62
+ /** subject (User) identifier */
63
+ sub?: string;
64
+ /** comes from initiate MFA process */
65
+ exchange_id?: string;
66
+ /** type of MFA to be used for verification */
67
+ verification_type?: string;
68
+ /** the message that a client sends to a server after successfully authenticating a user using public key cryptography */
69
+ fido2_client_response?: FIDO2EnrollEntity;
70
+ /** id of the device */
71
+ device_id?: string;
72
+ /** unique identifier of client app, can be found in app setting under admin ui */
73
+ client_id?: string;
74
+ /** code to authenticae */
75
+ pass_code?: string;
76
+ }
77
+ export interface CheckVerificationTypeConfiguredRequest extends GetMFAListRequest {
78
+ /** type of MFA to be used for verification */
79
+ verification_type: string;
80
+ }
81
+ export interface InitiateMFARequest {
82
+ /** user subject identifier */
83
+ sub?: string;
84
+ /** user email */
85
+ email?: string;
86
+ /** user mobile number */
87
+ mobile_number?: string;
88
+ /** application request id, generated by oauth call */
89
+ request_id?: string;
90
+ /** id for medium type (email, sms) */
91
+ medium_id?: string;
92
+ /** Type of authentication */
93
+ usage_type?: string;
94
+ /** medium type */
95
+ type?: string;
96
+ /** predetermined custom fields */
97
+ customFields?: {
98
+ [key: string]: string;
99
+ };
100
+ }
101
+ export interface AuthenticateMFARequest {
102
+ /** comes from initiate MFA process */
103
+ exchange_id: string;
104
+ /** code which has been sent to predetermined verification type */
105
+ pass_code: string;
106
+ /** type of MFA to be used for verification */
107
+ type: string;
108
+ /** Subject (User) identifier */
109
+ sub?: string;
110
+ /** id generated on Authz request */
111
+ requestId?: PerformanceServerTiming;
112
+ }
113
+ export interface DeviceInfo {
114
+ /** id of the device */
115
+ deviceId: string;
116
+ /** location details of the device */
117
+ location: Location;
118
+ }
119
+ export interface Location {
120
+ /** latitude of the device */
121
+ lat: string;
122
+ /** longitude of the device */
123
+ lon: string;
124
+ }
125
+ export interface FIDO2EnrollEntity {
126
+ /** details of client response */
127
+ client_response?: any;
128
+ /** unique identifier assigned to a FIDO2 authentication request. The value comes from initiate enrollment process */
129
+ fidoRequestId?: string;
130
+ }
131
+ export interface InitiateVerificationRequest {
132
+ /** mobile number */
133
+ mobile_number?: string;
134
+ /** phone number */
135
+ phone?: string;
136
+ /** email address */
137
+ email?: string;
138
+ }
139
+ export interface ConfigureVerificationRequest {
140
+ /** comes from initiate MFA process */
141
+ exchange_id: string;
142
+ /** subject (User) identifier */
143
+ sub: string;
144
+ /** code which has been sent to predetermined verification type */
145
+ pass_code: string;
146
+ }
147
+ export interface ConfigureFriendlyNameRequest {
148
+ /** id received from status verification API */
149
+ id?: string;
150
+ /** physical verification id received from status verification api */
151
+ ph_id?: string;
152
+ /** id recevied from enrollment API */
153
+ device_id?: string;
154
+ /** friendly name for the device */
155
+ friendly_name?: string;
156
+ /** subject (User) identifier */
157
+ sub?: string;
158
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });