@onfido/api 3.4.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 +7 -5
- package/dist/api.js +1 -1
- package/dist/configuration.js +1 -1
- package/dist/esm/api.js +1 -1
- package/dist/esm/configuration.js +1 -1
- package/package.json +2 -2
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
|
|
135
|
+
File downloads, for example `onfido.downloadDocument(documentId)`, will return an instance of a `FileTransfer` object.
|
|
136
136
|
|
|
137
|
-
|
|
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 `
|
|
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
|
-
|
|
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
|
-
|
|
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.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',
|
|
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);
|
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/3.
|
|
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.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',
|
|
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.
|
|
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
|
+
"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.
|
|
48
|
+
"axios": "^1.7.4"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@faker-js/faker": "^8.4.1",
|