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/docs/Changelog.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.0 (Jan, 2026)
|
|
4
|
+
|
|
5
|
+
- **Breaking:** New `finishActivation` state in `WDOVerificationService` to complete the user verification process by activating a new PowerAuth instance.
|
|
6
|
+
- New method must be called by the client when handling the `finishActivation` state in the verification flow, i.e. after all verification steps (identity, documents, presence, etc.) have succeeded but before the new `PowerAuth` instance is used anywhere else in the app: `finishActivation(newPaInstance: PowerAuth, activationName: string, password: WDOPowerAuthPassword, validatePassword: boolean)`.
|
|
7
|
+
- **Breaking:** Changed configuration endpoint response to include document groups instead of a flat list of documents.
|
|
8
|
+
|
|
3
9
|
## 1.1.0 (Dec, 2025)
|
|
4
10
|
|
|
5
11
|
- PowerAuth Cordova SDK dependency now requires v. `4.2.0`.
|
|
@@ -13,18 +13,21 @@ PowerAuth enrolled in such a way will need [further user verification](Verifying
|
|
|
13
13
|
To create an instance you will need a `PowerAuth` instance that is __ready to be activated__.
|
|
14
14
|
|
|
15
15
|
<!-- begin box info -->
|
|
16
|
-
[Documentation for `PowerAuth Mobile JS SDK`](https://developers.wultra.com/components/react-native-powerauth-mobile-sdk/).
|
|
16
|
+
[Documentation for the `PowerAuth Mobile JS SDK`](https://developers.wultra.com/components/react-native-powerauth-mobile-sdk/).
|
|
17
17
|
<!-- end -->
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
Example with `PowerAuth` instance:
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
|
+
// create and configure PowerAuth instance
|
|
23
24
|
const powerAuth = new PowerAuth("my-pa-instance")
|
|
24
|
-
powerAuth.configure({
|
|
25
|
+
await powerAuth.configure({
|
|
25
26
|
configuration: "ARCB+...jg==", // base64 PowerAuth configuration
|
|
26
27
|
baseEndpointUrl: "https://my-server-deployment.com/enrollment-server/"
|
|
27
28
|
})
|
|
29
|
+
|
|
30
|
+
// create activation service
|
|
28
31
|
const activationService = new WDOActivationService(
|
|
29
32
|
powerAuth,
|
|
30
33
|
"https://my-server-deployment.com/enrollment-server-onboarding/"
|
|
@@ -36,13 +39,13 @@ const activationService = new WDOActivationService(
|
|
|
36
39
|
To figure out if the activation process was already started and what is the status, you can use `hasActiveProcess`.
|
|
37
40
|
|
|
38
41
|
```typescript
|
|
39
|
-
/**
|
|
40
|
-
* If the activation process is in progress.
|
|
41
|
-
*
|
|
42
|
+
/**
|
|
43
|
+
* If the activation process is in progress.
|
|
44
|
+
*
|
|
42
45
|
* Note that even if this property is `true` it can be already discontinued on the server.
|
|
43
|
-
* Calling `status()`
|
|
46
|
+
* Calling `status()` after the app is launched is recommended.
|
|
44
47
|
*/
|
|
45
|
-
|
|
48
|
+
hasActiveProcess(): Promise<boolean>
|
|
46
49
|
```
|
|
47
50
|
|
|
48
51
|
If the process was started, you can verify its status by calling the `status` function. You can show an appropriate UI to the user based on this status.
|
|
@@ -53,7 +56,7 @@ If the process was started, you can verify its status by calling the `status` fu
|
|
|
53
56
|
*
|
|
54
57
|
* @return Promise resolved with onboarding status.
|
|
55
58
|
*/
|
|
56
|
-
status(): Promise<WDOOnboardingStatus
|
|
59
|
+
status(): Promise<WDOOnboardingStatus>
|
|
57
60
|
```
|
|
58
61
|
|
|
59
62
|
`WDOOnboardingStatus` possible values.
|
|
@@ -75,30 +78,29 @@ declare enum WDOOnboardingStatus {
|
|
|
75
78
|
|
|
76
79
|
To start the activation process, you can use any credentials that are sufficient to you that can identify the user.
|
|
77
80
|
|
|
78
|
-
Often, such data are user email, phone number, or
|
|
81
|
+
Often, such data are user email, phone number, or user ID. The definition of such data is up to your server implementation and requirements.
|
|
79
82
|
|
|
80
83
|
To start the activation, use the `start` function.
|
|
81
84
|
|
|
82
85
|
```typescript
|
|
83
86
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
87
|
+
* Start onboarding activation with user credentials.
|
|
88
|
+
*
|
|
89
|
+
* For example, when you require email, your object would look like this:
|
|
90
|
+
* ```
|
|
91
|
+
* {
|
|
92
|
+
* email: "<user_email>"
|
|
93
|
+
* }
|
|
94
|
+
* ```
|
|
95
|
+
* @param credentials Object with credentials. Which credentials are needed should be provided by a system/backend provider.
|
|
96
|
+
* @param processType The process type identification. If not specified, the default process type will be used.
|
|
97
|
+
*/
|
|
98
|
+
start(credentials: any, processType?: string): Promise<void>
|
|
96
99
|
```
|
|
97
100
|
|
|
98
101
|
### Example
|
|
99
102
|
|
|
100
103
|
```typescript
|
|
101
|
-
|
|
102
104
|
class MyUserService {
|
|
103
105
|
// prepared service
|
|
104
106
|
private activationService: WDOActivationService
|
|
@@ -106,9 +108,9 @@ class MyUserService {
|
|
|
106
108
|
async startActivation(id: string) {
|
|
107
109
|
const data = { userId: id}
|
|
108
110
|
try {
|
|
109
|
-
await this.activationService.start(data)
|
|
110
|
-
// success, continue with
|
|
111
|
-
// at this moment, the `hasActiveProcess` starts
|
|
111
|
+
await this.activationService.start(data, "onboarding")
|
|
112
|
+
// success, continue with the flow
|
|
113
|
+
// at this moment, the `hasActiveProcess` starts returning true
|
|
112
114
|
} catch (error) {
|
|
113
115
|
// show error to the user
|
|
114
116
|
}
|
|
@@ -118,7 +120,7 @@ class MyUserService {
|
|
|
118
120
|
|
|
119
121
|
## Creating the activation
|
|
120
122
|
|
|
121
|
-
To activate the user (activating the `PowerAuth` instance), data retrieved from the process start can be used with optional `OTP`. The OTP is usually sent via SMS, email, or other channel. To decide if the OTP is needed, you can use the [Configuration API](Process-Configuration.md) or have it
|
|
123
|
+
To activate the user (activating the `PowerAuth` instance), data retrieved from the process start can be used with optional `OTP`. The OTP is usually sent via SMS, email, or other channel. To decide if the OTP is needed, you can use the [Configuration API](Process-Configuration.md) or have it hard-coded.
|
|
122
124
|
|
|
123
125
|
Use the `activate` function to create the activation.
|
|
124
126
|
|
|
@@ -130,7 +132,7 @@ Use the `activate` function to create the activation.
|
|
|
130
132
|
* @param otp OTP code received by the user (via SMS or email). Optional when not required.
|
|
131
133
|
* @return Promise resolved with activation result.
|
|
132
134
|
*/
|
|
133
|
-
activate(activationName: string, otp?: string): Promise<WDOPowerAuthActivationResult
|
|
135
|
+
activate(activationName: string, otp?: string): Promise<WDOPowerAuthActivationResult>
|
|
134
136
|
```
|
|
135
137
|
|
|
136
138
|
Example implementation:
|
|
@@ -169,14 +171,14 @@ To cancel the process, just call the `cancel` function.
|
|
|
169
171
|
*
|
|
170
172
|
* @param forceCancel When true, the process will be canceled in the SDK even when fails on backend. `true` by default.
|
|
171
173
|
*/
|
|
172
|
-
cancel(forceCancel?: boolean): Promise<void
|
|
174
|
+
cancel(forceCancel?: boolean): Promise<void>
|
|
173
175
|
```
|
|
174
176
|
|
|
175
177
|
## OTP resend
|
|
176
178
|
|
|
177
179
|
In some cases, you need to resent the OTP:
|
|
178
|
-
- OTP was not received by the user (for example when the email ends in the spam folder)
|
|
179
|
-
- OTP expired
|
|
180
|
+
- OTP was not received by the user (for example when the email ends in the spam folder)
|
|
181
|
+
- OTP expired
|
|
180
182
|
|
|
181
183
|
For such cases, use `resendOTP` function.
|
|
182
184
|
|
|
@@ -186,9 +188,11 @@ In some cases, you need to resent the OTP:
|
|
|
186
188
|
*
|
|
187
189
|
* This is intended to be displayed for the user to use in case of the OTP is not received.
|
|
188
190
|
* For example, when the user does not receive SMS after some time, there should be a button to "send again".
|
|
191
|
+
* 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.
|
|
189
192
|
*/
|
|
190
|
-
resendOTP(): Promise<void
|
|
193
|
+
resendOTP(): Promise<void>
|
|
191
194
|
```
|
|
192
195
|
|
|
193
196
|
## Read next
|
|
194
|
-
|
|
197
|
+
|
|
198
|
+
- [Verifying the User](Verifying-User.md)
|
|
@@ -9,19 +9,21 @@ To retrieve the configuration, create an instance of `WDOConfigurationService` a
|
|
|
9
9
|
Example:
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
|
|
12
|
+
// create and configure PowerAuth instance
|
|
13
13
|
const powerAuth = new PowerAuth("my-pa-instance")
|
|
14
|
-
powerAuth.configure({
|
|
14
|
+
await powerAuth.configure({
|
|
15
15
|
configuration: "ARCB+...jg==", // base64 PowerAuth configuration
|
|
16
16
|
baseEndpointUrl: "https://my-server-deployment.com/enrollment-server/"
|
|
17
17
|
})
|
|
18
|
+
|
|
19
|
+
// create configuration service
|
|
18
20
|
const configurationService = new WDOConfigurationService(
|
|
19
21
|
powerAuth,
|
|
20
22
|
"https://my-server-deployment.com/enrollment-server-onboarding/"
|
|
21
23
|
)
|
|
22
24
|
|
|
23
|
-
const
|
|
24
|
-
const config = await configurationService.getConfiguration(
|
|
25
|
+
const processType = "onboarding" // defined on your server (can be undefined for default process type)
|
|
26
|
+
const config = await configurationService.getConfiguration(processType)
|
|
25
27
|
console.log("Configuration:", config)
|
|
26
28
|
```
|
|
27
29
|
|
|
@@ -31,27 +33,34 @@ console.log("Configuration:", config)
|
|
|
31
33
|
/** Configuration for the onboarding process */
|
|
32
34
|
interface WDOConfigurationResponse {
|
|
33
35
|
/** Is the onboarding process enabled */
|
|
34
|
-
enabled: boolean
|
|
36
|
+
enabled: boolean
|
|
35
37
|
/** Is OTP required for the first part - identification/activation. */
|
|
36
|
-
otpForIdentification: boolean
|
|
38
|
+
otpForIdentification: boolean
|
|
37
39
|
/** Is OTP required for the second part - identity verification. */
|
|
38
|
-
otpForIdentityVerification: boolean
|
|
40
|
+
otpForIdentityVerification: boolean
|
|
39
41
|
/** Documents required for identity verification. */
|
|
40
42
|
documents: {
|
|
41
|
-
/** Number of required documents */
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
|
|
43
|
+
/** Number of total required documents */
|
|
44
|
+
totalRequiredDocumentsCount: number
|
|
45
|
+
/** Groups of documents */
|
|
46
|
+
groups: Array<WDOConfigurationDocumentGroup>
|
|
45
47
|
}
|
|
46
48
|
}
|
|
49
|
+
|
|
50
|
+
/** Group of documents in the configuration */
|
|
51
|
+
interface WDOConfigurationDocumentGroup {
|
|
52
|
+
/** Number of required documents in the group */
|
|
53
|
+
requiredDocumentsCount: number
|
|
54
|
+
/** Documents in the group */
|
|
55
|
+
items: Array<WDOConfigurationDocument>
|
|
56
|
+
}
|
|
57
|
+
|
|
47
58
|
/** Configuration for a document */
|
|
48
59
|
interface WDOConfigurationDocument {
|
|
49
60
|
/** Type of the document */
|
|
50
|
-
type: string
|
|
51
|
-
/** Is the document mandatory */
|
|
52
|
-
mandatory: boolean;
|
|
61
|
+
type: string
|
|
53
62
|
/** Number of sides the document has */
|
|
54
|
-
sideCount: number
|
|
63
|
+
sideCount: number
|
|
55
64
|
}
|
|
56
65
|
```
|
|
57
66
|
|
package/docs/Verifying-User.md
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
# Verifying
|
|
1
|
+
# Verifying the User
|
|
2
2
|
|
|
3
|
-
If your
|
|
3
|
+
If your `PowerAuth` instance was activated via the `WDOActivationService`, it will be in the state that needs additional verification. Without such verification, it won't be able to properly sign requests.
|
|
4
4
|
|
|
5
|
-
Additional verification
|
|
5
|
+
Additional verification requires the user to scan their face and provide documents such as an ID card or passport.
|
|
6
6
|
|
|
7
7
|
## When is the verification needed?
|
|
8
8
|
|
|
9
9
|
Verification is needed if the `activationFlags` in the `PowerAuthActivationStatus` contains `VERIFICATION_PENDING` or `VERIFICATION_IN_PROGRESS` value.
|
|
10
10
|
|
|
11
|
+
<!-- begin box info -->
|
|
11
12
|
To simplify this check, you can use the `WDOVerificationService.isVerificationRequired` method that returns a boolean indicating whether verification is required.
|
|
13
|
+
<!-- end -->
|
|
12
14
|
|
|
13
15
|
Example:
|
|
14
16
|
|
|
@@ -42,65 +44,71 @@ The final flow (which screens come after another) is controlled by the backend.
|
|
|
42
44
|
- The screen that should be displayed is driven by the state on the server "session".
|
|
43
45
|
- At the beginning of the verification process, you will call the status which will tell you what to display to the user and which function to call next.
|
|
44
46
|
- Each API call returns a result and a next screen to display.
|
|
45
|
-
- This repeats until the process is finished or an "
|
|
47
|
+
- This repeats until the process is finished or an "end state" is presented which terminates the process.
|
|
46
48
|
|
|
47
49
|
## Possible state values
|
|
48
50
|
|
|
49
|
-
State is defined by the `WDOVerificationStateType`
|
|
51
|
+
State is defined by the `WDOVerificationStateType` with the following possibilities:
|
|
50
52
|
|
|
51
53
|
```typescript
|
|
52
54
|
/** Types of the verification state */
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Show the verification introduction screen where the user can start the activation.
|
|
56
|
-
*
|
|
57
|
-
* The next step should be calling the `
|
|
55
|
+
enum WDOVerificationStateType {
|
|
56
|
+
/**
|
|
57
|
+
* Show the verification introduction screen where the user can start the activation.
|
|
58
|
+
*
|
|
59
|
+
* The next step should be calling the `start()`.
|
|
58
60
|
*/
|
|
59
61
|
intro = "intro",
|
|
60
62
|
/**
|
|
61
63
|
* Show document selection to the user. Which documents are available and how many
|
|
62
64
|
* can the user select is up to your backend configuration.
|
|
63
|
-
*
|
|
65
|
+
*
|
|
64
66
|
* The next step should be calling the `documentsSetSelectedTypes`.
|
|
65
67
|
*/
|
|
66
68
|
documentsToScanSelect = "documentsToScanSelect",
|
|
67
69
|
/**
|
|
68
70
|
* User should scan documents - display UI for the user to scan all necessary documents.
|
|
69
|
-
*
|
|
71
|
+
*
|
|
70
72
|
* The next step should be calling the `documentsSubmit`.
|
|
71
73
|
*/
|
|
72
74
|
scanDocument = "scanDocument",
|
|
73
|
-
/**
|
|
75
|
+
/**
|
|
74
76
|
* The system is processing data - show loading with text hint from provided `WDOStatusCheckReason`.
|
|
75
|
-
*
|
|
77
|
+
*
|
|
76
78
|
* The next step should be calling the `status`.
|
|
77
79
|
*/
|
|
78
80
|
processing = "processing",
|
|
79
|
-
/**
|
|
81
|
+
/**
|
|
80
82
|
* The user should be presented with a presence check.
|
|
81
83
|
* Presence check is handled by third-party SDK based on the project setup.
|
|
82
|
-
*
|
|
84
|
+
*
|
|
83
85
|
* The next step should be calling the `presenceCheckInit` to start the check and `presenceCheckSubmit` to
|
|
84
86
|
* 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.
|
|
85
87
|
*/
|
|
86
88
|
presenceCheck = "presenceCheck",
|
|
87
89
|
/**
|
|
88
90
|
* Show enter OTP screen with resend button.
|
|
89
|
-
*
|
|
91
|
+
*
|
|
90
92
|
* The next step should be calling the `verifyOTP` with user-entered OTP.
|
|
91
93
|
* The OTP is usually SMS or email.
|
|
92
94
|
*/
|
|
93
95
|
otp = "otp",
|
|
96
|
+
/**
|
|
97
|
+
* Show "finish activation" with PIN prompt screen.
|
|
98
|
+
*
|
|
99
|
+
* The next step should be calling the `finishActivation` with user entered PIN.
|
|
100
|
+
*/
|
|
101
|
+
finishActivation = "finishActivation",
|
|
94
102
|
/**
|
|
95
103
|
* Verification failed and can be restarted
|
|
96
|
-
*
|
|
104
|
+
*
|
|
97
105
|
* The next step should be calling the `restartVerification` or `cancelWholeProcess` based on
|
|
98
106
|
* the user's decision if he wants to try it again or cancel the process.
|
|
99
107
|
*/
|
|
100
108
|
failed = "failed",
|
|
101
109
|
/**
|
|
102
110
|
* Verification is canceled and the user needs to start again with a new PowerAuth activation.
|
|
103
|
-
*
|
|
111
|
+
*
|
|
104
112
|
* The next step should be calling the `PowerAuth.removeActivationLocal()` and starting activation from scratch.
|
|
105
113
|
*/
|
|
106
114
|
endState = "endState",
|
|
@@ -123,6 +131,7 @@ export type WDOVerificationState =
|
|
|
123
131
|
| WDOProcessingState
|
|
124
132
|
| WDOPresenceCheckState
|
|
125
133
|
| WDOOtpState
|
|
134
|
+
| WDOFinishActivation
|
|
126
135
|
| WDOFailedState
|
|
127
136
|
| WDOEndStateState
|
|
128
137
|
| WDOSuccessState
|
|
@@ -193,6 +202,15 @@ export interface WDOOtpState {
|
|
|
193
202
|
remainingAttempts?: number
|
|
194
203
|
}
|
|
195
204
|
|
|
205
|
+
/**
|
|
206
|
+
* Show "finish activation" with PIN prompt screen.
|
|
207
|
+
*
|
|
208
|
+
* The next step should be calling the `finishActivation` with user entered PIN.
|
|
209
|
+
*/
|
|
210
|
+
export interface WDOFinishActivation {
|
|
211
|
+
type: WDOVerificationStateType.finishActivation
|
|
212
|
+
}
|
|
213
|
+
|
|
196
214
|
/**
|
|
197
215
|
* Verification failed and can be restarted
|
|
198
216
|
*
|
|
@@ -233,11 +251,14 @@ To create an instance you will need a `PowerAuth` instance that is __already act
|
|
|
233
251
|
|
|
234
252
|
Example:
|
|
235
253
|
```typescript
|
|
254
|
+
// create and configure PowerAuth instance
|
|
236
255
|
const powerAuth = new PowerAuth("my-pa-instance")
|
|
237
|
-
powerAuth.configure({
|
|
256
|
+
await powerAuth.configure({
|
|
238
257
|
configuration: "ARCB+...jg==", // base64 PowerAuth configuration
|
|
239
258
|
baseEndpointUrl: "https://my-server-deployment.com/enrollment-server/"
|
|
240
259
|
})
|
|
260
|
+
|
|
261
|
+
// create activation service
|
|
241
262
|
const verification = new WDOVerificationService(
|
|
242
263
|
powerAuth,
|
|
243
264
|
"https://my-server-deployment.com/enrollment-server-onboarding/"
|
|
@@ -246,11 +267,11 @@ const verification = new WDOVerificationService(
|
|
|
246
267
|
|
|
247
268
|
## Getting the verification status
|
|
248
269
|
|
|
249
|
-
When
|
|
270
|
+
When starting the verification flow for the first time (such as after a fresh app launch), you should retrieve the current verification state.
|
|
250
271
|
|
|
251
|
-
|
|
272
|
+
You should also retrieve the state after any operation fails, or whenever you are unsure about the next step in the verification process.
|
|
252
273
|
|
|
253
|
-
Most verification functions return the result and
|
|
274
|
+
Most verification functions return both the result and the updated state, making it easier to determine what action to take next.
|
|
254
275
|
|
|
255
276
|
Getting the state directly:
|
|
256
277
|
|
|
@@ -261,10 +282,6 @@ try {
|
|
|
261
282
|
// handle `WDOVerificationState` state and navigate to the expected screen
|
|
262
283
|
if (vfStatus.type === WDOVerificationStateType.intro) {
|
|
263
284
|
// display intro screen
|
|
264
|
-
const consentRequired = vfStatus.consentRequired // accessible based on union type 'intro'
|
|
265
|
-
// show consent info if needed
|
|
266
|
-
verification.start(WDOConsentResponse.approved) // example of starting the process
|
|
267
|
-
|
|
268
285
|
} else if (vfStatus.type === WDOVerificationStateType.documentsToScanSelect) {
|
|
269
286
|
// display document selector
|
|
270
287
|
}
|
|
@@ -309,13 +326,14 @@ try {
|
|
|
309
326
|
|
|
310
327
|
## Set document types to scan
|
|
311
328
|
|
|
312
|
-
After the user approves the consent, present a document selector for documents which will be scanned. The number and types of documents (or other rules like 1 type required) are completely dependent on your backend system integration. You can retrieve the list of available document types from the [configuration service](Process-Configuration.md).
|
|
329
|
+
After the user approves the consent, present a document selector for documents which will be scanned. The number and types of documents (or other rules like 1 type required) are completely dependent on your backend system integration. You can retrieve the list of available document types from the [configuration service](Process-Configuration.md) or have it hard-coded.
|
|
313
330
|
|
|
314
331
|
For example, your system might require a national ID and one additional document like a driver's license, passport, or any other government-issued personal document.
|
|
315
332
|
|
|
316
333
|
```typescript
|
|
317
334
|
const verification: WDOVerificationService // configured instance
|
|
318
335
|
try {
|
|
336
|
+
// assuming user selected ID card and driver's license
|
|
319
337
|
const docTypesResult = await verification.documentsSetSelectedTypes([
|
|
320
338
|
WDODocumentType.idCard,
|
|
321
339
|
WDODocumentType.driversLicense
|
|
@@ -338,7 +356,7 @@ This step does not move the state of the process but is a "stand-alone" API call
|
|
|
338
356
|
|
|
339
357
|
Since the document scanning itself is not provided by this library but by a 3rd party library, some of them need a server-side initialization.
|
|
340
358
|
|
|
341
|
-
If your chosen
|
|
359
|
+
If your chosen "document scan SDK" requires such a step, use this function to retrieve necessary data from the server.
|
|
342
360
|
|
|
343
361
|
Example:
|
|
344
362
|
|
|
@@ -367,7 +385,7 @@ for your implementation.
|
|
|
367
385
|
When a document is scanned (both sides when required), it needs to be uploaded to the server.
|
|
368
386
|
|
|
369
387
|
<!-- begin box warning -->
|
|
370
|
-
__Images of the document should not be bigger than
|
|
388
|
+
__Images of the document should not be bigger than hundreds of kilobytes. Files that are too big will take longer time to upload and process on the server.__
|
|
371
389
|
<!-- end -->
|
|
372
390
|
|
|
373
391
|
To upload a document, use `documentsSubmit` function. Each side of a document is a single `WDODocumentFile` instance.
|
|
@@ -381,8 +399,8 @@ const passportToUpload = WDODocumentFile(
|
|
|
381
399
|
"BASE64_ENCODED_IMAGE_DATA", // raw image data from the document scanning library/photo camera
|
|
382
400
|
WDODocumentType.passport,
|
|
383
401
|
WDODocumentSide.front, // passport has only front side
|
|
384
|
-
undefined, // use only when re-uploading the file
|
|
385
|
-
undefined //
|
|
402
|
+
undefined, // original id, optional (use only when re-uploading the file - for example when first upload was rejected because of a blur)
|
|
403
|
+
undefined // signature, optional (use when provided by the document scanning library)
|
|
386
404
|
)
|
|
387
405
|
try {
|
|
388
406
|
const result = await verification.documentsSubmit([passportToUpload])
|
|
@@ -474,6 +492,35 @@ try {
|
|
|
474
492
|
}
|
|
475
493
|
```
|
|
476
494
|
|
|
495
|
+
## Finalizing the verification (optional)
|
|
496
|
+
|
|
497
|
+
When the state `finishActivation` is received, prompt the user for a PIN code.
|
|
498
|
+
|
|
499
|
+
This PIN code is then used to activate a new `PowerAuth` object that will be used for signing requests.
|
|
500
|
+
|
|
501
|
+
Once the new `PowerAuth` instance is activated, the verification process is finished, and the user can proceed to the main app flow *with the new `PowerAuth` instance*.
|
|
502
|
+
|
|
503
|
+
<!-- begin box info -->
|
|
504
|
+
If the user's PIN used for the original activation should be equal to the one used for the new activation, then:
|
|
505
|
+
- Set the `validatePassword` parameter to `true` in the `finishActivation` call.
|
|
506
|
+
- The `PowerAuthPassword` passed to the `finishActivation` needs to be reusable (`destroyOnUse` set to false - `new PowerAuthPassword(false)`).
|
|
507
|
+
<!-- end -->
|
|
508
|
+
|
|
509
|
+
Example:
|
|
510
|
+
|
|
511
|
+
```typescript
|
|
512
|
+
const verification: WDOVerificationService // configured instance
|
|
513
|
+
const newPaInstance: PowerAuth // new PowerAuth instance to be activated and then used in the app
|
|
514
|
+
try {
|
|
515
|
+
const password = await PowerAuthPassword.fromString("user-password", false) // reusable password
|
|
516
|
+
const finishResult = await verification.finishActivation(newPaInstance, "my-new-activation-name", password, true)
|
|
517
|
+
// When here, the newPaInstance is activated and ready to use (to sign requests and so on).
|
|
518
|
+
// The original PowerAuth instance used for the verification will be in the `REMOVED` state and the `verification` instance can't be used anymore.
|
|
519
|
+
} catch (error) {
|
|
520
|
+
// handle error
|
|
521
|
+
}
|
|
522
|
+
```
|
|
523
|
+
|
|
477
524
|
## Success state
|
|
478
525
|
|
|
479
526
|
When a whole verification is finished, you will receive the `success` state. Show a success screen and navigate the user to a common activated flow.
|
package/docs/_Sidebar.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
- [SDK Integration](SDK-Integration.md)
|
|
4
4
|
- [Process Configuration](Process-Configuration.md)
|
|
5
5
|
- [Device Activation (With Weak Credentials)](Device-Activation.md)
|
|
6
|
-
- [Verifying User
|
|
6
|
+
- [Verifying the User](Verifying-User.md)
|
|
7
7
|
- [Language Configuration](Language-Configuration.md)
|
|
8
8
|
- [Logging](Logging.md)
|
|
9
9
|
|
|
Binary file
|
package/docs/images/intro.jpg
CHANGED
|
Binary file
|
|
Binary file
|