cordova-digital-onboarding 1.0.1 → 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 +25 -0
- package/docs/Device-Activation.md +39 -35
- package/docs/Process-Configuration.md +24 -15
- package/docs/Verifying-User.md +218 -60
- 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 +346 -289
- package/lib/index.js +1730 -1470
- package/package.json +1 -1
- package/plugin.xml +2 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,38 +1,3 @@
|
|
|
1
|
-
/** Describes the state of documents that need to be uploaded to the server. */
|
|
2
|
-
declare class WDOVerificationScanProcess {
|
|
3
|
-
/** All documents that need to be scanned. */
|
|
4
|
-
documents: WDOScannedDocument[];
|
|
5
|
-
/** Which document should be scanned next. `undefined` when all documents are uploaded and accepted. */
|
|
6
|
-
get nextDocumentToScan(): WDOScannedDocument | undefined;
|
|
7
|
-
}
|
|
8
|
-
/** Document that needs to be scanned during process. */
|
|
9
|
-
declare class WDOScannedDocument {
|
|
10
|
-
/** Type of the document. */
|
|
11
|
-
type: WDODocumentType;
|
|
12
|
-
/** Upload state. */
|
|
13
|
-
get uploadState(): UploadState;
|
|
14
|
-
/** Sides of the document that were uploaded on the server. */
|
|
15
|
-
get sides(): Side[];
|
|
16
|
-
}
|
|
17
|
-
/** State of the document on the server. */
|
|
18
|
-
declare enum UploadState {
|
|
19
|
-
/** The document was not uploaded yet. */
|
|
20
|
-
notUploaded = 0,
|
|
21
|
-
/** The document was accepted by the server. */
|
|
22
|
-
accepted = 1,
|
|
23
|
-
/** The document was rejected and needs to be re-uploaded. */
|
|
24
|
-
rejected = 2
|
|
25
|
-
}
|
|
26
|
-
/** Side of the uploaded document. */
|
|
27
|
-
declare class Side {
|
|
28
|
-
/** Type of the side. */
|
|
29
|
-
type: WDODocumentSide;
|
|
30
|
-
/** ID on the server. Use this ID in case of an reupload */
|
|
31
|
-
serverId: string;
|
|
32
|
-
/** Upload state of the document */
|
|
33
|
-
uploadState: UploadState;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
1
|
/** String that contains a Base64 encoded JPEG image */
|
|
37
2
|
type Base64EncodedJPEG = string;
|
|
38
3
|
/** Image of a document that can be sent to the backend for Identity Verification. */
|
|
@@ -85,13 +50,6 @@ declare enum WDODocumentType {
|
|
|
85
50
|
/** Drivers license */
|
|
86
51
|
driversLicense = "driversLicense"
|
|
87
52
|
}
|
|
88
|
-
/**
|
|
89
|
-
* Available sides of the document
|
|
90
|
-
*
|
|
91
|
-
* Front and back for ID card.
|
|
92
|
-
* For passport and drivers license front only.
|
|
93
|
-
*/
|
|
94
|
-
declare function WDODocumentTypeSides(type: WDODocumentType): WDODocumentSide[];
|
|
95
53
|
/** Side of the document */
|
|
96
54
|
declare enum WDODocumentSide {
|
|
97
55
|
/** Front side of a document. Usually the one with the picture.
|
|
@@ -103,138 +61,39 @@ declare enum WDODocumentSide {
|
|
|
103
61
|
back = "back"
|
|
104
62
|
}
|
|
105
63
|
|
|
106
|
-
/**
|
|
107
|
-
declare
|
|
108
|
-
/**
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
|
|
112
|
-
/** Onboarding process has failed */
|
|
113
|
-
failed = "FAILED",
|
|
114
|
-
/** Onboarding process is completed */
|
|
115
|
-
finished = "FINISHED"
|
|
116
|
-
}
|
|
117
|
-
/** Configuration for a document */
|
|
118
|
-
interface WDOConfigurationDocument {
|
|
119
|
-
/** Type of the document */
|
|
120
|
-
type: string;
|
|
121
|
-
/** Is the document mandatory */
|
|
122
|
-
mandatory: boolean;
|
|
123
|
-
/** Number of sides the document has */
|
|
124
|
-
sideCount: number;
|
|
125
|
-
}
|
|
126
|
-
/** Configuration for the onboarding process */
|
|
127
|
-
interface WDOConfigurationResponse {
|
|
128
|
-
/** Is the onboarding process enabled */
|
|
129
|
-
enabled: boolean;
|
|
130
|
-
/** Is OTP required for the first part - identification/activation. */
|
|
131
|
-
otpForIdentification: boolean;
|
|
132
|
-
/** Is OTP required for the second part - identity verification. */
|
|
133
|
-
otpForIdentityVerification: boolean;
|
|
134
|
-
/** Documents required for identity verification. */
|
|
135
|
-
documents: {
|
|
136
|
-
/** Number of required documents */
|
|
137
|
-
requiredDocumentsCount: number;
|
|
138
|
-
/** List of documents */
|
|
139
|
-
items: Array<WDOConfigurationDocument>;
|
|
140
|
-
};
|
|
64
|
+
/** Describes the state of documents that need to be uploaded to the server. */
|
|
65
|
+
declare class WDOVerificationScanProcess {
|
|
66
|
+
/** All documents that need to be scanned. */
|
|
67
|
+
documents: WDOScannedDocument[];
|
|
68
|
+
/** Which document should be scanned next. `undefined` when all documents are uploaded and accepted. */
|
|
69
|
+
get nextDocumentToScan(): WDOScannedDocument | undefined;
|
|
141
70
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
71
|
+
/** Document that needs to be scanned during process. */
|
|
72
|
+
declare class WDOScannedDocument {
|
|
73
|
+
/** Type of the document. */
|
|
74
|
+
type: WDODocumentType;
|
|
75
|
+
/** Upload state. */
|
|
76
|
+
get uploadState(): UploadState;
|
|
77
|
+
/** Sides of the document that were uploaded on the server. */
|
|
78
|
+
get sides(): Side[];
|
|
149
79
|
}
|
|
150
|
-
/**
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
declare abstract class WDOBaseActivationService {
|
|
159
|
-
/**
|
|
160
|
-
* If the activation process is in progress.
|
|
161
|
-
*
|
|
162
|
-
* Note that even if this property is `true` it can be already discontinued on the server.
|
|
163
|
-
* Calling `status()` for example after the app is launched in this case is recommended.
|
|
164
|
-
*/
|
|
165
|
-
get hasActiveProcess(): boolean;
|
|
166
|
-
/**
|
|
167
|
-
* Accept language for the outgoing requests headers.
|
|
168
|
-
* Default value is "en".
|
|
169
|
-
*
|
|
170
|
-
* Standard RFC "Accept-Language" https://tools.ietf.org/html/rfc7231#section-5.3.5
|
|
171
|
-
* Response texts are based on this setting. For example when "de" is set, server
|
|
172
|
-
* will return error texts and other in german (if available).
|
|
173
|
-
*/
|
|
174
|
-
changeAcceptLanguage(language: string): void;
|
|
175
|
-
/**
|
|
176
|
-
* Retrieves status of the onboarding activation.
|
|
177
|
-
*
|
|
178
|
-
* @return Promise resolved with onboarding status.
|
|
179
|
-
*/
|
|
180
|
-
status(): Promise<WDOOnboardingStatus>;
|
|
181
|
-
/**
|
|
182
|
-
* Start onboarding activation with user credentials.
|
|
183
|
-
*
|
|
184
|
-
* For example, when you require email and birth date, your object would look like this:
|
|
185
|
-
* ```
|
|
186
|
-
* {
|
|
187
|
-
* email: "<user_email>",
|
|
188
|
-
* birthdate: "<user_birth_date>"
|
|
189
|
-
* }
|
|
190
|
-
* ```
|
|
191
|
-
* @param credentials Object with credentials. Which credentials are needed should be provided by a system/backend provider.
|
|
192
|
-
* @param processType The process type identification. If not specified, the default process type will be used.
|
|
193
|
-
*/
|
|
194
|
-
start(credentials: any, processType?: string): Promise<void>;
|
|
195
|
-
/**
|
|
196
|
-
* Cancel the activation process (issues a cancel request to the backend and clears the local process ID).
|
|
197
|
-
*
|
|
198
|
-
* @param forceCancel When true, the process will be canceled in the SDK even when fails on backend. `true` by default.
|
|
199
|
-
*/
|
|
200
|
-
cancel(forceCancel?: boolean): Promise<void>;
|
|
201
|
-
/** Clear the stored data (without networking call). */
|
|
202
|
-
clear(): void;
|
|
203
|
-
/**
|
|
204
|
-
* OTP resend request.
|
|
205
|
-
*
|
|
206
|
-
* This is intended to be displayed for the user to use in case of the OTP is not received.
|
|
207
|
-
* For example, when the user does not receive SMS after some time, there should be a button to "send again".
|
|
208
|
-
*/
|
|
209
|
-
resendOTP(): Promise<void>;
|
|
210
|
-
/**
|
|
211
|
-
* Activate the PowerAuth instance that was passed in the initializer.
|
|
212
|
-
*
|
|
213
|
-
* @param activationName Name of the activation. Device name by default (usually something like John's iPhone or similar).
|
|
214
|
-
* @param otp OTP code received by the user (via SMS or email). Optional when not required.
|
|
215
|
-
* @return Promise resolved with activation result.
|
|
216
|
-
*/
|
|
217
|
-
activate(activationName: string, otp?: string): Promise<WDOPowerAuthActivationResult>;
|
|
80
|
+
/** State of the document on the server. */
|
|
81
|
+
declare enum UploadState {
|
|
82
|
+
/** The document was not uploaded yet. */
|
|
83
|
+
notUploaded = 0,
|
|
84
|
+
/** The document was accepted by the server. */
|
|
85
|
+
accepted = 1,
|
|
86
|
+
/** The document was rejected and needs to be re-uploaded. */
|
|
87
|
+
rejected = 2
|
|
218
88
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
*/
|
|
228
|
-
declare class WDOActivationService extends WDOBaseActivationService {
|
|
229
|
-
/** PowerAuth instance */
|
|
230
|
-
readonly powerauth: PowerAuth;
|
|
231
|
-
/**
|
|
232
|
-
* Creates service instance
|
|
233
|
-
*
|
|
234
|
-
* @param powerauth Configured PowerAuth instance. This instance needs to be without valid activation.
|
|
235
|
-
* @param baseUrl Base URL of the Wultra Digital Onboarding server. Usually ending with `/enrollment-onboarding-server`.
|
|
236
|
-
*/
|
|
237
|
-
constructor(powerauth: PowerAuth, baseUrl: string);
|
|
89
|
+
/** Side of the uploaded document. */
|
|
90
|
+
declare class Side {
|
|
91
|
+
/** Type of the side. */
|
|
92
|
+
type: WDODocumentSide;
|
|
93
|
+
/** ID on the server. Use this ID in case of an reupload */
|
|
94
|
+
serverId: string;
|
|
95
|
+
/** Upload state of the document */
|
|
96
|
+
uploadState: UploadState;
|
|
238
97
|
}
|
|
239
98
|
|
|
240
99
|
/**
|
|
@@ -247,33 +106,23 @@ declare class WDOActivationService extends WDOBaseActivationService {
|
|
|
247
106
|
* Usage:
|
|
248
107
|
*
|
|
249
108
|
* ```
|
|
250
|
-
* const state = await verificationService.status()
|
|
109
|
+
* const state = await verificationService.status()
|
|
251
110
|
* if (state.type === WDOVerificationStateType.scanDocument ) {
|
|
252
111
|
* // We are in the scan document state, access specific properties
|
|
253
|
-
* const process = state.process
|
|
112
|
+
* const process = state.process
|
|
254
113
|
* }
|
|
255
114
|
* ```
|
|
256
115
|
*/
|
|
257
|
-
type WDOVerificationState =
|
|
116
|
+
type WDOVerificationState = WDOIntroState | WDODocumentsToScanSelectState | WDOScanDocumentState | WDOProcessingState | WDOPresenceCheckState | WDOOtpState | WDOFinishActivation | WDOFailedState | WDOEndStateState | WDOSuccessState;
|
|
258
117
|
/**
|
|
259
118
|
* Show the verification introduction screen where the user can start the activation.
|
|
260
119
|
*
|
|
261
|
-
* The next step should be calling the `
|
|
120
|
+
* The next step should be calling the `start`.
|
|
262
121
|
*/
|
|
263
|
-
interface
|
|
122
|
+
interface WDOIntroState {
|
|
264
123
|
type: WDOVerificationStateType.intro;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
* Show approve/cancel user consent.
|
|
268
|
-
*
|
|
269
|
-
* The content of the text depends on the server configuration and might be plain text or HTML.
|
|
270
|
-
*
|
|
271
|
-
* The next step should be calling the `consentApprove`.
|
|
272
|
-
*/
|
|
273
|
-
interface Consent {
|
|
274
|
-
type: WDOVerificationStateType.consent;
|
|
275
|
-
/** Content of the consent text, which may be plain text or HTML depending on server configuration */
|
|
276
|
-
body: string;
|
|
124
|
+
/** Indicates whether the user consent is required to proceed */
|
|
125
|
+
consentRequired: boolean;
|
|
277
126
|
}
|
|
278
127
|
/**
|
|
279
128
|
* Show document selection to the user. Which documents are available and how many
|
|
@@ -281,7 +130,7 @@ interface Consent {
|
|
|
281
130
|
*
|
|
282
131
|
* The next step should be calling the `documentsSetSelectedTypes`.
|
|
283
132
|
*/
|
|
284
|
-
interface
|
|
133
|
+
interface WDODocumentsToScanSelectState {
|
|
285
134
|
type: WDOVerificationStateType.documentsToScanSelect;
|
|
286
135
|
}
|
|
287
136
|
/**
|
|
@@ -289,7 +138,7 @@ interface DocumentsToScanSelect {
|
|
|
289
138
|
*
|
|
290
139
|
* The next step should be calling the `documentsSubmit`.
|
|
291
140
|
*/
|
|
292
|
-
interface
|
|
141
|
+
interface WDOScanDocumentState {
|
|
293
142
|
type: WDOVerificationStateType.scanDocument;
|
|
294
143
|
/** Scanning process that helps with the document scanning */
|
|
295
144
|
process: WDOVerificationScanProcess;
|
|
@@ -299,7 +148,7 @@ interface ScanDocument {
|
|
|
299
148
|
*
|
|
300
149
|
* The next step should be calling the `status`.
|
|
301
150
|
*/
|
|
302
|
-
interface
|
|
151
|
+
interface WDOProcessingState {
|
|
303
152
|
type: WDOVerificationStateType.processing;
|
|
304
153
|
/** Reason for the current processing state */
|
|
305
154
|
item: WDOStatusCheckReason;
|
|
@@ -311,7 +160,7 @@ interface Processing {
|
|
|
311
160
|
* The next step should be calling the `presenceCheckInit` to start the check and `presenceCheckSubmit` to
|
|
312
161
|
* 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.
|
|
313
162
|
*/
|
|
314
|
-
interface
|
|
163
|
+
interface WDOPresenceCheckState {
|
|
315
164
|
type: WDOVerificationStateType.presenceCheck;
|
|
316
165
|
}
|
|
317
166
|
/**
|
|
@@ -320,18 +169,26 @@ interface PresenceCheck {
|
|
|
320
169
|
* The next step should be calling the `verifyOTP` with user-entered OTP.
|
|
321
170
|
* The OTP is usually SMS or email.
|
|
322
171
|
*/
|
|
323
|
-
interface
|
|
172
|
+
interface WDOOtpState {
|
|
324
173
|
type: WDOVerificationStateType.otp;
|
|
325
174
|
/** Number of remaining attempts to enter the correct OTP */
|
|
326
175
|
remainingAttempts?: number;
|
|
327
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Show "finish activation" with PIN prompt screen.
|
|
179
|
+
*
|
|
180
|
+
* The next step should be calling the `finishActivation` with user entered PIN.
|
|
181
|
+
*/
|
|
182
|
+
interface WDOFinishActivation {
|
|
183
|
+
type: WDOVerificationStateType.finishActivation;
|
|
184
|
+
}
|
|
328
185
|
/**
|
|
329
186
|
* Verification failed and can be restarted
|
|
330
187
|
*
|
|
331
188
|
* The next step should be calling the `restartVerification` or `cancelWholeProcess` based on
|
|
332
189
|
* the user's decision if he wants to try it again or cancel the process.
|
|
333
190
|
*/
|
|
334
|
-
interface
|
|
191
|
+
interface WDOFailedState {
|
|
335
192
|
type: WDOVerificationStateType.failed;
|
|
336
193
|
}
|
|
337
194
|
/**
|
|
@@ -339,7 +196,7 @@ interface Failed {
|
|
|
339
196
|
*
|
|
340
197
|
* The next step should be calling the `PowerAuth.removeActivationLocal()` and starting activation from scratch.
|
|
341
198
|
*/
|
|
342
|
-
interface
|
|
199
|
+
interface WDOEndStateState {
|
|
343
200
|
type: WDOVerificationStateType.endState;
|
|
344
201
|
/** Reason for the end state */
|
|
345
202
|
reason: WDOEndStateReason;
|
|
@@ -347,7 +204,7 @@ interface EndState {
|
|
|
347
204
|
/**
|
|
348
205
|
* Verification was successfully ended. Continue into your app flow.
|
|
349
206
|
*/
|
|
350
|
-
interface
|
|
207
|
+
interface WDOSuccessState {
|
|
351
208
|
type: WDOVerificationStateType.success;
|
|
352
209
|
}
|
|
353
210
|
/** Types of the verification state */
|
|
@@ -355,17 +212,9 @@ declare enum WDOVerificationStateType {
|
|
|
355
212
|
/**
|
|
356
213
|
* Show the verification introduction screen where the user can start the activation.
|
|
357
214
|
*
|
|
358
|
-
* The next step should be calling the `
|
|
215
|
+
* The next step should be calling the `start()`.
|
|
359
216
|
*/
|
|
360
217
|
intro = "intro",
|
|
361
|
-
/**
|
|
362
|
-
* Show approve/cancel user consent.
|
|
363
|
-
*
|
|
364
|
-
* The content of the text depends on the server configuration and might be plain text or HTML.
|
|
365
|
-
*
|
|
366
|
-
* The next step should be calling the `consentApprove`.
|
|
367
|
-
*/
|
|
368
|
-
consent = "consent",
|
|
369
218
|
/**
|
|
370
219
|
* Show document selection to the user. Which documents are available and how many
|
|
371
220
|
* can the user select is up to your backend configuration.
|
|
@@ -400,6 +249,12 @@ declare enum WDOVerificationStateType {
|
|
|
400
249
|
* The OTP is usually SMS or email.
|
|
401
250
|
*/
|
|
402
251
|
otp = "otp",
|
|
252
|
+
/**
|
|
253
|
+
* Show "finish activation" with PIN prompt screen.
|
|
254
|
+
*
|
|
255
|
+
* The next step should be calling the `finishActivation` with user entered PIN.
|
|
256
|
+
*/
|
|
257
|
+
finishActivation = "finishActivation",
|
|
403
258
|
/**
|
|
404
259
|
* Verification failed and can be restarted
|
|
405
260
|
*
|
|
@@ -450,21 +305,40 @@ declare enum WDOStatusCheckReason {
|
|
|
450
305
|
clientAccepted = "clientAccepted",
|
|
451
306
|
verifyingPresence = "verifyingPresence"
|
|
452
307
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
308
|
+
/** Internal multiplatform PowerAuth representation */
|
|
309
|
+
interface WDOPowerAuth {
|
|
310
|
+
fetchActivationStatus(): Promise<WDOPowerAuthActivationStatus>;
|
|
311
|
+
validatePassword(password: WDOPowerAuthPassword | string): Promise<void>;
|
|
312
|
+
createActivation(activation: WDOPowerAuthActivation): Promise<WDOPowerAuthCreateActivationResult>;
|
|
313
|
+
persistActivation(authentication: WDOPowerAuthAuthentication): Promise<void>;
|
|
314
|
+
canStartActivation(): Promise<boolean>;
|
|
315
|
+
removeActivationLocal(): Promise<void>;
|
|
316
|
+
get instanceId(): string;
|
|
317
|
+
}
|
|
318
|
+
/** Internal multiplatform PowerAuthPassword representation */
|
|
319
|
+
interface WDOPowerAuthPassword {
|
|
320
|
+
clear(): Promise<void>;
|
|
321
|
+
}
|
|
322
|
+
/** Internal multiplatform WDOPowerAuthActivation representation */
|
|
323
|
+
interface WDOPowerAuthActivation {
|
|
324
|
+
}
|
|
325
|
+
/** Internal multiplatform WDOPowerAuthAuthentication representation */
|
|
326
|
+
interface WDOPowerAuthAuthentication {
|
|
327
|
+
}
|
|
328
|
+
/** Internal multiplatform WDOPowerAuthCreateActivationResult representation */
|
|
329
|
+
interface WDOPowerAuthCreateActivationResult {
|
|
330
|
+
activationFingerprint: string;
|
|
331
|
+
customAttributes?: any;
|
|
332
|
+
}
|
|
460
333
|
/**
|
|
334
|
+
*
|
|
461
335
|
* The `WDOPowerAuthActivationStatus` object represents complete status of the activation.
|
|
462
336
|
*/
|
|
463
337
|
interface WDOPowerAuthActivationStatus {
|
|
464
338
|
/**
|
|
465
339
|
* State of the activation.
|
|
466
340
|
*/
|
|
467
|
-
state:
|
|
341
|
+
state: "CREATED" | "PENDING_COMMIT" | "ACTIVE" | "BLOCKED" | "REMOVED" | "DEADLOCK";
|
|
468
342
|
/**
|
|
469
343
|
* Number of failed authentication attempts in a row.
|
|
470
344
|
*/
|
|
@@ -482,38 +356,6 @@ interface WDOPowerAuthActivationStatus {
|
|
|
482
356
|
*/
|
|
483
357
|
customObject?: any;
|
|
484
358
|
}
|
|
485
|
-
/**
|
|
486
|
-
* The `WDOPowerAuthActivationState` enum defines all possible states of activation.
|
|
487
|
-
* The state is a part of information received together with the rest
|
|
488
|
-
* of the `WDOPowerAuthActivationStatus` object.
|
|
489
|
-
*/
|
|
490
|
-
declare enum WDOPowerAuthActivationState {
|
|
491
|
-
/**
|
|
492
|
-
* The activation is just created.
|
|
493
|
-
*/
|
|
494
|
-
CREATED = "CREATED",
|
|
495
|
-
/**
|
|
496
|
-
* The activation is not completed yet on the server.
|
|
497
|
-
*/
|
|
498
|
-
PENDING_COMMIT = "PENDING_COMMIT",
|
|
499
|
-
/**
|
|
500
|
-
* The shared secure context is valid and active.
|
|
501
|
-
*/
|
|
502
|
-
ACTIVE = "ACTIVE",
|
|
503
|
-
/**
|
|
504
|
-
* The activation is blocked.
|
|
505
|
-
*/
|
|
506
|
-
BLOCKED = "BLOCKED",
|
|
507
|
-
/**
|
|
508
|
-
* The activation doesn't exist anymore.
|
|
509
|
-
*/
|
|
510
|
-
REMOVED = "REMOVED",
|
|
511
|
-
/**
|
|
512
|
-
* The activation is technically blocked. You cannot use it anymore
|
|
513
|
-
* for the signature calculations.
|
|
514
|
-
*/
|
|
515
|
-
DEADLOCK = "DEADLOCK"
|
|
516
|
-
}
|
|
517
359
|
|
|
518
360
|
/**
|
|
519
361
|
* Listener of the Verification Service that can listen on Verification Status and PowerAuth Status changes.
|
|
@@ -525,9 +367,18 @@ interface WDOVerificationServiceListener {
|
|
|
525
367
|
* Note that this happens only when error is returned in some of the Verification endpoints and this error indicates PowerAuth status change. For
|
|
526
368
|
* example when the service finds out during the API call that the PowerAuth activation was removed or blocked on the server
|
|
527
369
|
*/
|
|
528
|
-
powerAuthActivationStatusChanged(
|
|
370
|
+
powerAuthActivationStatusChanged(senderService: any, status: WDOPowerAuthActivationStatus): void;
|
|
529
371
|
/** Called when state of the verification has changed. */
|
|
530
|
-
verificationStatusChanged(
|
|
372
|
+
verificationStatusChanged(senderService: any, status: WDOVerificationState): void;
|
|
373
|
+
}
|
|
374
|
+
/** Possible results of the user consent. */
|
|
375
|
+
declare enum WDOConsentResponse {
|
|
376
|
+
/** User approved the consent. */
|
|
377
|
+
approved = 0,
|
|
378
|
+
/** User declined the consent. */
|
|
379
|
+
declined = 1,
|
|
380
|
+
/** Consent is not required. */
|
|
381
|
+
notRequired = 2
|
|
531
382
|
}
|
|
532
383
|
/**
|
|
533
384
|
* Service that can verify previously activated PowerAuth instance.
|
|
@@ -537,7 +388,19 @@ interface WDOVerificationServiceListener {
|
|
|
537
388
|
*
|
|
538
389
|
* This service operates against Wultra Onboarding server (usually ending with `/enrollment-onboarding-server`) and you need to configure networking service with the right URL.
|
|
539
390
|
*/
|
|
540
|
-
declare abstract class WDOBaseVerificationService {
|
|
391
|
+
declare abstract class WDOBaseVerificationService<TPowerAuth extends WDOPowerAuth, TPowerAuthPassword extends WDOPowerAuthPassword> {
|
|
392
|
+
/** Checks if verification is required based on PowerAuth activation status */
|
|
393
|
+
protected static isVerificationRequiredInternal(paStatus: WDOPowerAuthActivationStatus): boolean;
|
|
394
|
+
/** PowerAuth instance */
|
|
395
|
+
readonly powerauth: TPowerAuth;
|
|
396
|
+
private readonly api;
|
|
397
|
+
/**
|
|
398
|
+
* Creates service instance
|
|
399
|
+
*
|
|
400
|
+
* @param powerauth Configured PowerAuth instance. This instance needs to be without valid activation.
|
|
401
|
+
* @param baseUrl Base URL of the Wultra Digital Onboarding server. Usually ending with `/enrollment-onboarding-server`.
|
|
402
|
+
*/
|
|
403
|
+
constructor(powerauth: TPowerAuth, baseUrl: string);
|
|
541
404
|
/**
|
|
542
405
|
* Accept language for the outgoing requests headers.
|
|
543
406
|
* Default value is "en".
|
|
@@ -562,11 +425,13 @@ declare abstract class WDOBaseVerificationService {
|
|
|
562
425
|
*
|
|
563
426
|
* Consent text explains how the service will handle his document photos or selfie scans.
|
|
564
427
|
*/
|
|
565
|
-
consentGet(): Promise<
|
|
428
|
+
consentGet(): Promise<string>;
|
|
566
429
|
/**
|
|
567
|
-
*
|
|
430
|
+
* Start the identity verification after user approved the consent (if required)
|
|
431
|
+
*
|
|
432
|
+
* @param consentApprovedByUser Response of the user to the consent. The hint can be obtained in the `status()` call (`consentRequired` property when the result is `intro`).
|
|
568
433
|
*/
|
|
569
|
-
|
|
434
|
+
start(consentApprovedByUser: WDOConsentResponse): Promise<WDOVerificationState>;
|
|
570
435
|
/**
|
|
571
436
|
* Get the token for the document scanning SDK, when required.
|
|
572
437
|
*
|
|
@@ -574,7 +439,10 @@ declare abstract class WDOBaseVerificationService {
|
|
|
574
439
|
*
|
|
575
440
|
* @param challenge Optional challenge provided by the scanning SDK.
|
|
576
441
|
*/
|
|
577
|
-
documentsInitSDK(challenge?: string): Promise<
|
|
442
|
+
documentsInitSDK(challenge?: string): Promise<{
|
|
443
|
+
blinkIDKey?: string;
|
|
444
|
+
zenIDToken?: string;
|
|
445
|
+
}>;
|
|
578
446
|
/**
|
|
579
447
|
* Set which documents will be scanned.
|
|
580
448
|
*
|
|
@@ -595,7 +463,9 @@ declare abstract class WDOBaseVerificationService {
|
|
|
595
463
|
/**
|
|
596
464
|
* Initiates the presence check. This returns attributes that are needed to start the 3rd party SDK (if needed).
|
|
597
465
|
*/
|
|
598
|
-
presenceCheckInit(): Promise<
|
|
466
|
+
presenceCheckInit(): Promise<{
|
|
467
|
+
iProovVerificationToken?: string;
|
|
468
|
+
}>;
|
|
599
469
|
/**
|
|
600
470
|
* Call when presence check was finished in the 3rd party SDK.
|
|
601
471
|
*/
|
|
@@ -615,6 +485,26 @@ declare abstract class WDOBaseVerificationService {
|
|
|
615
485
|
* @param otp OTP that user obtained via other channel (usually SMS or email).
|
|
616
486
|
*/
|
|
617
487
|
verifyOTP(otp: string): Promise<WDOVerificationState>;
|
|
488
|
+
/**
|
|
489
|
+
* Finishes verification by creating a new PowerAuth activation on given `newPowerAuthInstance`.
|
|
490
|
+
*
|
|
491
|
+
* Needs to be called when "activationFinish" next step is returned from the `status()` call.
|
|
492
|
+
*
|
|
493
|
+
* The method verifies that the provided `password` is the same as used in the original activation
|
|
494
|
+
* (if `validatePassword` is set to `true`), then it calls the server API to finish
|
|
495
|
+
* the verification and obtain the activation code for the new activation. Finally, it creates
|
|
496
|
+
* a new activation on `newPowerAuthInstance` using the obtained activation code and persists it
|
|
497
|
+
* with the provided `newPassword`.
|
|
498
|
+
*
|
|
499
|
+
* After successful completion, the original PowerAuth instance becomes invalid (`REMOVED` state) and cannot be used anymore.
|
|
500
|
+
*
|
|
501
|
+
* @param newPowerAuthInstance PowerAuth instance where to create new activation. This instance must not have an existing activation.
|
|
502
|
+
* @param newActivationName Name of the new activation to be created on `newPowerAuthInstance`.
|
|
503
|
+
* @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).
|
|
504
|
+
* @param validatePassword If set to `true`, the method verifies that the provided `newPassword` matches the password of the original activation.
|
|
505
|
+
* @param userIdentification Optional user identification object to be sent to the server during the finish activation process.
|
|
506
|
+
*/
|
|
507
|
+
finishActivation(newPowerAuthInstance: TPowerAuth, newActivationName: string, newPassword: TPowerAuthPassword, validatePassword: boolean, userIdentification?: any): Promise<WDOVerificationState>;
|
|
618
508
|
/**
|
|
619
509
|
* Request OTP resend.
|
|
620
510
|
*
|
|
@@ -623,69 +513,236 @@ declare abstract class WDOBaseVerificationService {
|
|
|
623
513
|
resendOTP(): Promise<void>;
|
|
624
514
|
}
|
|
625
515
|
|
|
516
|
+
/** Log levels for Wultra Digital Onboarding. */
|
|
517
|
+
declare enum WDOLogLevel {
|
|
518
|
+
NONE = 0,
|
|
519
|
+
ERROR = 1,
|
|
520
|
+
WARN = 2,
|
|
521
|
+
INFO = 3,
|
|
522
|
+
DEBUG = 4
|
|
523
|
+
}
|
|
524
|
+
/** Simple logger utility for Wultra Digital Onboarding SDK. */
|
|
525
|
+
declare class WDOLogger {
|
|
526
|
+
/** Current log level. Messages with a level higher than this will not be logged. */
|
|
527
|
+
static logLevel: WDOLogLevel;
|
|
528
|
+
/** Listener for custom logging implementation */
|
|
529
|
+
static listener: WDOLoggerListener | null;
|
|
530
|
+
}
|
|
531
|
+
/** Log listener for your custom logging implementation */
|
|
532
|
+
interface WDOLoggerListener {
|
|
533
|
+
log(level: WDOLogLevel, message: string): void;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/** Status of the onboarding */
|
|
537
|
+
declare enum WDOOnboardingStatus {
|
|
538
|
+
/** Activation part of the process is in progress */
|
|
539
|
+
activationInProgress = "ACTIVATION_IN_PROGRESS",
|
|
540
|
+
/** Verification part of the process is in progress */
|
|
541
|
+
verificationInProgress = "VERIFICATION_IN_PROGRESS",
|
|
542
|
+
/** Onboarding process has failed */
|
|
543
|
+
failed = "FAILED",
|
|
544
|
+
/** Onboarding process is completed */
|
|
545
|
+
finished = "FINISHED"
|
|
546
|
+
}
|
|
547
|
+
/** Configuration for a document */
|
|
548
|
+
interface WDOConfigurationDocument {
|
|
549
|
+
/** Type of the document */
|
|
550
|
+
type: string;
|
|
551
|
+
/** Number of sides the document has */
|
|
552
|
+
sideCount: number;
|
|
553
|
+
}
|
|
554
|
+
/** Group of documents in the configuration */
|
|
555
|
+
interface WDOConfigurationDocumentGroup {
|
|
556
|
+
/** Number of required documents in the group */
|
|
557
|
+
requiredDocumentsCount: number;
|
|
558
|
+
/** Documents in the group */
|
|
559
|
+
items: Array<WDOConfigurationDocument>;
|
|
560
|
+
}
|
|
561
|
+
/** Configuration for the onboarding process */
|
|
562
|
+
interface WDOConfigurationResponse {
|
|
563
|
+
/** Is the onboarding process enabled */
|
|
564
|
+
enabled: boolean;
|
|
565
|
+
/** Is OTP required for the first part - identification/activation. */
|
|
566
|
+
otpForIdentification: boolean;
|
|
567
|
+
/** Is OTP required for the second part - identity verification. */
|
|
568
|
+
otpForIdentityVerification: boolean;
|
|
569
|
+
/** Documents required for identity verification. */
|
|
570
|
+
documents: {
|
|
571
|
+
/** Number of total required documents */
|
|
572
|
+
totalRequiredDocumentsCount: number;
|
|
573
|
+
/** Groups of documents */
|
|
574
|
+
groups: Array<WDOConfigurationDocumentGroup>;
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
/** Represent error thrown from a WDO library */
|
|
579
|
+
declare class WDOError {
|
|
580
|
+
/** Reason for the error */
|
|
581
|
+
readonly reason: WDOErrorReason;
|
|
582
|
+
/** Error message */
|
|
583
|
+
readonly message: string;
|
|
584
|
+
/** Additional info about the error (eg. original error object) */
|
|
585
|
+
readonly additionalInfo?: any;
|
|
586
|
+
/** Helper to identify this object as a WDOError */
|
|
587
|
+
readonly isWdoError = true;
|
|
588
|
+
/**
|
|
589
|
+
* Whether retrying OTP is allowed based on remaining attempts.
|
|
590
|
+
*
|
|
591
|
+
* This may be filled only when the error reason is `WDOErrorReason.activationFailed`.
|
|
592
|
+
*/
|
|
593
|
+
get allowOnboardingOtpRetry(): boolean;
|
|
594
|
+
/**
|
|
595
|
+
* Number of remaining OTP attempts during onboarding
|
|
596
|
+
*
|
|
597
|
+
* This may be filled only when the error reason is `WDOErrorReason.activationFailed`.
|
|
598
|
+
*/
|
|
599
|
+
get onboardingOtpRemainingAttempts(): number | undefined;
|
|
600
|
+
}
|
|
601
|
+
/** Reasons for WDO errors */
|
|
602
|
+
declare enum WDOErrorReason {
|
|
603
|
+
/** Network error occurred */
|
|
604
|
+
networkError = "NETWORK_ERROR",
|
|
605
|
+
/** Activation failed */
|
|
606
|
+
activationFailed = "ACTIVATION_FAILED",
|
|
607
|
+
/** Process is already in progress - happens when start() is called twice */
|
|
608
|
+
processAlreadyInProgress = "PROCESS_ALREADY_IN_PROGRESS",
|
|
609
|
+
/** No process is in progress - happens when an operation requires an active process */
|
|
610
|
+
processNotInProgress = "PROCESS_NOT_IN_PROGRESS",
|
|
611
|
+
/** The PowerAuth instance is already activated when trying to activate it again */
|
|
612
|
+
powerauthAlreadyActivated = "POWERAUTH_ALREADY_ACTIVATED",
|
|
613
|
+
/** The PowerAuth instance is not configured properly */
|
|
614
|
+
powerAuthNotConfigured = "POWERAUTH_NOT_CONFIGURED",
|
|
615
|
+
/** The PowerAuth instance is not activated when trying to use it */
|
|
616
|
+
powerauthNotActivated = "POWERAUTH_NOT_ACTIVATED",
|
|
617
|
+
/** OTP verification failed */
|
|
618
|
+
otpFailed = "OTP_FAILED",
|
|
619
|
+
/** Invalid parameter */
|
|
620
|
+
invalidParameter = "INVALID_PARAMETER"
|
|
621
|
+
}
|
|
622
|
+
|
|
626
623
|
/**
|
|
627
|
-
* Service that can
|
|
624
|
+
* Service that can activate PowerAuth instance by user weak credentials (like his email, phone number or client ID) + optional SMS OTP.
|
|
628
625
|
*
|
|
629
|
-
* When PowerAuth
|
|
626
|
+
* When the PowerAuth is activated with this service, `WDOVerificationService.isVerificationRequired` will be `true`
|
|
627
|
+
* and you will need to verify the PowerAuth instance via `WDOVerificationService`.
|
|
630
628
|
*
|
|
631
629
|
* This service operates against Wultra Onboarding server (usually ending with `/enrollment-onboarding-server`) and you need to configure networking service with the right URL.
|
|
632
630
|
*/
|
|
633
|
-
declare class
|
|
631
|
+
declare abstract class WDOBaseActivationService<TPowerAuth extends WDOPowerAuth> {
|
|
634
632
|
/** PowerAuth instance */
|
|
635
|
-
readonly powerauth:
|
|
636
|
-
/** Checks if verification is required based on PowerAuth activation status */
|
|
637
|
-
static isVerificationRequired(paStatus: PowerAuthActivationStatus): boolean;
|
|
633
|
+
readonly powerauth: TPowerAuth;
|
|
638
634
|
/**
|
|
639
635
|
* Creates service instance
|
|
640
636
|
*
|
|
641
637
|
* @param powerauth Configured PowerAuth instance. This instance needs to be without valid activation.
|
|
642
638
|
* @param baseUrl Base URL of the Wultra Digital Onboarding server. Usually ending with `/enrollment-onboarding-server`.
|
|
643
639
|
*/
|
|
644
|
-
constructor(powerauth:
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
/** Service that provides configuration for the Wultra Digital Onboarding SDK. */
|
|
648
|
-
declare abstract class WDOBaseConfigurationService {
|
|
640
|
+
constructor(powerauth: TPowerAuth, baseUrl: string);
|
|
649
641
|
/**
|
|
650
|
-
*
|
|
642
|
+
* If the activation process is in progress.
|
|
651
643
|
*
|
|
652
|
-
*
|
|
653
|
-
*
|
|
644
|
+
* Note that even if this property is `true` it can be already discontinued on the server.
|
|
645
|
+
* Calling `status()` after the app is launched is recommended.
|
|
654
646
|
*/
|
|
655
|
-
|
|
647
|
+
hasActiveProcess(): Promise<boolean>;
|
|
648
|
+
/**
|
|
649
|
+
* Accept language for the outgoing requests headers.
|
|
650
|
+
* Default value is "en".
|
|
651
|
+
*
|
|
652
|
+
* Standard RFC "Accept-Language" https://tools.ietf.org/html/rfc7231#section-5.3.5
|
|
653
|
+
* Response texts are based on this setting. For example when "de" is set, server
|
|
654
|
+
* will return error texts and other in german (if available).
|
|
655
|
+
*/
|
|
656
|
+
changeAcceptLanguage(language: string): void;
|
|
657
|
+
/**
|
|
658
|
+
* Retrieves status of the onboarding activation.
|
|
659
|
+
*
|
|
660
|
+
* @return Promise resolved with onboarding status.
|
|
661
|
+
*/
|
|
662
|
+
status(): Promise<WDOOnboardingStatus>;
|
|
663
|
+
/**
|
|
664
|
+
* Start onboarding activation with user credentials.
|
|
665
|
+
*
|
|
666
|
+
* For example, when you require email and birth date, your object would look like this:
|
|
667
|
+
* ```
|
|
668
|
+
* {
|
|
669
|
+
* email: "<user_email>",
|
|
670
|
+
* birthdate: "<user_birth_date>"
|
|
671
|
+
* }
|
|
672
|
+
* ```
|
|
673
|
+
* @param credentials Object with credentials. Which credentials are needed should be provided by a system/backend provider.
|
|
674
|
+
* @param processType The process type identification. If not specified, the default process type will be used.
|
|
675
|
+
*/
|
|
676
|
+
start(credentials: any, processType?: string): Promise<void>;
|
|
677
|
+
/**
|
|
678
|
+
* Cancel the activation process (issues a cancel request to the backend and clears the local process ID).
|
|
679
|
+
*
|
|
680
|
+
* @param forceCancel When true, the process will be canceled in the SDK even when fails on backend. `true` by default.
|
|
681
|
+
*/
|
|
682
|
+
cancel(forceCancel?: boolean): Promise<void>;
|
|
683
|
+
/** Clear the stored data (without networking call). */
|
|
684
|
+
clear(): Promise<void>;
|
|
685
|
+
/**
|
|
686
|
+
* OTP resend request.
|
|
687
|
+
*
|
|
688
|
+
* This is intended to be displayed for the user to use in case of the OTP is not received.
|
|
689
|
+
* For example, when the user does not receive SMS after some time, there should be a button to "send again".
|
|
690
|
+
* 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.
|
|
691
|
+
*/
|
|
692
|
+
resendOTP(): Promise<void>;
|
|
693
|
+
/**
|
|
694
|
+
* Activate the PowerAuth instance that was passed in the initializer.
|
|
695
|
+
*
|
|
696
|
+
* @param activationName Name of the activation. Usually something like John's iPhone or similar.
|
|
697
|
+
* @param otp OTP code received by the user (via SMS or email). Optional when not required.
|
|
698
|
+
* @return Promise resolved with activation result.
|
|
699
|
+
*/
|
|
700
|
+
activate(activationName: string, otp?: string): Promise<WDOPowerAuthCreateActivationResult>;
|
|
656
701
|
}
|
|
657
702
|
|
|
658
703
|
/** Service that provides configuration for the Wultra Digital Onboarding SDK. */
|
|
659
|
-
declare class
|
|
704
|
+
declare abstract class WDOBaseConfigurationService<TPowerAuth extends WDOPowerAuth> {
|
|
660
705
|
/** PowerAuth instance */
|
|
661
|
-
readonly powerauth:
|
|
706
|
+
readonly powerauth: TPowerAuth;
|
|
662
707
|
/**
|
|
663
708
|
* Creates service instance
|
|
664
709
|
*
|
|
665
710
|
* @param powerauth Configured PowerAuth instance.
|
|
666
711
|
* @param baseUrl Base URL of the Wultra Digital Onboarding server. Usually ending with `/enrollment-onboarding-server`.
|
|
667
712
|
*/
|
|
668
|
-
constructor(powerauth:
|
|
713
|
+
constructor(powerauth: TPowerAuth, baseUrl: string);
|
|
714
|
+
/**
|
|
715
|
+
* Fetches configuration for the given process type from the server.
|
|
716
|
+
*
|
|
717
|
+
* @param processType Type of the process for which to fetch configuration.
|
|
718
|
+
* @returns Configuration response from the server.
|
|
719
|
+
*/
|
|
720
|
+
getConfiguration(processType: string): Promise<WDOConfigurationResponse>;
|
|
669
721
|
}
|
|
670
722
|
|
|
671
|
-
/**
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
723
|
+
/**
|
|
724
|
+
* Service that can activate PowerAuth instance by user weak credentials (like his email, phone number or client ID) + optional SMS OTP.
|
|
725
|
+
*
|
|
726
|
+
* When the PowerAuth is activated with this service, `WDOVerificationService.isVerificationRequired` will be `true`
|
|
727
|
+
* and you will need to verify the PowerAuth instance via `WDOVerificationService`.
|
|
728
|
+
*
|
|
729
|
+
* This service operates against Wultra Onboarding server (usually ending with `/enrollment-onboarding-server`) and you need to configure networking service with the right URL.
|
|
730
|
+
*/
|
|
731
|
+
declare class WDOActivationService extends WDOBaseActivationService<PowerAuth> {
|
|
678
732
|
}
|
|
679
|
-
/**
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
733
|
+
/**
|
|
734
|
+
* Service that can verify previously activated PowerAuth instance.
|
|
735
|
+
*
|
|
736
|
+
* When PowerAuth instance was activated with weak credentials via `WDOActivationService`, user needs to verify his genuine presence.
|
|
737
|
+
*
|
|
738
|
+
* This service operates against Wultra Onboarding server (usually ending with `/enrollment-onboarding-server`) and you need to configure networking service with the right URL.
|
|
739
|
+
*/
|
|
740
|
+
declare class WDOVerificationService extends WDOBaseVerificationService<PowerAuth, PowerAuthPassword> {
|
|
741
|
+
/** Checks if verification is required based on PowerAuth activation status */
|
|
742
|
+
static isVerificationRequired(paStatus: PowerAuthActivationStatus): boolean;
|
|
685
743
|
}
|
|
686
|
-
/**
|
|
687
|
-
|
|
688
|
-
log(level: WDOLogLevel, message: string): void;
|
|
744
|
+
/** Service that provides configuration for the Wultra Digital Onboarding SDK. */
|
|
745
|
+
declare class WDOConfigurationService extends WDOBaseConfigurationService<PowerAuth> {
|
|
689
746
|
}
|
|
690
|
-
export { Side, UploadState, WDOActivationService, WDOConfigurationService, WDODocumentFile, WDODocumentSide, WDODocumentType,
|
|
691
|
-
export type { Base64EncodedJPEG, WDOLoggerListener, WDOVerificationState };
|
|
747
|
+
export { Side, UploadState, WDOActivationService, WDOConfigurationService, WDOConsentResponse, WDODocumentFile, WDODocumentSide, WDODocumentType, WDOEndStateReason, WDOError, WDOErrorReason, WDOLogLevel, WDOLogger, WDOOnboardingStatus, WDOScannedDocument, WDOStatusCheckReason, WDOVerificationScanProcess, WDOVerificationService, WDOVerificationStateType };
|
|
748
|
+
export type { Base64EncodedJPEG, WDOConfigurationDocument, WDOConfigurationDocumentGroup, WDOConfigurationResponse, WDODocumentsToScanSelectState, WDOEndStateState, WDOFailedState, WDOFinishActivation, WDOIntroState, WDOLoggerListener, WDOOtpState, WDOPresenceCheckState, WDOProcessingState, WDOScanDocumentState, WDOSuccessState, WDOVerificationServiceListener, WDOVerificationState };
|