cidaas-javascript-sdk 2.4.3 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/README.md +2 -3
  3. package/package.json +10 -12
  4. package/src/main/authentication/index.ts +223 -0
  5. package/src/main/global.d.ts +10 -0
  6. package/src/main/index.ts +6 -0
  7. package/src/main/web-auth/ConsentService.ts +98 -0
  8. package/src/main/web-auth/Entities.ts +645 -0
  9. package/src/main/web-auth/Helper.ts +75 -0
  10. package/src/main/web-auth/LoginService.ts +248 -0
  11. package/src/main/web-auth/TokenService.ts +196 -0
  12. package/src/main/web-auth/UserService.ts +388 -0
  13. package/src/main/web-auth/VerificationService.ts +267 -0
  14. package/src/main/web-auth/WebAuth.ts +1706 -0
  15. package/types/authentication/index.d.ts +55 -0
  16. package/types/authentication/index.js +262 -0
  17. package/types/index.d.ts +4 -0
  18. package/types/index.js +9 -0
  19. package/types/web-auth/ConsentService.d.ts +59 -0
  20. package/types/web-auth/ConsentService.js +97 -0
  21. package/types/web-auth/Entities.d.ts +567 -0
  22. package/types/web-auth/Entities.js +88 -0
  23. package/types/web-auth/Helper.d.ts +24 -0
  24. package/types/web-auth/Helper.js +89 -0
  25. package/types/web-auth/LoginService.d.ts +102 -0
  26. package/types/web-auth/LoginService.js +248 -0
  27. package/types/web-auth/TokenService.d.ts +48 -0
  28. package/types/web-auth/TokenService.js +210 -0
  29. package/types/web-auth/UserService.d.ts +143 -0
  30. package/types/web-auth/UserService.js +408 -0
  31. package/types/web-auth/VerificationService.d.ts +125 -0
  32. package/types/web-auth/VerificationService.js +273 -0
  33. package/types/web-auth/WebAuth.d.ts +895 -0
  34. package/types/web-auth/WebAuth.js +1767 -0
  35. package/Changelogs.md +0 -29
  36. package/src/main/.gitkeep +0 -0
  37. package/src/main/authentication/index.js +0 -213
  38. package/src/main/index.js +0 -11
  39. package/src/main/web-auth/exception.js +0 -7
  40. package/src/main/web-auth/webauth.js +0 -1899
  41. package/src/test/sum.js +0 -4
  42. package/src/test/test.js +0 -5
  43. package/types/.DS_Store +0 -0
  44. package/types/main/authentication/index.d.ts +0 -15
  45. package/types/main/index.d.ts +0 -5
  46. package/types/main/web-auth/exception.d.ts +0 -7
  47. package/types/main/web-auth/webauth.d.ts +0 -141
  48. package/types/test/sum.d.ts +0 -2
  49. package/types/test/test.d.ts +0 -1
