Skip to content

Commit 30e47cb

Browse files
authored
Initial codebase (#10)
1 parent b0eade6 commit 30e47cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+11557
-200
lines changed

.github/actions/setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ runs:
2525
run: corepack enable
2626
- name: Install dependencies
2727
if: steps.yarn-cache.outputs.cache-hit != 'true'
28-
run: yarn install --immutable
28+
run: yarn install
2929
shell: bash

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,7 @@ packages/lib-cordova/lib/
7070
packages/lib-cordova/native_shared
7171

7272
# lib artifacts
73-
*.tgz
73+
*.tgz
74+
75+
# Cordova test app
76+
testapp-cordova/www/js

.prepare-release.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"metadata": {
3+
"purpose": "This file is used as a definition file for the prepare-release script.",
4+
"info": "It defines files that contains version number that should be updated during the release preparation.",
5+
"customBuildscript": "If needed, in the library object, set \"buildscript\": \"your-custom-build-command\" command if your build command is different than 'npm i && npm run build'"
6+
},
7+
"library": {
8+
"name": "digital-onboarding-js",
9+
"type": "yarn",
10+
"artifacts": [
11+
"packages/lib-cordova/digital-onboarding-js.tgz"
12+
],
13+
"buildscript": "corepack enable && yarn install && yarn packCordova"
14+
},
15+
"files": [
16+
{
17+
"description": "Cordova package definition file.",
18+
"path": "packages/lib-cordova/package.json",
19+
"type": "version_replace",
20+
"match": "\"version\": \"%VERSION%\",\n"
21+
},
22+
{
23+
"description": "Cordova plugin.xml file.",
24+
"path": "packages/lib-cordova/plugin.xml",
25+
"type": "version_replace",
26+
"match": "id=\"cordova-digital-onboarding\" version=\"%VERSION%\""
27+
}
28+
]
29+
}

