@onfido/api 4.5.0 → 4.6.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/README.md +22 -13
- package/dist/api.d.ts +7 -0
- package/dist/api.js +1 -0
- package/dist/configuration.js +1 -1
- package/dist/esm/api.d.ts +7 -0
- package/dist/esm/api.js +1 -0
- package/dist/esm/configuration.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,9 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
The official Node.js library for integrating with the Onfido API.
|
|
4
4
|
|
|
5
|
-
Documentation
|
|
5
|
+
Documentation is available at <https://documentation.onfido.com>.
|
|
6
6
|
|
|
7
|
-
This library is
|
|
7
|
+
This library is for backend use only, as it requires secret Onfido API tokens and should not be used in the frontend due to security reasons.
|
|
8
|
+
|
|
9
|
+
If you need to collect applicant data in the frontend of your application, we recommend that you use the Onfido SDKs:
|
|
10
|
+
|
|
11
|
+
- [iOS](https://github.com/onfido/onfido-ios-sdk)
|
|
12
|
+
- [Android](https://github.com/onfido/onfido-android-sdk)
|
|
13
|
+
- [Web](https://github.com/onfido/onfido-sdk-ui)
|
|
14
|
+
- [React Native](https://github.com/onfido/react-native-sdk)
|
|
8
15
|
|
|
9
16
|
This version uses Onfido API v3.6. Refer to our [API versioning guide](https://developers.onfido.com/guide/api-versioning-policy#client-libraries) for details of which client library versions use which versions of the API.
|
|
10
17
|
|
|
@@ -58,7 +65,7 @@ Configure with your API token and region:
|
|
|
58
65
|
const onfido = new DefaultApi(
|
|
59
66
|
new Configuration({
|
|
60
67
|
apiToken: process.env.ONFIDO_API_TOKEN,
|
|
61
|
-
region: Region.EU, // Supports Region.EU, Region.US and Region.CA
|
|
68
|
+
region: Region.EU, // Supports Region.EU (Europe), Region.US (United States), and Region.CA (Canada)
|
|
62
69
|
baseOptions: { timeout: 60_000 } // Additional Axios options (timeout, etc.)
|
|
63
70
|
})
|
|
64
71
|
);
|
|
@@ -162,7 +169,7 @@ onfido.uploadDocument(
|
|
|
162
169
|
|
|
163
170
|
### Webhook event verification
|
|
164
171
|
|
|
165
|
-
Webhook events payload needs to be verified before it can be accessed.
|
|
172
|
+
Webhook events payload needs to be verified before it can be accessed. Verifying webhook payloads is crucial for security reasons, as it ensures that the payloads are indeed from Onfido and have not been tampered with. The library allows you to easily decode the payload and verify its signature before returning it as an object for user convenience:
|
|
166
173
|
|
|
167
174
|
```js
|
|
168
175
|
(async () => {
|
|
@@ -184,41 +191,43 @@ Webhook events payload needs to be verified before it can be accessed. Library a
|
|
|
184
191
|
|
|
185
192
|
#### Do not use square bracket syntax
|
|
186
193
|
|
|
187
|
-
Except for accessing Task object's outputs,
|
|
194
|
+
Except for accessing Task object's outputs, avoid using the square bracket syntax (i.e. `[]`) to access undefined properties to prevent breaking changes when these fields appear.
|
|
188
195
|
|
|
189
196
|
## Contributing
|
|
190
197
|
|
|
191
|
-
This library is automatically generated using [OpenAPI Generator](https://openapi-generator.tech) (version: 7.9.0); therefore all
|
|
198
|
+
This library is automatically generated using [OpenAPI Generator](https://openapi-generator.tech) (version: 7.9.0); therefore, all contributions (except test files) should target the [Onfido OpenAPI specification repository](https://github.com/onfido/onfido-openapi-spec/tree/master) instead of this repository. Please follow the contribution guidelines provided in the OpenAPI specification repository.
|
|
192
199
|
|
|
193
200
|
For contributions to the tests instead, please follow the steps below:
|
|
194
201
|
|
|
195
|
-
1. [
|
|
202
|
+
1. Fork the [repository](https://github.com/onfido/onfido-node/fork)
|
|
196
203
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
197
204
|
3. Make your changes
|
|
198
|
-
4. Commit your changes (`git commit -am 'Add
|
|
205
|
+
4. Commit your changes (`git commit -am 'Add detailed description of the feature'`)
|
|
199
206
|
5. Push to the branch (`git push origin my-new-feature`)
|
|
200
207
|
6. Create a new Pull Request
|
|
201
208
|
|
|
202
209
|
## Versioning policy
|
|
203
210
|
|
|
204
|
-
|
|
211
|
+
Versioning helps manage changes and ensures compatibility across different versions of the library.
|
|
212
|
+
|
|
213
|
+
[Semantic Versioning](https://semver.org) policy is used for library versioning, following the guidelines and limitations outlined below:
|
|
205
214
|
|
|
206
|
-
- MAJOR versions (x.0.0)
|
|
215
|
+
- MAJOR versions (x.0.0) may:
|
|
207
216
|
- target a new API version
|
|
208
217
|
- include non-backward compatible change
|
|
209
|
-
- MINOR versions (0.x.0)
|
|
218
|
+
- MINOR versions (0.x.0) may:
|
|
210
219
|
- add a new functionality, non-mandatory parameter or property
|
|
211
220
|
- deprecate an old functionality
|
|
212
221
|
- include non-backward compatible change to a functionality which is:
|
|
213
222
|
- labelled as alpha or beta
|
|
214
223
|
- completely broken and not usable
|
|
215
|
-
- PATCH version (0.0.x)
|
|
224
|
+
- PATCH version (0.0.x) will:
|
|
216
225
|
- fix a bug
|
|
217
226
|
- include backward compatible changes only
|
|
218
227
|
|
|
219
228
|
## More documentation
|
|
220
229
|
|
|
221
|
-
|
|
230
|
+
Additional documentation and code examples can be found at <https://documentation.onfido.com>.
|
|
222
231
|
|
|
223
232
|
## Support
|
|
224
233
|
|
package/dist/api.d.ts
CHANGED
|
@@ -6081,6 +6081,7 @@ export declare const IdNumberTypeEnum: {
|
|
|
6081
6081
|
readonly SocialInsurance: "social_insurance";
|
|
6082
6082
|
readonly TaxId: "tax_id";
|
|
6083
6083
|
readonly IdentityCard: "identity_card";
|
|
6084
|
+
readonly DrivingLicense: "driving_license";
|
|
6084
6085
|
readonly DrivingLicence: "driving_licence";
|
|
6085
6086
|
readonly ShareCode: "share_code";
|
|
6086
6087
|
readonly VoterId: "voter_id";
|
|
@@ -10112,6 +10113,12 @@ export interface WebhookEventPayloadResource {
|
|
|
10112
10113
|
* @memberof WebhookEventPayloadResource
|
|
10113
10114
|
*/
|
|
10114
10115
|
'error'?: WorkflowRunError;
|
|
10116
|
+
/**
|
|
10117
|
+
* Customer-provided user identifier.
|
|
10118
|
+
* @type {string}
|
|
10119
|
+
* @memberof WebhookEventPayloadResource
|
|
10120
|
+
*/
|
|
10121
|
+
'customer_user_id'?: string;
|
|
10115
10122
|
}
|
|
10116
10123
|
/**
|
|
10117
10124
|
*
|
package/dist/api.js
CHANGED
|
@@ -544,6 +544,7 @@ exports.IdNumberTypeEnum = {
|
|
|
544
544
|
SocialInsurance: 'social_insurance',
|
|
545
545
|
TaxId: 'tax_id',
|
|
546
546
|
IdentityCard: 'identity_card',
|
|
547
|
+
DrivingLicense: 'driving_license',
|
|
547
548
|
DrivingLicence: 'driving_licence',
|
|
548
549
|
ShareCode: 'share_code',
|
|
549
550
|
VoterId: 'voter_id',
|
package/dist/configuration.js
CHANGED
|
@@ -32,7 +32,7 @@ class Configuration {
|
|
|
32
32
|
}
|
|
33
33
|
this.apiKey = 'Token token=' + param.apiToken;
|
|
34
34
|
this.basePath = param.basePath || base_1.BASE_PATH.replace('.eu.', `.${Region[param.region || Region.EU].toLowerCase()}.`);
|
|
35
|
-
this.baseOptions = Object.assign(Object.assign({ timeout: 30000 }, param.baseOptions), { headers: Object.assign(Object.assign({}, (_a = param.baseOptions) === null || _a === void 0 ? void 0 : _a.headers), { 'User-Agent': 'onfido-node/4.
|
|
35
|
+
this.baseOptions = Object.assign(Object.assign({ timeout: 30000 }, param.baseOptions), { headers: Object.assign(Object.assign({}, (_a = param.baseOptions) === null || _a === void 0 ? void 0 : _a.headers), { 'User-Agent': 'onfido-node/4.6.0' }) });
|
|
36
36
|
this.formDataCtor = param.formDataCtor || require('form-data'); // Injiect form data constructor (if needed)
|
|
37
37
|
}
|
|
38
38
|
/**
|
package/dist/esm/api.d.ts
CHANGED
|
@@ -6081,6 +6081,7 @@ export declare const IdNumberTypeEnum: {
|
|
|
6081
6081
|
readonly SocialInsurance: "social_insurance";
|
|
6082
6082
|
readonly TaxId: "tax_id";
|
|
6083
6083
|
readonly IdentityCard: "identity_card";
|
|
6084
|
+
readonly DrivingLicense: "driving_license";
|
|
6084
6085
|
readonly DrivingLicence: "driving_licence";
|
|
6085
6086
|
readonly ShareCode: "share_code";
|
|
6086
6087
|
readonly VoterId: "voter_id";
|
|
@@ -10112,6 +10113,12 @@ export interface WebhookEventPayloadResource {
|
|
|
10112
10113
|
* @memberof WebhookEventPayloadResource
|
|
10113
10114
|
*/
|
|
10114
10115
|
'error'?: WorkflowRunError;
|
|
10116
|
+
/**
|
|
10117
|
+
* Customer-provided user identifier.
|
|
10118
|
+
* @type {string}
|
|
10119
|
+
* @memberof WebhookEventPayloadResource
|
|
10120
|
+
*/
|
|
10121
|
+
'customer_user_id'?: string;
|
|
10115
10122
|
}
|
|
10116
10123
|
/**
|
|
10117
10124
|
*
|
package/dist/esm/api.js
CHANGED
|
@@ -540,6 +540,7 @@ export const IdNumberTypeEnum = {
|
|
|
540
540
|
SocialInsurance: 'social_insurance',
|
|
541
541
|
TaxId: 'tax_id',
|
|
542
542
|
IdentityCard: 'identity_card',
|
|
543
|
+
DrivingLicense: 'driving_license',
|
|
543
544
|
DrivingLicence: 'driving_licence',
|
|
544
545
|
ShareCode: 'share_code',
|
|
545
546
|
VoterId: 'voter_id',
|
|
@@ -29,7 +29,7 @@ export class Configuration {
|
|
|
29
29
|
}
|
|
30
30
|
this.apiKey = 'Token token=' + param.apiToken;
|
|
31
31
|
this.basePath = param.basePath || BASE_PATH.replace('.eu.', `.${Region[param.region || Region.EU].toLowerCase()}.`);
|
|
32
|
-
this.baseOptions = Object.assign(Object.assign({ timeout: 30000 }, param.baseOptions), { headers: Object.assign(Object.assign({}, (_a = param.baseOptions) === null || _a === void 0 ? void 0 : _a.headers), { 'User-Agent': 'onfido-node/4.
|
|
32
|
+
this.baseOptions = Object.assign(Object.assign({ timeout: 30000 }, param.baseOptions), { headers: Object.assign(Object.assign({}, (_a = param.baseOptions) === null || _a === void 0 ? void 0 : _a.headers), { 'User-Agent': 'onfido-node/4.6.0' }) });
|
|
33
33
|
this.formDataCtor = param.formDataCtor || require('form-data'); // Injiect form data constructor (if needed)
|
|
34
34
|
}
|
|
35
35
|
/**
|