@@ -0,0 +1,273 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.VerificationService = void 0;
4
+ var Helper_1 = require("./Helper");
5
+ var VerificationService;
6
+ (function (VerificationService) {
7
+ /**
8
+ * initiate verification
9
+ * @param options
10
+ * @returns
11
+ */
12
+ function initiateAccountVerification(options) {
13
+ try {
14
+ var url = window.webAuthSettings.authority + "/verification-srv/account/initiate";
15
+ var form = Helper_1.Helper.createForm(url, options);
16
+ document.body.appendChild(form);
17
+ form.submit();
18
+ }
19
+ catch (ex) {
20
+ throw new Helper_1.CustomException(ex, 417);
21
+ }
22
+ }
23
+ VerificationService.initiateAccountVerification = initiateAccountVerification;
24
+ ;
25
+ /**
26
+ * initiate verification and return response
27
+ * @param options
28
+ * @returns
29
+ */
30
+ function initiateAccountVerificationAsynFn(options) {
31
+ try {
32
+ var searchParams = new URLSearchParams(options);
33
+ var response = fetch(window.webAuthSettings.authority + "/verification-srv/account/initiate", {
34
+ method: "POST",
35
+ redirect: "follow",
36
+ body: searchParams.toString(),
37
+ headers: {
38
+ "Content-Type": "application/x-www-form-urlencoded"
39
+ }
40
+ });
41
+ return response;
42
+ }
43
+ catch (ex) {
44
+ throw new Helper_1.CustomException(ex, 417);
45
+ }
46
+ }
47
+ VerificationService.initiateAccountVerificationAsynFn = initiateAccountVerificationAsynFn;
48
+ ;
49
+ /**
50
+ * verify account
51
+ * @param options
52
+ * @returns
53
+ */
54
+ function verifyAccount(options) {
55
+ var _serviceURL = window.webAuthSettings.authority + "/verification-srv/account/verify";
56
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, false);
57
+ }
58
+ VerificationService.verifyAccount = verifyAccount;
59
+ ;
60
+ /**
61
+ * get mfa list v2
62
+ * @param options
63
+ * @returns
64
+ */
65
+ function getMFAListV2(options) {
66
+ var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/public/configured/list";
67
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, false);
68
+ }
69
+ VerificationService.getMFAListV2 = getMFAListV2;
70
+ ;
71
+ /**
72
+ * cancel mfa v2
73
+ * @param options
74
+ * @returns
75
+ */
76
+ function cancelMFAV2(options) {
77
+ var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/cancel/" + options.type;
78
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, undefined);
79
+ }
80
+ VerificationService.cancelMFAV2 = cancelMFAV2;
81
+ ;
82
+ /**
83
+ * @param access_token
84
+ * @returns
85
+ */
86
+ function getAllVerificationList(access_token) {
87
+ return new Promise(function (resolve, reject) {
88
+ try {
89
+ var http = new XMLHttpRequest();
90
+ http.onreadystatechange = function () {
91
+ if (http.readyState == 4) {
92
+ if (http.responseText) {
93
+ resolve(JSON.parse(http.responseText));
94
+ }
95
+ else {
96
+ resolve(undefined);
97
+ }
98
+ }
99
+ };
100
+ http.open("GET", "".concat(window.webAuthSettings.authority, "/verification-srv/config/list"), true);
101
+ http.setRequestHeader("Authorization", "Bearer ".concat(access_token));
102
+ if (window.localeSettings) {
103
+ http.setRequestHeader("accept-language", window.localeSettings);
104
+ }
105
+ http.send();
106
+ }
107
+ catch (ex) {
108
+ reject(ex);
109
+ }
110
+ });
111
+ }
112
+ VerificationService.getAllVerificationList = getAllVerificationList;
113
+ ;
114
+ /**
115
+ * enrollVerification
116
+ * @param options
117
+ * @returns
118
+ */
119
+ function enrollVerification(options) {
120
+ var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/enroll/" + options.verification_type;
121
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, undefined);
122
+ }
123
+ VerificationService.enrollVerification = enrollVerification;
124
+ ;
125
+ /**
126
+ * @deprecated This function is no longer supported, instead use {this.updateStatus()}
127
+ * @param status_id
128
+ * @returns
129
+ */
130
+ function updateSocket(status_id) {
131
+ var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/notification/status/" + status_id;
132
+ return Helper_1.Helper.createPostPromise(undefined, _serviceURL, undefined);
133
+ }
134
+ VerificationService.updateSocket = updateSocket;
135
+ ;
136
+ /**
137
+ * update the status of notification
138
+ * @param status_id
139
+ * @returns
140
+ */
141
+ function updateStatus(status_id) {
142
+ var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/notification/status/" + status_id;
143
+ return Helper_1.Helper.createPostPromise(undefined, _serviceURL, undefined);
144
+ }
145
+ VerificationService.updateStatus = updateStatus;
146
+ ;
147
+ /**
148
+ * setupFidoVerification
149
+ * @param options
150
+ * @returns
151
+ */
152
+ function setupFidoVerification(options) {
153
+ var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/initiate/suggestmfa/" + options.verification_type;
154
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, undefined);
155
+ }
156
+ VerificationService.setupFidoVerification = setupFidoVerification;
157
+ ;
158
+ /**
159
+ * checkVerificationTypeConfigured
160
+ * @param options
161
+ * @returns
162
+ */
163
+ function checkVerificationTypeConfigured(options) {
164
+ var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/public/configured/check/" + options.verification_type;
165
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, undefined);
166
+ }
167
+ VerificationService.checkVerificationTypeConfigured = checkVerificationTypeConfigured;
168
+ ;
169
+ /**
170
+ * initiate mfa v2
171
+ * @param options
172
+ * @returns
173
+ */
174
+ function initiateMFAV2(options) {
175
+ var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/initiate/" + options.type;
176
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, false);
177
+ }
178
+ VerificationService.initiateMFAV2 = initiateMFAV2;
179
+ ;
180
+ /**
181
+ * @deprecated
182
+ * @param options
183
+ * @param verificationType
184
+ * @returns
185
+ */
186
+ function initiateMfaV1(options, verificationType) {
187
+ var _serviceURL = window.webAuthSettings.authority + "/verification-srv/" + verificationType.toLowerCase() + "/initiate";
188
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, false);
189
+ }
190
+ VerificationService.initiateMfaV1 = initiateMfaV1;
191
+ /**
192
+ * authenticate mfa v2
193
+ * @param options
194
+ * @returns
195
+ */
196
+ function authenticateMFAV2(options) {
197
+ var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/authenticate/" + options.type;
198
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, undefined);
199
+ }
200
+ VerificationService.authenticateMFAV2 = authenticateMFAV2;
201
+ ;
202
+ /**
203
+ * authenticateVerification form type (for face)
204
+ * @param options
205
+ * @returns
206
+ */
207
+ function authenticateFaceVerification(options) {
208
+ return new Promise(function (resolve, reject) {
209
+ try {
210
+ var http = new XMLHttpRequest();
211
+ var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/authenticate/face";
212
+ http.onreadystatechange = function () {
213
+ if (http.readyState == 4) {
214
+ if (http.responseText) {
215
+ resolve(JSON.parse(http.responseText));
216
+ }
217
+ else {
218
+ resolve(undefined);
219
+ }
220
+ }
221
+ };
222
+ http.open("POST", _serviceURL, true);
223
+ http.setRequestHeader("Content-type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");
224
+ if (window.localeSettings) {
225
+ http.setRequestHeader("accept-language", window.localeSettings);
226
+ }
227
+ http.send(JSON.stringify(options));
228
+ }
229
+ catch (ex) {
230
+ reject(ex);
231
+ }
232
+ });
233
+ }
234
+ VerificationService.authenticateFaceVerification = authenticateFaceVerification;
235
+ ;
236
+ /**
237
+ * @deprecated
238
+ * setup verification - v1
239
+ * @param options
240
+ * @param access_token
241
+ * @param verificationType
242
+ * @returns
243
+ */
244
+ function setupVerificationV1(options, access_token, verificationType) {
245
+ var _serviceURL = window.webAuthSettings.authority + "/verification-srv/" + verificationType.toLowerCase() + "/setup";
246
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, false, access_token);
247
+ }
248
+ VerificationService.setupVerificationV1 = setupVerificationV1;
249
+ /**
250
+ * @deprecated
251
+ * enroll verification - v1
252
+ * @param options
253
+ * @param access_token
254
+ * @param verificationType
255
+ * @returns
256
+ */
257
+ function enrollVerificationV1(options, access_token, verificationType) {
258
+ var _serviceURL = window.webAuthSettings.authority + "/verification-srv/" + verificationType.toLowerCase() + "/enroll";
259
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, false, access_token);
260
+ }
261
+ VerificationService.enrollVerificationV1 = enrollVerificationV1;
262
+ /**
263
+ * @deprecated
264
+ * authenticate mfa - v1
265
+ * @param verificationType
266
+ * @returns
267
+ */
268
+ function authenticateMfaV1(options, verificationType) {
269
+ var _serviceURL = window.webAuthSettings.authority + "/verification-srv/" + verificationType.toLowerCase() + "/authenticate";
270
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, false);
271
+ }
272
+ VerificationService.authenticateMfaV1 = authenticateMfaV1;
273
+ })(VerificationService = exports.VerificationService || (exports.VerificationService = {}));