cordova-digital-onboarding 1.1.0 → 1.2.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/docs/Changelog.md +6 -0
- package/docs/Device-Activation.md +36 -32
- package/docs/Process-Configuration.md +24 -15
- package/docs/Verifying-User.md +79 -32
- package/docs/_Sidebar.md +1 -1
- package/docs/images/activation-mockup.png +0 -0
- package/docs/images/intro.jpg +0 -0
- package/docs/images/verification-mockup.png +0 -0
- package/lib/index.d.ts +251 -380
- package/lib/index.js +858 -864
- package/package.json +1 -1
- package/plugin.xml +1 -1
package/lib/index.js
CHANGED
|
@@ -74,6 +74,232 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
74
74
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Copyright Wultra s.r.o.
|
|
79
|
+
*
|
|
80
|
+
* This source code is licensed under the Apache License, Version 2.0 license
|
|
81
|
+
* found in the LICENSE file in the root directory of this source tree.
|
|
82
|
+
*
|
|
83
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
84
|
+
*/
|
|
85
|
+
/** Types of the verification state */
|
|
86
|
+
exports.WDOVerificationStateType = void 0;
|
|
87
|
+
(function (WDOVerificationStateType) {
|
|
88
|
+
/**
|
|
89
|
+
* Show the verification introduction screen where the user can start the activation.
|
|
90
|
+
*
|
|
91
|
+
* The next step should be calling the `start()`.
|
|
92
|
+
*/
|
|
93
|
+
WDOVerificationStateType["intro"] = "intro";
|
|
94
|
+
/**
|
|
95
|
+
* Show document selection to the user. Which documents are available and how many
|
|
96
|
+
* can the user select is up to your backend configuration.
|
|
97
|
+
*
|
|
98
|
+
* The next step should be calling the `documentsSetSelectedTypes`.
|
|
99
|
+
*/
|
|
100
|
+
WDOVerificationStateType["documentsToScanSelect"] = "documentsToScanSelect";
|
|
101
|
+
/**
|
|
102
|
+
* User should scan documents - display UI for the user to scan all necessary documents.
|
|
103
|
+
*
|
|
104
|
+
* The next step should be calling the `documentsSubmit`.
|
|
105
|
+
*/
|
|
106
|
+
WDOVerificationStateType["scanDocument"] = "scanDocument";
|
|
107
|
+
/**
|
|
108
|
+
* The system is processing data - show loading with text hint from provided `WDOStatusCheckReason`.
|
|
109
|
+
*
|
|
110
|
+
* The next step should be calling the `status`.
|
|
111
|
+
*/
|
|
112
|
+
WDOVerificationStateType["processing"] = "processing";
|
|
113
|
+
/**
|
|
114
|
+
* The user should be presented with a presence check.
|
|
115
|
+
* Presence check is handled by third-party SDK based on the project setup.
|
|
116
|
+
*
|
|
117
|
+
* The next step should be calling the `presenceCheckInit` to start the check and `presenceCheckSubmit` to
|
|
118
|
+
* mark it finished. Note that these methods won't change the status and it's up to the app to handle the process of the presence check.
|
|
119
|
+
*/
|
|
120
|
+
WDOVerificationStateType["presenceCheck"] = "presenceCheck";
|
|
121
|
+
/**
|
|
122
|
+
* Show enter OTP screen with resend button.
|
|
123
|
+
*
|
|
124
|
+
* The next step should be calling the `verifyOTP` with user-entered OTP.
|
|
125
|
+
* The OTP is usually SMS or email.
|
|
126
|
+
*/
|
|
127
|
+
WDOVerificationStateType["otp"] = "otp";
|
|
128
|
+
/**
|
|
129
|
+
* Show "finish activation" with PIN prompt screen.
|
|
130
|
+
*
|
|
131
|
+
* The next step should be calling the `finishActivation` with user entered PIN.
|
|
132
|
+
*/
|
|
133
|
+
WDOVerificationStateType["finishActivation"] = "finishActivation";
|
|
134
|
+
/**
|
|
135
|
+
* Verification failed and can be restarted
|
|
136
|
+
*
|
|
137
|
+
* The next step should be calling the `restartVerification` or `cancelWholeProcess` based on
|
|
138
|
+
* the user's decision if he wants to try it again or cancel the process.
|
|
139
|
+
*/
|
|
140
|
+
WDOVerificationStateType["failed"] = "failed";
|
|
141
|
+
/**
|
|
142
|
+
* Verification is canceled and the user needs to start again with a new PowerAuth activation.
|
|
143
|
+
*
|
|
144
|
+
* The next step should be calling the `PowerAuth.removeActivationLocal()` and starting activation from scratch.
|
|
145
|
+
*/
|
|
146
|
+
WDOVerificationStateType["endState"] = "endState";
|
|
147
|
+
/**
|
|
148
|
+
* Verification was successfully ended. Continue into your app flow.
|
|
149
|
+
*/
|
|
150
|
+
WDOVerificationStateType["success"] = "success";
|
|
151
|
+
})(exports.WDOVerificationStateType || (exports.WDOVerificationStateType = {}));
|
|
152
|
+
/** The reason why the process ended in a non-recoverable state. */
|
|
153
|
+
exports.WDOEndStateReason = void 0;
|
|
154
|
+
(function (WDOEndStateReason) {
|
|
155
|
+
/**
|
|
156
|
+
* The verification was rejected by the system
|
|
157
|
+
*
|
|
158
|
+
* eg: Fake information, fraud detection, or user is trying repeatedly in a short time.
|
|
159
|
+
* The real reason is not presented to the user and is only audited on the server.
|
|
160
|
+
*/
|
|
161
|
+
WDOEndStateReason["rejected"] = "rejected";
|
|
162
|
+
/**
|
|
163
|
+
* The limit of repeat tries was reached. There is a fixed number of tries that the user can reach
|
|
164
|
+
* before the system stops the process.
|
|
165
|
+
*/
|
|
166
|
+
WDOEndStateReason["limitReached"] = "limitReached";
|
|
167
|
+
/** An unknown reason. */
|
|
168
|
+
WDOEndStateReason["other"] = "other";
|
|
169
|
+
})(exports.WDOEndStateReason || (exports.WDOEndStateReason = {}));
|
|
170
|
+
/**
|
|
171
|
+
* The reason for what we are waiting for. For example, we can wait for documents to be OCRed and matched against the database.
|
|
172
|
+
* Use these values for better loading texts to tell the user what is happening - some tasks may take some time
|
|
173
|
+
* and it would be frustrating to just show a generic loading indicator.
|
|
174
|
+
*/
|
|
175
|
+
exports.WDOStatusCheckReason = void 0;
|
|
176
|
+
(function (WDOStatusCheckReason) {
|
|
177
|
+
WDOStatusCheckReason["unknown"] = "unknown";
|
|
178
|
+
WDOStatusCheckReason["documentUpload"] = "documentUpload";
|
|
179
|
+
WDOStatusCheckReason["documentVerification"] = "documentVerification";
|
|
180
|
+
WDOStatusCheckReason["documentAccepted"] = "documentAccepted";
|
|
181
|
+
WDOStatusCheckReason["documentsCrossVerification"] = "documentsCrossVerification";
|
|
182
|
+
WDOStatusCheckReason["clientVerification"] = "clientVerification";
|
|
183
|
+
WDOStatusCheckReason["clientAccepted"] = "clientAccepted";
|
|
184
|
+
WDOStatusCheckReason["verifyingPresence"] = "verifyingPresence";
|
|
185
|
+
})(exports.WDOStatusCheckReason || (exports.WDOStatusCheckReason = {}));
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Copyright Wultra s.r.o.
|
|
189
|
+
*
|
|
190
|
+
* This source code is licensed under the Apache License, Version 2.0 license
|
|
191
|
+
* found in the LICENSE file in the root directory of this source tree.
|
|
192
|
+
*
|
|
193
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
194
|
+
*/
|
|
195
|
+
var WDOActivationEndpoints = /** @class */ (function () {
|
|
196
|
+
function WDOActivationEndpoints() {
|
|
197
|
+
}
|
|
198
|
+
WDOActivationEndpoints.start = {
|
|
199
|
+
path: "/api/onboarding/start",
|
|
200
|
+
e2eeScope: "APPLICATION",
|
|
201
|
+
returnsData: true
|
|
202
|
+
};
|
|
203
|
+
WDOActivationEndpoints.cancel = {
|
|
204
|
+
path: "/api/onboarding/cleanup",
|
|
205
|
+
e2eeScope: "APPLICATION",
|
|
206
|
+
returnsData: false
|
|
207
|
+
};
|
|
208
|
+
WDOActivationEndpoints.resendOTP = {
|
|
209
|
+
path: "/api/onboarding/otp/resend",
|
|
210
|
+
e2eeScope: "APPLICATION",
|
|
211
|
+
returnsData: false
|
|
212
|
+
};
|
|
213
|
+
WDOActivationEndpoints.getStatus = {
|
|
214
|
+
path: "/api/onboarding/status",
|
|
215
|
+
e2eeScope: "APPLICATION",
|
|
216
|
+
returnsData: true
|
|
217
|
+
};
|
|
218
|
+
return WDOActivationEndpoints;
|
|
219
|
+
}());
|
|
220
|
+
var WDOVerificationEndpoints = /** @class */ (function () {
|
|
221
|
+
function WDOVerificationEndpoints() {
|
|
222
|
+
}
|
|
223
|
+
WDOVerificationEndpoints.getStatus = {
|
|
224
|
+
path: "/api/identity/status",
|
|
225
|
+
e2eeScope: "NONE",
|
|
226
|
+
tokenName: "possession_universal",
|
|
227
|
+
returnsData: true
|
|
228
|
+
};
|
|
229
|
+
WDOVerificationEndpoints.init = {
|
|
230
|
+
path: "/api/identity/init",
|
|
231
|
+
uriId: "/api/identity/init",
|
|
232
|
+
e2eeScope: "NONE",
|
|
233
|
+
returnsData: false
|
|
234
|
+
};
|
|
235
|
+
WDOVerificationEndpoints.cancel = {
|
|
236
|
+
path: "/api/identity/cleanup",
|
|
237
|
+
uriId: "/api/identity/cleanup",
|
|
238
|
+
e2eeScope: "NONE",
|
|
239
|
+
returnsData: false
|
|
240
|
+
};
|
|
241
|
+
WDOVerificationEndpoints.consentText = {
|
|
242
|
+
path: "/api/identity/consent/text",
|
|
243
|
+
tokenName: "possession_universal",
|
|
244
|
+
e2eeScope: "NONE",
|
|
245
|
+
returnsData: true
|
|
246
|
+
};
|
|
247
|
+
WDOVerificationEndpoints.consentApprove = {
|
|
248
|
+
path: "/api/identity/consent/approve",
|
|
249
|
+
uriId: "/api/identity/consent/approve",
|
|
250
|
+
e2eeScope: "NONE",
|
|
251
|
+
returnsData: false
|
|
252
|
+
};
|
|
253
|
+
WDOVerificationEndpoints.documentScanSdkInit = {
|
|
254
|
+
path: "/api/identity/document/init-sdk",
|
|
255
|
+
uriId: "/api/identity/document/init-sdk",
|
|
256
|
+
e2eeScope: "ACTIVATION",
|
|
257
|
+
returnsData: true
|
|
258
|
+
};
|
|
259
|
+
WDOVerificationEndpoints.v2submitDocuments = {
|
|
260
|
+
path: "/api/v2/identity/document/submit",
|
|
261
|
+
tokenName: "possession_universal",
|
|
262
|
+
e2eeScope: "ACTIVATION",
|
|
263
|
+
returnsData: false
|
|
264
|
+
};
|
|
265
|
+
WDOVerificationEndpoints.documentsStatus = {
|
|
266
|
+
path: "/api/identity/document/status",
|
|
267
|
+
tokenName: "possession_universal",
|
|
268
|
+
e2eeScope: "NONE",
|
|
269
|
+
returnsData: true
|
|
270
|
+
};
|
|
271
|
+
WDOVerificationEndpoints.presenceCheckInit = {
|
|
272
|
+
path: "/api/identity/presence-check/init",
|
|
273
|
+
uriId: "/api/identity/presence-check/init",
|
|
274
|
+
e2eeScope: "ACTIVATION",
|
|
275
|
+
returnsData: true
|
|
276
|
+
};
|
|
277
|
+
WDOVerificationEndpoints.presenceCheckSubmit = {
|
|
278
|
+
path: "/api/identity/presence-check/submit",
|
|
279
|
+
uriId: "/api/identity/presence-check/submit",
|
|
280
|
+
e2eeScope: "NONE",
|
|
281
|
+
returnsData: false
|
|
282
|
+
};
|
|
283
|
+
WDOVerificationEndpoints.resendOTP = {
|
|
284
|
+
path: "/api/identity/otp/resend",
|
|
285
|
+
uriId: "/api/identity/otp/resend",
|
|
286
|
+
e2eeScope: "NONE",
|
|
287
|
+
returnsData: false
|
|
288
|
+
};
|
|
289
|
+
WDOVerificationEndpoints.verifyOTP = {
|
|
290
|
+
path: "/api/identity/otp/verify",
|
|
291
|
+
e2eeScope: "ACTIVATION",
|
|
292
|
+
returnsData: true
|
|
293
|
+
};
|
|
294
|
+
WDOVerificationEndpoints.finishActivation = {
|
|
295
|
+
path: "/api/identity/activation",
|
|
296
|
+
tokenName: "possession_universal",
|
|
297
|
+
e2eeScope: "ACTIVATION",
|
|
298
|
+
returnsData: true
|
|
299
|
+
};
|
|
300
|
+
return WDOVerificationEndpoints;
|
|
301
|
+
}());
|
|
302
|
+
|
|
77
303
|
/**
|
|
78
304
|
* Copyright Wultra s.r.o.
|
|
79
305
|
*
|
|
@@ -195,10 +421,14 @@ exports.WDOErrorReason = void 0;
|
|
|
195
421
|
WDOErrorReason["processNotInProgress"] = "PROCESS_NOT_IN_PROGRESS";
|
|
196
422
|
/** The PowerAuth instance is already activated when trying to activate it again */
|
|
197
423
|
WDOErrorReason["powerauthAlreadyActivated"] = "POWERAUTH_ALREADY_ACTIVATED";
|
|
424
|
+
/** The PowerAuth instance is not configured properly */
|
|
425
|
+
WDOErrorReason["powerAuthNotConfigured"] = "POWERAUTH_NOT_CONFIGURED";
|
|
198
426
|
/** The PowerAuth instance is not activated when trying to use it */
|
|
199
427
|
WDOErrorReason["powerauthNotActivated"] = "POWERAUTH_NOT_ACTIVATED";
|
|
200
428
|
/** OTP verification failed */
|
|
201
429
|
WDOErrorReason["otpFailed"] = "OTP_FAILED";
|
|
430
|
+
/** Invalid parameter */
|
|
431
|
+
WDOErrorReason["invalidParameter"] = "INVALID_PARAMETER";
|
|
202
432
|
})(exports.WDOErrorReason || (exports.WDOErrorReason = {}));
|
|
203
433
|
|
|
204
434
|
/**
|
|
@@ -209,10 +439,10 @@ exports.WDOErrorReason = void 0;
|
|
|
209
439
|
*
|
|
210
440
|
* SPDX-License-Identifier: Apache-2.0
|
|
211
441
|
*/
|
|
212
|
-
var
|
|
213
|
-
function
|
|
442
|
+
var WDOPlatform = /** @class */ (function () {
|
|
443
|
+
function WDOPlatform() {
|
|
214
444
|
}
|
|
215
|
-
return
|
|
445
|
+
return WDOPlatform;
|
|
216
446
|
}());
|
|
217
447
|
|
|
218
448
|
/**
|
|
@@ -223,532 +453,63 @@ var WDODefaultCache = /** @class */ (function () {
|
|
|
223
453
|
*
|
|
224
454
|
* SPDX-License-Identifier: Apache-2.0
|
|
225
455
|
*/
|
|
226
|
-
/**
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
* and you will need to verify the PowerAuth instance via `WDOVerificationService`.
|
|
231
|
-
*
|
|
232
|
-
* This service operates against Wultra Onboarding server (usually ending with `/enrollment-onboarding-server`) and you need to configure networking service with the right URL.
|
|
233
|
-
*/
|
|
234
|
-
var WDOBaseActivationService = /** @class */ (function () {
|
|
235
|
-
function WDOBaseActivationService() {
|
|
456
|
+
var WDOApi = /** @class */ (function () {
|
|
457
|
+
function WDOApi(powerauth, baseUrl) {
|
|
458
|
+
// TODO: additional configuration?
|
|
459
|
+
this.networking = WDOPlatform.networkingFactory.networking(powerauth, baseUrl);
|
|
236
460
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
* Calling `status()` for example after the app is launched in this case is recommended.
|
|
242
|
-
*/
|
|
243
|
-
WDOBaseActivationService.prototype.hasActiveProcess = function () {
|
|
244
|
-
return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
245
|
-
switch (_a.label) {
|
|
246
|
-
case 0: return [4 /*yield*/, this.getCachedProcessData()];
|
|
247
|
-
case 1: return [2 /*return*/, !!(_a.sent())];
|
|
248
|
-
}
|
|
249
|
-
}); });
|
|
250
|
-
};
|
|
251
|
-
/**
|
|
252
|
-
* Accept language for the outgoing requests headers.
|
|
253
|
-
* Default value is "en".
|
|
254
|
-
*
|
|
255
|
-
* Standard RFC "Accept-Language" https://tools.ietf.org/html/rfc7231#section-5.3.5
|
|
256
|
-
* Response texts are based on this setting. For example when "de" is set, server
|
|
257
|
-
* will return error texts and other in german (if available).
|
|
258
|
-
*/
|
|
259
|
-
WDOBaseActivationService.prototype.changeAcceptLanguage = function (language) {
|
|
260
|
-
this.changeAcceptLanguageImpl(language);
|
|
261
|
-
};
|
|
262
|
-
/* @internal */
|
|
263
|
-
WDOBaseActivationService.prototype.cacheKey = function () { return "wdopd_".concat(this.getPAInstanceId()); };
|
|
264
|
-
/* @internal */
|
|
265
|
-
WDOBaseActivationService.prototype.setCachedProcessData = function (data) {
|
|
266
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
267
|
-
return __generator(this, function (_a) {
|
|
268
|
-
switch (_a.label) {
|
|
269
|
-
case 0: return [4 /*yield*/, WDODefaultCache.instance.set(this.cacheKey(), JSON.stringify(data))];
|
|
270
|
-
case 1:
|
|
271
|
-
_a.sent();
|
|
272
|
-
return [2 /*return*/];
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
});
|
|
276
|
-
};
|
|
277
|
-
/* @internal */
|
|
278
|
-
WDOBaseActivationService.prototype.getCachedProcessData = function () {
|
|
279
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
280
|
-
var data;
|
|
281
|
-
return __generator(this, function (_a) {
|
|
282
|
-
switch (_a.label) {
|
|
283
|
-
case 0: return [4 /*yield*/, WDODefaultCache.instance.get(this.cacheKey())];
|
|
284
|
-
case 1:
|
|
285
|
-
data = _a.sent();
|
|
286
|
-
if (!data) {
|
|
287
|
-
return [2 /*return*/, undefined];
|
|
288
|
-
}
|
|
289
|
-
return [2 /*return*/, JSON.parse(data)];
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
});
|
|
293
|
-
};
|
|
294
|
-
/* @internal */
|
|
295
|
-
WDOBaseActivationService.prototype.processId = function () {
|
|
296
|
-
return __awaiter(this, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
|
|
297
|
-
switch (_b.label) {
|
|
298
|
-
case 0: return [4 /*yield*/, this.getCachedProcessData()];
|
|
299
|
-
case 1: return [2 /*return*/, (_a = (_b.sent())) === null || _a === void 0 ? void 0 : _a.processId];
|
|
300
|
-
}
|
|
301
|
-
}); });
|
|
302
|
-
};
|
|
303
|
-
// PUBLIC API
|
|
304
|
-
/**
|
|
305
|
-
* Retrieves status of the onboarding activation.
|
|
306
|
-
*
|
|
307
|
-
* @return Promise resolved with onboarding status.
|
|
308
|
-
*/
|
|
309
|
-
WDOBaseActivationService.prototype.status = function () {
|
|
310
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
311
|
-
var _a, _b, _c, pid, result;
|
|
312
|
-
return __generator(this, function (_d) {
|
|
313
|
-
switch (_d.label) {
|
|
314
|
-
case 0:
|
|
315
|
-
_b = (_a = WDOLogger).debug;
|
|
316
|
-
_c = "Getting activation status for processId=".concat;
|
|
317
|
-
return [4 /*yield*/, this.processId()];
|
|
318
|
-
case 1:
|
|
319
|
-
_b.apply(_a, [_c.apply("Getting activation status for processId=", [_d.sent()])]);
|
|
320
|
-
return [4 /*yield*/, this.verifyCanStartActivation()];
|
|
321
|
-
case 2:
|
|
322
|
-
_d.sent();
|
|
323
|
-
return [4 /*yield*/, this.verifyHasActiveProcess()];
|
|
324
|
-
case 3:
|
|
325
|
-
pid = _d.sent();
|
|
326
|
-
return [4 /*yield*/, this.api.activationGetStatus(pid)];
|
|
327
|
-
case 4:
|
|
328
|
-
result = _d.sent();
|
|
329
|
-
return [2 /*return*/, result.onboardingStatus];
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
});
|
|
333
|
-
};
|
|
334
|
-
/**
|
|
335
|
-
* Start onboarding activation with user credentials.
|
|
336
|
-
*
|
|
337
|
-
* For example, when you require email and birth date, your object would look like this:
|
|
338
|
-
* ```
|
|
339
|
-
* {
|
|
340
|
-
* email: "<user_email>",
|
|
341
|
-
* birthdate: "<user_birth_date>"
|
|
342
|
-
* }
|
|
343
|
-
* ```
|
|
344
|
-
* @param credentials Object with credentials. Which credentials are needed should be provided by a system/backend provider.
|
|
345
|
-
* @param processType The process type identification. If not specified, the default process type will be used.
|
|
346
|
-
*/
|
|
347
|
-
WDOBaseActivationService.prototype.start = function (credentials, processType) {
|
|
348
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
349
|
-
var result;
|
|
350
|
-
return __generator(this, function (_a) {
|
|
351
|
-
switch (_a.label) {
|
|
352
|
-
case 0:
|
|
353
|
-
WDOLogger.debug("Starting activation with credentials: ".concat(JSON.stringify(credentials)));
|
|
354
|
-
return [4 /*yield*/, this.processId()];
|
|
355
|
-
case 1:
|
|
356
|
-
if (_a.sent()) {
|
|
357
|
-
throw new WDOError(exports.WDOErrorReason.processAlreadyInProgress, "Cannot start the process - processId already obtained, cancel first.");
|
|
358
|
-
}
|
|
359
|
-
return [4 /*yield*/, this.verifyCanStartActivation()];
|
|
360
|
-
case 2:
|
|
361
|
-
_a.sent();
|
|
362
|
-
return [4 /*yield*/, this.api.activationStart(credentials, processType)];
|
|
363
|
-
case 3:
|
|
364
|
-
result = _a.sent();
|
|
365
|
-
WDOLogger.info("WDOActivationService.start success");
|
|
366
|
-
WDOLogger.debug(" - processId: ".concat(result.processId));
|
|
367
|
-
return [4 /*yield*/, this.setCachedProcessData({ processId: result.processId, activationCode: result.activationCode })];
|
|
368
|
-
case 4:
|
|
369
|
-
_a.sent();
|
|
370
|
-
return [2 /*return*/];
|
|
371
|
-
}
|
|
372
|
-
});
|
|
373
|
-
});
|
|
374
|
-
};
|
|
375
|
-
/**
|
|
376
|
-
* Cancel the activation process (issues a cancel request to the backend and clears the local process ID).
|
|
377
|
-
*
|
|
378
|
-
* @param forceCancel When true, the process will be canceled in the SDK even when fails on backend. `true` by default.
|
|
379
|
-
*/
|
|
380
|
-
WDOBaseActivationService.prototype.cancel = function () {
|
|
381
|
-
return __awaiter(this, arguments, void 0, function (forceCancel) {
|
|
382
|
-
var _a, _b, _c, pid, error_1;
|
|
383
|
-
if (forceCancel === void 0) { forceCancel = true; }
|
|
384
|
-
return __generator(this, function (_d) {
|
|
385
|
-
switch (_d.label) {
|
|
386
|
-
case 0:
|
|
387
|
-
_b = (_a = WDOLogger).debug;
|
|
388
|
-
_c = "Canceling activation for processId=".concat;
|
|
389
|
-
return [4 /*yield*/, this.processId()];
|
|
390
|
-
case 1:
|
|
391
|
-
_b.apply(_a, [_c.apply("Canceling activation for processId=", [_d.sent(), ", forceCancel="]).concat(forceCancel)]);
|
|
392
|
-
return [4 /*yield*/, this.verifyHasActiveProcess()];
|
|
393
|
-
case 2:
|
|
394
|
-
pid = _d.sent();
|
|
395
|
-
_d.label = 3;
|
|
396
|
-
case 3:
|
|
397
|
-
_d.trys.push([3, 6, , 10]);
|
|
398
|
-
return [4 /*yield*/, this.api.activationCancel(pid)];
|
|
399
|
-
case 4:
|
|
400
|
-
_d.sent();
|
|
401
|
-
return [4 /*yield*/, this.setCachedProcessData(undefined)];
|
|
402
|
-
case 5:
|
|
403
|
-
_d.sent();
|
|
404
|
-
WDOLogger.info("WDOActivationService.cancel success");
|
|
405
|
-
return [3 /*break*/, 10];
|
|
406
|
-
case 6:
|
|
407
|
-
error_1 = _d.sent();
|
|
408
|
-
if (!forceCancel) return [3 /*break*/, 8];
|
|
409
|
-
// pretend it was successful and just log the error
|
|
410
|
-
WDOLogger.debug("Process canceled (but the request failed) - ".concat(error_1, "."));
|
|
411
|
-
return [4 /*yield*/, this.setCachedProcessData(undefined)];
|
|
412
|
-
case 7:
|
|
413
|
-
_d.sent();
|
|
414
|
-
return [3 /*break*/, 9];
|
|
415
|
-
case 8: throw error_1; // rethrow
|
|
416
|
-
case 9: return [3 /*break*/, 10];
|
|
417
|
-
case 10: return [2 /*return*/];
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
});
|
|
421
|
-
};
|
|
422
|
-
/** Clear the stored data (without networking call). */
|
|
423
|
-
WDOBaseActivationService.prototype.clear = function () {
|
|
424
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
425
|
-
return __generator(this, function (_a) {
|
|
426
|
-
switch (_a.label) {
|
|
427
|
-
case 0: return [4 /*yield*/, this.setCachedProcessData(undefined)];
|
|
428
|
-
case 1:
|
|
429
|
-
_a.sent();
|
|
430
|
-
return [2 /*return*/];
|
|
431
|
-
}
|
|
432
|
-
});
|
|
433
|
-
});
|
|
434
|
-
};
|
|
435
|
-
/**
|
|
436
|
-
* OTP resend request.
|
|
437
|
-
*
|
|
438
|
-
* This is intended to be displayed for the user to use in case of the OTP is not received.
|
|
439
|
-
* For example, when the user does not receive SMS after some time, there should be a button to "send again".
|
|
440
|
-
*/
|
|
441
|
-
WDOBaseActivationService.prototype.resendOTP = function () {
|
|
442
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
443
|
-
var pid;
|
|
444
|
-
return __generator(this, function (_a) {
|
|
445
|
-
switch (_a.label) {
|
|
446
|
-
case 0:
|
|
447
|
-
WDOLogger.debug("Activation: resending OTP");
|
|
448
|
-
return [4 /*yield*/, this.verifyHasActiveProcess()];
|
|
449
|
-
case 1:
|
|
450
|
-
pid = _a.sent();
|
|
451
|
-
return [4 /*yield*/, this.verifyCanStartActivation()];
|
|
452
|
-
case 2:
|
|
453
|
-
_a.sent();
|
|
454
|
-
return [4 /*yield*/, this.api.activationResendOTP(pid)];
|
|
455
|
-
case 3:
|
|
456
|
-
_a.sent();
|
|
457
|
-
return [2 /*return*/];
|
|
458
|
-
}
|
|
459
|
-
});
|
|
460
|
-
});
|
|
461
|
-
};
|
|
462
|
-
/**
|
|
463
|
-
* @internal
|
|
464
|
-
* Demo endpoint available only in Wultra Demo systems.
|
|
465
|
-
*
|
|
466
|
-
* If the app is running against our demo server, you can retrieve the OTP without needing to send SMS or emails.
|
|
467
|
-
*/
|
|
468
|
-
WDOBaseActivationService.prototype.getOTP = function () {
|
|
469
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
470
|
-
var pid;
|
|
471
|
-
return __generator(this, function (_a) {
|
|
472
|
-
switch (_a.label) {
|
|
473
|
-
case 0:
|
|
474
|
-
WDOLogger.debug("Activation: getting OTP from server (only for testing purposes)");
|
|
475
|
-
return [4 /*yield*/, this.verifyHasActiveProcess()];
|
|
476
|
-
case 1:
|
|
477
|
-
pid = _a.sent();
|
|
478
|
-
return [4 /*yield*/, this.api.activationGetOTP(pid, "ACTIVATION")];
|
|
479
|
-
case 2: return [2 /*return*/, (_a.sent()).otpCode];
|
|
480
|
-
}
|
|
481
|
-
});
|
|
482
|
-
});
|
|
483
|
-
};
|
|
484
|
-
/**
|
|
485
|
-
* Activate the PowerAuth instance that was passed in the initializer.
|
|
486
|
-
*
|
|
487
|
-
* @param activationName Name of the activation. Usually something like John's iPhone or similar.
|
|
488
|
-
* @param otp OTP code received by the user (via SMS or email). Optional when not required.
|
|
489
|
-
* @return Promise resolved with activation result.
|
|
490
|
-
*/
|
|
491
|
-
WDOBaseActivationService.prototype.activate = function (activationName, otp) {
|
|
492
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
493
|
-
var pid, code, result, identityAttributes, error_2;
|
|
494
|
-
var _a;
|
|
495
|
-
return __generator(this, function (_b) {
|
|
496
|
-
switch (_b.label) {
|
|
497
|
-
case 0:
|
|
498
|
-
WDOLogger.debug("Activating the PowerAuth with activation name '".concat(activationName, "'"));
|
|
499
|
-
return [4 /*yield*/, this.verifyCanStartActivation()];
|
|
500
|
-
case 1:
|
|
501
|
-
_b.sent();
|
|
502
|
-
return [4 /*yield*/, this.verifyHasActiveProcess()];
|
|
503
|
-
case 2:
|
|
504
|
-
pid = _b.sent();
|
|
505
|
-
return [4 /*yield*/, this.getCachedProcessData()];
|
|
506
|
-
case 3:
|
|
507
|
-
code = (_a = (_b.sent())) === null || _a === void 0 ? void 0 : _a.activationCode;
|
|
508
|
-
_b.label = 4;
|
|
509
|
-
case 4:
|
|
510
|
-
_b.trys.push([4, 9, , 10]);
|
|
511
|
-
if (!code) return [3 /*break*/, 6];
|
|
512
|
-
WDOLogger.info("Activating PowerAuth using activation code from the onboarding process");
|
|
513
|
-
return [4 /*yield*/, this.activatePowerAuthWithCode(code, otp, activationName)];
|
|
514
|
-
case 5:
|
|
515
|
-
result = _b.sent();
|
|
516
|
-
return [3 /*break*/, 8];
|
|
517
|
-
case 6:
|
|
518
|
-
WDOLogger.info("Activating PowerAuth using identity attributes from the onboarding process");
|
|
519
|
-
identityAttributes = { processId: pid, otpCode: otp, credentialsType: "ONBOARDING" };
|
|
520
|
-
return [4 /*yield*/, this.activatePowerAuth(identityAttributes, activationName)];
|
|
521
|
-
case 7:
|
|
522
|
-
result = _b.sent();
|
|
523
|
-
_b.label = 8;
|
|
524
|
-
case 8: return [3 /*break*/, 10];
|
|
525
|
-
case 9:
|
|
526
|
-
error_2 = _b.sent();
|
|
527
|
-
throw new WDOError(exports.WDOErrorReason.activationFailed, "Activation failed", error_2);
|
|
528
|
-
case 10:
|
|
529
|
-
// Clear process ID after activation attempt
|
|
530
|
-
return [4 /*yield*/, this.setCachedProcessData(undefined)];
|
|
531
|
-
case 11:
|
|
532
|
-
// Clear process ID after activation attempt
|
|
533
|
-
_b.sent();
|
|
534
|
-
return [2 /*return*/, result];
|
|
535
|
-
}
|
|
536
|
-
});
|
|
537
|
-
});
|
|
538
|
-
};
|
|
539
|
-
// PRIVATE METHODS
|
|
540
|
-
/* @internal */
|
|
541
|
-
WDOBaseActivationService.prototype.verifyCanStartActivation = function () {
|
|
542
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
543
|
-
return __generator(this, function (_a) {
|
|
544
|
-
switch (_a.label) {
|
|
545
|
-
case 0: return [4 /*yield*/, this.api.canStartActivation()];
|
|
546
|
-
case 1:
|
|
547
|
-
if (!!(_a.sent())) return [3 /*break*/, 3];
|
|
548
|
-
WDOLogger.error("PowerAuth is already activated - Activation cannot be started/processed.");
|
|
549
|
-
return [4 /*yield*/, this.setCachedProcessData(undefined)];
|
|
550
|
-
case 2:
|
|
551
|
-
_a.sent();
|
|
552
|
-
throw new WDOError(exports.WDOErrorReason.powerauthAlreadyActivated, "PowerAuth is already activated");
|
|
553
|
-
case 3: return [2 /*return*/];
|
|
554
|
-
}
|
|
555
|
-
});
|
|
556
|
-
});
|
|
557
|
-
};
|
|
558
|
-
/* @internal */
|
|
559
|
-
WDOBaseActivationService.prototype.verifyHasActiveProcess = function () {
|
|
560
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
561
|
-
var pid;
|
|
562
|
-
return __generator(this, function (_a) {
|
|
563
|
-
switch (_a.label) {
|
|
564
|
-
case 0: return [4 /*yield*/, this.processId()];
|
|
565
|
-
case 1:
|
|
566
|
-
pid = _a.sent();
|
|
567
|
-
if (!pid) {
|
|
568
|
-
WDOLogger.warn("Cannot proceed (processId not available).");
|
|
569
|
-
throw new WDOError(exports.WDOErrorReason.processNotInProgress, "No active activation process");
|
|
570
|
-
}
|
|
571
|
-
return [2 /*return*/, pid];
|
|
572
|
-
}
|
|
573
|
-
});
|
|
574
|
-
});
|
|
575
|
-
};
|
|
576
|
-
return WDOBaseActivationService;
|
|
577
|
-
}());
|
|
578
|
-
|
|
579
|
-
/**
|
|
580
|
-
* Copyright Wultra s.r.o.
|
|
581
|
-
*
|
|
582
|
-
* This source code is licensed under the Apache License, Version 2.0 license
|
|
583
|
-
* found in the LICENSE file in the root directory of this source tree.
|
|
584
|
-
*
|
|
585
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
586
|
-
*/
|
|
587
|
-
var WDOActivationEndpoints = /** @class */ (function () {
|
|
588
|
-
function WDOActivationEndpoints() {
|
|
589
|
-
}
|
|
590
|
-
WDOActivationEndpoints.start = {
|
|
591
|
-
path: "/api/onboarding/start",
|
|
592
|
-
e2eeScope: "APPLICATION",
|
|
593
|
-
returnsData: true
|
|
594
|
-
};
|
|
595
|
-
WDOActivationEndpoints.cancel = {
|
|
596
|
-
path: "/api/onboarding/cleanup",
|
|
597
|
-
e2eeScope: "APPLICATION",
|
|
598
|
-
returnsData: false
|
|
599
|
-
};
|
|
600
|
-
WDOActivationEndpoints.resendOTP = {
|
|
601
|
-
path: "/api/onboarding/otp/resend",
|
|
602
|
-
e2eeScope: "APPLICATION",
|
|
603
|
-
returnsData: false
|
|
604
|
-
};
|
|
605
|
-
WDOActivationEndpoints.getStatus = {
|
|
606
|
-
path: "/api/onboarding/status",
|
|
607
|
-
e2eeScope: "APPLICATION",
|
|
608
|
-
returnsData: true
|
|
609
|
-
};
|
|
610
|
-
return WDOActivationEndpoints;
|
|
611
|
-
}());
|
|
612
|
-
var WDOVerificationEndpoints = /** @class */ (function () {
|
|
613
|
-
function WDOVerificationEndpoints() {
|
|
614
|
-
}
|
|
615
|
-
WDOVerificationEndpoints.getStatus = {
|
|
616
|
-
path: "/api/identity/status",
|
|
617
|
-
e2eeScope: "NONE",
|
|
618
|
-
tokenName: "possession_universal",
|
|
619
|
-
returnsData: true
|
|
620
|
-
};
|
|
621
|
-
WDOVerificationEndpoints.init = {
|
|
622
|
-
path: "/api/identity/init",
|
|
623
|
-
uriId: "/api/identity/init",
|
|
624
|
-
e2eeScope: "NONE",
|
|
625
|
-
returnsData: false
|
|
626
|
-
};
|
|
627
|
-
WDOVerificationEndpoints.cancel = {
|
|
628
|
-
path: "/api/identity/cleanup",
|
|
629
|
-
uriId: "/api/identity/cleanup",
|
|
630
|
-
e2eeScope: "NONE",
|
|
631
|
-
returnsData: false
|
|
632
|
-
};
|
|
633
|
-
WDOVerificationEndpoints.consentText = {
|
|
634
|
-
path: "/api/identity/consent/text",
|
|
635
|
-
tokenName: "possession_universal",
|
|
636
|
-
e2eeScope: "NONE",
|
|
637
|
-
returnsData: true
|
|
638
|
-
};
|
|
639
|
-
WDOVerificationEndpoints.consentApprove = {
|
|
640
|
-
path: "/api/identity/consent/approve",
|
|
641
|
-
uriId: "/api/identity/consent/approve",
|
|
642
|
-
e2eeScope: "NONE",
|
|
643
|
-
returnsData: false
|
|
644
|
-
};
|
|
645
|
-
WDOVerificationEndpoints.documentScanSdkInit = {
|
|
646
|
-
path: "/api/identity/document/init-sdk",
|
|
647
|
-
uriId: "/api/identity/document/init-sdk",
|
|
648
|
-
e2eeScope: "ACTIVATION",
|
|
649
|
-
returnsData: true
|
|
650
|
-
};
|
|
651
|
-
WDOVerificationEndpoints.v2submitDocuments = {
|
|
652
|
-
path: "/api/v2/identity/document/submit",
|
|
653
|
-
tokenName: "possession_universal",
|
|
654
|
-
e2eeScope: "ACTIVATION",
|
|
655
|
-
returnsData: false
|
|
656
|
-
};
|
|
657
|
-
WDOVerificationEndpoints.documentsStatus = {
|
|
658
|
-
path: "/api/identity/document/status",
|
|
659
|
-
tokenName: "possession_universal",
|
|
660
|
-
e2eeScope: "NONE",
|
|
661
|
-
returnsData: true
|
|
662
|
-
};
|
|
663
|
-
WDOVerificationEndpoints.presenceCheckInit = {
|
|
664
|
-
path: "/api/identity/presence-check/init",
|
|
665
|
-
uriId: "/api/identity/presence-check/init",
|
|
666
|
-
e2eeScope: "ACTIVATION",
|
|
667
|
-
returnsData: true
|
|
668
|
-
};
|
|
669
|
-
WDOVerificationEndpoints.presenceCheckSubmit = {
|
|
670
|
-
path: "/api/identity/presence-check/submit",
|
|
671
|
-
uriId: "/api/identity/presence-check/submit",
|
|
672
|
-
e2eeScope: "NONE",
|
|
673
|
-
returnsData: false
|
|
674
|
-
};
|
|
675
|
-
WDOVerificationEndpoints.resendOTP = {
|
|
676
|
-
path: "/api/identity/otp/resend",
|
|
677
|
-
uriId: "/api/identity/otp/resend",
|
|
678
|
-
e2eeScope: "NONE",
|
|
679
|
-
returnsData: false
|
|
680
|
-
};
|
|
681
|
-
WDOVerificationEndpoints.verifyOTP = {
|
|
682
|
-
path: "/api/identity/otp/verify",
|
|
683
|
-
e2eeScope: "ACTIVATION",
|
|
684
|
-
returnsData: true
|
|
685
|
-
};
|
|
686
|
-
return WDOVerificationEndpoints;
|
|
687
|
-
}());
|
|
688
|
-
|
|
689
|
-
/**
|
|
690
|
-
* Copyright Wultra s.r.o.
|
|
691
|
-
*
|
|
692
|
-
* This source code is licensed under the Apache License, Version 2.0 license
|
|
693
|
-
* found in the LICENSE file in the root directory of this source tree.
|
|
694
|
-
*
|
|
695
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
696
|
-
*/
|
|
697
|
-
var WDOBaseApi = /** @class */ (function () {
|
|
698
|
-
function WDOBaseApi() {
|
|
699
|
-
}
|
|
700
|
-
// Configuration endpoints
|
|
701
|
-
WDOBaseApi.prototype.getConfiguration = function (processType) {
|
|
702
|
-
var requestObject = { processType: processType };
|
|
703
|
-
return this.callApi(requestObject, { path: "/api/configuration", e2eeScope: "APPLICATION", returnsData: true });
|
|
461
|
+
// Configuration endpoints
|
|
462
|
+
WDOApi.prototype.getConfiguration = function (processType) {
|
|
463
|
+
var requestObject = { processType: processType };
|
|
464
|
+
return this.callApi(requestObject, { path: "/api/configuration", e2eeScope: "APPLICATION", returnsData: true });
|
|
704
465
|
};
|
|
705
466
|
// Activation endpoints
|
|
706
|
-
|
|
467
|
+
WDOApi.prototype.activationStart = function (credentials, processType) {
|
|
707
468
|
var requestObject = { identification: credentials, processType: processType };
|
|
708
469
|
return this.callApi(requestObject, WDOActivationEndpoints.start);
|
|
709
470
|
};
|
|
710
|
-
|
|
471
|
+
WDOApi.prototype.activationCancel = function (processId) {
|
|
711
472
|
var requestObject = { processId: processId };
|
|
712
473
|
return this.callApi(requestObject, WDOActivationEndpoints.cancel);
|
|
713
474
|
};
|
|
714
|
-
|
|
475
|
+
WDOApi.prototype.activationGetStatus = function (processId) {
|
|
715
476
|
var requestObject = { processId: processId };
|
|
716
477
|
return this.callApi(requestObject, WDOActivationEndpoints.getStatus);
|
|
717
478
|
};
|
|
718
|
-
|
|
479
|
+
WDOApi.prototype.activationResendOTP = function (processId) {
|
|
719
480
|
var requestObject = { processId: processId };
|
|
720
481
|
return this.callApi(requestObject, WDOActivationEndpoints.resendOTP);
|
|
721
482
|
};
|
|
722
|
-
|
|
483
|
+
WDOApi.prototype.activationGetOTP = function (processId, otpType) {
|
|
723
484
|
var requestObject = { processId: processId, otpType: otpType };
|
|
724
485
|
return this.callApi(requestObject, { path: "/api/onboarding/otp/detail", e2eeScope: "APPLICATION", returnsData: true });
|
|
725
486
|
};
|
|
726
487
|
// Verification endpoints
|
|
727
|
-
|
|
488
|
+
WDOApi.prototype.verificationStatus = function () {
|
|
728
489
|
var requestObject = {};
|
|
729
490
|
return this.callApi(requestObject, WDOVerificationEndpoints.getStatus);
|
|
730
491
|
};
|
|
731
|
-
|
|
492
|
+
WDOApi.prototype.verificationStart = function (processId) {
|
|
732
493
|
var requestObject = { processId: processId };
|
|
733
494
|
return this.callApi(requestObject, WDOVerificationEndpoints.init);
|
|
734
495
|
};
|
|
735
|
-
|
|
496
|
+
WDOApi.prototype.verificationCleanup = function (processId) {
|
|
736
497
|
var requestObject = { processId: processId };
|
|
737
498
|
return this.callApi(requestObject, WDOVerificationEndpoints.cancel);
|
|
738
499
|
};
|
|
739
|
-
|
|
500
|
+
WDOApi.prototype.verificationGetConsentText = function (processId) {
|
|
740
501
|
var requestObject = { processId: processId, consentType: "GDPR" };
|
|
741
502
|
return this.callApi(requestObject, WDOVerificationEndpoints.consentText);
|
|
742
503
|
};
|
|
743
|
-
|
|
504
|
+
WDOApi.prototype.verificationResolveConsent = function (processId, approved) {
|
|
744
505
|
var requestObject = { processId: processId, approved: approved, consentType: "GDPR" };
|
|
745
506
|
return this.callApi(requestObject, WDOVerificationEndpoints.consentApprove);
|
|
746
507
|
};
|
|
747
|
-
|
|
508
|
+
WDOApi.prototype.verificationInitScanSDK = function (processId, challenge) {
|
|
748
509
|
var requestObject = { processId: processId, attributes: { 'sdk-init-token': challenge } };
|
|
749
510
|
return this.callApi(requestObject, WDOVerificationEndpoints.documentScanSdkInit);
|
|
750
511
|
};
|
|
751
|
-
|
|
512
|
+
WDOApi.prototype.verificationSubmitDocuments = function (processId, resubmit, documents) {
|
|
752
513
|
var requestObject = {
|
|
753
514
|
processId: processId,
|
|
754
515
|
resubmit: resubmit,
|
|
@@ -757,54 +518,40 @@ var WDOBaseApi = /** @class */ (function () {
|
|
|
757
518
|
// TODO: there should be longer timeout!
|
|
758
519
|
return this.callApi(requestObject, WDOVerificationEndpoints.v2submitDocuments);
|
|
759
520
|
};
|
|
760
|
-
|
|
521
|
+
WDOApi.prototype.verificationDocumentsStatus = function (processId) {
|
|
761
522
|
var requestObject = { processId: processId };
|
|
762
523
|
// TODO: longer timeout?
|
|
763
524
|
return this.callApi(requestObject, WDOVerificationEndpoints.documentsStatus);
|
|
764
525
|
};
|
|
765
|
-
|
|
526
|
+
WDOApi.prototype.verificationPresenceCheckInit = function (processId) {
|
|
766
527
|
var requestObject = { processId: processId };
|
|
767
528
|
return this.callApi(requestObject, WDOVerificationEndpoints.presenceCheckInit);
|
|
768
529
|
};
|
|
769
|
-
|
|
530
|
+
WDOApi.prototype.verificationPresenceCheckSubmit = function (processId) {
|
|
770
531
|
var requestObject = { processId: processId };
|
|
771
532
|
return this.callApi(requestObject, WDOVerificationEndpoints.presenceCheckSubmit);
|
|
772
533
|
};
|
|
773
|
-
|
|
534
|
+
WDOApi.prototype.verificationResendOTP = function (processId) {
|
|
774
535
|
var requestObject = { processId: processId };
|
|
775
536
|
return this.callApi(requestObject, WDOVerificationEndpoints.resendOTP);
|
|
776
537
|
};
|
|
777
|
-
|
|
538
|
+
WDOApi.prototype.verifyOTP = function (processId, otp) {
|
|
778
539
|
var requestObject = { processId: processId, otpCode: otp };
|
|
779
540
|
return this.callApi(requestObject, WDOVerificationEndpoints.verifyOTP);
|
|
780
541
|
};
|
|
781
|
-
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
*/
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
var WDOApi = /** @class */ (function (_super) {
|
|
795
|
-
__extends(WDOApi, _super);
|
|
796
|
-
function WDOApi(powerauth, baseUrl) {
|
|
797
|
-
var _this = _super.call(this) || this;
|
|
798
|
-
// TODO: additional configuration?
|
|
799
|
-
_this.networking = new WPNNetworking(powerauth, baseUrl);
|
|
800
|
-
_this.powerauth = powerauth;
|
|
801
|
-
return _this;
|
|
802
|
-
}
|
|
803
|
-
WDOApi.prototype.callApi = function (requestObject, endpoint) {
|
|
542
|
+
WDOApi.prototype.verificationFinishActivation = function (processId, userIdentification) {
|
|
543
|
+
var requestObject = { processId: processId, identification: userIdentification };
|
|
544
|
+
return this.callApi(requestObject, WDOVerificationEndpoints.finishActivation);
|
|
545
|
+
};
|
|
546
|
+
WDOApi.prototype.callApi = function (requestObject, endpoint, authObject) {
|
|
547
|
+
if (authObject && !(authObject instanceof PowerAuthAuthentication)) {
|
|
548
|
+
throw new WDOError(exports.WDOErrorReason.invalidParameter, "The authObject parameter must be of type PowerAuthAuthentication.");
|
|
549
|
+
}
|
|
550
|
+
// set authentication to given authObject or to possession if endpoint is "signed"
|
|
551
|
+
var authentication = authObject || (endpoint.tokenName || endpoint.uriId ? PowerAuthAuthentication.possession() : undefined);
|
|
804
552
|
return this.networking.call(
|
|
805
553
|
// construct
|
|
806
|
-
this.constructEndpoint(endpoint), { requestObject: requestObject },
|
|
807
|
-
).then(function (result) {
|
|
554
|
+
this.constructEndpoint(endpoint), { requestObject: requestObject }, authentication).then(function (result) {
|
|
808
555
|
if (result.responseObject) {
|
|
809
556
|
return result.responseObject;
|
|
810
557
|
}
|
|
@@ -820,129 +567,29 @@ var WDOApi = /** @class */ (function (_super) {
|
|
|
820
567
|
}
|
|
821
568
|
});
|
|
822
569
|
};
|
|
823
|
-
WDOApi.prototype.canStartActivation = function () {
|
|
824
|
-
return this.powerauth.canStartActivation();
|
|
825
|
-
};
|
|
826
570
|
WDOApi.prototype.constructEndpoint = function (endpoint) {
|
|
827
571
|
var scope;
|
|
828
572
|
if (endpoint.e2eeScope === "ACTIVATION") {
|
|
829
|
-
scope =
|
|
573
|
+
scope = 1;
|
|
830
574
|
}
|
|
831
575
|
else if (endpoint.e2eeScope === "APPLICATION") {
|
|
832
|
-
scope =
|
|
576
|
+
scope = 0;
|
|
833
577
|
}
|
|
834
578
|
else {
|
|
835
|
-
scope =
|
|
579
|
+
scope = 2;
|
|
836
580
|
}
|
|
837
581
|
if (endpoint.uriId) {
|
|
838
|
-
return
|
|
582
|
+
return WDOPlatform.networkingFactory.signedEndpoint(endpoint.path, endpoint.uriId, undefined, scope);
|
|
839
583
|
}
|
|
840
584
|
else if (endpoint.tokenName) {
|
|
841
|
-
return
|
|
585
|
+
return WDOPlatform.networkingFactory.signedWithTokenEndpoint(endpoint.path, endpoint.tokenName, undefined, scope);
|
|
842
586
|
}
|
|
843
587
|
else {
|
|
844
|
-
return
|
|
588
|
+
return WDOPlatform.networkingFactory.unsignedEndpoint(endpoint.path, undefined, scope);
|
|
845
589
|
}
|
|
846
590
|
};
|
|
847
591
|
return WDOApi;
|
|
848
|
-
}(
|
|
849
|
-
|
|
850
|
-
/**
|
|
851
|
-
* Copyright Wultra s.r.o.
|
|
852
|
-
*
|
|
853
|
-
* This source code is licensed under the Apache License, Version 2.0 license
|
|
854
|
-
* found in the LICENSE file in the root directory of this source tree.
|
|
855
|
-
*
|
|
856
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
857
|
-
*/
|
|
858
|
-
|
|
859
|
-
/**
|
|
860
|
-
* Service that can activate PowerAuth instance by user weak credentials (like his email, phone number or client ID) + optional SMS OTP.
|
|
861
|
-
*
|
|
862
|
-
* When the PowerAuth is activated with this service, `WDOVerificationService.isVerificationRequired` will be `true`
|
|
863
|
-
* and you will need to verify the PowerAuth instance via `WDOVerificationService`.
|
|
864
|
-
*
|
|
865
|
-
* This service operates against Wultra Onboarding server (usually ending with `/enrollment-onboarding-server`) and you need to configure networking service with the right URL.
|
|
866
|
-
*/
|
|
867
|
-
var WDOActivationService = /** @class */ (function (_super) {
|
|
868
|
-
__extends(WDOActivationService, _super);
|
|
869
|
-
/**
|
|
870
|
-
* Creates service instance
|
|
871
|
-
*
|
|
872
|
-
* @param powerauth Configured PowerAuth instance. This instance needs to be without valid activation.
|
|
873
|
-
* @param baseUrl Base URL of the Wultra Digital Onboarding server. Usually ending with `/enrollment-onboarding-server`.
|
|
874
|
-
*/
|
|
875
|
-
function WDOActivationService(powerauth, baseUrl) {
|
|
876
|
-
var _this = _super.call(this) || this;
|
|
877
|
-
_this.api = new WDOApi(powerauth, baseUrl);
|
|
878
|
-
_this.powerauth = powerauth;
|
|
879
|
-
return _this;
|
|
880
|
-
}
|
|
881
|
-
/* @internal */
|
|
882
|
-
WDOActivationService.prototype.activatePowerAuth = function (identityAttributes, activationName) {
|
|
883
|
-
var activation = PowerAuthActivation.createWithIdentityAttributes(identityAttributes, activationName);
|
|
884
|
-
return this.powerauth.createActivation(activation);
|
|
885
|
-
};
|
|
886
|
-
/* @internal */
|
|
887
|
-
WDOActivationService.prototype.activatePowerAuthWithCode = function (activationCode, otp, activationName) {
|
|
888
|
-
var activation = PowerAuthActivation.createWithActivationCode(activationCode, activationName);
|
|
889
|
-
if (otp) {
|
|
890
|
-
activation.additionalActivationOtp = otp;
|
|
891
|
-
}
|
|
892
|
-
return this.powerauth.createActivation(activation);
|
|
893
|
-
};
|
|
894
|
-
/* @internal */
|
|
895
|
-
WDOActivationService.prototype.changeAcceptLanguageImpl = function (language) {
|
|
896
|
-
this.api.networking.acceptLanguage = language;
|
|
897
|
-
};
|
|
898
|
-
/* @internal */
|
|
899
|
-
WDOActivationService.prototype.getPAInstanceId = function () {
|
|
900
|
-
return this.powerauth.instanceId;
|
|
901
|
-
};
|
|
902
|
-
return WDOActivationService;
|
|
903
|
-
}(WDOBaseActivationService));
|
|
904
|
-
|
|
905
|
-
/**
|
|
906
|
-
* Copyright Wultra s.r.o.
|
|
907
|
-
*
|
|
908
|
-
* This source code is licensed under the Apache License, Version 2.0 license
|
|
909
|
-
* found in the LICENSE file in the root directory of this source tree.
|
|
910
|
-
*
|
|
911
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
912
|
-
*/
|
|
913
|
-
/**
|
|
914
|
-
* The `WDOPowerAuthActivationState` enum defines all possible states of activation.
|
|
915
|
-
* The state is a part of information received together with the rest
|
|
916
|
-
* of the `WDOPowerAuthActivationStatus` object.
|
|
917
|
-
*/
|
|
918
|
-
var WDOPowerAuthActivationState;
|
|
919
|
-
(function (WDOPowerAuthActivationState) {
|
|
920
|
-
/**
|
|
921
|
-
* The activation is just created.
|
|
922
|
-
*/
|
|
923
|
-
WDOPowerAuthActivationState["CREATED"] = "CREATED";
|
|
924
|
-
/**
|
|
925
|
-
* The activation is not completed yet on the server.
|
|
926
|
-
*/
|
|
927
|
-
WDOPowerAuthActivationState["PENDING_COMMIT"] = "PENDING_COMMIT";
|
|
928
|
-
/**
|
|
929
|
-
* The shared secure context is valid and active.
|
|
930
|
-
*/
|
|
931
|
-
WDOPowerAuthActivationState["ACTIVE"] = "ACTIVE";
|
|
932
|
-
/**
|
|
933
|
-
* The activation is blocked.
|
|
934
|
-
*/
|
|
935
|
-
WDOPowerAuthActivationState["BLOCKED"] = "BLOCKED";
|
|
936
|
-
/**
|
|
937
|
-
* The activation doesn't exist anymore.
|
|
938
|
-
*/
|
|
939
|
-
WDOPowerAuthActivationState["REMOVED"] = "REMOVED";
|
|
940
|
-
/**
|
|
941
|
-
* The activation is technically blocked. You cannot use it anymore
|
|
942
|
-
* for the signature calculations.
|
|
943
|
-
*/
|
|
944
|
-
WDOPowerAuthActivationState["DEADLOCK"] = "DEADLOCK";
|
|
945
|
-
})(WDOPowerAuthActivationState || (WDOPowerAuthActivationState = {}));
|
|
592
|
+
}());
|
|
946
593
|
|
|
947
594
|
/**
|
|
948
595
|
* Copyright Wultra s.r.o.
|
|
@@ -964,7 +611,7 @@ exports.WDOOnboardingStatus = void 0;
|
|
|
964
611
|
/** Onboarding process is completed */
|
|
965
612
|
WDOOnboardingStatus["finished"] = "FINISHED";
|
|
966
613
|
})(exports.WDOOnboardingStatus || (exports.WDOOnboardingStatus = {}));
|
|
967
|
-
|
|
614
|
+
/* @internal */
|
|
968
615
|
exports.WDOIdentityVerificationStatus = void 0;
|
|
969
616
|
(function (WDOIdentityVerificationStatus) {
|
|
970
617
|
/** Identity verification is waiting for initialization */
|
|
@@ -980,7 +627,7 @@ exports.WDOIdentityVerificationStatus = void 0;
|
|
|
980
627
|
/** Identity verification was rejected */
|
|
981
628
|
WDOIdentityVerificationStatus["rejected"] = "REJECTED";
|
|
982
629
|
})(exports.WDOIdentityVerificationStatus || (exports.WDOIdentityVerificationStatus = {}));
|
|
983
|
-
|
|
630
|
+
/* @internal */
|
|
984
631
|
exports.WDOIdentityVerificationPhase = void 0;
|
|
985
632
|
(function (WDOIdentityVerificationPhase) {
|
|
986
633
|
/** Document upload is in progress */
|
|
@@ -997,8 +644,10 @@ exports.WDOIdentityVerificationPhase = void 0;
|
|
|
997
644
|
WDOIdentityVerificationPhase["otp"] = "OTP_VERIFICATION";
|
|
998
645
|
/** Completed */
|
|
999
646
|
WDOIdentityVerificationPhase["completed"] = "COMPLETED";
|
|
647
|
+
/** Exchanging the temporary activation for the permanent one. */
|
|
648
|
+
WDOIdentityVerificationPhase["activationFinish"] = "ACTIVATION_FINISH";
|
|
1000
649
|
})(exports.WDOIdentityVerificationPhase || (exports.WDOIdentityVerificationPhase = {}));
|
|
1001
|
-
|
|
650
|
+
/* @internal */
|
|
1002
651
|
exports.WDODocumentSubmitFileType = void 0;
|
|
1003
652
|
(function (WDODocumentSubmitFileType) {
|
|
1004
653
|
/** National ID card */
|
|
@@ -1010,7 +659,7 @@ exports.WDODocumentSubmitFileType = void 0;
|
|
|
1010
659
|
/** Selfie photo */
|
|
1011
660
|
WDODocumentSubmitFileType["selfiePhoto"] = "SELFIE_PHOTO";
|
|
1012
661
|
})(exports.WDODocumentSubmitFileType || (exports.WDODocumentSubmitFileType = {}));
|
|
1013
|
-
|
|
662
|
+
/* @internal */
|
|
1014
663
|
exports.WDODocumentSubmitFileSide = void 0;
|
|
1015
664
|
(function (WDODocumentSubmitFileSide) {
|
|
1016
665
|
/** Front side of an document. Usually the one with the picture */
|
|
@@ -1018,7 +667,7 @@ exports.WDODocumentSubmitFileSide = void 0;
|
|
|
1018
667
|
/** Back side of an document */
|
|
1019
668
|
WDODocumentSubmitFileSide["back"] = "BACK";
|
|
1020
669
|
})(exports.WDODocumentSubmitFileSide || (exports.WDODocumentSubmitFileSide = {}));
|
|
1021
|
-
|
|
670
|
+
/* @internal */
|
|
1022
671
|
exports.WDODocumentStatus = void 0;
|
|
1023
672
|
(function (WDODocumentStatus) {
|
|
1024
673
|
/** Document was accepted */
|
|
@@ -1037,110 +686,6 @@ exports.WDODocumentStatus = void 0;
|
|
|
1037
686
|
WDODocumentStatus["failed"] = "FAILED";
|
|
1038
687
|
})(exports.WDODocumentStatus || (exports.WDODocumentStatus = {}));
|
|
1039
688
|
|
|
1040
|
-
/**
|
|
1041
|
-
* Copyright Wultra s.r.o.
|
|
1042
|
-
*
|
|
1043
|
-
* This source code is licensed under the Apache License, Version 2.0 license
|
|
1044
|
-
* found in the LICENSE file in the root directory of this source tree.
|
|
1045
|
-
*
|
|
1046
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
1047
|
-
*/
|
|
1048
|
-
/** Types of the verification state */
|
|
1049
|
-
exports.WDOVerificationStateType = void 0;
|
|
1050
|
-
(function (WDOVerificationStateType) {
|
|
1051
|
-
/**
|
|
1052
|
-
* Show the verification introduction screen where the user can start the activation.
|
|
1053
|
-
*
|
|
1054
|
-
* The next step should be calling the `start()`.
|
|
1055
|
-
*/
|
|
1056
|
-
WDOVerificationStateType["intro"] = "intro";
|
|
1057
|
-
/**
|
|
1058
|
-
* Show document selection to the user. Which documents are available and how many
|
|
1059
|
-
* can the user select is up to your backend configuration.
|
|
1060
|
-
*
|
|
1061
|
-
* The next step should be calling the `documentsSetSelectedTypes`.
|
|
1062
|
-
*/
|
|
1063
|
-
WDOVerificationStateType["documentsToScanSelect"] = "documentsToScanSelect";
|
|
1064
|
-
/**
|
|
1065
|
-
* User should scan documents - display UI for the user to scan all necessary documents.
|
|
1066
|
-
*
|
|
1067
|
-
* The next step should be calling the `documentsSubmit`.
|
|
1068
|
-
*/
|
|
1069
|
-
WDOVerificationStateType["scanDocument"] = "scanDocument";
|
|
1070
|
-
/**
|
|
1071
|
-
* The system is processing data - show loading with text hint from provided `WDOStatusCheckReason`.
|
|
1072
|
-
*
|
|
1073
|
-
* The next step should be calling the `status`.
|
|
1074
|
-
*/
|
|
1075
|
-
WDOVerificationStateType["processing"] = "processing";
|
|
1076
|
-
/**
|
|
1077
|
-
* The user should be presented with a presence check.
|
|
1078
|
-
* Presence check is handled by third-party SDK based on the project setup.
|
|
1079
|
-
*
|
|
1080
|
-
* The next step should be calling the `presenceCheckInit` to start the check and `presenceCheckSubmit` to
|
|
1081
|
-
* mark it finished. Note that these methods won't change the status and it's up to the app to handle the process of the presence check.
|
|
1082
|
-
*/
|
|
1083
|
-
WDOVerificationStateType["presenceCheck"] = "presenceCheck";
|
|
1084
|
-
/**
|
|
1085
|
-
* Show enter OTP screen with resend button.
|
|
1086
|
-
*
|
|
1087
|
-
* The next step should be calling the `verifyOTP` with user-entered OTP.
|
|
1088
|
-
* The OTP is usually SMS or email.
|
|
1089
|
-
*/
|
|
1090
|
-
WDOVerificationStateType["otp"] = "otp";
|
|
1091
|
-
/**
|
|
1092
|
-
* Verification failed and can be restarted
|
|
1093
|
-
*
|
|
1094
|
-
* The next step should be calling the `restartVerification` or `cancelWholeProcess` based on
|
|
1095
|
-
* the user's decision if he wants to try it again or cancel the process.
|
|
1096
|
-
*/
|
|
1097
|
-
WDOVerificationStateType["failed"] = "failed";
|
|
1098
|
-
/**
|
|
1099
|
-
* Verification is canceled and the user needs to start again with a new PowerAuth activation.
|
|
1100
|
-
*
|
|
1101
|
-
* The next step should be calling the `PowerAuth.removeActivationLocal()` and starting activation from scratch.
|
|
1102
|
-
*/
|
|
1103
|
-
WDOVerificationStateType["endState"] = "endState";
|
|
1104
|
-
/**
|
|
1105
|
-
* Verification was successfully ended. Continue into your app flow.
|
|
1106
|
-
*/
|
|
1107
|
-
WDOVerificationStateType["success"] = "success";
|
|
1108
|
-
})(exports.WDOVerificationStateType || (exports.WDOVerificationStateType = {}));
|
|
1109
|
-
/** The reason why the process ended in a non-recoverable state. */
|
|
1110
|
-
exports.WDOEndStateReason = void 0;
|
|
1111
|
-
(function (WDOEndStateReason) {
|
|
1112
|
-
/**
|
|
1113
|
-
* The verification was rejected by the system
|
|
1114
|
-
*
|
|
1115
|
-
* eg: Fake information, fraud detection, or user is trying repeatedly in a short time.
|
|
1116
|
-
* The real reason is not presented to the user and is only audited on the server.
|
|
1117
|
-
*/
|
|
1118
|
-
WDOEndStateReason["rejected"] = "rejected";
|
|
1119
|
-
/**
|
|
1120
|
-
* The limit of repeat tries was reached. There is a fixed number of tries that the user can reach
|
|
1121
|
-
* before the system stops the process.
|
|
1122
|
-
*/
|
|
1123
|
-
WDOEndStateReason["limitReached"] = "limitReached";
|
|
1124
|
-
/** An unknown reason. */
|
|
1125
|
-
WDOEndStateReason["other"] = "other";
|
|
1126
|
-
})(exports.WDOEndStateReason || (exports.WDOEndStateReason = {}));
|
|
1127
|
-
/**
|
|
1128
|
-
* The reason for what we are waiting for. For example, we can wait for documents to be OCRed and matched against the database.
|
|
1129
|
-
* Use these values for better loading texts to tell the user what is happening - some tasks may take some time
|
|
1130
|
-
* and it would be frustrating to just show a generic loading indicator.
|
|
1131
|
-
*/
|
|
1132
|
-
exports.WDOStatusCheckReason = void 0;
|
|
1133
|
-
(function (WDOStatusCheckReason) {
|
|
1134
|
-
WDOStatusCheckReason["unknown"] = "unknown";
|
|
1135
|
-
WDOStatusCheckReason["documentUpload"] = "documentUpload";
|
|
1136
|
-
WDOStatusCheckReason["documentVerification"] = "documentVerification";
|
|
1137
|
-
WDOStatusCheckReason["documentAccepted"] = "documentAccepted";
|
|
1138
|
-
WDOStatusCheckReason["documentsCrossVerification"] = "documentsCrossVerification";
|
|
1139
|
-
WDOStatusCheckReason["clientVerification"] = "clientVerification";
|
|
1140
|
-
WDOStatusCheckReason["clientAccepted"] = "clientAccepted";
|
|
1141
|
-
WDOStatusCheckReason["verifyingPresence"] = "verifyingPresence";
|
|
1142
|
-
})(exports.WDOStatusCheckReason || (exports.WDOStatusCheckReason = {}));
|
|
1143
|
-
|
|
1144
689
|
/**
|
|
1145
690
|
* Copyright Wultra s.r.o.
|
|
1146
691
|
*
|
|
@@ -1193,22 +738,6 @@ exports.WDODocumentType = void 0;
|
|
|
1193
738
|
/** Drivers license */
|
|
1194
739
|
WDODocumentType["driversLicense"] = "driversLicense";
|
|
1195
740
|
})(exports.WDODocumentType || (exports.WDODocumentType = {}));
|
|
1196
|
-
/**
|
|
1197
|
-
* Available sides of the document
|
|
1198
|
-
*
|
|
1199
|
-
* Front and back for ID card.
|
|
1200
|
-
* For passport and drivers license front only.
|
|
1201
|
-
*/
|
|
1202
|
-
function WDODocumentTypeSides(type) {
|
|
1203
|
-
switch (type) {
|
|
1204
|
-
case exports.WDODocumentType.idCard:
|
|
1205
|
-
return [exports.WDODocumentSide.front, exports.WDODocumentSide.back];
|
|
1206
|
-
case exports.WDODocumentType.passport:
|
|
1207
|
-
return [exports.WDODocumentSide.front];
|
|
1208
|
-
case exports.WDODocumentType.driversLicense:
|
|
1209
|
-
return [exports.WDODocumentSide.front];
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
741
|
/** Side of the document */
|
|
1213
742
|
exports.WDODocumentSide = void 0;
|
|
1214
743
|
(function (WDODocumentSide) {
|
|
@@ -1220,7 +749,7 @@ exports.WDODocumentSide = void 0;
|
|
|
1220
749
|
/** Back side of a document */
|
|
1221
750
|
WDODocumentSide["back"] = "back";
|
|
1222
751
|
})(exports.WDODocumentSide || (exports.WDODocumentSide = {}));
|
|
1223
|
-
|
|
752
|
+
/* @internal */
|
|
1224
753
|
function WDODocumentTypeToSubmitType(type) {
|
|
1225
754
|
switch (type) {
|
|
1226
755
|
case exports.WDODocumentType.idCard:
|
|
@@ -1231,7 +760,7 @@ function WDODocumentTypeToSubmitType(type) {
|
|
|
1231
760
|
return exports.WDODocumentSubmitFileType.driversLicense;
|
|
1232
761
|
}
|
|
1233
762
|
}
|
|
1234
|
-
|
|
763
|
+
/* @internal */
|
|
1235
764
|
function WDOCreateDocumentSubmitFileSide(side) {
|
|
1236
765
|
switch (side) {
|
|
1237
766
|
case exports.WDODocumentSide.front:
|
|
@@ -1384,18 +913,33 @@ exports.WDOConsentResponse = void 0;
|
|
|
1384
913
|
* This service operates against Wultra Onboarding server (usually ending with `/enrollment-onboarding-server`) and you need to configure networking service with the right URL.
|
|
1385
914
|
*/
|
|
1386
915
|
var WDOBaseVerificationService = /** @class */ (function () {
|
|
1387
|
-
|
|
916
|
+
/**
|
|
917
|
+
* Creates service instance
|
|
918
|
+
*
|
|
919
|
+
* @param powerauth Configured PowerAuth instance. This instance needs to be without valid activation.
|
|
920
|
+
* @param baseUrl Base URL of the Wultra Digital Onboarding server. Usually ending with `/enrollment-onboarding-server`.
|
|
921
|
+
*/
|
|
922
|
+
function WDOBaseVerificationService(powerauth, baseUrl) {
|
|
923
|
+
// --
|
|
1388
924
|
/* @internal */
|
|
1389
925
|
this.lastStatus = undefined;
|
|
926
|
+
this.powerauth = powerauth;
|
|
927
|
+
this.api = new WDOApi(powerauth, baseUrl);
|
|
1390
928
|
}
|
|
929
|
+
/** Checks if verification is required based on PowerAuth activation status */
|
|
930
|
+
WDOBaseVerificationService.isVerificationRequiredInternal = function (paStatus) {
|
|
931
|
+
var _a;
|
|
932
|
+
var flags = (_a = paStatus.customObject) === null || _a === void 0 ? void 0 : _a.activationFlags;
|
|
933
|
+
return !!flags && flags.some(function (f) { return f === "VERIFICATION_PENDING" || f === "VERIFICATION_IN_PROGRESS"; });
|
|
934
|
+
};
|
|
1391
935
|
/* @internal */
|
|
1392
|
-
WDOBaseVerificationService.prototype.cacheKey = function () { return "wdocp_".concat(this.
|
|
936
|
+
WDOBaseVerificationService.prototype.cacheKey = function () { return "wdocp_".concat(this.powerauth.instanceId); };
|
|
1393
937
|
/* @internal */
|
|
1394
938
|
WDOBaseVerificationService.prototype.setCachedProcess = function (process) {
|
|
1395
939
|
return __awaiter(this, void 0, void 0, function () {
|
|
1396
940
|
return __generator(this, function (_a) {
|
|
1397
941
|
switch (_a.label) {
|
|
1398
|
-
case 0: return [4 /*yield*/,
|
|
942
|
+
case 0: return [4 /*yield*/, WDOPlatform.cache.set(this.cacheKey(), process === null || process === void 0 ? void 0 : process.dataForCache())];
|
|
1399
943
|
case 1:
|
|
1400
944
|
_a.sent();
|
|
1401
945
|
return [2 /*return*/];
|
|
@@ -1409,7 +953,7 @@ var WDOBaseVerificationService = /** @class */ (function () {
|
|
|
1409
953
|
var data;
|
|
1410
954
|
return __generator(this, function (_a) {
|
|
1411
955
|
switch (_a.label) {
|
|
1412
|
-
case 0: return [4 /*yield*/,
|
|
956
|
+
case 0: return [4 /*yield*/, WDOPlatform.cache.get(this.cacheKey())];
|
|
1413
957
|
case 1:
|
|
1414
958
|
data = _a.sent();
|
|
1415
959
|
if (!data) {
|
|
@@ -1430,7 +974,7 @@ var WDOBaseVerificationService = /** @class */ (function () {
|
|
|
1430
974
|
* will return error texts and other in german (if available).
|
|
1431
975
|
*/
|
|
1432
976
|
WDOBaseVerificationService.prototype.changeAcceptLanguage = function (language) {
|
|
1433
|
-
this.
|
|
977
|
+
this.api.networking.acceptLanguage = language;
|
|
1434
978
|
};
|
|
1435
979
|
Object.defineProperty(WDOBaseVerificationService.prototype, "otpResendPeriodSeconds", {
|
|
1436
980
|
/** Time in seconds that user needs to wait between OTP resend calls */
|
|
@@ -1447,17 +991,20 @@ var WDOBaseVerificationService = /** @class */ (function () {
|
|
|
1447
991
|
WDOBaseVerificationService.prototype.status = function () {
|
|
1448
992
|
return __awaiter(this, void 0, void 0, function () {
|
|
1449
993
|
var response, _a, vf, _b, docsResponse, documents, cachedProcess, error_1;
|
|
1450
|
-
var _c
|
|
1451
|
-
return __generator(this, function (
|
|
1452
|
-
switch (
|
|
994
|
+
var _c;
|
|
995
|
+
return __generator(this, function (_d) {
|
|
996
|
+
switch (_d.label) {
|
|
1453
997
|
case 0:
|
|
1454
|
-
|
|
998
|
+
_d.trys.push([0, 18, , 19]);
|
|
1455
999
|
return [4 /*yield*/, this.api.verificationStatus()];
|
|
1456
1000
|
case 1:
|
|
1457
|
-
response =
|
|
1458
|
-
response.consentRequired = (_c = response.consentRequired) !== null && _c !== void 0 ? _c : false; // when undefined, assume false
|
|
1001
|
+
response = _d.sent();
|
|
1459
1002
|
WDOLogger.info("Verification status successfully retrieved.");
|
|
1460
1003
|
WDOLogger.debug("Verification status: ".concat(JSON.stringify(response)));
|
|
1004
|
+
if (response.consentRequired == undefined) {
|
|
1005
|
+
WDOLogger.debug("Consent required flag not present in the response, assuming false");
|
|
1006
|
+
response.consentRequired = false;
|
|
1007
|
+
}
|
|
1461
1008
|
_a = response.identityVerificationStatus;
|
|
1462
1009
|
switch (_a) {
|
|
1463
1010
|
case exports.WDOIdentityVerificationStatus.failed: return [3 /*break*/, 2];
|
|
@@ -1470,7 +1017,7 @@ var WDOBaseVerificationService = /** @class */ (function () {
|
|
|
1470
1017
|
WDOLogger.debug("Status ".concat(response.identityVerificationStatus, " - clearing cache"));
|
|
1471
1018
|
return [4 /*yield*/, this.setCachedProcess(undefined)];
|
|
1472
1019
|
case 3:
|
|
1473
|
-
|
|
1020
|
+
_d.sent();
|
|
1474
1021
|
return [3 /*break*/, 5];
|
|
1475
1022
|
case 4:
|
|
1476
1023
|
// no-op
|
|
@@ -1489,19 +1036,20 @@ var WDOBaseVerificationService = /** @class */ (function () {
|
|
|
1489
1036
|
case WDONextStep.failed: return [3 /*break*/, 13];
|
|
1490
1037
|
case WDONextStep.rejected: return [3 /*break*/, 14];
|
|
1491
1038
|
case WDONextStep.success: return [3 /*break*/, 15];
|
|
1039
|
+
case WDONextStep.finishActivation: return [3 /*break*/, 16];
|
|
1492
1040
|
}
|
|
1493
|
-
return [3 /*break*/,
|
|
1041
|
+
return [3 /*break*/, 17];
|
|
1494
1042
|
case 6: return [2 /*return*/, this.processSuccess({ type: exports.WDOVerificationStateType.intro, consentRequired: response.consentRequired })];
|
|
1495
1043
|
case 7:
|
|
1496
1044
|
WDOLogger.debug("Verifying documents status");
|
|
1497
1045
|
return [4 /*yield*/, this.api.verificationDocumentsStatus(response.processId)];
|
|
1498
1046
|
case 8:
|
|
1499
|
-
docsResponse =
|
|
1047
|
+
docsResponse = _d.sent();
|
|
1500
1048
|
WDOLogger.debug("Documents status: ".concat(JSON.stringify(docsResponse)));
|
|
1501
1049
|
documents = docsResponse.documents;
|
|
1502
1050
|
return [4 /*yield*/, this.getCachedProcess()];
|
|
1503
1051
|
case 9:
|
|
1504
|
-
cachedProcess =
|
|
1052
|
+
cachedProcess = _d.sent();
|
|
1505
1053
|
if (cachedProcess) {
|
|
1506
1054
|
cachedProcess.feedServerData(docsResponse.documents);
|
|
1507
1055
|
if (documents.some(function (d) { return documentAction(d) === "error"; }) || documents.some(function (d) { return d.errors != undefined && d.errors.length > 0; })) {
|
|
@@ -1534,17 +1082,18 @@ var WDOBaseVerificationService = /** @class */ (function () {
|
|
|
1534
1082
|
}
|
|
1535
1083
|
case 10: return [2 /*return*/, this.processSuccess({ type: exports.WDOVerificationStateType.presenceCheck })];
|
|
1536
1084
|
case 11: return [2 /*return*/, this.processSuccess({ type: exports.WDOVerificationStateType.otp })];
|
|
1537
|
-
case 12: return [2 /*return*/, this.processSuccess({ type: exports.WDOVerificationStateType.processing, item: (
|
|
1085
|
+
case 12: return [2 /*return*/, this.processSuccess({ type: exports.WDOVerificationStateType.processing, item: (_c = vf.statusCheckReason) !== null && _c !== void 0 ? _c : exports.WDOStatusCheckReason.unknown })];
|
|
1538
1086
|
case 13: return [2 /*return*/, this.processSuccess({ type: exports.WDOVerificationStateType.failed })];
|
|
1539
1087
|
case 14: return [2 /*return*/, this.processSuccess({ type: exports.WDOVerificationStateType.endState, reason: exports.WDOEndStateReason.rejected })];
|
|
1540
1088
|
case 15: return [2 /*return*/, this.processSuccess({ type: exports.WDOVerificationStateType.success })];
|
|
1541
|
-
case 16: return [
|
|
1542
|
-
case 17:
|
|
1543
|
-
|
|
1089
|
+
case 16: return [2 /*return*/, this.processSuccess({ type: exports.WDOVerificationStateType.finishActivation })];
|
|
1090
|
+
case 17: return [3 /*break*/, 19];
|
|
1091
|
+
case 18:
|
|
1092
|
+
error_1 = _d.sent();
|
|
1544
1093
|
WDOLogger.error("Error fetching verification status: ".concat(JSON.stringify(error_1)));
|
|
1545
1094
|
this.lastStatus = undefined;
|
|
1546
1095
|
throw this.processError(error_1);
|
|
1547
|
-
case
|
|
1096
|
+
case 19: return [2 /*return*/];
|
|
1548
1097
|
}
|
|
1549
1098
|
});
|
|
1550
1099
|
});
|
|
@@ -1810,6 +1359,78 @@ var WDOBaseVerificationService = /** @class */ (function () {
|
|
|
1810
1359
|
});
|
|
1811
1360
|
});
|
|
1812
1361
|
};
|
|
1362
|
+
/**
|
|
1363
|
+
* Finishes verification by creating a new PowerAuth activation on given `newPowerAuthInstance`.
|
|
1364
|
+
*
|
|
1365
|
+
* Needs to be called when "activationFinish" next step is returned from the `status()` call.
|
|
1366
|
+
*
|
|
1367
|
+
* The method verifies that the provided `password` is the same as used in the original activation
|
|
1368
|
+
* (if `validatePassword` is set to `true`), then it calls the server API to finish
|
|
1369
|
+
* the verification and obtain the activation code for the new activation. Finally, it creates
|
|
1370
|
+
* a new activation on `newPowerAuthInstance` using the obtained activation code and persists it
|
|
1371
|
+
* with the provided `newPassword`.
|
|
1372
|
+
*
|
|
1373
|
+
* After successful completion, the original PowerAuth instance becomes invalid (`REMOVED` state) and cannot be used anymore.
|
|
1374
|
+
*
|
|
1375
|
+
* @param newPowerAuthInstance PowerAuth instance where to create new activation. This instance must not have an existing activation.
|
|
1376
|
+
* @param newActivationName Name of the new activation to be created on `newPowerAuthInstance`.
|
|
1377
|
+
* @param newPassword Password to protect the new activation. In case `validatePassword` is `true`, this password must match the password of the original activation and must be reusable (not destroyed on use).
|
|
1378
|
+
* @param validatePassword If set to `true`, the method verifies that the provided `newPassword` matches the password of the original activation.
|
|
1379
|
+
* @param userIdentification Optional user identification object to be sent to the server during the finish activation process.
|
|
1380
|
+
*/
|
|
1381
|
+
WDOBaseVerificationService.prototype.finishActivation = function (newPowerAuthInstance, newActivationName, newPassword, validatePassword, userIdentification) {
|
|
1382
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1383
|
+
var pid, response, activation, e_1;
|
|
1384
|
+
return __generator(this, function (_a) {
|
|
1385
|
+
switch (_a.label) {
|
|
1386
|
+
case 0:
|
|
1387
|
+
_a.trys.push([0, , 12, 14]);
|
|
1388
|
+
pid = this.verifyHasActiveProcess();
|
|
1389
|
+
if (!validatePassword) return [3 /*break*/, 2];
|
|
1390
|
+
// password must be reusable
|
|
1391
|
+
if (newPassword.destroyOnUse) { // TODO: ok? maybe make this property public in PowerAuthPassword?
|
|
1392
|
+
throw new WDOError(exports.WDOErrorReason.invalidParameter, "The provided PowerAuthPassword is configured to be destroyed on use, which is not supported in finishActivation with validatePassword=true. Please provide a reusable PowerAuthPassword instance. (with destroyOnUse=false)");
|
|
1393
|
+
}
|
|
1394
|
+
// validate password against original activation
|
|
1395
|
+
return [4 /*yield*/, this.powerauth.validatePassword(newPassword)];
|
|
1396
|
+
case 1:
|
|
1397
|
+
// validate password against original activation
|
|
1398
|
+
_a.sent();
|
|
1399
|
+
_a.label = 2;
|
|
1400
|
+
case 2: return [4 /*yield*/, this.handleError(this.api.verificationFinishActivation(pid, userIdentification))];
|
|
1401
|
+
case 3:
|
|
1402
|
+
response = _a.sent();
|
|
1403
|
+
_a.label = 4;
|
|
1404
|
+
case 4:
|
|
1405
|
+
_a.trys.push([4, 7, , 11]);
|
|
1406
|
+
activation = WDOPlatform.powerAuthFactory.activationWithActivationCode(response.activationCode, newActivationName, undefined);
|
|
1407
|
+
return [4 /*yield*/, newPowerAuthInstance.createActivation(activation)];
|
|
1408
|
+
case 5:
|
|
1409
|
+
_a.sent();
|
|
1410
|
+
return [4 /*yield*/, newPowerAuthInstance.persistActivation(WDOPlatform.powerAuthFactory.authenticationWithPassword(newPassword))];
|
|
1411
|
+
case 6:
|
|
1412
|
+
_a.sent();
|
|
1413
|
+
return [3 /*break*/, 11];
|
|
1414
|
+
case 7:
|
|
1415
|
+
e_1 = _a.sent();
|
|
1416
|
+
return [4 /*yield*/, newPowerAuthInstance.canStartActivation()];
|
|
1417
|
+
case 8:
|
|
1418
|
+
if (!((_a.sent()) == false)) return [3 /*break*/, 10];
|
|
1419
|
+
return [4 /*yield*/, newPowerAuthInstance.removeActivationLocal()];
|
|
1420
|
+
case 9:
|
|
1421
|
+
_a.sent();
|
|
1422
|
+
_a.label = 10;
|
|
1423
|
+
case 10: throw e_1; // rethrow
|
|
1424
|
+
case 11: return [2 /*return*/, this.processSuccess({ type: exports.WDOVerificationStateType.success })];
|
|
1425
|
+
case 12: return [4 /*yield*/, newPassword.clear()]; // destroy the password after use
|
|
1426
|
+
case 13:
|
|
1427
|
+
_a.sent(); // destroy the password after use
|
|
1428
|
+
return [7 /*endfinally*/];
|
|
1429
|
+
case 14: return [2 /*return*/];
|
|
1430
|
+
}
|
|
1431
|
+
});
|
|
1432
|
+
});
|
|
1433
|
+
};
|
|
1813
1434
|
/**
|
|
1814
1435
|
* Request OTP resend.
|
|
1815
1436
|
*
|
|
@@ -1888,10 +1509,10 @@ var WDOBaseVerificationService = /** @class */ (function () {
|
|
|
1888
1509
|
_c.label = 1;
|
|
1889
1510
|
case 1:
|
|
1890
1511
|
_c.trys.push([1, 3, , 4]);
|
|
1891
|
-
return [4 /*yield*/, this.fetchActivationStatus()];
|
|
1512
|
+
return [4 /*yield*/, this.powerauth.fetchActivationStatus()];
|
|
1892
1513
|
case 2:
|
|
1893
1514
|
status_1 = _c.sent();
|
|
1894
|
-
if (status_1.state !==
|
|
1515
|
+
if (status_1.state !== "ACTIVE") {
|
|
1895
1516
|
WDOLogger.error("PowerAuth status is not active (status".concat(status_1.state, ") - notifying the delegate and returning and error."));
|
|
1896
1517
|
(_b = this.listener) === null || _b === void 0 ? void 0 : _b.powerAuthActivationStatusChanged(this, status_1);
|
|
1897
1518
|
return [2 /*return*/, new WDOError(exports.WDOErrorReason.powerauthNotActivated, "PowerAuth activation is not active anymore")];
|
|
@@ -2043,6 +1664,10 @@ var WDOVerificationStatus = /** @class */ (function () {
|
|
|
2043
1664
|
break;
|
|
2044
1665
|
}
|
|
2045
1666
|
}
|
|
1667
|
+
else if (phase === exports.WDOIdentityVerificationPhase.activationFinish) {
|
|
1668
|
+
// TODO: handle status?
|
|
1669
|
+
nextStep = WDONextStep.finishActivation;
|
|
1670
|
+
}
|
|
2046
1671
|
if (nextStep == undefined) {
|
|
2047
1672
|
WDOLogger.error("Unknown phase/status combo: ".concat(phase !== null && phase !== void 0 ? phase : "nil", ", ").concat(status));
|
|
2048
1673
|
nextStep = WDONextStep.failed;
|
|
@@ -2067,6 +1692,7 @@ var WDONextStep;
|
|
|
2067
1692
|
WDONextStep["statusCheck"] = "statusCheck";
|
|
2068
1693
|
WDONextStep["presenceCheck"] = "presenceCheck";
|
|
2069
1694
|
WDONextStep["otp"] = "otp";
|
|
1695
|
+
WDONextStep["finishActivation"] = "finishActivation";
|
|
2070
1696
|
WDONextStep["failed"] = "failed";
|
|
2071
1697
|
WDONextStep["rejected"] = "rejected";
|
|
2072
1698
|
WDONextStep["success"] = "success";
|
|
@@ -2097,63 +1723,437 @@ function documentAction(document) {
|
|
|
2097
1723
|
* SPDX-License-Identifier: Apache-2.0
|
|
2098
1724
|
*/
|
|
2099
1725
|
|
|
1726
|
+
|
|
1727
|
+
var WDOCordovaCache = /** @class */ (function () {
|
|
1728
|
+
function WDOCordovaCache() {
|
|
1729
|
+
}
|
|
1730
|
+
WDOCordovaCache.prototype.set = function (key, value) {
|
|
1731
|
+
if (value) {
|
|
1732
|
+
return PowerAuthStorageUtils.setString(key, value, PowerAuthStorageType.SECURE);
|
|
1733
|
+
}
|
|
1734
|
+
else {
|
|
1735
|
+
return PowerAuthStorageUtils.remove(key, PowerAuthStorageType.SECURE).then(function () { });
|
|
1736
|
+
}
|
|
1737
|
+
};
|
|
1738
|
+
WDOCordovaCache.prototype.get = function (key) {
|
|
1739
|
+
return PowerAuthStorageUtils.getString(key, PowerAuthStorageType.SECURE);
|
|
1740
|
+
};
|
|
1741
|
+
WDOCordovaCache.prototype.has = function (key) {
|
|
1742
|
+
return PowerAuthStorageUtils.exists(key, PowerAuthStorageType.SECURE);
|
|
1743
|
+
};
|
|
1744
|
+
return WDOCordovaCache;
|
|
1745
|
+
}());
|
|
1746
|
+
var WDONetworkingFactoryCordova = /** @class */ (function () {
|
|
1747
|
+
function WDONetworkingFactoryCordova() {
|
|
1748
|
+
}
|
|
1749
|
+
WDONetworkingFactoryCordova.prototype.signedEndpoint = function (path, uriId, responseConfig, e2eeConfig) {
|
|
1750
|
+
return WPNEndpoint.signed(path, uriId, responseConfig, e2eeConfig);
|
|
1751
|
+
};
|
|
1752
|
+
WDONetworkingFactoryCordova.prototype.signedWithTokenEndpoint = function (path, tokenName, responseConfig, e2eeConfig) {
|
|
1753
|
+
return WPNEndpoint.signedWithToken(path, tokenName, responseConfig, e2eeConfig);
|
|
1754
|
+
};
|
|
1755
|
+
WDONetworkingFactoryCordova.prototype.unsignedEndpoint = function (path, responseConfig, e2eeConfig) {
|
|
1756
|
+
return WPNEndpoint.unsigned(path, responseConfig, e2eeConfig);
|
|
1757
|
+
};
|
|
1758
|
+
WDONetworkingFactoryCordova.prototype.networking = function (powerAuth, baseUrl) {
|
|
1759
|
+
return new WPNNetworking(powerAuth, baseUrl);
|
|
1760
|
+
};
|
|
1761
|
+
return WDONetworkingFactoryCordova;
|
|
1762
|
+
}());
|
|
1763
|
+
var WDOPowerAuthFactoryCordova = /** @class */ (function () {
|
|
1764
|
+
function WDOPowerAuthFactoryCordova() {
|
|
1765
|
+
}
|
|
1766
|
+
WDOPowerAuthFactoryCordova.prototype.activationWithActivationCode = function (activationCode, activationName, otp) {
|
|
1767
|
+
var activation = PowerAuthActivation.createWithActivationCode(activationCode, activationName);
|
|
1768
|
+
if (otp) {
|
|
1769
|
+
activation.additionalActivationOtp = otp;
|
|
1770
|
+
}
|
|
1771
|
+
return activation;
|
|
1772
|
+
};
|
|
1773
|
+
WDOPowerAuthFactoryCordova.prototype.activationWithIdentityAttributes = function (identityAttributes, activationName) {
|
|
1774
|
+
return PowerAuthActivation.createWithIdentityAttributes(identityAttributes, activationName);
|
|
1775
|
+
};
|
|
1776
|
+
WDOPowerAuthFactoryCordova.prototype.authenticationWithPassword = function (password) {
|
|
1777
|
+
return PowerAuthAuthentication.password(password);
|
|
1778
|
+
};
|
|
1779
|
+
return WDOPowerAuthFactoryCordova;
|
|
1780
|
+
}());
|
|
1781
|
+
|
|
2100
1782
|
/**
|
|
2101
|
-
*
|
|
1783
|
+
* Copyright Wultra s.r.o.
|
|
2102
1784
|
*
|
|
2103
|
-
*
|
|
1785
|
+
* This source code is licensed under the Apache License, Version 2.0 license
|
|
1786
|
+
* found in the LICENSE file in the root directory of this source tree.
|
|
1787
|
+
*
|
|
1788
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
1789
|
+
*/
|
|
1790
|
+
/**
|
|
1791
|
+
* Service that can activate PowerAuth instance by user weak credentials (like his email, phone number or client ID) + optional SMS OTP.
|
|
1792
|
+
*
|
|
1793
|
+
* When the PowerAuth is activated with this service, `WDOVerificationService.isVerificationRequired` will be `true`
|
|
1794
|
+
* and you will need to verify the PowerAuth instance via `WDOVerificationService`.
|
|
2104
1795
|
*
|
|
2105
1796
|
* This service operates against Wultra Onboarding server (usually ending with `/enrollment-onboarding-server`) and you need to configure networking service with the right URL.
|
|
2106
1797
|
*/
|
|
2107
|
-
var
|
|
2108
|
-
|
|
1798
|
+
var WDOBaseActivationService = /** @class */ (function () {
|
|
1799
|
+
// PUBLIC API
|
|
1800
|
+
/**
|
|
1801
|
+
* Creates service instance
|
|
1802
|
+
*
|
|
1803
|
+
* @param powerauth Configured PowerAuth instance. This instance needs to be without valid activation.
|
|
1804
|
+
* @param baseUrl Base URL of the Wultra Digital Onboarding server. Usually ending with `/enrollment-onboarding-server`.
|
|
1805
|
+
*/
|
|
1806
|
+
function WDOBaseActivationService(powerauth, baseUrl) {
|
|
1807
|
+
this.api = new WDOApi(powerauth, baseUrl);
|
|
1808
|
+
this.powerauth = powerauth;
|
|
1809
|
+
}
|
|
1810
|
+
Object.defineProperty(WDOBaseActivationService.prototype, "cacheKey", {
|
|
1811
|
+
/* @internal */
|
|
1812
|
+
get: function () { return "wdopd_".concat(this.powerauth.instanceId); },
|
|
1813
|
+
enumerable: false,
|
|
1814
|
+
configurable: true
|
|
1815
|
+
});
|
|
1816
|
+
/* @internal */
|
|
1817
|
+
WDOBaseActivationService.prototype.setCachedProcessData = function (data) {
|
|
1818
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1819
|
+
return __generator(this, function (_a) {
|
|
1820
|
+
switch (_a.label) {
|
|
1821
|
+
case 0: return [4 /*yield*/, WDOPlatform.cache.set(this.cacheKey, JSON.stringify(data))];
|
|
1822
|
+
case 1:
|
|
1823
|
+
_a.sent();
|
|
1824
|
+
return [2 /*return*/];
|
|
1825
|
+
}
|
|
1826
|
+
});
|
|
1827
|
+
});
|
|
1828
|
+
};
|
|
1829
|
+
/* @internal */
|
|
1830
|
+
WDOBaseActivationService.prototype.getCachedProcessData = function () {
|
|
1831
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1832
|
+
var data;
|
|
1833
|
+
return __generator(this, function (_a) {
|
|
1834
|
+
switch (_a.label) {
|
|
1835
|
+
case 0: return [4 /*yield*/, WDOPlatform.cache.get(this.cacheKey)];
|
|
1836
|
+
case 1:
|
|
1837
|
+
data = _a.sent();
|
|
1838
|
+
if (!data) {
|
|
1839
|
+
return [2 /*return*/, undefined];
|
|
1840
|
+
}
|
|
1841
|
+
return [2 /*return*/, JSON.parse(data)];
|
|
1842
|
+
}
|
|
1843
|
+
});
|
|
1844
|
+
});
|
|
1845
|
+
};
|
|
1846
|
+
/* @internal */
|
|
1847
|
+
WDOBaseActivationService.prototype.processId = function () {
|
|
1848
|
+
return __awaiter(this, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
|
|
1849
|
+
switch (_b.label) {
|
|
1850
|
+
case 0: return [4 /*yield*/, this.getCachedProcessData()];
|
|
1851
|
+
case 1: return [2 /*return*/, (_a = (_b.sent())) === null || _a === void 0 ? void 0 : _a.processId];
|
|
1852
|
+
}
|
|
1853
|
+
}); });
|
|
1854
|
+
};
|
|
1855
|
+
/**
|
|
1856
|
+
* If the activation process is in progress.
|
|
1857
|
+
*
|
|
1858
|
+
* Note that even if this property is `true` it can be already discontinued on the server.
|
|
1859
|
+
* Calling `status()` after the app is launched is recommended.
|
|
1860
|
+
*/
|
|
1861
|
+
WDOBaseActivationService.prototype.hasActiveProcess = function () {
|
|
1862
|
+
return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
1863
|
+
switch (_a.label) {
|
|
1864
|
+
case 0: return [4 /*yield*/, this.getCachedProcessData()];
|
|
1865
|
+
case 1: return [2 /*return*/, !!(_a.sent())];
|
|
1866
|
+
}
|
|
1867
|
+
}); });
|
|
1868
|
+
};
|
|
1869
|
+
/**
|
|
1870
|
+
* Accept language for the outgoing requests headers.
|
|
1871
|
+
* Default value is "en".
|
|
1872
|
+
*
|
|
1873
|
+
* Standard RFC "Accept-Language" https://tools.ietf.org/html/rfc7231#section-5.3.5
|
|
1874
|
+
* Response texts are based on this setting. For example when "de" is set, server
|
|
1875
|
+
* will return error texts and other in german (if available).
|
|
1876
|
+
*/
|
|
1877
|
+
WDOBaseActivationService.prototype.changeAcceptLanguage = function (language) {
|
|
1878
|
+
this.api.networking.acceptLanguage = language;
|
|
1879
|
+
};
|
|
1880
|
+
/**
|
|
1881
|
+
* Retrieves status of the onboarding activation.
|
|
1882
|
+
*
|
|
1883
|
+
* @return Promise resolved with onboarding status.
|
|
1884
|
+
*/
|
|
1885
|
+
WDOBaseActivationService.prototype.status = function () {
|
|
1886
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1887
|
+
var _a, _b, _c, pid, result;
|
|
1888
|
+
return __generator(this, function (_d) {
|
|
1889
|
+
switch (_d.label) {
|
|
1890
|
+
case 0:
|
|
1891
|
+
_b = (_a = WDOLogger).debug;
|
|
1892
|
+
_c = "Getting activation status for processId=".concat;
|
|
1893
|
+
return [4 /*yield*/, this.processId()];
|
|
1894
|
+
case 1:
|
|
1895
|
+
_b.apply(_a, [_c.apply("Getting activation status for processId=", [_d.sent()])]);
|
|
1896
|
+
return [4 /*yield*/, this.verifyCanStartActivation()];
|
|
1897
|
+
case 2:
|
|
1898
|
+
_d.sent();
|
|
1899
|
+
return [4 /*yield*/, this.verifyHasActiveProcess()];
|
|
1900
|
+
case 3:
|
|
1901
|
+
pid = _d.sent();
|
|
1902
|
+
return [4 /*yield*/, this.api.activationGetStatus(pid)];
|
|
1903
|
+
case 4:
|
|
1904
|
+
result = _d.sent();
|
|
1905
|
+
return [2 /*return*/, result.onboardingStatus];
|
|
1906
|
+
}
|
|
1907
|
+
});
|
|
1908
|
+
});
|
|
1909
|
+
};
|
|
1910
|
+
/**
|
|
1911
|
+
* Start onboarding activation with user credentials.
|
|
1912
|
+
*
|
|
1913
|
+
* For example, when you require email and birth date, your object would look like this:
|
|
1914
|
+
* ```
|
|
1915
|
+
* {
|
|
1916
|
+
* email: "<user_email>",
|
|
1917
|
+
* birthdate: "<user_birth_date>"
|
|
1918
|
+
* }
|
|
1919
|
+
* ```
|
|
1920
|
+
* @param credentials Object with credentials. Which credentials are needed should be provided by a system/backend provider.
|
|
1921
|
+
* @param processType The process type identification. If not specified, the default process type will be used.
|
|
1922
|
+
*/
|
|
1923
|
+
WDOBaseActivationService.prototype.start = function (credentials, processType) {
|
|
1924
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1925
|
+
var result;
|
|
1926
|
+
return __generator(this, function (_a) {
|
|
1927
|
+
switch (_a.label) {
|
|
1928
|
+
case 0:
|
|
1929
|
+
WDOLogger.debug("Starting activation with credentials: ".concat(JSON.stringify(credentials)));
|
|
1930
|
+
return [4 /*yield*/, this.processId()];
|
|
1931
|
+
case 1:
|
|
1932
|
+
if (_a.sent()) {
|
|
1933
|
+
throw new WDOError(exports.WDOErrorReason.processAlreadyInProgress, "Cannot start the process - processId already obtained, cancel first.");
|
|
1934
|
+
}
|
|
1935
|
+
return [4 /*yield*/, this.verifyCanStartActivation()];
|
|
1936
|
+
case 2:
|
|
1937
|
+
_a.sent();
|
|
1938
|
+
return [4 /*yield*/, this.api.activationStart(credentials, processType)];
|
|
1939
|
+
case 3:
|
|
1940
|
+
result = _a.sent();
|
|
1941
|
+
WDOLogger.info("WDOActivationService.start success");
|
|
1942
|
+
WDOLogger.debug(" - processId: ".concat(result.processId));
|
|
1943
|
+
return [4 /*yield*/, this.setCachedProcessData({ processId: result.processId, activationCode: result.activationCode })];
|
|
1944
|
+
case 4:
|
|
1945
|
+
_a.sent();
|
|
1946
|
+
return [2 /*return*/];
|
|
1947
|
+
}
|
|
1948
|
+
});
|
|
1949
|
+
});
|
|
1950
|
+
};
|
|
1951
|
+
/**
|
|
1952
|
+
* Cancel the activation process (issues a cancel request to the backend and clears the local process ID).
|
|
1953
|
+
*
|
|
1954
|
+
* @param forceCancel When true, the process will be canceled in the SDK even when fails on backend. `true` by default.
|
|
1955
|
+
*/
|
|
1956
|
+
WDOBaseActivationService.prototype.cancel = function () {
|
|
1957
|
+
return __awaiter(this, arguments, void 0, function (forceCancel) {
|
|
1958
|
+
var _a, _b, _c, pid, error_1;
|
|
1959
|
+
if (forceCancel === void 0) { forceCancel = true; }
|
|
1960
|
+
return __generator(this, function (_d) {
|
|
1961
|
+
switch (_d.label) {
|
|
1962
|
+
case 0:
|
|
1963
|
+
_b = (_a = WDOLogger).debug;
|
|
1964
|
+
_c = "Canceling activation for processId=".concat;
|
|
1965
|
+
return [4 /*yield*/, this.processId()];
|
|
1966
|
+
case 1:
|
|
1967
|
+
_b.apply(_a, [_c.apply("Canceling activation for processId=", [_d.sent(), ", forceCancel="]).concat(forceCancel)]);
|
|
1968
|
+
return [4 /*yield*/, this.verifyHasActiveProcess()];
|
|
1969
|
+
case 2:
|
|
1970
|
+
pid = _d.sent();
|
|
1971
|
+
_d.label = 3;
|
|
1972
|
+
case 3:
|
|
1973
|
+
_d.trys.push([3, 6, , 10]);
|
|
1974
|
+
return [4 /*yield*/, this.api.activationCancel(pid)];
|
|
1975
|
+
case 4:
|
|
1976
|
+
_d.sent();
|
|
1977
|
+
return [4 /*yield*/, this.setCachedProcessData(undefined)];
|
|
1978
|
+
case 5:
|
|
1979
|
+
_d.sent();
|
|
1980
|
+
WDOLogger.info("WDOActivationService.cancel success");
|
|
1981
|
+
return [3 /*break*/, 10];
|
|
1982
|
+
case 6:
|
|
1983
|
+
error_1 = _d.sent();
|
|
1984
|
+
if (!forceCancel) return [3 /*break*/, 8];
|
|
1985
|
+
// pretend it was successful and just log the error
|
|
1986
|
+
WDOLogger.debug("Process canceled (but the request failed) - ".concat(error_1, "."));
|
|
1987
|
+
return [4 /*yield*/, this.setCachedProcessData(undefined)];
|
|
1988
|
+
case 7:
|
|
1989
|
+
_d.sent();
|
|
1990
|
+
return [3 /*break*/, 9];
|
|
1991
|
+
case 8: throw error_1; // rethrow
|
|
1992
|
+
case 9: return [3 /*break*/, 10];
|
|
1993
|
+
case 10: return [2 /*return*/];
|
|
1994
|
+
}
|
|
1995
|
+
});
|
|
1996
|
+
});
|
|
1997
|
+
};
|
|
1998
|
+
/** Clear the stored data (without networking call). */
|
|
1999
|
+
WDOBaseActivationService.prototype.clear = function () {
|
|
2000
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2001
|
+
return __generator(this, function (_a) {
|
|
2002
|
+
switch (_a.label) {
|
|
2003
|
+
case 0: return [4 /*yield*/, this.setCachedProcessData(undefined)];
|
|
2004
|
+
case 1:
|
|
2005
|
+
_a.sent();
|
|
2006
|
+
return [2 /*return*/];
|
|
2007
|
+
}
|
|
2008
|
+
});
|
|
2009
|
+
});
|
|
2010
|
+
};
|
|
2109
2011
|
/**
|
|
2110
|
-
*
|
|
2012
|
+
* OTP resend request.
|
|
2111
2013
|
*
|
|
2112
|
-
*
|
|
2113
|
-
*
|
|
2014
|
+
* This is intended to be displayed for the user to use in case of the OTP is not received.
|
|
2015
|
+
* For example, when the user does not receive SMS after some time, there should be a button to "send again".
|
|
2016
|
+
* There is a server-side rate limit applied to this operation to prevent abuse; it is good practice to disable the button temporarily while the OTP is being sent.
|
|
2114
2017
|
*/
|
|
2115
|
-
function
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2018
|
+
WDOBaseActivationService.prototype.resendOTP = function () {
|
|
2019
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2020
|
+
var pid;
|
|
2021
|
+
return __generator(this, function (_a) {
|
|
2022
|
+
switch (_a.label) {
|
|
2023
|
+
case 0:
|
|
2024
|
+
WDOLogger.debug("Activation: resending OTP");
|
|
2025
|
+
return [4 /*yield*/, this.verifyHasActiveProcess()];
|
|
2026
|
+
case 1:
|
|
2027
|
+
pid = _a.sent();
|
|
2028
|
+
return [4 /*yield*/, this.verifyCanStartActivation()];
|
|
2029
|
+
case 2:
|
|
2030
|
+
_a.sent();
|
|
2031
|
+
return [4 /*yield*/, this.api.activationResendOTP(pid)];
|
|
2032
|
+
case 3:
|
|
2033
|
+
_a.sent();
|
|
2034
|
+
return [2 /*return*/];
|
|
2035
|
+
}
|
|
2036
|
+
});
|
|
2037
|
+
});
|
|
2126
2038
|
};
|
|
2127
|
-
|
|
2128
|
-
|
|
2039
|
+
/**
|
|
2040
|
+
* @internal
|
|
2041
|
+
* Demo endpoint available only in Wultra Demo systems.
|
|
2042
|
+
*
|
|
2043
|
+
* If the app is running against our demo server, you can retrieve the OTP without needing to send SMS or emails.
|
|
2044
|
+
*/
|
|
2045
|
+
WDOBaseActivationService.prototype.getOTP = function () {
|
|
2129
2046
|
return __awaiter(this, void 0, void 0, function () {
|
|
2130
|
-
var
|
|
2047
|
+
var pid;
|
|
2131
2048
|
return __generator(this, function (_a) {
|
|
2132
2049
|
switch (_a.label) {
|
|
2133
|
-
case 0:
|
|
2050
|
+
case 0:
|
|
2051
|
+
WDOLogger.debug("Activation: getting OTP from server (only for testing purposes)");
|
|
2052
|
+
return [4 /*yield*/, this.verifyHasActiveProcess()];
|
|
2134
2053
|
case 1:
|
|
2135
|
-
|
|
2136
|
-
return [
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2054
|
+
pid = _a.sent();
|
|
2055
|
+
return [4 /*yield*/, this.api.activationGetOTP(pid, "ACTIVATION")];
|
|
2056
|
+
case 2: return [2 /*return*/, (_a.sent()).otpCode];
|
|
2057
|
+
}
|
|
2058
|
+
});
|
|
2059
|
+
});
|
|
2060
|
+
};
|
|
2061
|
+
/**
|
|
2062
|
+
* Activate the PowerAuth instance that was passed in the initializer.
|
|
2063
|
+
*
|
|
2064
|
+
* @param activationName Name of the activation. Usually something like John's iPhone or similar.
|
|
2065
|
+
* @param otp OTP code received by the user (via SMS or email). Optional when not required.
|
|
2066
|
+
* @return Promise resolved with activation result.
|
|
2067
|
+
*/
|
|
2068
|
+
WDOBaseActivationService.prototype.activate = function (activationName, otp) {
|
|
2069
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2070
|
+
var pid, code, result, activation, identityAttributes, activation, error_2;
|
|
2071
|
+
var _a;
|
|
2072
|
+
return __generator(this, function (_b) {
|
|
2073
|
+
switch (_b.label) {
|
|
2074
|
+
case 0:
|
|
2075
|
+
WDOLogger.debug("Activating the PowerAuth with activation name '".concat(activationName, "'"));
|
|
2076
|
+
return [4 /*yield*/, this.verifyCanStartActivation()];
|
|
2077
|
+
case 1:
|
|
2078
|
+
_b.sent();
|
|
2079
|
+
return [4 /*yield*/, this.verifyHasActiveProcess()];
|
|
2080
|
+
case 2:
|
|
2081
|
+
pid = _b.sent();
|
|
2082
|
+
return [4 /*yield*/, this.getCachedProcessData()];
|
|
2083
|
+
case 3:
|
|
2084
|
+
code = (_a = (_b.sent())) === null || _a === void 0 ? void 0 : _a.activationCode;
|
|
2085
|
+
_b.label = 4;
|
|
2086
|
+
case 4:
|
|
2087
|
+
_b.trys.push([4, 9, , 10]);
|
|
2088
|
+
if (!code) return [3 /*break*/, 6];
|
|
2089
|
+
WDOLogger.info("Activating PowerAuth using activation code from the onboarding process");
|
|
2090
|
+
activation = WDOPlatform.powerAuthFactory.activationWithActivationCode(code, activationName, otp);
|
|
2091
|
+
return [4 /*yield*/, this.powerauth.createActivation(activation)];
|
|
2092
|
+
case 5:
|
|
2093
|
+
result = _b.sent();
|
|
2094
|
+
return [3 /*break*/, 8];
|
|
2095
|
+
case 6:
|
|
2096
|
+
WDOLogger.info("Activating PowerAuth using identity attributes from the onboarding process");
|
|
2097
|
+
identityAttributes = { processId: pid, otpCode: otp, credentialsType: "ONBOARDING" };
|
|
2098
|
+
activation = WDOPlatform.powerAuthFactory.activationWithIdentityAttributes(identityAttributes, activationName);
|
|
2099
|
+
return [4 /*yield*/, this.powerauth.createActivation(activation)];
|
|
2100
|
+
case 7:
|
|
2101
|
+
result = _b.sent();
|
|
2102
|
+
_b.label = 8;
|
|
2103
|
+
case 8: return [3 /*break*/, 10];
|
|
2104
|
+
case 9:
|
|
2105
|
+
error_2 = _b.sent();
|
|
2106
|
+
throw new WDOError(exports.WDOErrorReason.activationFailed, "Activation failed", error_2);
|
|
2107
|
+
case 10:
|
|
2108
|
+
// Clear process ID after activation attempt
|
|
2109
|
+
return [4 /*yield*/, this.setCachedProcessData(undefined)];
|
|
2110
|
+
case 11:
|
|
2111
|
+
// Clear process ID after activation attempt
|
|
2112
|
+
_b.sent();
|
|
2113
|
+
return [2 /*return*/, result];
|
|
2143
2114
|
}
|
|
2144
2115
|
});
|
|
2145
2116
|
});
|
|
2146
2117
|
};
|
|
2118
|
+
// PRIVATE METHODS
|
|
2147
2119
|
/* @internal */
|
|
2148
|
-
|
|
2149
|
-
this
|
|
2120
|
+
WDOBaseActivationService.prototype.verifyCanStartActivation = function () {
|
|
2121
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2122
|
+
return __generator(this, function (_a) {
|
|
2123
|
+
switch (_a.label) {
|
|
2124
|
+
case 0: return [4 /*yield*/, this.powerauth.canStartActivation()];
|
|
2125
|
+
case 1:
|
|
2126
|
+
if (!!(_a.sent())) return [3 /*break*/, 3];
|
|
2127
|
+
WDOLogger.error("PowerAuth is already activated - Activation cannot be started/processed.");
|
|
2128
|
+
return [4 /*yield*/, this.setCachedProcessData(undefined)];
|
|
2129
|
+
case 2:
|
|
2130
|
+
_a.sent();
|
|
2131
|
+
throw new WDOError(exports.WDOErrorReason.powerauthAlreadyActivated, "PowerAuth is already activated");
|
|
2132
|
+
case 3: return [2 /*return*/];
|
|
2133
|
+
}
|
|
2134
|
+
});
|
|
2135
|
+
});
|
|
2150
2136
|
};
|
|
2151
2137
|
/* @internal */
|
|
2152
|
-
|
|
2153
|
-
return this
|
|
2138
|
+
WDOBaseActivationService.prototype.verifyHasActiveProcess = function () {
|
|
2139
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2140
|
+
var pid;
|
|
2141
|
+
return __generator(this, function (_a) {
|
|
2142
|
+
switch (_a.label) {
|
|
2143
|
+
case 0: return [4 /*yield*/, this.processId()];
|
|
2144
|
+
case 1:
|
|
2145
|
+
pid = _a.sent();
|
|
2146
|
+
if (!pid) {
|
|
2147
|
+
WDOLogger.warn("Cannot proceed (processId not available).");
|
|
2148
|
+
throw new WDOError(exports.WDOErrorReason.processNotInProgress, "No active activation process");
|
|
2149
|
+
}
|
|
2150
|
+
return [2 /*return*/, pid];
|
|
2151
|
+
}
|
|
2152
|
+
});
|
|
2153
|
+
});
|
|
2154
2154
|
};
|
|
2155
|
-
return
|
|
2156
|
-
}(
|
|
2155
|
+
return WDOBaseActivationService;
|
|
2156
|
+
}());
|
|
2157
2157
|
|
|
2158
2158
|
/**
|
|
2159
2159
|
* Copyright Wultra s.r.o.
|
|
@@ -2165,7 +2165,15 @@ var WDOVerificationService = /** @class */ (function (_super) {
|
|
|
2165
2165
|
*/
|
|
2166
2166
|
/** Service that provides configuration for the Wultra Digital Onboarding SDK. */
|
|
2167
2167
|
var WDOBaseConfigurationService = /** @class */ (function () {
|
|
2168
|
-
|
|
2168
|
+
/**
|
|
2169
|
+
* Creates service instance
|
|
2170
|
+
*
|
|
2171
|
+
* @param powerauth Configured PowerAuth instance.
|
|
2172
|
+
* @param baseUrl Base URL of the Wultra Digital Onboarding server. Usually ending with `/enrollment-onboarding-server`.
|
|
2173
|
+
*/
|
|
2174
|
+
function WDOBaseConfigurationService(powerauth, baseUrl) {
|
|
2175
|
+
this.api = new WDOApi(powerauth, baseUrl);
|
|
2176
|
+
this.powerauth = powerauth;
|
|
2169
2177
|
}
|
|
2170
2178
|
/**
|
|
2171
2179
|
* Fetches configuration for the given process type from the server.
|
|
@@ -2194,70 +2202,56 @@ var WDOBaseConfigurationService = /** @class */ (function () {
|
|
|
2194
2202
|
*
|
|
2195
2203
|
* SPDX-License-Identifier: Apache-2.0
|
|
2196
2204
|
*/
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
__extends(WDOConfigurationService, _super);
|
|
2201
|
-
/**
|
|
2202
|
-
* Creates service instance
|
|
2203
|
-
*
|
|
2204
|
-
* @param powerauth Configured PowerAuth instance.
|
|
2205
|
-
* @param baseUrl Base URL of the Wultra Digital Onboarding server. Usually ending with `/enrollment-onboarding-server`.
|
|
2206
|
-
*/
|
|
2207
|
-
function WDOConfigurationService(powerauth, baseUrl) {
|
|
2208
|
-
var _this = _super.call(this) || this;
|
|
2209
|
-
_this.api = new WDOApi(powerauth, baseUrl);
|
|
2210
|
-
_this.powerauth = powerauth;
|
|
2211
|
-
return _this;
|
|
2212
|
-
}
|
|
2213
|
-
return WDOConfigurationService;
|
|
2214
|
-
}(WDOBaseConfigurationService));
|
|
2215
|
-
|
|
2205
|
+
WDOPlatform.cache = new WDOCordovaCache();
|
|
2206
|
+
WDOPlatform.networkingFactory = new WDONetworkingFactoryCordova();
|
|
2207
|
+
WDOPlatform.powerAuthFactory = new WDOPowerAuthFactoryCordova();
|
|
2216
2208
|
/**
|
|
2217
|
-
*
|
|
2209
|
+
* Service that can activate PowerAuth instance by user weak credentials (like his email, phone number or client ID) + optional SMS OTP.
|
|
2218
2210
|
*
|
|
2219
|
-
*
|
|
2220
|
-
*
|
|
2211
|
+
* When the PowerAuth is activated with this service, `WDOVerificationService.isVerificationRequired` will be `true`
|
|
2212
|
+
* and you will need to verify the PowerAuth instance via `WDOVerificationService`.
|
|
2221
2213
|
*
|
|
2222
|
-
*
|
|
2214
|
+
* This service operates against Wultra Onboarding server (usually ending with `/enrollment-onboarding-server`) and you need to configure networking service with the right URL.
|
|
2223
2215
|
*/
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
function
|
|
2216
|
+
var WDOActivationService = /** @class */ (function (_super) {
|
|
2217
|
+
__extends(WDOActivationService, _super);
|
|
2218
|
+
function WDOActivationService() {
|
|
2219
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2227
2220
|
}
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
return PowerAuthStorageUtils.setString(key, value, PowerAuthStorageType.SECURE);
|
|
2231
|
-
}
|
|
2232
|
-
else {
|
|
2233
|
-
return PowerAuthStorageUtils.remove(key, PowerAuthStorageType.SECURE).then(function () { });
|
|
2234
|
-
}
|
|
2235
|
-
};
|
|
2236
|
-
WDOCordovaCache.prototype.get = function (key) {
|
|
2237
|
-
return PowerAuthStorageUtils.getString(key, PowerAuthStorageType.SECURE);
|
|
2238
|
-
};
|
|
2239
|
-
WDOCordovaCache.prototype.has = function (key) {
|
|
2240
|
-
return PowerAuthStorageUtils.exists(key, PowerAuthStorageType.SECURE);
|
|
2241
|
-
};
|
|
2242
|
-
return WDOCordovaCache;
|
|
2243
|
-
}());
|
|
2244
|
-
|
|
2221
|
+
return WDOActivationService;
|
|
2222
|
+
}(WDOBaseActivationService));
|
|
2245
2223
|
/**
|
|
2246
|
-
*
|
|
2224
|
+
* Service that can verify previously activated PowerAuth instance.
|
|
2247
2225
|
*
|
|
2248
|
-
*
|
|
2249
|
-
* found in the LICENSE file in the root directory of this source tree.
|
|
2226
|
+
* When PowerAuth instance was activated with weak credentials via `WDOActivationService`, user needs to verify his genuine presence.
|
|
2250
2227
|
*
|
|
2251
|
-
*
|
|
2228
|
+
* This service operates against Wultra Onboarding server (usually ending with `/enrollment-onboarding-server`) and you need to configure networking service with the right URL.
|
|
2252
2229
|
*/
|
|
2253
|
-
|
|
2230
|
+
var WDOVerificationService = /** @class */ (function (_super) {
|
|
2231
|
+
__extends(WDOVerificationService, _super);
|
|
2232
|
+
function WDOVerificationService() {
|
|
2233
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2234
|
+
}
|
|
2235
|
+
/** Checks if verification is required based on PowerAuth activation status */
|
|
2236
|
+
WDOVerificationService.isVerificationRequired = function (paStatus) {
|
|
2237
|
+
return _super.isVerificationRequiredInternal.call(this, paStatus);
|
|
2238
|
+
};
|
|
2239
|
+
return WDOVerificationService;
|
|
2240
|
+
}(WDOBaseVerificationService));
|
|
2241
|
+
/** Service that provides configuration for the Wultra Digital Onboarding SDK. */
|
|
2242
|
+
var WDOConfigurationService = /** @class */ (function (_super) {
|
|
2243
|
+
__extends(WDOConfigurationService, _super);
|
|
2244
|
+
function WDOConfigurationService() {
|
|
2245
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2246
|
+
}
|
|
2247
|
+
return WDOConfigurationService;
|
|
2248
|
+
}(WDOBaseConfigurationService));
|
|
2254
2249
|
|
|
2255
2250
|
exports.Side = Side;
|
|
2256
2251
|
exports.WDOActivationService = WDOActivationService;
|
|
2257
2252
|
exports.WDOConfigurationService = WDOConfigurationService;
|
|
2258
2253
|
exports.WDOCreateDocumentSubmitFileSide = WDOCreateDocumentSubmitFileSide;
|
|
2259
2254
|
exports.WDODocumentFile = WDODocumentFile;
|
|
2260
|
-
exports.WDODocumentTypeSides = WDODocumentTypeSides;
|
|
2261
2255
|
exports.WDODocumentTypeToSubmitType = WDODocumentTypeToSubmitType;
|
|
2262
2256
|
exports.WDOError = WDOError;
|
|
2263
2257
|
exports.WDOLogger = WDOLogger;
|