README.md

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,62 @@
1-
# digital-onboarding-js
2-
Wultra Digital Onboarding for JS mobile platforms (Cordova and React Native)
1+
# Wultra Digital Onboarding for mobile JS Platforms
2+
3+
<!-- begin remove -->
4+
<p align="center"><img src="docs/images/intro.jpg" alt="Wultra Digital Onboarding for mobile JS Platforms" width="100%" /></p>
5+
<!-- end -->
6+
7+
<!-- begin box info -->
8+
The Wultra Digital Onboarding SDK functions as an extension of [Wultra Mobile Authentication (PowerAuth)](https://wultra.com/powerauth) that is required.
9+
<!-- end -->
10+
11+
## Introduction
12+
13+
Elevate your standard device activation, user login, and request signing scenarios by incorporating facial recognition and document scanning in diverse situations:
14+
15+
- Reclaim access or recover lost credentials through authenticating the user's genuine presence and verifying document validity.
16+
- Reinforce conventional password or PIN-based authentication with an extra layer of security through face recognition.
17+
- Seamlessly onboard new customers into your systems, authenticating them with identification cards and facial scans for access to your app.
18+
19+
### Other resources
20+
21+
We also provide an [Android](https://github.com/wultra/digital-onboarding-android) and [iOS](https://github.com/wultra/digital-onboarding-apple) versions of this library.
22+
23+
## What will you need before the implementation
24+
25+
<!-- begin box info -->
26+
The Wultra Digital Onboarding SDK functions as an extension of Wultra Mobile Authentication that is required.
27+
<!-- end -->
28+
29+
Before initiating the integration, it's essential to ensure that your server environment is prepared with appropriately configured services capable of managing user verification and onboarding, seamlessly connecting to your systems.
30+
31+
Given the unique characteristics of each customer system, the utilization of this SDK may vary. To accurately outline the user verification process, we recommend consulting with our technical team for tailored guidance.
32+
33+
## Document OCR and face verification
34+
35+
We seamlessly incorporate industry-leading solutions for document scanning, ensuring versatility and effectiveness in your operations.
36+
37+
- iProov for genuine presence
38+
- Innovatrics for document scanning and genuine presence
39+
- ZenID for document scanning
40+
- BlinkID for document scanning
41+
42+
Our dedicated technical and sales representatives are available to guide you in selecting the optimal solution that aligns perfectly with your needs.
43+
44+
## Documentation
45+
46+
<!-- begin box warning -->
47+
Please be aware that the scenarios outlined in the documentation are illustrative examples. Your user flow and implementation may vary based on your specific requirements and circumstances.
48+
<!-- end -->
49+
50+
The documentation is available at the [Wultra Developer Portal](https://developers.wultra.com/components/digital-onboarding-js) or inside the [docs folder](docs).
51+
52+
## License
53+
54+
All sources are licensed using the Apache 2.0 license.
55+
56+
## Contact
57+
58+
If you need any assistance, do not hesitate to drop us a line at [hello@wultra.com](mailto:hello@wultra.com) or our official [wultra.com/discord](https://wultra.com/discord) channel.
59+
60+
### Security Disclosure
61+
62+
If you believe you have identified a security vulnerability with Wultra Digital Onboarding, you should report it as soon as possible via email to [support@wultra.com](mailto:support@wultra.com). Please do not post it to a public issue tracker.

docs/Changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## 1.0.0 (Nov, 2025)
4+
5+
Initial release.

docs/Device-Activation.md

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# Device Activation
2+
3+
With `WDOActivationService` you can onboard PowerAuth with just a piece of user information like his email, phone number, or login name.
4+
5+
PowerAuth enrolled in such a way will need [further user verification](Verifying-User.md) until fully operational (able to sign operations).
6+
7+
## Example app flow
8+
9+
<p align="center"><img src="images/activation-mockup.png" alt="Example application flow for the activation" width="100%" /></p>
10+
11+
## Creating an instance
12+
13+
To create an instance you will need a `PowerAuth` instance that is __ready to be activated__.
14+
15+
<!-- begin box info -->
16+
[Documentation for `PowerAuth Mobile JS SDK`](https://developers.wultra.com/components/react-native-powerauth-mobile-sdk/).
17+
<!-- end -->
18+
19+
20+
Example with `PowerAuth` instance:
21+
22+
```typescript
23+
const powerAuth = new PowerAuth("my-pa-instance")
24+
powerAuth.configure({
25+
configuration: "ARCB+...jg==", // base64 PowerAuth configuration
26+
baseEndpointUrl: "https://my-server-deployment.com/enrollment-server/"
27+
})
28+
const activationService = new WDOActivationService(
29+
powerAuth,
30+
"https://my-server-deployment.com/enrollment-server-onboarding/"
31+
)
32+
```
33+
34+
## Retrieving the status
35+
36+
To figure out if the activation process was already started and what is the status, you can use `hasActiveProcess`.
37+
38+
```typescript
39+
/**
40+
* If the activation process is in progress.
41+
*
42+
* 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.
44+
*/
45+
get hasActiveProcess(): boolean;
46+
```
47+
48+
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.
49+
50+
```typescript
51+
/**
52+
* Retrieves status of the onboarding activation.
53+
*
54+
* @return Promise resolved with onboarding status.
55+
*/
56+
status(): Promise<WDOOnboardingStatus>;
57+
```
58+
59+
`WDOOnboardingStatus` possible values.
60+
61+
```typescript
62+
declare enum WDOOnboardingStatus {
63+
/** Activation part of the process is in progress */
64+
activationInProgress = "ACTIVATION_IN_PROGRESS",
65+
/** Verification part of the process is in progress */
66+
verificationInProgress = "VERIFICATION_IN_PROGRESS",
67+
/** Onboarding process has failed */
68+
failed = "FAILED",
69+
/** Onboarding process is completed */
70+
finished = "FINISHED"
71+
}
72+
```
73+
74+
## Starting the process
75+
76+
To start the activation process, you can use any credentials that are sufficient to you that can identify the user.
77+
78+
Often, such data are user email, phone number, or userID. The definition of such data is up to your server implementation and requirements.
79+
80+
To start the activation, use the `start` function.
81+
82+
```typescript
83+
/**
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>;
96+
```
97+
98+
### Example
99+
100+
```typescript
101+
102+
class MyUserService {
103+
// prepared service
104+
private activationService: WDOActivationService
105+
106+
async startActivation(id: string) {
107+
const data = { userId: id}
108+
try {
109+
await this.activationService.start(data)
110+
// success, continue with `activate()`
111+
// at this moment, the `hasActiveProcess` starts return true
112+
} catch (error) {
113+
// show error to the user
114+
}
115+
}
116+
}
117+
```
118+
119+
## Creating the activation
120+
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.
122+
123+
Use the `activate` function to create the activation.
124+
125+
```typescript
126+
/**
127+
* Activate the PowerAuth instance that was passed in the initializer.
128+
*
129+
* @param activationName Name of the activation. Device name by default (usually something like John's iPhone or similar).
130+
* @param otp OTP code received by the user (via SMS or email). Optional when not required.
131+
* @return Promise resolved with activation result.
132+
*/
133+
activate(activationName: string, otp?: string): Promise<WDOPowerAuthActivationResult>;
134+
```
135+
136+
Example implementation:
137+
138+
```typescript
139+
class MyUserService {
140+
// prepared service
141+
private activationService: WDOActivationService
142+
143+
async activate(smsOTP?: string) {
144+
try {
145+
const activationResult = await activationService.activate("my-test-activation", smsOTP)
146+
// PowerAuthSDK instance was activated.
147+
// At this moment, navigate the user to
148+
// the PIN keyboard to finish the PowerAuthSDK initialization.
149+
// For more information, follow the PowerAuthSDK documentation.
150+
} catch (error) {
151+
if (allowOnboardingOtpRetry(error)) {
152+
// User entered the wrong OTP, prompt for a new one.
153+
// Remaining OTP attempts count: onboardingOtpRemainingAttempts(error)
154+
} else {
155+
// show error UI
156+
}
157+
}
158+
}
159+
}
160+
```
161+
162+
## Canceling the process
163+
164+
To cancel the process, just call the `cancel` function.
165+
166+
```typescript
167+
/**
168+
* Cancel the activation process (issues a cancel request to the backend and clears the local process ID).
169+
*
170+
* @param forceCancel When true, the process will be canceled in the SDK even when fails on backend. `true` by default.
171+
*/
172+
cancel(forceCancel?: boolean): Promise<void>;
173+
```
174+
175+
## OTP resend
176+
177+
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+
181+
For such cases, use `resendOTP` function.
182+
183+
```typescript
184+
/**
185+
* OTP resend request.
186+
*
187+
* This is intended to be displayed for the user to use in case of the OTP is not received.
188+
* For example, when the user does not receive SMS after some time, there should be a button to "send again".
189+
*/
190+
resendOTP(): Promise<void>;
191+
```
192+
193+
## Read next
194+
- [Verifying User With Document Scan And Genuine Presence Check](Verifying-User.md)

docs/Language-Configuration.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Language Configuration
2+
3+
The language of content that might be localized can be configured via `changeAcceptLanguage` method on both `WDOActivationService` and `WDOVerificationService`.
4+
5+
The default language is `en`. Availability of languages depends on server configuration and implementation.
6+
7+
<!-- begin box info -->
8+
The language configuration is a wrap-around of the underlying networking language configuration described in [our networking library documentation](https://github.com/wultra/networking-js).
9+
<!-- end -->
10+
11+
## Read next
12+
13+
- [Logging](Logging.md)

docs/Logging.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Logging
2+
3+
You can set up logging for the library using the `WDOLogger` class.
4+
5+
<!-- begin box info -->
6+
Networking traffic is logged in its own logger described in the [networking library documentation](https://github.com/wultra/networking-js).
7+
<!-- end -->
8+
9+
### Verbosity Level
10+
11+
You can limit the amount of logged information via the `verboseLevel` property.
12+
13+
| Level | Description |
14+
| ---------------------- | ------------------------------------------------- |
15+
| `NONE` | Silences all messages. |
16+
| `ERROR` _(default)_ | Only errors will be logged. |
17+
| `WARNING` | Errors and warnings will be logged. |
18+
| `INFO` | Error, warning and info messages will be logged. |
19+
| `DEBUG` | All messages will be logged. |
20+
### Logger Delegate
21+
22+
In case you want to process logs on your own (for example log into a file or some cloud service), you can set `WDOLogger.listener`.

0 commit comments

Comments
 (0)