cordova-digital-onboarding 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +62 -0
- package/docs/Changelog.md +5 -0
- package/docs/Device-Activation.md +194 -0
- package/docs/Language-Configuration.md +13 -0
- package/docs/Logging.md +22 -0
- package/docs/Process-Configuration.md +59 -0
- package/docs/Readme.md +61 -0
- package/docs/SDK-Integration.md +20 -0
- package/docs/Verifying-User.md +382 -0
- package/docs/_Sidebar.md +12 -0
- 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 +691 -0
- package/lib/index.js +2001 -0
- package/package.json +1 -1
- package/plugin.xml +1 -1
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,691 @@
|
|
|
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
|
+
/** String that contains a Base64 encoded JPEG image */
|
|
37
|
+
type Base64EncodedJPEG = string;
|
|
38
|
+
/** Image of a document that can be sent to the backend for Identity Verification. */
|
|
39
|
+
declare class WDODocumentFile {
|
|
40
|
+
/** Raw data to upload. Make sure that the data aren't too big, hundreds of kbs should be enough. */
|
|
41
|
+
data: Base64EncodedJPEG;
|
|
42
|
+
/**
|
|
43
|
+
* Image signature.
|
|
44
|
+
*
|
|
45
|
+
* Optional, use only when the scan SDK supports this.
|
|
46
|
+
*/
|
|
47
|
+
dataSignature: string | undefined;
|
|
48
|
+
/** Type of the document. */
|
|
49
|
+
type: WDODocumentType;
|
|
50
|
+
/** Side of the document (`front` if the document is one-sided or only one side is expected). */
|
|
51
|
+
side: WDODocumentSide;
|
|
52
|
+
/**
|
|
53
|
+
* For image reuploading when the previous file of the same document was rejected.
|
|
54
|
+
*
|
|
55
|
+
* Without specifying this value, the document side won't be overwritten.
|
|
56
|
+
*/
|
|
57
|
+
originalDocumentId: string | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Create the document file from an image that can be sent to the backend for Identity Verification.
|
|
60
|
+
*
|
|
61
|
+
* @param scannedDocument Document to upload.
|
|
62
|
+
* @param side The side of the document that the image captures.
|
|
63
|
+
* @param data Raw image data. Make sure that the data aren't too big, hundreds of kbs should be enough.
|
|
64
|
+
* @param dataSignature Signature of the image data. Optional, use only when the scan SDK supports this. `undefined` by default.
|
|
65
|
+
* @returns Document file to upload.
|
|
66
|
+
*/
|
|
67
|
+
static fromScannedDocument(scannedDocument: WDOScannedDocument, side: WDODocumentSide, data: Base64EncodedJPEG, dataSignature?: string): WDODocumentFile;
|
|
68
|
+
/**
|
|
69
|
+
* Image of a document that can be sent to the backend for Identity Verification.
|
|
70
|
+
*
|
|
71
|
+
* @param data Raw image data. Make sure that the data aren't too big, hundreds of kbs should be enough.
|
|
72
|
+
* @param type Type of the document.
|
|
73
|
+
* @param side The side of the document that the image captures.
|
|
74
|
+
* @param originalDocumentId Original document ID In case of a reupload. If you've previously uploaded this type and side and won't specify the previous ID, the image won't be overwritten.
|
|
75
|
+
* @param dataSignature Signature of the image data. Optional, use only when the scan SDK supports this. `undefined` by default.
|
|
76
|
+
*/
|
|
77
|
+
constructor(data: Base64EncodedJPEG, type: WDODocumentType, side: WDODocumentSide, originalDocumentId?: string, dataSignature?: string);
|
|
78
|
+
}
|
|
79
|
+
/** Type of the document. */
|
|
80
|
+
declare enum WDODocumentType {
|
|
81
|
+
/** National ID card */
|
|
82
|
+
idCard = "idCard",
|
|
83
|
+
/** Passport */
|
|
84
|
+
passport = "passport",
|
|
85
|
+
/** Drivers license */
|
|
86
|
+
driversLicense = "driversLicense"
|
|
87
|
+
}
|
|
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
|
+
/** Side of the document */
|
|
96
|
+
declare enum WDODocumentSide {
|
|
97
|
+
/** Front side of a document. Usually the one with the picture.
|
|
98
|
+
*
|
|
99
|
+
* When a document has more than one side but only one side is used (for example passport), then such side is considered to be front.
|
|
100
|
+
*/
|
|
101
|
+
front = "front",
|
|
102
|
+
/** Back side of a document */
|
|
103
|
+
back = "back"
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Status of the onboarding */
|
|
107
|
+
declare enum WDOOnboardingStatus {
|
|
108
|
+
/** Activation part of the process is in progress */
|
|
109
|
+
activationInProgress = "ACTIVATION_IN_PROGRESS",
|
|
110
|
+
/** Verification part of the process is in progress */
|
|
111
|
+
verificationInProgress = "VERIFICATION_IN_PROGRESS",
|
|
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
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Duck-typed PowerAuthActivationResult for WDO space */
|
|
144
|
+
interface WDOPowerAuthActivationResult {
|
|
145
|
+
/** Decimalized fingerprint calculated from device's and server's public keys. */
|
|
146
|
+
activationFingerprint: string;
|
|
147
|
+
/** When available, contents of this object depends of your enrollment server configuration. */
|
|
148
|
+
customAttributes?: any;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Service that can activate PowerAuth instance by user weak credentials (like his email, phone number or client ID) + optional SMS OTP.
|
|
152
|
+
*
|
|
153
|
+
* When the PowerAuth is activated with this service, `WDOVerificationService.isVerificationRequired` will be `true`
|
|
154
|
+
* and you will need to verify the PowerAuth instance via `WDOVerificationService`.
|
|
155
|
+
*
|
|
156
|
+
* This service operates against Wultra Onboarding server (usually ending with `/enrollment-onboarding-server`) and you need to configure networking service with the right URL.
|
|
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>;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Service that can activate PowerAuth instance by user weak credentials (like his email, phone number or client ID) + optional SMS OTP.
|
|
222
|
+
*
|
|
223
|
+
* When the PowerAuth is activated with this service, `WDOVerificationService.isVerificationRequired` will be `true`
|
|
224
|
+
* and you will need to verify the PowerAuth instance via `WDOVerificationService`.
|
|
225
|
+
*
|
|
226
|
+
* This service operates against Wultra Onboarding server (usually ending with `/enrollment-onboarding-server`) and you need to configure networking service with the right URL.
|
|
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);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* State which should be presented to the user.
|
|
242
|
+
* Each state represents a separate screen UI that should be presented to the user.
|
|
243
|
+
*
|
|
244
|
+
* This type is an "tagged union" type, where each interface has a `type` property
|
|
245
|
+
* that uniquely identifies the state type.
|
|
246
|
+
*
|
|
247
|
+
* Usage:
|
|
248
|
+
*
|
|
249
|
+
* ```
|
|
250
|
+
* const state = await verificationService.status();
|
|
251
|
+
* if (state.type === WDOVerificationStateType.scanDocument ) {
|
|
252
|
+
* // We are in the scan document state, access specific properties
|
|
253
|
+
* const process = state.process;
|
|
254
|
+
* }
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
type WDOVerificationState = Intro | Consent | DocumentsToScanSelect | ScanDocument | Processing | PresenceCheck | Otp | Failed | EndState | Success;
|
|
258
|
+
/**
|
|
259
|
+
* Show the verification introduction screen where the user can start the activation.
|
|
260
|
+
*
|
|
261
|
+
* The next step should be calling the `consentGet()`.
|
|
262
|
+
*/
|
|
263
|
+
interface Intro {
|
|
264
|
+
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;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Show document selection to the user. Which documents are available and how many
|
|
280
|
+
* can the user select is up to your backend configuration.
|
|
281
|
+
*
|
|
282
|
+
* The next step should be calling the `documentsSetSelectedTypes`.
|
|
283
|
+
*/
|
|
284
|
+
interface DocumentsToScanSelect {
|
|
285
|
+
type: WDOVerificationStateType.documentsToScanSelect;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* User should scan documents - display UI for the user to scan all necessary documents.
|
|
289
|
+
*
|
|
290
|
+
* The next step should be calling the `documentsSubmit`.
|
|
291
|
+
*/
|
|
292
|
+
interface ScanDocument {
|
|
293
|
+
type: WDOVerificationStateType.scanDocument;
|
|
294
|
+
/** Scanning process that helps with the document scanning */
|
|
295
|
+
process: WDOVerificationScanProcess;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* The system is processing data - show loading with text hint from provided `WDOStatusCheckReason`.
|
|
299
|
+
*
|
|
300
|
+
* The next step should be calling the `status`.
|
|
301
|
+
*/
|
|
302
|
+
interface Processing {
|
|
303
|
+
type: WDOVerificationStateType.processing;
|
|
304
|
+
/** Reason for the current processing state */
|
|
305
|
+
item: WDOStatusCheckReason;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* The user should be presented with a presence check.
|
|
309
|
+
* Presence check is handled by third-party SDK based on the project setup.
|
|
310
|
+
*
|
|
311
|
+
* The next step should be calling the `presenceCheckInit` to start the check and `presenceCheckSubmit` to
|
|
312
|
+
* 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
|
+
*/
|
|
314
|
+
interface PresenceCheck {
|
|
315
|
+
type: WDOVerificationStateType.presenceCheck;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Show enter OTP screen with resend button.
|
|
319
|
+
*
|
|
320
|
+
* The next step should be calling the `verifyOTP` with user-entered OTP.
|
|
321
|
+
* The OTP is usually SMS or email.
|
|
322
|
+
*/
|
|
323
|
+
interface Otp {
|
|
324
|
+
type: WDOVerificationStateType.otp;
|
|
325
|
+
/** Number of remaining attempts to enter the correct OTP */
|
|
326
|
+
remainingAttempts?: number;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Verification failed and can be restarted
|
|
330
|
+
*
|
|
331
|
+
* The next step should be calling the `restartVerification` or `cancelWholeProcess` based on
|
|
332
|
+
* the user's decision if he wants to try it again or cancel the process.
|
|
333
|
+
*/
|
|
334
|
+
interface Failed {
|
|
335
|
+
type: WDOVerificationStateType.failed;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Verification is canceled and the user needs to start again with a new PowerAuth activation.
|
|
339
|
+
*
|
|
340
|
+
* The next step should be calling the `PowerAuth.removeActivationLocal()` and starting activation from scratch.
|
|
341
|
+
*/
|
|
342
|
+
interface EndState {
|
|
343
|
+
type: WDOVerificationStateType.endState;
|
|
344
|
+
/** Reason for the end state */
|
|
345
|
+
reason: WDOEndStateReason;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Verification was successfully ended. Continue into your app flow.
|
|
349
|
+
*/
|
|
350
|
+
interface Success {
|
|
351
|
+
type: WDOVerificationStateType.success;
|
|
352
|
+
}
|
|
353
|
+
/** Types of the verification state */
|
|
354
|
+
declare enum WDOVerificationStateType {
|
|
355
|
+
/**
|
|
356
|
+
* Show the verification introduction screen where the user can start the activation.
|
|
357
|
+
*
|
|
358
|
+
* The next step should be calling the `consentGet()`.
|
|
359
|
+
*/
|
|
360
|
+
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
|
+
/**
|
|
370
|
+
* Show document selection to the user. Which documents are available and how many
|
|
371
|
+
* can the user select is up to your backend configuration.
|
|
372
|
+
*
|
|
373
|
+
* The next step should be calling the `documentsSetSelectedTypes`.
|
|
374
|
+
*/
|
|
375
|
+
documentsToScanSelect = "documentsToScanSelect",
|
|
376
|
+
/**
|
|
377
|
+
* User should scan documents - display UI for the user to scan all necessary documents.
|
|
378
|
+
*
|
|
379
|
+
* The next step should be calling the `documentsSubmit`.
|
|
380
|
+
*/
|
|
381
|
+
scanDocument = "scanDocument",
|
|
382
|
+
/**
|
|
383
|
+
* The system is processing data - show loading with text hint from provided `WDOStatusCheckReason`.
|
|
384
|
+
*
|
|
385
|
+
* The next step should be calling the `status`.
|
|
386
|
+
*/
|
|
387
|
+
processing = "processing",
|
|
388
|
+
/**
|
|
389
|
+
* The user should be presented with a presence check.
|
|
390
|
+
* Presence check is handled by third-party SDK based on the project setup.
|
|
391
|
+
*
|
|
392
|
+
* The next step should be calling the `presenceCheckInit` to start the check and `presenceCheckSubmit` to
|
|
393
|
+
* 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.
|
|
394
|
+
*/
|
|
395
|
+
presenceCheck = "presenceCheck",
|
|
396
|
+
/**
|
|
397
|
+
* Show enter OTP screen with resend button.
|
|
398
|
+
*
|
|
399
|
+
* The next step should be calling the `verifyOTP` with user-entered OTP.
|
|
400
|
+
* The OTP is usually SMS or email.
|
|
401
|
+
*/
|
|
402
|
+
otp = "otp",
|
|
403
|
+
/**
|
|
404
|
+
* Verification failed and can be restarted
|
|
405
|
+
*
|
|
406
|
+
* The next step should be calling the `restartVerification` or `cancelWholeProcess` based on
|
|
407
|
+
* the user's decision if he wants to try it again or cancel the process.
|
|
408
|
+
*/
|
|
409
|
+
failed = "failed",
|
|
410
|
+
/**
|
|
411
|
+
* Verification is canceled and the user needs to start again with a new PowerAuth activation.
|
|
412
|
+
*
|
|
413
|
+
* The next step should be calling the `PowerAuth.removeActivationLocal()` and starting activation from scratch.
|
|
414
|
+
*/
|
|
415
|
+
endState = "endState",
|
|
416
|
+
/**
|
|
417
|
+
* Verification was successfully ended. Continue into your app flow.
|
|
418
|
+
*/
|
|
419
|
+
success = "success"
|
|
420
|
+
}
|
|
421
|
+
/** The reason why the process ended in a non-recoverable state. */
|
|
422
|
+
declare enum WDOEndStateReason {
|
|
423
|
+
/**
|
|
424
|
+
* The verification was rejected by the system
|
|
425
|
+
*
|
|
426
|
+
* eg: Fake information, fraud detection, or user is trying repeatedly in a short time.
|
|
427
|
+
* The real reason is not presented to the user and is only audited on the server.
|
|
428
|
+
*/
|
|
429
|
+
rejected = "rejected",
|
|
430
|
+
/**
|
|
431
|
+
* The limit of repeat tries was reached. There is a fixed number of tries that the user can reach
|
|
432
|
+
* before the system stops the process.
|
|
433
|
+
*/
|
|
434
|
+
limitReached = "limitReached",
|
|
435
|
+
/** An unknown reason. */
|
|
436
|
+
other = "other"
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* The reason for what we are waiting for. For example, we can wait for documents to be OCRed and matched against the database.
|
|
440
|
+
* Use these values for better loading texts to tell the user what is happening - some tasks may take some time
|
|
441
|
+
* and it would be frustrating to just show a generic loading indicator.
|
|
442
|
+
*/
|
|
443
|
+
declare enum WDOStatusCheckReason {
|
|
444
|
+
unknown = "unknown",
|
|
445
|
+
documentUpload = "documentUpload",
|
|
446
|
+
documentVerification = "documentVerification",
|
|
447
|
+
documentAccepted = "documentAccepted",
|
|
448
|
+
documentsCrossVerification = "documentsCrossVerification",
|
|
449
|
+
clientVerification = "clientVerification",
|
|
450
|
+
clientAccepted = "clientAccepted",
|
|
451
|
+
verifyingPresence = "verifyingPresence"
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* ######################################
|
|
456
|
+
* This file contains duck-typed representation of PowerAuthActivationStatus
|
|
457
|
+
* to avoid direct dependency on PowerAuth types in the shared library.
|
|
458
|
+
* ######################################
|
|
459
|
+
*/
|
|
460
|
+
/**
|
|
461
|
+
* The `WDOPowerAuthActivationStatus` object represents complete status of the activation.
|
|
462
|
+
*/
|
|
463
|
+
interface WDOPowerAuthActivationStatus {
|
|
464
|
+
/**
|
|
465
|
+
* State of the activation.
|
|
466
|
+
*/
|
|
467
|
+
state: WDOPowerAuthActivationState;
|
|
468
|
+
/**
|
|
469
|
+
* Number of failed authentication attempts in a row.
|
|
470
|
+
*/
|
|
471
|
+
failCount: number;
|
|
472
|
+
/**
|
|
473
|
+
* Maximum number of allowed failed authentication attempts in a row.
|
|
474
|
+
*/
|
|
475
|
+
maxFailCount: number;
|
|
476
|
+
/**
|
|
477
|
+
* Contains `(maxFailCount - failCount)` if state is `ACTIVE`, otherwise 0.
|
|
478
|
+
*/
|
|
479
|
+
remainingAttempts: number;
|
|
480
|
+
/**
|
|
481
|
+
* Contains custom object returned from the server. The value is optional and PowerAuth Application Server must support this custom object.
|
|
482
|
+
*/
|
|
483
|
+
customObject?: any;
|
|
484
|
+
}
|
|
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
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Listener of the Verification Service that can listen on Verification Status and PowerAuth Status changes.
|
|
520
|
+
*/
|
|
521
|
+
interface WDOVerificationServiceListener {
|
|
522
|
+
/**
|
|
523
|
+
* Called when PowerAuth activation status changed.
|
|
524
|
+
*
|
|
525
|
+
* Note that this happens only when error is returned in some of the Verification endpoints and this error indicates PowerAuth status change. For
|
|
526
|
+
* example when the service finds out during the API call that the PowerAuth activation was removed or blocked on the server
|
|
527
|
+
*/
|
|
528
|
+
powerAuthActivationStatusChanged(sender: WDOBaseVerificationService, status: WDOPowerAuthActivationStatus): void;
|
|
529
|
+
/** Called when state of the verification has changed. */
|
|
530
|
+
verificationStatusChanged(sender: WDOBaseVerificationService, status: WDOVerificationState): void;
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Service that can verify previously activated PowerAuth instance.
|
|
534
|
+
*
|
|
535
|
+
* When PowerAuth instance was activated with weak credentials via `WDOActivationService`, user needs to verify his genuine presence.
|
|
536
|
+
* This can be confirmed in the `WDOVerificationService.isVerificationRequired` which will be `true`.
|
|
537
|
+
*
|
|
538
|
+
* 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
|
+
*/
|
|
540
|
+
declare abstract class WDOBaseVerificationService {
|
|
541
|
+
/**
|
|
542
|
+
* Accept language for the outgoing requests headers.
|
|
543
|
+
* Default value is "en".
|
|
544
|
+
*
|
|
545
|
+
* Standard RFC "Accept-Language" https://tools.ietf.org/html/rfc7231#section-5.3.5
|
|
546
|
+
* Response texts are based on this setting. For example when "de" is set, server
|
|
547
|
+
* will return error texts and other in german (if available).
|
|
548
|
+
*/
|
|
549
|
+
changeAcceptLanguage(language: string): void;
|
|
550
|
+
/** Time in seconds that user needs to wait between OTP resend calls */
|
|
551
|
+
get otpResendPeriodSeconds(): number | undefined;
|
|
552
|
+
/**
|
|
553
|
+
* Listener that retrieves information about the verification and activation changes.
|
|
554
|
+
*/
|
|
555
|
+
listener?: WDOVerificationServiceListener;
|
|
556
|
+
/**
|
|
557
|
+
* Status of the verification.
|
|
558
|
+
*/
|
|
559
|
+
status(): Promise<WDOVerificationState>;
|
|
560
|
+
/**
|
|
561
|
+
* Returns consent text for user to approve. The content of the text depends on the server configuration and might be plain text or HTML.
|
|
562
|
+
*
|
|
563
|
+
* Consent text explains how the service will handle his document photos or selfie scans.
|
|
564
|
+
*/
|
|
565
|
+
consentGet(): Promise<WDOVerificationState>;
|
|
566
|
+
/**
|
|
567
|
+
* Approves the consent for this process and starts the activation.
|
|
568
|
+
*/
|
|
569
|
+
consentApprove(): Promise<WDOVerificationState>;
|
|
570
|
+
/**
|
|
571
|
+
* Get the token for the document scanning SDK, when required.
|
|
572
|
+
*
|
|
573
|
+
* This is needed for example for ZenID or BlinkID provider.
|
|
574
|
+
*
|
|
575
|
+
* @param challenge Optional challenge provided by the scanning SDK.
|
|
576
|
+
*/
|
|
577
|
+
documentsInitSDK(challenge?: string): Promise<any>;
|
|
578
|
+
/**
|
|
579
|
+
* Set which documents will be scanned.
|
|
580
|
+
*
|
|
581
|
+
* Note that this needs to be in sync what server expects based on the configuration.
|
|
582
|
+
*
|
|
583
|
+
* @param types Types of documents to scan.
|
|
584
|
+
*/
|
|
585
|
+
documentsSetSelectedTypes(types: WDODocumentType[]): Promise<WDOVerificationState>;
|
|
586
|
+
/**
|
|
587
|
+
* Upload document files to the server. The order of the documents is up to you.
|
|
588
|
+
* Make sure that uploaded document are reasonable size so you're not uploading large files.
|
|
589
|
+
*
|
|
590
|
+
* If you're uploading the same document file again, you need to include the `originalDocumentId` otherwise it will be rejected by the server.
|
|
591
|
+
*
|
|
592
|
+
* @param files Document files to upload.
|
|
593
|
+
*/
|
|
594
|
+
documentsSubmit(files: WDODocumentFile[]): Promise<WDOVerificationState>;
|
|
595
|
+
/**
|
|
596
|
+
* Initiates the presence check. This returns attributes that are needed to start the 3rd party SDK (if needed).
|
|
597
|
+
*/
|
|
598
|
+
presenceCheckInit(): Promise<any>;
|
|
599
|
+
/**
|
|
600
|
+
* Call when presence check was finished in the 3rd party SDK.
|
|
601
|
+
*/
|
|
602
|
+
presenceCheckSubmit(): Promise<WDOVerificationState>;
|
|
603
|
+
/**
|
|
604
|
+
* Verification restart. When sucessfully called, intro screen should be presented.
|
|
605
|
+
*/
|
|
606
|
+
restartVerification(): Promise<WDOVerificationState>;
|
|
607
|
+
/**
|
|
608
|
+
* Cancel the whole activation/verification. After this it's no longer possible to call
|
|
609
|
+
* any API of this library and PowerAuth activation should be removed and activation started again.
|
|
610
|
+
*/
|
|
611
|
+
cancelWholeProcess(): Promise<void>;
|
|
612
|
+
/**
|
|
613
|
+
* Verify OTP that user entered as a last step of the verification.
|
|
614
|
+
*
|
|
615
|
+
* @param otp OTP that user obtained via other channel (usually SMS or email).
|
|
616
|
+
*/
|
|
617
|
+
verifyOTP(otp: string): Promise<WDOVerificationState>;
|
|
618
|
+
/**
|
|
619
|
+
* Request OTP resend.
|
|
620
|
+
*
|
|
621
|
+
* Since SMS or emails can fail to deliver, use this to send the OTP again.
|
|
622
|
+
*/
|
|
623
|
+
resendOTP(): Promise<void>;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Service that can verify previously activated PowerAuth instance.
|
|
628
|
+
*
|
|
629
|
+
* When PowerAuth instance was activated with weak credentials via `WDOActivationService`, user needs to verify his genuine presence.
|
|
630
|
+
*
|
|
631
|
+
* 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
|
+
*/
|
|
633
|
+
declare class WDOVerificationService extends WDOBaseVerificationService {
|
|
634
|
+
/** PowerAuth instance */
|
|
635
|
+
readonly powerauth: PowerAuth;
|
|
636
|
+
/** Checks if verification is required based on PowerAuth activation status */
|
|
637
|
+
static isVerificationRequired(paStatus: PowerAuthActivationStatus): boolean;
|
|
638
|
+
/**
|
|
639
|
+
* Creates service instance
|
|
640
|
+
*
|
|
641
|
+
* @param powerauth Configured PowerAuth instance. This instance needs to be without valid activation.
|
|
642
|
+
* @param baseUrl Base URL of the Wultra Digital Onboarding server. Usually ending with `/enrollment-onboarding-server`.
|
|
643
|
+
*/
|
|
644
|
+
constructor(powerauth: PowerAuth, baseUrl: string);
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/** Service that provides configuration for the Wultra Digital Onboarding SDK. */
|
|
648
|
+
declare abstract class WDOBaseConfigurationService {
|
|
649
|
+
/**
|
|
650
|
+
* Fetches configuration for the given process type from the server.
|
|
651
|
+
*
|
|
652
|
+
* @param processType Type of the process for which to fetch configuration.
|
|
653
|
+
* @returns Configuration response from the server.
|
|
654
|
+
*/
|
|
655
|
+
getConfiguration(processType: string): Promise<WDOConfigurationResponse>;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/** Service that provides configuration for the Wultra Digital Onboarding SDK. */
|
|
659
|
+
declare class WDOConfigurationService extends WDOBaseConfigurationService {
|
|
660
|
+
/** PowerAuth instance */
|
|
661
|
+
readonly powerauth: PowerAuth;
|
|
662
|
+
/**
|
|
663
|
+
* Creates service instance
|
|
664
|
+
*
|
|
665
|
+
* @param powerauth Configured PowerAuth instance.
|
|
666
|
+
* @param baseUrl Base URL of the Wultra Digital Onboarding server. Usually ending with `/enrollment-onboarding-server`.
|
|
667
|
+
*/
|
|
668
|
+
constructor(powerauth: PowerAuth, baseUrl: string);
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/** Log levels for Wultra Digital Onboarding. */
|
|
672
|
+
declare enum WDOLogLevel {
|
|
673
|
+
NONE = 0,
|
|
674
|
+
ERROR = 1,
|
|
675
|
+
WARN = 2,
|
|
676
|
+
INFO = 3,
|
|
677
|
+
DEBUG = 4
|
|
678
|
+
}
|
|
679
|
+
/** Simple logger utility for Wultra Digital Onboarding SDK. */
|
|
680
|
+
declare class WDOLogger {
|
|
681
|
+
/** Current log level. Messages with a level higher than this will not be logged. */
|
|
682
|
+
static logLevel: WDOLogLevel;
|
|
683
|
+
/** Listener for custom logging implementation */
|
|
684
|
+
static listener: WDOLoggerListener | null;
|
|
685
|
+
}
|
|
686
|
+
/** Log listener for your custom logging implementation */
|
|
687
|
+
interface WDOLoggerListener {
|
|
688
|
+
log(level: WDOLogLevel, message: string): void;
|
|
689
|
+
}
|
|
690
|
+
export { Side, UploadState, WDOActivationService, WDOConfigurationService, WDODocumentFile, WDODocumentSide, WDODocumentType, WDODocumentTypeSides, WDOEndStateReason, WDOLogLevel, WDOLogger, WDOScannedDocument, WDOStatusCheckReason, WDOVerificationScanProcess, WDOVerificationService, WDOVerificationStateType };
|
|
691
|
+
export type { Base64EncodedJPEG, WDOLoggerListener, WDOVerificationState };
|