cidaas-javascript-sdk 3.1.3 → 3.1.4

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,247 +0,0 @@
1
- import {
2
- IConfiguredListRequestEntity,
3
- IInitVerificationAuthenticationRequestEntity,
4
- FidoSetupEntity,
5
- IEnrollVerificationSetupRequestEntity,
6
- IAuthVerificationAuthenticationRequestEntity,
7
- FaceVerificationAuthenticationRequestEntity,
8
- AccountVerificationRequestEntity,
9
- } from "./Entities"
10
- import { Helper, CustomException } from "./Helper";
11
-
12
- export namespace VerificationService {
13
- /**
14
- * initiate verification
15
- * @param options
16
- * @returns
17
- */
18
- export function initiateAccountVerification(options: AccountVerificationRequestEntity) {
19
- try {
20
- const url = window.webAuthSettings.authority + "/verification-srv/account/initiate";
21
- let form = Helper.createForm(url, options)
22
- document.body.appendChild(form);
23
- form.submit();
24
- } catch (ex) {
25
- throw new CustomException(ex, 417);
26
- }
27
- };
28
-
29
- /**
30
- * initiate verification and return response
31
- * @param options
32
- * @returns
33
- */
34
- export function initiateAccountVerificationAsynFn(options: AccountVerificationRequestEntity) {
35
- try {
36
- var searchParams = new URLSearchParams(options);
37
- var response = fetch(window.webAuthSettings.authority + "/verification-srv/account/initiate", {
38
- method: "POST",
39
- redirect: "follow",
40
- body: searchParams.toString(),
41
- headers: {
42
- "Content-Type": "application/x-www-form-urlencoded",
43
- }
44
- });
45
-
46
- return response;
47
- } catch (ex) {
48
- throw new CustomException(ex, 417);
49
- }
50
-
51
- };
52
-
53
- /**
54
- * verify account
55
- * @param options
56
- * @returns
57
- */
58
- export function verifyAccount(options: {
59
- accvid: string;
60
- code: string;
61
- }) {
62
- var _serviceURL = window.webAuthSettings.authority + "/verification-srv/account/verify";
63
- return Helper.createPostPromise(options, _serviceURL, false,"POST");
64
- };
65
-
66
- /**
67
- * get mfa list v2
68
- * @param options
69
- * @returns
70
- */
71
- export function getMFAListV2(options: IConfiguredListRequestEntity) {
72
- var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/public/configured/list";
73
- return Helper.createPostPromise(options, _serviceURL, false,"POST");
74
- };
75
-
76
- /**
77
- * cancel mfa v2
78
- * @param options
79
- * @returns
80
- */
81
- export function cancelMFAV2(options: {
82
- exchange_id: string;
83
- reason: string;
84
- type: string;
85
- }) {
86
- var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/cancel/" + options.type;
87
- return Helper.createPostPromise(options, _serviceURL, undefined,"POST");
88
- };
89
-
90
- /**
91
- * @param access_token
92
- * @returns
93
- */
94
- export function getAllVerificationList(access_token: string) {
95
- const _serviceURL = `${window.webAuthSettings.authority}/verification-srv/config/list`;
96
- return Helper.createPostPromise(undefined, _serviceURL,undefined, "GET", access_token);
97
- };
98
-
99
- /**
100
- * enrollVerification
101
- * @param options
102
- * @returns
103
- */
104
- export function enrollVerification(options: IEnrollVerificationSetupRequestEntity) {
105
- var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/enroll/" + options.verification_type;
106
- return Helper.createPostPromise(options, _serviceURL, undefined,"POST");
107
- };
108
-
109
- /**
110
- * @deprecated This function is no longer supported, instead use {this.updateStatus()}
111
- * @param status_id
112
- * @returns
113
- */
114
- export function updateSocket(status_id: string) {
115
- var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/notification/status/" + status_id;
116
- return Helper.createPostPromise(undefined, _serviceURL, undefined,"POST");
117
- };
118
-
119
- /**
120
- * update the status of notification
121
- * @param status_id
122
- * @returns
123
- */
124
- export function updateStatus(status_id: string) {
125
- var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/notification/status/" + status_id;
126
- return Helper.createPostPromise(undefined, _serviceURL, undefined,"POST");
127
- };
128
-
129
- /**
130
- * setupFidoVerification
131
- * @param options
132
- * @returns
133
- */
134
- export function setupFidoVerification(options: FidoSetupEntity) {
135
- var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/initiate/suggestmfa/" + options.verification_type;
136
- return Helper.createPostPromise(options, _serviceURL, undefined,"POST");
137
- };
138
-
139
- /**
140
- * checkVerificationTypeConfigured
141
- * @param options
142
- * @returns
143
- */
144
- export function checkVerificationTypeConfigured(options: IConfiguredListRequestEntity) {
145
- var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/public/configured/check/" + options.verification_type;
146
- return Helper.createPostPromise(options, _serviceURL, undefined,"POST");
147
- };
148
-
149
- /**
150
- * initiate mfa v2
151
- * @param options
152
- * @returns
153
- */
154
- export function initiateMFAV2(options: IInitVerificationAuthenticationRequestEntity) {
155
- var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/initiate/" + options.type;
156
- return Helper.createPostPromise(options, _serviceURL, false,"POST");
157
- };
158
-
159
- /**
160
- * @deprecated
161
- * @param options
162
- * @param verificationType
163
- * @returns
164
- */
165
- export function initiateMfaV1(options: any, verificationType: string) {
166
- var _serviceURL = window.webAuthSettings.authority + "/verification-srv/" + verificationType.toLowerCase() + "/initiate";
167
- return Helper.createPostPromise(options, _serviceURL, false,"POST");
168
- }
169
-
170
- /**
171
- * authenticate mfa v2
172
- * @param options
173
- * @returns
174
- */
175
- export function authenticateMFAV2(options: IAuthVerificationAuthenticationRequestEntity) {
176
- var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/authenticate/" + options.type;
177
- return Helper.createPostPromise(options, _serviceURL, undefined,"POST");
178
- };
179
-
180
- /**
181
- * authenticateVerification form type (for face)
182
- * @param options
183
- * @returns
184
- */
185
- export function authenticateFaceVerification(options: FaceVerificationAuthenticationRequestEntity) {
186
- return new Promise((resolve, reject) => {
187
- try {
188
- var http = new XMLHttpRequest();
189
- var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/authenticate/face";
190
- http.onreadystatechange = function () {
191
- if (http.readyState == 4) {
192
- if (http.responseText) {
193
- resolve(JSON.parse(http.responseText));
194
- } else {
195
- resolve(undefined);
196
- }
197
- }
198
- };
199
- http.open("POST", _serviceURL, true);
200
- http.setRequestHeader("Content-type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");
201
- if (window.localeSettings) {
202
- http.setRequestHeader("accept-language", window.localeSettings);
203
- }
204
- http.send(JSON.stringify(options));
205
- } catch (ex) {
206
- reject(ex);
207
- }
208
- });
209
- };
210
-
211
- /**
212
- * @deprecated
213
- * setup verification - v1
214
- * @param options
215
- * @param access_token
216
- * @param verificationType
217
- * @returns
218
- */
219
- export function setupVerificationV1(options: any, access_token: string, verificationType: string) {
220
- var _serviceURL = window.webAuthSettings.authority + "/verification-srv/" + verificationType.toLowerCase() + "/setup";
221
- return Helper.createPostPromise(options, _serviceURL, false,"POST", access_token);
222
- }
223
-
224
- /**
225
- * @deprecated
226
- * enroll verification - v1
227
- * @param options
228
- * @param access_token
229
- * @param verificationType
230
- * @returns
231
- */
232
- export function enrollVerificationV1(options: any, access_token: string, verificationType: string) {
233
- var _serviceURL = window.webAuthSettings.authority + "/verification-srv/" + verificationType.toLowerCase() + "/enroll";
234
- return Helper.createPostPromise(options, _serviceURL, false,"POST", access_token);
235
- }
236
-
237
- /**
238
- * @deprecated
239
- * authenticate mfa - v1
240
- * @param verificationType
241
- * @returns
242
- */
243
- export function authenticateMfaV1(options: any, verificationType: string) {
244
- var _serviceURL = window.webAuthSettings.authority + "/verification-srv/" + verificationType.toLowerCase() + "/authenticate";
245
- return Helper.createPostPromise(options, _serviceURL, false,"POST");
246
- }
247
- }