@onfido/api 3.0.0 → 3.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/README.md CHANGED
@@ -8,6 +8,9 @@ This library is only for use on the backend, as it uses Onfido API tokens which
8
8
 
9
9
  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
10
 
11
+ [![npm version](https://badge.fury.io/js/@onfido%2Fapi.svg)](https://badge.fury.io/js/@onfido%2Fapi)
12
+ ![Build Status](https://github.com/onfido/onfido-node/actions/workflows/node.yml/badge.svg)
13
+
11
14
  ## Installation & Usage
12
15
 
13
16
  ### Installation
@@ -32,7 +35,7 @@ Require the package:
32
35
  const {
33
36
  DefaultApi,
34
37
  Configuration,
35
- WebhookEventVerifier,
38
+ WebhookEventVerifier
36
39
  } = require("@onfido/api");
37
40
  const { isAxiosError } = require("axios");
38
41
  ```
@@ -44,7 +47,7 @@ import {
44
47
  DefaultApi,
45
48
  Configuration,
46
49
  Region,
47
- WebhookEventVerifier,
50
+ WebhookEventVerifier
48
51
  } from "@onfido/api";
49
52
  import { isAxiosError } from "axios";
50
53
  ```
@@ -56,8 +59,8 @@ const onfido = new DefaultApi(
56
59
  new Configuration({
57
60
  apiToken: process.env.ONFIDO_API_TOKEN,
58
61
  region: Region.EU, // Supports Region.EU, Region.US and Region.CA
59
- baseOptions: { timeout: 60_000 }, // Additional Axios options (timeout, etc.)
60
- }),
62
+ baseOptions: { timeout: 60_000 } // Additional Axios options (timeout, etc.)
63
+ })
61
64
  );
62
65
  ```
63
66
 
@@ -75,8 +78,8 @@ Using `async`/`await` (in an `async function`):
75
78
  last_name: "Doe",
76
79
  location: {
77
80
  ip_address: "127.0.0.1",
78
- country_of_residence: "GBR",
79
- },
81
+ country_of_residence: "GBR"
82
+ }
80
83
  });
81
84
 
82
85
  // ...
@@ -151,7 +154,7 @@ For some common types of streams, like instances of `fs.ReadStream`, you can pro
151
154
  onfido.uploadDocument(
152
155
  "passport",
153
156
  "<APPLICANT_ID>",
154
- fs.createReadStream("path/to/passport.png"),
157
+ fs.createReadStream("path/to/passport.png")
155
158
  );
156
159
  ```
157
160
 
@@ -162,7 +165,8 @@ Webhook events payload needs to be verified before it can be accessed. Library a
162
165
  ```js
163
166
  (async () => {
164
167
  try {
165
- const verifier = new WebhookEventVerifier("_ABC123abc...3ABC123_");
168
+ const token = process.env.ONFIDO_WEBHOOK_SECRET_TOKEN;
169
+ const verifier = new WebhookEventVerifier(token);
166
170
  const signature = "a0...760e";
167
171
 
168
172
  const event = verifier.readPayload(`{"payload":{"r...3"}}`, signature);
@@ -174,24 +178,46 @@ Webhook events payload needs to be verified before it can be accessed. Library a
174
178
  })();
175
179
  ```
176
180
 
181
+ ### Recommendations
182
+
183
+ #### Do not use square bracket syntax
184
+
185
+ Except for accessing Task object's outputs, retain from using the square bracket syntax (i.e. `[]`) to access not defined properties to avoid breaking changes when these fields will appear.
186
+
177
187
  ## Contributing
178
188
 
179
- This library is automatically generated using [OpenAPI Generator](https://openapi-generator.tech) - version: 7.5.0; therefore all the contributions, except tests files, should target [Onfido OpenAPI specification repository](https://github.com/onfido/onfido-openapi-spec/tree/master) instead of this repository.
189
+ This library is automatically generated using [OpenAPI Generator](https://openapi-generator.tech) (version: 7.6.0); therefore all the contributions, except tests files, should target [Onfido OpenAPI specification repository](https://github.com/onfido/onfido-openapi-spec/tree/master) instead of this repository.
180
190
 
181
191
  For contributions to the tests instead, please follow the steps below:
182
192
 
183
- 1. [Fork](<https://github.com/onfido/onfido-node/fork>) repository
193
+ 1. [Fork](https://github.com/onfido/onfido-node/fork) repository
184
194
  2. Create your feature branch (`git checkout -b my-new-feature`)
185
195
  3. Make your changes
186
196
  4. Commit your changes (`git commit -am 'Add some feature'`)
187
197
  5. Push to the branch (`git push origin my-new-feature`)
188
198
  6. Create a new Pull Request
189
199
 
200
+ ## Versioning policy
201
+
202
+ [Semantic Versioning](https://semver.org) policy is used for library versioning, following guidelines and limitations below:
203
+
204
+ - MAJOR versions (x.0.0) might:
205
+ - target a new API version
206
+ - include non-backward compatible change
207
+ - MINOR versions (0.x.0) might:
208
+ - add a new functionality, non-mandatory parameter or property
209
+ - deprecate an old functionality
210
+ - include non-backward compatible change to a functionality which is:
211
+ - labelled as alpha or beta
212
+ - completely broken and not usable
213
+ - PATCH version (0.0.x) might:
214
+ - fix a bug
215
+ - include backward compatible changes only
216
+
190
217
  ## More documentation
191
218
 
192
219
  More documentation and code examples can be found at <https://documentation.onfido.com>.
193
220
 
194
221
  ## Support
195
222
 
196
- Should you encounter any technical issues during integration, please contact Onfido's Customer Support team
197
- via the [Customer Experience Portal](https://public.support.onfido.com/) which also includes support documentation.
223
+ Should you encounter any technical issues during integration, please contact Onfido's Customer Support team via the [Customer Experience Portal](https://public.support.onfido.com/) which also includes support documentation.