cidaas-javascript-sdk 4.2.3 → 4.3.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.
- package/CHANGELOG.md +23 -3
- package/README.md +3 -0
- package/dist/authentication/{index.d.ts → Authentication.d.ts} +2 -2
- package/dist/authentication/{index.js → Authentication.js} +21 -10
- package/dist/authentication/Authentication.model.js +23 -0
- package/dist/common/Common.model.d.ts +37 -0
- package/dist/common/Common.model.js +26 -0
- package/dist/{web-auth → common}/Helper.d.ts +6 -6
- package/dist/{web-auth → common}/Helper.js +17 -12
- package/dist/common/JwtHelper.d.ts +8 -0
- package/dist/{web-auth → common}/JwtHelper.js +13 -9
- package/dist/common/User.model.d.ts +134 -0
- package/dist/common/User.model.js +2 -0
- package/dist/consent-service/ConsentService.d.ts +96 -0
- package/dist/consent-service/ConsentService.js +127 -0
- package/dist/consent-service/ConsentService.model.d.ts +102 -0
- package/dist/consent-service/ConsentService.model.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -3
- package/dist/login-service/LoginService.d.ts +143 -0
- package/dist/login-service/LoginService.js +247 -0
- package/dist/login-service/LoginService.model.d.ts +138 -0
- package/dist/login-service/LoginService.model.js +13 -0
- package/dist/token-service/TokenService.d.ts +139 -0
- package/dist/token-service/TokenService.js +242 -0
- package/dist/token-service/TokenService.model.d.ts +149 -0
- package/dist/token-service/TokenService.model.js +43 -0
- package/dist/user-service/UserService.d.ts +317 -0
- package/dist/user-service/UserService.js +451 -0
- package/dist/user-service/UserService.model.d.ts +142 -0
- package/dist/user-service/UserService.model.js +10 -0
- package/dist/verification-service/VerificationService.d.ts +218 -0
- package/dist/verification-service/VerificationService.js +288 -0
- package/dist/verification-service/VerificationService.model.d.ts +158 -0
- package/dist/verification-service/VerificationService.model.js +2 -0
- package/dist/web-auth/WebAuth.d.ts +110 -177
- package/dist/web-auth/WebAuth.js +98 -123
- package/dist/web-auth/webauth.model.d.ts +50 -0
- package/dist/web-auth/webauth.model.js +2 -0
- package/package.json +1 -1
- package/dist/authentication/authentication.model.js +0 -18
- package/dist/web-auth/ConsentService.d.ts +0 -123
- package/dist/web-auth/ConsentService.js +0 -133
- package/dist/web-auth/Entities.d.ts +0 -516
- package/dist/web-auth/Entities.js +0 -59
- package/dist/web-auth/JwtHelper.d.ts +0 -7
- package/dist/web-auth/LoginService.d.ts +0 -165
- package/dist/web-auth/LoginService.js +0 -243
- package/dist/web-auth/TokenService.d.ts +0 -143
- package/dist/web-auth/TokenService.js +0 -246
- package/dist/web-auth/UserService.d.ts +0 -345
- package/dist/web-auth/UserService.js +0 -468
- package/dist/web-auth/VerificationService.d.ts +0 -224
- package/dist/web-auth/VerificationService.js +0 -275
- /package/dist/authentication/{authentication.model.d.ts → Authentication.model.d.ts} +0 -0
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
import { Helper, CustomException } from "./Helper";
|
|
2
|
-
export var VerificationService;
|
|
3
|
-
(function (VerificationService) {
|
|
4
|
-
/**
|
|
5
|
-
* To initiate the account verification, call **initiateAccountVerification()**. This will send verification code email or sms or ivr based on the verificationMedium you mentioned.
|
|
6
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/cgans5erj5alg-init-account-verification for more details.
|
|
7
|
-
* @example
|
|
8
|
-
* ```js
|
|
9
|
-
* cidaas.initiateAccountVerification({
|
|
10
|
-
* verificationMedium: 'email',
|
|
11
|
-
* requestId: 'your requestId',
|
|
12
|
-
* processingType: 'CODE',
|
|
13
|
-
* email: 'your email'
|
|
14
|
-
* }).then(function (response) {
|
|
15
|
-
* // the response will give you account verification details.
|
|
16
|
-
* }).catch(function(ex) {
|
|
17
|
-
* // your failure code here
|
|
18
|
-
* });
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
function initiateAccountVerification(options) {
|
|
22
|
-
try {
|
|
23
|
-
const url = window.webAuthSettings.authority + "/verification-srv/account/initiate";
|
|
24
|
-
let form = Helper.createForm(url, options);
|
|
25
|
-
document.body.appendChild(form);
|
|
26
|
-
form.submit();
|
|
27
|
-
}
|
|
28
|
-
catch (ex) {
|
|
29
|
-
throw new CustomException(ex, 417);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
VerificationService.initiateAccountVerification = initiateAccountVerification;
|
|
33
|
-
;
|
|
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) {
|
|
50
|
-
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/account/verify";
|
|
51
|
-
return Helper.createHttpPromise(options, _serviceURL, false, "POST");
|
|
52
|
-
}
|
|
53
|
-
VerificationService.verifyAccount = verifyAccount;
|
|
54
|
-
;
|
|
55
|
-
/**
|
|
56
|
-
* To get all configured multi factor authentication, call **getMFAList()**.
|
|
57
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/ee688a9c52b63-list-of-configured-verification-methods for more details.
|
|
58
|
-
* @example
|
|
59
|
-
* ```js
|
|
60
|
-
* cidaas.getMFAList({
|
|
61
|
-
* request_id: 'your request id',
|
|
62
|
-
* email: 'your email'
|
|
63
|
-
* }).then(function (response) {
|
|
64
|
-
* // the response will give you list of configured multi factor authentication
|
|
65
|
-
* }).catch(function(ex) {
|
|
66
|
-
* // your failure code here
|
|
67
|
-
* });
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
function getMFAList(options) {
|
|
71
|
-
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/public/configured/list";
|
|
72
|
-
return Helper.createHttpPromise(options, _serviceURL, false, "POST");
|
|
73
|
-
}
|
|
74
|
-
VerificationService.getMFAList = getMFAList;
|
|
75
|
-
;
|
|
76
|
-
/**
|
|
77
|
-
* to cancel mfa process, call **cancelMFA()**.
|
|
78
|
-
* @example
|
|
79
|
-
* ```js
|
|
80
|
-
* cidaas.cancelMFA({
|
|
81
|
-
* exchange_id: 'exchange id from initiateMFA() response',
|
|
82
|
-
* reason: 'reason of mfa cancelation',
|
|
83
|
-
* type: 'authentication type e.g. email'
|
|
84
|
-
* }).then(function (response) {
|
|
85
|
-
* // your success code here
|
|
86
|
-
* }).catch(function(ex) {
|
|
87
|
-
* // your failure code here
|
|
88
|
-
* });
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
function cancelMFA(options) {
|
|
92
|
-
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/cancel/" + options.type;
|
|
93
|
-
return Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
94
|
-
}
|
|
95
|
-
VerificationService.cancelMFA = cancelMFA;
|
|
96
|
-
;
|
|
97
|
-
/**
|
|
98
|
-
* To get list of all verification type configured, call **getAllVerificationList()**. access_token must be passed as function parameter.
|
|
99
|
-
* @example
|
|
100
|
-
* ```js
|
|
101
|
-
* const access_token = "your access token";
|
|
102
|
-
*
|
|
103
|
-
* cidaas.getAllVerificationList(access_token)
|
|
104
|
-
* .then(function (response) {
|
|
105
|
-
* // type your code here
|
|
106
|
-
* })
|
|
107
|
-
* .catch(function (ex) {
|
|
108
|
-
* // your failure code here
|
|
109
|
-
* });
|
|
110
|
-
* ```
|
|
111
|
-
*/
|
|
112
|
-
function getAllVerificationList(access_token) {
|
|
113
|
-
const _serviceURL = `${window.webAuthSettings.authority}/verification-srv/config/list`;
|
|
114
|
-
return Helper.createHttpPromise(undefined, _serviceURL, undefined, "GET", access_token);
|
|
115
|
-
}
|
|
116
|
-
VerificationService.getAllVerificationList = getAllVerificationList;
|
|
117
|
-
;
|
|
118
|
-
/**
|
|
119
|
-
* To initiate enrollment of new multi factor authentication, call **initiateEnrollment()**.
|
|
120
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/f85aef6754714-initiate-physical-verification-setup for more details.
|
|
121
|
-
* @example
|
|
122
|
-
* ```js
|
|
123
|
-
* const access_token = "your access token";
|
|
124
|
-
* const options = {
|
|
125
|
-
* verification_type: 'one of verification_type such as fido2, face, ivr',
|
|
126
|
-
* deviceInfo: {
|
|
127
|
-
* deviceId: '',
|
|
128
|
-
* location: {lat: '', lon: ''}
|
|
129
|
-
* }
|
|
130
|
-
* }
|
|
131
|
-
*
|
|
132
|
-
* cidaas.initiateEnrollment(options, access_token)
|
|
133
|
-
* .then(function (response) {
|
|
134
|
-
* // type your code here
|
|
135
|
-
* })
|
|
136
|
-
* .catch(function (ex) {
|
|
137
|
-
* // your failure code here
|
|
138
|
-
* });
|
|
139
|
-
* ```
|
|
140
|
-
*/
|
|
141
|
-
function initiateEnrollment(options, accessToken) {
|
|
142
|
-
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/initiate/" + options.verification_type;
|
|
143
|
-
return Helper.createHttpPromise(options, _serviceURL, undefined, "POST", accessToken);
|
|
144
|
-
}
|
|
145
|
-
VerificationService.initiateEnrollment = initiateEnrollment;
|
|
146
|
-
;
|
|
147
|
-
/**
|
|
148
|
-
* to get the status of MFA enrollment, call **getEnrollmentStatus()**.
|
|
149
|
-
* 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.
|
|
150
|
-
* @example
|
|
151
|
-
* ```js
|
|
152
|
-
* cidaas.getEnrollmentStatus('statusId from initiateEnrollment()', 'your access token')
|
|
153
|
-
* .then(function (response) {
|
|
154
|
-
* // type your code here
|
|
155
|
-
* })
|
|
156
|
-
* .catch(function (ex) {
|
|
157
|
-
* // your failure code here
|
|
158
|
-
* });
|
|
159
|
-
* ```
|
|
160
|
-
*/
|
|
161
|
-
function getEnrollmentStatus(status_id, accessToken) {
|
|
162
|
-
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/notification/status/" + status_id;
|
|
163
|
-
return Helper.createHttpPromise(undefined, _serviceURL, undefined, "POST", accessToken);
|
|
164
|
-
}
|
|
165
|
-
VerificationService.getEnrollmentStatus = getEnrollmentStatus;
|
|
166
|
-
;
|
|
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
|
-
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/enroll/" + options.verification_type;
|
|
192
|
-
return Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
193
|
-
}
|
|
194
|
-
VerificationService.enrollVerification = enrollVerification;
|
|
195
|
-
;
|
|
196
|
-
/**
|
|
197
|
-
* to see details of configured verification type, call **checkVerificationTypeConfigured()**.
|
|
198
|
-
* @example
|
|
199
|
-
* ```js
|
|
200
|
-
* cidaas.checkVerificationTypeConfigured({
|
|
201
|
-
* request_id: 'your request id',
|
|
202
|
-
* email: 'your email',
|
|
203
|
-
* verification_type: 'email'
|
|
204
|
-
* }).then(function (response) {
|
|
205
|
-
* // type your code here
|
|
206
|
-
* })
|
|
207
|
-
* .catch(function (ex) {
|
|
208
|
-
* // your failure code here
|
|
209
|
-
* });
|
|
210
|
-
* ```
|
|
211
|
-
*/
|
|
212
|
-
function checkVerificationTypeConfigured(options) {
|
|
213
|
-
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/public/configured/check/" + options.verification_type;
|
|
214
|
-
return Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
215
|
-
}
|
|
216
|
-
VerificationService.checkVerificationTypeConfigured = checkVerificationTypeConfigured;
|
|
217
|
-
;
|
|
218
|
-
/**
|
|
219
|
-
* to initiate multi factor auhentication, call **initiateMFA()**.
|
|
220
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/2a3ea581bb249-initiate-verification for more details.
|
|
221
|
-
* @example
|
|
222
|
-
* ```js
|
|
223
|
-
* const access_token = "your access token";
|
|
224
|
-
* const options = {
|
|
225
|
-
* request_id: 'your request id',
|
|
226
|
-
* usage_type: 'PASSWORDLESS_AUTHENTICATION',
|
|
227
|
-
* type: 'email'
|
|
228
|
-
* email: 'your email'
|
|
229
|
-
* }
|
|
230
|
-
* }
|
|
231
|
-
*
|
|
232
|
-
* cidaas.initiateMFA(options, access_token)
|
|
233
|
-
* .then(function (response) {
|
|
234
|
-
* // type your code here
|
|
235
|
-
* })
|
|
236
|
-
* .catch(function (ex) {
|
|
237
|
-
* // your failure code here
|
|
238
|
-
* });
|
|
239
|
-
* ```
|
|
240
|
-
*/
|
|
241
|
-
function initiateMFA(options, accessToken) {
|
|
242
|
-
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/initiate/" + options.type;
|
|
243
|
-
// TODO: remove accessToken parameter in the next major release
|
|
244
|
-
if (accessToken) {
|
|
245
|
-
return Helper.createHttpPromise(options, _serviceURL, false, "POST", accessToken);
|
|
246
|
-
}
|
|
247
|
-
return Helper.createHttpPromise(options, _serviceURL, false, "POST");
|
|
248
|
-
}
|
|
249
|
-
VerificationService.initiateMFA = initiateMFA;
|
|
250
|
-
;
|
|
251
|
-
/**
|
|
252
|
-
* to authenticate with multi factor auhentication, call **authenticateMFA()**.
|
|
253
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/1aa38936252d6-perform-the-authentication-method for more details.
|
|
254
|
-
* @example
|
|
255
|
-
* ```js
|
|
256
|
-
* cidaas.authenticateMFA({
|
|
257
|
-
* type: 'email',
|
|
258
|
-
* client_id: 'your client id',
|
|
259
|
-
* exchange_id: exchange id from initiateMFA(),
|
|
260
|
-
* pass_code: 'code to authenticate'
|
|
261
|
-
* }).then(function (response) {
|
|
262
|
-
* // type your code here
|
|
263
|
-
* })
|
|
264
|
-
* .catch(function (ex) {
|
|
265
|
-
* // your failure code here
|
|
266
|
-
* });
|
|
267
|
-
* ```
|
|
268
|
-
*/
|
|
269
|
-
function authenticateMFA(options) {
|
|
270
|
-
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/authenticate/" + options.type;
|
|
271
|
-
return Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
272
|
-
}
|
|
273
|
-
VerificationService.authenticateMFA = authenticateMFA;
|
|
274
|
-
;
|
|
275
|
-
})(VerificationService || (VerificationService = {}));
|
|
File without changes
|