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 CHANGED
@@ -1,5 +1,30 @@
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
+
9
+ ## 1.1.0 (Dec, 2025)
10
+
11
+ - PowerAuth Cordova SDK dependency now requires v. `4.2.0`.
12
+ - Process cache is now persistent across app restarts.
13
+ - Changes to `WDOError`:
14
+ - added `reason: WDOErrorReason` property to specify the error cause.
15
+ - added `allowOnboardingOtpRetry: boolean` property to indicate if OTP retry is allowed (during activation failure).
16
+ - modified `onboardingOtpRemainingAttempts` to parse the remaining attempts from the original exception (during activation failure).
17
+ - `WDOActivaitonService` changes:
18
+ - `hasActiveProcess()` now returns Promise<boolean> instead of boolean.
19
+ - `clear()` is now asynchronous and returns Promise<void>.
20
+ - `WDOActivaitonService` changes:
21
+ - removed `consent` state
22
+ - replaced `consentApprove` with `start` method with a `consent` argument.
23
+ - `consentGet` now returns Promise<string> instead of the verification state.
24
+ - `documentsInitSDK` method now returns strongly typed response.
25
+ - `presenceCheckInit` method now returns strongly typed response.
26
+ - `intro` state now contains `consentRequired: boolean` property in the corresponding union type.
27
+
3
28
  ## 1.0.0 (Nov, 2025)
4
29
 
5
30
  Initial release.
@@ -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()` for example after the app is launched in this case is recommended.
46
+ * Calling `status()` after the app is launched is recommended.
44
47
  */
45
- get hasActiveProcess(): boolean;
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 userID. The definition of such data is up to your server implementation and requirements.
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
- * Start onboarding activation with user credentials.
85
- *
86
- * For example, when you require email, your object would look like this:
87
- * ```
88
- * {
89
- * email: "<user_email>"
90
- * }
91
- * ```
92
- * @param credentials Object with credentials. Which credentials are needed should be provided by a system/backend provider.
93
- * @param processType The process type identification. If not specified, the default process type will be used.
94
- */
95
- start(credentials: any, processType?: string): Promise<void>;
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 `activate()`
111
- // at this moment, the `hasActiveProcess` starts return true
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 hardcoded.
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
 
@@ -126,11 +128,11 @@ Use the `activate` function to create the activation.
126
128
  /**
127
129
  * Activate the PowerAuth instance that was passed in the initializer.
128
130
  *
129
- * @param activationName Name of the activation. Device name by default (usually something like John's iPhone or similar).
131
+ * @param activationName Name of the activation. Usually something like John's iPhone or similar.
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:
@@ -148,9 +150,9 @@ class MyUserService {
148
150
  // the PIN keyboard to finish the PowerAuthSDK initialization.
149
151
  // For more information, follow the PowerAuthSDK documentation.
150
152
  } catch (error) {
151
- if (allowOnboardingOtpRetry(error)) {
153
+ if (error instanceof WDOError && error.allowOnboardingOtpRetry) {
152
154
  // User entered the wrong OTP, prompt for a new one.
153
- // Remaining OTP attempts count: onboardingOtpRemainingAttempts(error)
155
+ // Remaining OTP attempts count: error.onboardingOtpRemainingAttempts
154
156
  } else {
155
157
  // show error UI
156
158
  }
@@ -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
- - [Verifying User With Document Scan And Genuine Presence Check](Verifying-User.md)
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 procesType = "onboarding" // defined on your server
24
- const config = await configurationService.getConfiguration(procesType)
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
- requiredDocumentsCount: number;
43
- /** List of documents */
44
- items: Array<WDOConfigurationDocument>;
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