@onfido/api 3.3.0 → 3.5.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
@@ -132,15 +132,15 @@ onfido
132
132
 
133
133
  ### File download
134
134
 
135
- File downloads, for example `onfido.downloadDocument(documentId, {responseType: 'arraybuffer'})`, will return an instance of a specific object for this endpoint.
135
+ File downloads, for example `onfido.downloadDocument(documentId)`, will return an instance of a `FileTransfer` object.
136
136
 
137
- These objects will have a content type, e.g. `image/png`.
137
+ This object will have a content type, e.g. `image/png`.
138
138
 
139
139
  ```js
140
140
  download.headers["content-type"];
141
141
  ```
142
142
 
143
- Call `slice()` to get a `Blob` of the download:
143
+ Call `slice()` to get a `Buffer` of the download:
144
144
 
145
145
  ```js
146
146
  const blob = download.data.slice();
@@ -148,16 +148,18 @@ const blob = download.data.slice();
148
148
 
149
149
  ### File upload
150
150
 
151
- For some common types of streams, like instances of `fs.ReadStream`, you can provide the stream directly:
151
+ File upload should make use of the provided `FileTransfer` class, e.g.:
152
152
 
153
153
  ```js
154
154
  onfido.uploadDocument(
155
155
  "passport",
156
156
  "<APPLICANT_ID>",
157
- fs.createReadStream("path/to/passport.png")
157
+ new FileTransfer(Buffer.from(document.buffer), document.filename)
158
158
  );
159
159
  ```
160
160
 
161
+ `FileTransfer` object can also be created from an existing file, e.g. `new FileTransfer("path/to/passport.png")`.
162
+
161
163
  ### Webhook event verification
162
164
 
163
165
  Webhook events payload needs to be verified before it can be accessed. Library allows to easily decode the payload and verify its signature before returning it as an object for user convenience:
package/dist/api.d.ts CHANGED
@@ -9738,6 +9738,12 @@ export interface WorkflowRun {
9738
9738
  * @memberof WorkflowRun
9739
9739
  */
9740
9740
  'tags'?: Array<string> | null;
9741
+ /**
9742
+ * Customer-provided user identifier.
9743
+ * @type {string}
9744
+ * @memberof WorkflowRun
9745
+ */
9746
+ 'customer_user_id'?: string;
9741
9747
  /**
9742
9748
  *
9743
9749
  * @type {WorkflowRunSharedLink}
@@ -9798,6 +9804,12 @@ export interface WorkflowRun {
9798
9804
  * @memberof WorkflowRun
9799
9805
  */
9800
9806
  'error'?: WorkflowRunResponseError;
9807
+ /**
9808
+ * Client token to use when loading this workflow run in the Onfido SDK.
9809
+ * @type {string}
9810
+ * @memberof WorkflowRun
9811
+ */
9812
+ 'sdk_token'?: string | null;
9801
9813
  }
9802
9814
  export declare const WorkflowRunStatusEnum: {
9803
9815
  readonly AwaitingInput: "awaiting_input";
@@ -9834,6 +9846,12 @@ export interface WorkflowRunBuilder {
9834
9846
  * @memberof WorkflowRunBuilder
9835
9847
  */
9836
9848
  'tags'?: Array<string> | null;
9849
+ /**
9850
+ * Customer-provided user identifier.
9851
+ * @type {string}
9852
+ * @memberof WorkflowRunBuilder
9853
+ */
9854
+ 'customer_user_id'?: string;
9837
9855
  /**
9838
9856
  *
9839
9857
  * @type {WorkflowRunSharedLink}
@@ -9924,6 +9942,12 @@ export interface WorkflowRunResponse {
9924
9942
  * @memberof WorkflowRunResponse
9925
9943
  */
9926
9944
  'error'?: WorkflowRunResponseError;
9945
+ /**
9946
+ * Client token to use when loading this workflow run in the Onfido SDK.
9947
+ * @type {string}
9948
+ * @memberof WorkflowRunResponse
9949
+ */
9950
+ 'sdk_token'?: string | null;
9927
9951
  }
9928
9952
  export declare const WorkflowRunResponseStatusEnum: {
9929
9953
  readonly AwaitingInput: "awaiting_input";
@@ -9979,6 +10003,12 @@ export interface WorkflowRunShared {
9979
10003
  * @memberof WorkflowRunShared
9980
10004
  */
9981
10005
  'tags'?: Array<string> | null;
10006
+ /**
10007
+ * Customer-provided user identifier.
10008
+ * @type {string}
10009
+ * @memberof WorkflowRunShared
10010
+ */
10011
+ 'customer_user_id'?: string;
9982
10012
  /**
9983
10013
  *
9984
10014
  * @type {WorkflowRunSharedLink}
package/dist/api.js CHANGED
@@ -2789,7 +2789,7 @@ const DefaultApiAxiosParamCreator = function (configuration) {
2789
2789
  localVarFormParams.append('validate_image_quality', String(validateImageQuality));
2790
2790
  }
2791
2791
  if (location !== undefined) {
2792
- localVarFormParams.append('location', new Blob([JSON.stringify(location)], { type: "application/json", }));
2792
+ localVarFormParams.append('location', JSON.stringify(location));
2793
2793
  }
2794
2794
  localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
2795
2795
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
@@ -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/3.3.0' }) });
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/3.5.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
@@ -9738,6 +9738,12 @@ export interface WorkflowRun {
9738
9738
  * @memberof WorkflowRun
9739
9739
  */
9740
9740
  'tags'?: Array<string> | null;
9741
+ /**
9742
+ * Customer-provided user identifier.
9743
+ * @type {string}
9744
+ * @memberof WorkflowRun
9745
+ */
9746
+ 'customer_user_id'?: string;
9741
9747
  /**
9742
9748
  *
9743
9749
  * @type {WorkflowRunSharedLink}
@@ -9798,6 +9804,12 @@ export interface WorkflowRun {
9798
9804
  * @memberof WorkflowRun
9799
9805
  */
9800
9806
  'error'?: WorkflowRunResponseError;
9807
+ /**
9808
+ * Client token to use when loading this workflow run in the Onfido SDK.
9809
+ * @type {string}
9810
+ * @memberof WorkflowRun
9811
+ */
9812
+ 'sdk_token'?: string | null;
9801
9813
  }
9802
9814
  export declare const WorkflowRunStatusEnum: {
9803
9815
  readonly AwaitingInput: "awaiting_input";
@@ -9834,6 +9846,12 @@ export interface WorkflowRunBuilder {
9834
9846
  * @memberof WorkflowRunBuilder
9835
9847
  */
9836
9848
  'tags'?: Array<string> | null;
9849
+ /**
9850
+ * Customer-provided user identifier.
9851
+ * @type {string}
9852
+ * @memberof WorkflowRunBuilder
9853
+ */
9854
+ 'customer_user_id'?: string;
9837
9855
  /**
9838
9856
  *
9839
9857
  * @type {WorkflowRunSharedLink}
@@ -9924,6 +9942,12 @@ export interface WorkflowRunResponse {
9924
9942
  * @memberof WorkflowRunResponse
9925
9943
  */
9926
9944
  'error'?: WorkflowRunResponseError;
9945
+ /**
9946
+ * Client token to use when loading this workflow run in the Onfido SDK.
9947
+ * @type {string}
9948
+ * @memberof WorkflowRunResponse
9949
+ */
9950
+ 'sdk_token'?: string | null;
9927
9951
  }
9928
9952
  export declare const WorkflowRunResponseStatusEnum: {
9929
9953
  readonly AwaitingInput: "awaiting_input";
@@ -9979,6 +10003,12 @@ export interface WorkflowRunShared {
9979
10003
  * @memberof WorkflowRunShared
9980
10004
  */
9981
10005
  'tags'?: Array<string> | null;
10006
+ /**
10007
+ * Customer-provided user identifier.
10008
+ * @type {string}
10009
+ * @memberof WorkflowRunShared
10010
+ */
10011
+ 'customer_user_id'?: string;
9982
10012
  /**
9983
10013
  *
9984
10014
  * @type {WorkflowRunSharedLink}
package/dist/esm/api.js CHANGED
@@ -2785,7 +2785,7 @@ export const DefaultApiAxiosParamCreator = function (configuration) {
2785
2785
  localVarFormParams.append('validate_image_quality', String(validateImageQuality));
2786
2786
  }
2787
2787
  if (location !== undefined) {
2788
- localVarFormParams.append('location', new Blob([JSON.stringify(location)], { type: "application/json", }));
2788
+ localVarFormParams.append('location', JSON.stringify(location));
2789
2789
  }
2790
2790
  localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
2791
2791
  setSearchParams(localVarUrlObj, localVarQueryParameter);
@@ -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/3.3.0' }) });
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/3.5.0' }) });
33
33
  this.formDataCtor = param.formDataCtor || require('form-data'); // Injiect form data constructor (if needed)
34
34
  }
35
35
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onfido/api",
3
- "version": "3.3.0",
3
+ "version": "3.5.0",
4
4
  "description": "Node.js library for the Onfido API",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "repository": {
@@ -45,7 +45,7 @@
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
- "axios": "^1.6.1"
48
+ "axios": "^1.7.4"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@faker-js/faker": "^8.4.1",