@onfido/api 2.5.0 → 2.7.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/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/dist/Onfido.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +24 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +24 -3
- package/dist/index.js.map +1 -1
- package/dist/resources/WorkflowRuns.d.ts +45 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v2.7.0, 24 January 2023
|
|
4
|
+
|
|
5
|
+
- Updated to use API v3.6. For more details please see our [release notes](https://developers.onfido.com/release-notes#api-v36)
|
|
6
|
+
|
|
7
|
+
## v2.6.0, 7 December 2022
|
|
8
|
+
|
|
9
|
+
- Added WorkflowRuns support
|
|
10
|
+
|
|
3
11
|
## v2.5.0, 22 November 2022
|
|
4
12
|
|
|
5
13
|
- Added Motion capture support
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Documentation can be found at <https://documentation.onfido.com>
|
|
|
6
6
|
|
|
7
7
|
This library is only for use on the backend, as it uses Onfido API tokens which must be kept secret. If you do need to collect applicant data in the frontend of your application, we recommend that you use the Onfido SDKs: [iOS](https://github.com/onfido/onfido-ios-sdk), [Android](https://github.com/onfido/onfido-android-sdk), [Web](https://github.com/onfido/onfido-sdk-ui), and [React Native](https://github.com/onfido/react-native-sdk).
|
|
8
8
|
|
|
9
|
-
This version uses Onfido API v3.
|
|
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
11
|
## Installation
|
|
12
12
|
|
package/dist/Onfido.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { MotionCaptures } from "./resources/MotionCaptures";
|
|
|
10
10
|
import { Reports } from "./resources/Reports";
|
|
11
11
|
import { SdkTokens } from "./resources/SdkTokens";
|
|
12
12
|
import { Webhooks } from "./resources/Webhooks";
|
|
13
|
+
import { WorkflowRuns } from "./resources/WorkflowRuns";
|
|
13
14
|
export declare enum Region {
|
|
14
15
|
EU = "EU",
|
|
15
16
|
US = "US",
|
|
@@ -30,6 +31,7 @@ export declare class Onfido {
|
|
|
30
31
|
readonly motionCapture: MotionCaptures;
|
|
31
32
|
readonly check: Checks;
|
|
32
33
|
readonly report: Reports;
|
|
34
|
+
readonly workflowRun: WorkflowRuns;
|
|
33
35
|
readonly address: Addresses;
|
|
34
36
|
readonly webhook: Webhooks;
|
|
35
37
|
readonly sdkToken: SdkTokens;
|
package/dist/index.d.ts
CHANGED
|
@@ -16,3 +16,4 @@ export { Report } from "./resources/Reports";
|
|
|
16
16
|
export { Webhook, WebhookRequest } from "./resources/Webhooks";
|
|
17
17
|
export { SdkTokenRequest } from "./resources/SdkTokens";
|
|
18
18
|
export { Autofill, ExtractionResult } from "./resources/Autofill";
|
|
19
|
+
export { WorkflowRun, WorkflowRunRequest } from "./resources/WorkflowRuns";
|
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import { PassThrough, Readable } from 'stream';
|
|
3
3
|
|
|
4
|
-
var version = "2.
|
|
4
|
+
var version = "2.7.0";
|
|
5
5
|
|
|
6
6
|
class OnfidoError extends Error {
|
|
7
7
|
constructor(message) {
|
|
@@ -172,9 +172,10 @@ class Resource {
|
|
|
172
172
|
this.axiosInstance = axiosInstance;
|
|
173
173
|
}
|
|
174
174
|
async request({ method, path = "", body, query }) {
|
|
175
|
+
const url = path === null ? `${this.name}` : `${this.name}/${path}`;
|
|
175
176
|
const request = this.axiosInstance({
|
|
176
177
|
method,
|
|
177
|
-
url:
|
|
178
|
+
url: url,
|
|
178
179
|
data: body && convertObjectToSnakeCase(body),
|
|
179
180
|
params: query && convertObjectToSnakeCase(query)
|
|
180
181
|
});
|
|
@@ -435,6 +436,25 @@ class Webhooks extends Resource {
|
|
|
435
436
|
}
|
|
436
437
|
}
|
|
437
438
|
|
|
439
|
+
class WorkflowRuns extends Resource {
|
|
440
|
+
constructor(axiosInstance) {
|
|
441
|
+
super("workflow_runs", axiosInstance);
|
|
442
|
+
}
|
|
443
|
+
async create(workflowRunRequest) {
|
|
444
|
+
return this.request({ method: Method.POST, body: workflowRunRequest });
|
|
445
|
+
}
|
|
446
|
+
async find(id) {
|
|
447
|
+
return this.request({ method: Method.GET, path: id });
|
|
448
|
+
}
|
|
449
|
+
async list(queryParams) {
|
|
450
|
+
const workflowRuns = await this.request({
|
|
451
|
+
method: Method.GET,
|
|
452
|
+
query: queryParams
|
|
453
|
+
});
|
|
454
|
+
return workflowRuns;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
438
458
|
var Region;
|
|
439
459
|
(function (Region) {
|
|
440
460
|
Region["EU"] = "EU";
|
|
@@ -451,7 +471,7 @@ class Onfido {
|
|
|
451
471
|
"We previously defaulted to region 'EU', so if you previously didn’t " +
|
|
452
472
|
"set a region or used api.onfido.com, please set your region to 'EU'");
|
|
453
473
|
}
|
|
454
|
-
const regionUrl = `https://api.${region.toLowerCase()}.onfido.com/v3.
|
|
474
|
+
const regionUrl = `https://api.${region.toLowerCase()}.onfido.com/v3.6/`;
|
|
455
475
|
this.axiosInstance = axios.create({
|
|
456
476
|
baseURL: unknownApiUrl || regionUrl,
|
|
457
477
|
headers: {
|
|
@@ -469,6 +489,7 @@ class Onfido {
|
|
|
469
489
|
this.motionCapture = new MotionCaptures(this.axiosInstance);
|
|
470
490
|
this.check = new Checks(this.axiosInstance);
|
|
471
491
|
this.report = new Reports(this.axiosInstance);
|
|
492
|
+
this.workflowRun = new WorkflowRuns(this.axiosInstance);
|
|
472
493
|
// Other endpoints
|
|
473
494
|
this.address = new Addresses(this.axiosInstance);
|
|
474
495
|
this.webhook = new Webhooks(this.axiosInstance);
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../src/errors/OnfidoError.ts","../src/errors/OnfidoApiError.ts","../src/formatting.ts","../src/OnfidoDownload.ts","../src/Resource.ts","../src/resources/Addresses.ts","../src/resources/Applicants.ts","../src/resources/Autofill.ts","../src/resources/Checks.ts","../src/resources/Documents.ts","../src/resources/LivePhotos.ts","../src/resources/LiveVideos.ts","../src/resources/MotionCaptures.ts","../src/resources/Reports.ts","../src/resources/SdkTokens.ts","../src/resources/Webhooks.ts","../src/Onfido.ts","../src/WebhookEventVerifier.ts"],"sourcesContent":["export class OnfidoError extends Error {\n constructor(message?: string) {\n super(message);\n this.name = \"OnfidoError\";\n }\n}\n","import { OnfidoError } from \"./OnfidoError\";\n\nexport class OnfidoApiError extends OnfidoError {\n public readonly responseBody: unknown;\n public readonly statusCode: number;\n public readonly type: string;\n public readonly fields: unknown;\n\n private constructor(\n message: string,\n responseBody: unknown,\n statusCode: number,\n type: string,\n fields: unknown\n ) {\n super(message);\n this.name = \"OnfidoApiError\";\n\n this.responseBody = responseBody;\n this.statusCode = statusCode;\n this.type = type;\n this.fields = fields;\n }\n\n public static fromResponse(\n responseBody: unknown,\n statusCode: number\n ): OnfidoApiError {\n const innerErrorData: unknown =\n responseBody instanceof Object ? (responseBody as any).error : {};\n\n const innerError: {\n type?: unknown;\n message?: unknown;\n fields?: unknown;\n } = innerErrorData instanceof Object ? innerErrorData : {};\n\n const type = `${innerError.type || \"unknown\"}`;\n const message = `${innerError.message || responseBody}`;\n const fields = innerError.fields;\n\n const fullMessage =\n `${message} (status code ${statusCode})` +\n (fields ? ` | ${JSON.stringify(fields)}` : \"\");\n\n return new OnfidoApiError(\n fullMessage,\n responseBody,\n statusCode,\n type,\n fields\n );\n }\n\n public isClientError(): boolean {\n return this.statusCode < 500;\n }\n}\n","import { Readable } from \"stream\";\nimport { IFormData } from \"./types/formData\";\n\n// Using require because \"form-data\" exports this object as a default export which breaks integration when esModuleInterop: false\n// tslint:disable-next-line: no-var-requires\nconst FormData = require(\"form-data\");\n\nexport type SimpleObject = { [key: string]: unknown };\n\ntype ContentsAndOptions = {\n contents: Readable;\n filepath: string;\n contentType?: string;\n};\n\nexport type FileLike = Readable | ContentsAndOptions;\n\nconst snakeCase = (camelCaseString: string): string =>\n camelCaseString.replace(/[A-Z]/g, char => `_${char.toLowerCase()}`);\n\nconst camelCase = (snakeCaseString: string): string =>\n snakeCaseString\n .replace(/_[0-9]/g, underscoreDigit => underscoreDigit[1])\n .replace(/_[a-z]/g, underscoreChar => underscoreChar[1].toUpperCase());\n\nconst deepMapObjectKeys = (value: unknown, f: (key: string) => string): any => {\n if (!(value instanceof Object)) {\n return value;\n } else if (Array.isArray(value)) {\n return value.map(item => deepMapObjectKeys(item, f));\n } else {\n return Object.keys(value).reduce<SimpleObject>((acc, key) => {\n acc[f(key)] = deepMapObjectKeys((value as SimpleObject)[key], f);\n return acc;\n }, {});\n }\n};\n\nexport const convertObjectToSnakeCase = (requestBody: unknown): unknown => {\n // Converting to JSON and back first handles things like dates, circular references etc.\n requestBody = JSON.parse(JSON.stringify(requestBody));\n\n return deepMapObjectKeys(requestBody, snakeCase);\n};\n\nexport const convertObjectToCamelCase = (\n responseBody: SimpleObject\n): SimpleObject => deepMapObjectKeys(responseBody, camelCase);\n\nexport const toFormData = (object: SimpleObject): IFormData => {\n return Object.entries(object).reduce((formData, [key, value]) => {\n if (value instanceof Object && \"contents\" in value) {\n const { contents, ...options } = value as ContentsAndOptions;\n formData.append(snakeCase(key), contents, options);\n } else if (value !== undefined && value !== null) {\n if (value instanceof Object) {\n for (const [elementKey, elementValue] of Object.entries(value)) {\n formData.append(snakeCase(key + \"[\" + elementKey + \"]\"), elementValue);\n }\n } else {\n formData.append(snakeCase(key), value);\n }\n }\n return formData;\n }, new FormData());\n};\n","import { IncomingMessage } from \"http\";\nimport { PassThrough, Readable } from \"stream\";\n\nexport class OnfidoDownload {\n private readonly incomingMessage: IncomingMessage;\n\n constructor(incomingMessage: IncomingMessage) {\n this.incomingMessage = incomingMessage;\n }\n\n public asStream(): Readable {\n // Use a PassThrough stream so the IncomingMessage isn't exposed.\n const passThroughStream = new PassThrough();\n this.incomingMessage.pipe(passThroughStream);\n return passThroughStream;\n }\n\n public get contentType(): string {\n return this.incomingMessage.headers[\"content-type\"]!;\n }\n}\n","import { AxiosInstance, AxiosPromise, AxiosResponse } from \"axios\";\nimport { IncomingMessage } from \"http\";\nimport { Readable } from \"stream\";\nimport { OnfidoApiError } from \"./errors/OnfidoApiError\";\nimport { OnfidoError } from \"./errors/OnfidoError\";\nimport {\n convertObjectToCamelCase,\n convertObjectToSnakeCase,\n SimpleObject,\n toFormData\n} from \"./formatting\";\nimport { OnfidoDownload } from \"./OnfidoDownload\";\n\nexport enum Method {\n GET = \"get\",\n POST = \"post\",\n PUT = \"put\",\n DELETE = \"delete\"\n}\n\nconst isJson = (response: AxiosResponse<unknown>): boolean =>\n (response.headers[\"content-type\"] || \"\").includes(\"application/json\");\n\nconst readFullStream = (stream: Readable): Promise<unknown> =>\n new Promise((resolve): void => {\n let all = \"\";\n\n stream.on(\"data\", data => (all += data));\n stream.on(\"error\", () => resolve(\"An error occurred reading the response\"));\n stream.on(\"end\", () => {\n // Try to parse as JSON, but fall back to just returning the raw text.\n try {\n resolve(JSON.parse(all));\n } catch {\n resolve(all);\n }\n });\n });\n\nconst convertAxiosErrorToOnfidoError = async (\n error: any\n): Promise<OnfidoError> => {\n if (!error.response) {\n return new OnfidoError(\n error.message || \"An unknown error occurred making the request\"\n );\n }\n\n // Received a 4XX or 5XX response.\n const response: AxiosResponse = error.response;\n const data = response.data;\n\n // If we were downloading a file, we will have a stream instead of a string.\n const body = data instanceof Readable ? await readFullStream(data) : data;\n\n return OnfidoApiError.fromResponse(body, response.status);\n};\n\nconst handleResponse = async (request: AxiosPromise<any>): Promise<any> => {\n try {\n const response = await request;\n const data = response.data;\n return isJson(response) ? convertObjectToCamelCase(data) : data;\n } catch (error) {\n throw await convertAxiosErrorToOnfidoError(error);\n }\n};\n\nexport class Resource<T extends SimpleObject> {\n private readonly name: string;\n private readonly axiosInstance: AxiosInstance;\n\n protected constructor(name: string, axiosInstance: AxiosInstance) {\n this.name = name;\n this.axiosInstance = axiosInstance;\n }\n\n protected async request({\n method,\n path = \"\",\n body,\n query\n }: {\n method: Method;\n path?: string;\n body?: T;\n query?: SimpleObject;\n }): Promise<any> {\n const request = this.axiosInstance({\n method,\n url: `${this.name}/${path}`,\n data: body && convertObjectToSnakeCase(body),\n params: query && convertObjectToSnakeCase(query)\n });\n\n return handleResponse(request);\n }\n\n protected async upload(body: T): Promise<any> {\n const formData = toFormData(body);\n\n const request = this.axiosInstance({\n method: Method.POST,\n url: `${this.name}/`,\n data: formData,\n headers: formData.getHeaders()\n });\n\n return handleResponse(request);\n }\n\n protected async download(path: string): Promise<OnfidoDownload> {\n const request = this.axiosInstance({\n method: Method.GET,\n url: `${this.name}/${path}`,\n responseType: \"stream\",\n // Accept a response with any content type (e.g. image/png, application/pdf, video/mp4)\n headers: { Accept: \"*/*\" }\n });\n\n const stream: IncomingMessage = await handleResponse(request);\n return new OnfidoDownload(stream);\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\ntype AddressOptional = {\n flatNumber: string | null;\n buildingNumber: string | null;\n buildingName: string | null;\n street: string | null;\n subStreet: string | null;\n town: string | null;\n state: string | null;\n line1: string | null;\n line2: string | null;\n line3: string | null;\n};\n\nexport type AddressRequest = {\n postcode: string;\n country: string;\n} & Partial<AddressOptional>;\n\nexport type Address = {\n postcode: string;\n country: string;\n} & Partial<AddressOptional>;\n\nexport class Addresses extends Resource<never> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"addresses\", axiosInstance);\n }\n\n public async pick(postcode: string): Promise<Address[]> {\n const { addresses } = await this.request({\n method: Method.GET,\n path: \"pick\",\n query: { postcode }\n });\n\n return addresses;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\nimport { Address, AddressRequest } from \"./Addresses\";\nimport { IdNumber, IdNumberRequest } from \"./IdNumbers\";\nimport { Location, LocationRequest } from \"./Location\";\nimport { ConsentsRequest } from \"./ConsentsRequest\";\n\n// firstName and lastName are also optional, to allow updating.\nexport type ApplicantRequest = {\n firstName?: string | null;\n lastName?: string | null;\n email?: string | null;\n dob?: string | null;\n address?: AddressRequest | null;\n idNumbers?: IdNumberRequest[] | null;\n phoneNumber?: string | null;\n location?: LocationRequest | null;\n consents?: ConsentsRequest[] | null;\n};\n\nexport type Applicant = {\n id: string;\n createdAt: string;\n deleteAt: string | null;\n href: string;\n firstName: string;\n lastName: string;\n email: string | null;\n dob: string | null;\n address: Address | null;\n idNumbers: IdNumber[] | null;\n phoneNumber: string | null;\n location: Location | null;\n};\n\nexport class Applicants extends Resource<ApplicantRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"applicants\", axiosInstance);\n }\n\n public async create(applicantRequest: ApplicantRequest): Promise<Applicant> {\n return this.request({ method: Method.POST, body: applicantRequest });\n }\n\n public async find(id: string): Promise<Applicant> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async update(\n id: string,\n applicantRequest: ApplicantRequest\n ): Promise<Applicant> {\n return this.request({\n method: Method.PUT,\n path: id,\n body: applicantRequest\n });\n }\n\n public async delete(id: string): Promise<void> {\n await this.request({ method: Method.DELETE, path: id });\n }\n\n public async restore(id: string): Promise<void> {\n await this.request({ method: Method.POST, path: `${id}/restore` });\n }\n\n public async list({\n page,\n perPage,\n includeDeleted\n }: {\n page?: number;\n perPage?: number;\n includeDeleted?: boolean;\n } = {}): Promise<Applicant[]> {\n const { applicants } = await this.request({\n method: Method.GET,\n query: { page, perPage, includeDeleted }\n });\n\n return applicants;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type ExtractionResult = {\n documentId: string;\n documentClassification: {\n issuingCountry: string;\n documentType: string;\n issuingState?: string;\n };\n extractedData: {\n documentNumber?: string;\n firstName?: string;\n lastName?: string;\n middleName?: string;\n fullName?: string;\n gender?: string;\n dateOfBirth?: string;\n dateOfExpiry?: string;\n nationality?: string;\n mrzLine1?: string;\n mrzLine2?: string;\n mrzLine3?: string;\n addressLine1?: string;\n addressLine2?: string;\n addressLine3?: string;\n addressLine4?: string;\n addressLine5?: string;\n };\n};\n\ntype AutofillResource = {\n documentId: string;\n};\n\nexport class Autofill extends Resource<AutofillResource> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"extractions\", axiosInstance);\n }\n\n public async perform(documentId: string): Promise<ExtractionResult> {\n return this.request({\n method: Method.POST,\n body: { documentId }\n });\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type CheckRequest = {\n applicantId: string;\n reportNames: string[];\n documentIds?: string[] | null;\n applicantProvidesData?: boolean;\n asynchronous?: boolean;\n tags?: string[] | null;\n suppressFormEmails?: boolean;\n redirectUri?: string | null;\n privacyNoticesReadConsentGiven?: boolean;\n webhookIds?: string[] | null;\n subResult?: string;\n consider?: string[];\n};\n\nexport type Check = {\n id: string;\n reportIds: string[];\n createdAt: string;\n href: string;\n applicantId: string;\n applicantProvidesData: boolean;\n status: string;\n tags: string[];\n result: string | null;\n formUri: string | null;\n redirectUri: string | null;\n resultsUri: string;\n privacyNoticesReadConsentGiven: boolean;\n webhookIds: string[] | null;\n};\n\nexport class Checks extends Resource<CheckRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"checks\", axiosInstance);\n }\n\n public async create(checkRequest: CheckRequest): Promise<Check> {\n return this.request({ method: Method.POST, body: checkRequest });\n }\n\n public async find(id: string): Promise<Check> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<Check[]> {\n const { checks } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return checks;\n }\n\n public async resume(id: string): Promise<void> {\n await this.request({ method: Method.POST, path: `${id}/resume` });\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { FileLike } from \"../formatting\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\nimport { LocationRequest } from \"./Location\";\n\nexport type DocumentRequest = {\n applicantId?: string | null;\n file: FileLike;\n type: string;\n side?: string | null;\n issuingCountry?: string | null;\n validateImageQuality?: boolean | null;\n location?: LocationRequest | null;\n};\n\nexport type Document = {\n id: string;\n applicantId: string | null;\n createdAt: string;\n href: string;\n downloadHref: string;\n fileName: string;\n fileType: string;\n fileSize: number;\n type: string;\n side: string | null;\n issuingCountry: string | null;\n};\n\nexport class Documents extends Resource<DocumentRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"documents\", axiosInstance);\n }\n\n public async upload(documentRequest: DocumentRequest): Promise<Document> {\n return super.upload(documentRequest);\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n\n public async find(id: string): Promise<Document> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<Document[]> {\n const { documents } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return documents;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { FileLike } from \"../formatting\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type LivePhotoRequest = {\n applicantId: string;\n file: FileLike;\n advancedValidation?: string;\n};\n\nexport type LivePhoto = {\n id: string;\n createdAt: string;\n href: string;\n downloadHref: string;\n fileName: string;\n fileType: string;\n fileSize: number;\n};\n\nexport class LivePhotos extends Resource<LivePhotoRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"live_photos\", axiosInstance);\n }\n\n public async upload(livePhotoRequest: LivePhotoRequest): Promise<LivePhoto> {\n return super.upload(livePhotoRequest);\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n\n public async find(id: string): Promise<LivePhoto> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<LivePhoto[]> {\n const { livePhotos } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return livePhotos;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type LiveVideo = {\n id: string;\n createdAt: string;\n href: string;\n downloadHref: string;\n fileName: string;\n fileType: string;\n fileSize: number;\n};\n\nexport class LiveVideos extends Resource<never> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"live_videos\", axiosInstance);\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n\n public async frame(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/frame`);\n }\n\n public async find(id: string): Promise<LiveVideo> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<LiveVideo[]> {\n const { liveVideos } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return liveVideos;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type MotionCapture = {\n id: string;\n createdAt: string;\n href: string;\n downloadHref: string;\n fileName: string;\n fileType: string;\n fileSize: number;\n};\n\nexport class MotionCaptures extends Resource<never> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"motion_captures\", axiosInstance);\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n\n public async frame(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/frame`);\n }\n\n public async find(id: string): Promise<MotionCapture> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<MotionCapture[]> {\n const { motionCaptures } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return motionCaptures;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type Report = {\n id: string;\n createdAt: string;\n name: string;\n href: string;\n status: string;\n result: string | null;\n subResult: string | null;\n properties: object | null;\n breakdown: object | null;\n documents: Array<{ id: string }>;\n checkId: string;\n};\n\nexport class Reports extends Resource<never> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"reports\", axiosInstance);\n }\n\n public async find(id: string): Promise<Report> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(checkId: string): Promise<Report[]> {\n const { reports } = await this.request({\n method: Method.GET,\n query: { checkId }\n });\n\n return reports;\n }\n\n public async resume(id: string): Promise<void> {\n await this.request({ method: Method.POST, path: `${id}/resume` });\n }\n\n public async cancel(id: string): Promise<void> {\n await this.request({ method: Method.POST, path: `${id}/cancel` });\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type SdkTokenRequest = {\n applicantId: string;\n applicationId?: string | null;\n referrer?: string | null;\n crossDeviceUrl?: string | null;\n};\n\nexport class SdkTokens extends Resource<SdkTokenRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"sdk_token\", axiosInstance);\n }\n\n public async generate(sdkTokenRequest: SdkTokenRequest): Promise<string> {\n const { token } = await this.request({\n method: Method.POST,\n body: sdkTokenRequest\n });\n\n return token;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\n// url is also optional to allow updating.\nexport type WebhookRequest = {\n url?: string | null;\n enabled?: boolean;\n environments?: string[];\n events?: string[] | null;\n};\n\nexport type Webhook = {\n id: string;\n url: string;\n enabled: boolean;\n events: string[];\n token: string;\n href: string;\n environments: string[];\n};\n\nexport class Webhooks extends Resource<WebhookRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"webhooks\", axiosInstance);\n }\n\n public async create(webhookRequest: WebhookRequest): Promise<Webhook> {\n return this.request({ method: Method.POST, body: webhookRequest });\n }\n\n public async find(id: string): Promise<Webhook> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async update(\n id: string,\n webhookRequest: WebhookRequest\n ): Promise<Webhook> {\n return this.request({\n method: Method.PUT,\n path: id,\n body: webhookRequest\n });\n }\n\n public async delete(id: string): Promise<void> {\n await this.request({ method: Method.DELETE, path: id });\n }\n\n public async list(): Promise<Webhook[]> {\n const { webhooks } = await this.request({ method: Method.GET });\n\n return webhooks;\n }\n}\n","import axios, { AxiosInstance } from \"axios\";\nimport { version } from \"../package.json\";\nimport { Addresses } from \"./resources/Addresses\";\nimport { Applicants } from \"./resources/Applicants\";\nimport { Autofill } from \"./resources/Autofill\";\nimport { Checks } from \"./resources/Checks\";\nimport { Documents } from \"./resources/Documents\";\nimport { LivePhotos } from \"./resources/LivePhotos\";\nimport { LiveVideos } from \"./resources/LiveVideos\";\nimport { MotionCaptures } from \"./resources/MotionCaptures\";\nimport { Reports } from \"./resources/Reports\";\nimport { SdkTokens } from \"./resources/SdkTokens\";\nimport { Webhooks } from \"./resources/Webhooks\";\n\nexport enum Region {\n EU = \"EU\",\n US = \"US\",\n CA = \"CA\"\n}\n\nexport type OnfidoOptions = {\n apiToken: string;\n region: Region;\n timeout?: number;\n unknownApiUrl?: string;\n};\n\nexport class Onfido {\n public readonly axiosInstance: AxiosInstance;\n // Core resources\n public readonly applicant: Applicants;\n public readonly document: Documents;\n public readonly livePhoto: LivePhotos;\n public readonly liveVideo: LiveVideos;\n public readonly motionCapture: MotionCaptures;\n public readonly check: Checks;\n public readonly report: Reports;\n // Other endpoints\n public readonly address: Addresses;\n public readonly webhook: Webhooks;\n public readonly sdkToken: SdkTokens;\n public readonly autofill: Autofill;\n\n constructor({\n apiToken,\n region,\n timeout = 30_000,\n unknownApiUrl\n }: OnfidoOptions) {\n if (!apiToken) {\n throw new Error(\"No apiToken provided\");\n }\n if (!region || !Object.values(Region).includes(region)) {\n throw new Error(\n `Unknown or missing region '${region}'. ` +\n \"We previously defaulted to region 'EU', so if you previously didn’t \" +\n \"set a region or used api.onfido.com, please set your region to 'EU'\"\n );\n }\n\n const regionUrl = `https://api.${region.toLowerCase()}.onfido.com/v3.5/`;\n\n this.axiosInstance = axios.create({\n baseURL: unknownApiUrl || regionUrl,\n headers: {\n Authorization: `Token token=${apiToken}`,\n Accept: \"application/json\",\n \"User-Agent\": `onfido-node/${version}`\n },\n timeout\n });\n\n // Core resources\n this.applicant = new Applicants(this.axiosInstance);\n this.document = new Documents(this.axiosInstance);\n this.livePhoto = new LivePhotos(this.axiosInstance);\n this.liveVideo = new LiveVideos(this.axiosInstance);\n this.motionCapture = new MotionCaptures(this.axiosInstance);\n this.check = new Checks(this.axiosInstance);\n this.report = new Reports(this.axiosInstance);\n // Other endpoints\n this.address = new Addresses(this.axiosInstance);\n this.webhook = new Webhooks(this.axiosInstance);\n this.sdkToken = new SdkTokens(this.axiosInstance);\n this.autofill = new Autofill(this.axiosInstance);\n }\n}\n","import { OnfidoError } from \"./errors/OnfidoError\";\nimport { convertObjectToCamelCase } from \"./formatting\";\n\n// Require crypto instead of importing, because Node can be built without crypto support.\nlet crypto: typeof import(\"crypto\") | undefined;\ntry {\n // tslint:disable-next-line: no-var-requires\n crypto = require(\"crypto\");\n} catch {\n // We throw an error when verifying webhooks instead.\n}\n\nexport type WebhookEvent = {\n resourceType: string;\n action: string;\n object: {\n id: string;\n status: string;\n href: string;\n completedAtIso8601: string;\n };\n};\n\nexport class WebhookEventVerifier {\n private readonly webhookToken: string;\n\n constructor(webhookToken: string) {\n this.webhookToken = webhookToken;\n }\n\n public readPayload(\n rawEventBody: string | Buffer,\n hexSignature: string\n ): WebhookEvent {\n if (!crypto) {\n throw new Error(\"Verifying webhook events requires crypto support\");\n }\n\n const givenSignature = Buffer.from(hexSignature, \"hex\");\n\n // Compute the the actual HMAC signature from the raw request body.\n const hmac = crypto.createHmac(\"sha256\", this.webhookToken);\n hmac.update(rawEventBody);\n const eventSignature = hmac.digest();\n\n // Use timingSafeEqual to prevent against timing attacks.\n if (!crypto.timingSafeEqual(givenSignature, eventSignature)) {\n throw new OnfidoError(\"Invalid signature for webhook event\");\n }\n\n const { payload } = JSON.parse(rawEventBody.toString());\n return convertObjectToCamelCase(payload) as WebhookEvent;\n }\n}\n"],"names":[],"mappings":";;;;;MAAa,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;KAC3B;CACF;;MCHY,cAAe,SAAQ,WAAW;IAM7C,YACE,OAAe,EACf,YAAqB,EACrB,UAAkB,EAClB,IAAY,EACZ,MAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAE7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;KACtB;IAEM,OAAO,YAAY,CACxB,YAAqB,EACrB,UAAkB;QAElB,MAAM,cAAc,GAClB,YAAY,YAAY,MAAM,GAAI,YAAoB,CAAC,KAAK,GAAG,EAAE,CAAC;QAEpE,MAAM,UAAU,GAIZ,cAAc,YAAY,MAAM,GAAG,cAAc,GAAG,EAAE,CAAC;QAE3D,MAAM,IAAI,GAAG,GAAG,UAAU,CAAC,IAAI,IAAI,SAAS,EAAE,CAAC;QAC/C,MAAM,OAAO,GAAG,GAAG,UAAU,CAAC,OAAO,IAAI,YAAY,EAAE,CAAC;QACxD,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAEjC,MAAM,WAAW,GACf,GAAG,OAAO,iBAAiB,UAAU,GAAG;aACvC,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAEjD,OAAO,IAA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CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;KAClD;CACF;;ACnFD;AACA,IAAI,MAA2C,CAAC;AAChD,IAAI;;IAEF,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC5B;AAAC,WAAM;;CAEP;AAaD,MAAa,oBAAoB;IAG/B,YAAY,YAAoB;QAC9B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;KAClC;IAEM,WAAW,CAChB,YAA6B,EAC7B,YAAoB;QAEpB,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;SACrE;QAED,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;;QAGxD,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC5D,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC1B,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;;QAGrC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE;YAC3D,MAAM,IAAI,WAAW,CAAC,qCAAqC,CAAC,CAAC;SAC9D;QAED,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;QACxD,OAAO,wBAAwB,CAAC,OAAO,CAAiB,CAAC;KAC1D;CACF;;;;"}
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../src/errors/OnfidoError.ts","../src/errors/OnfidoApiError.ts","../src/formatting.ts","../src/OnfidoDownload.ts","../src/Resource.ts","../src/resources/Addresses.ts","../src/resources/Applicants.ts","../src/resources/Autofill.ts","../src/resources/Checks.ts","../src/resources/Documents.ts","../src/resources/LivePhotos.ts","../src/resources/LiveVideos.ts","../src/resources/MotionCaptures.ts","../src/resources/Reports.ts","../src/resources/SdkTokens.ts","../src/resources/Webhooks.ts","../src/resources/WorkflowRuns.ts","../src/Onfido.ts","../src/WebhookEventVerifier.ts"],"sourcesContent":["export class OnfidoError extends Error {\n constructor(message?: string) {\n super(message);\n this.name = \"OnfidoError\";\n }\n}\n","import { OnfidoError } from \"./OnfidoError\";\n\nexport class OnfidoApiError extends OnfidoError {\n public readonly responseBody: unknown;\n public readonly statusCode: number;\n public readonly type: string;\n public readonly fields: unknown;\n\n private constructor(\n message: string,\n responseBody: unknown,\n statusCode: number,\n type: string,\n fields: unknown\n ) {\n super(message);\n this.name = \"OnfidoApiError\";\n\n this.responseBody = responseBody;\n this.statusCode = statusCode;\n this.type = type;\n this.fields = fields;\n }\n\n public static fromResponse(\n responseBody: unknown,\n statusCode: number\n ): OnfidoApiError {\n const innerErrorData: unknown =\n responseBody instanceof Object ? (responseBody as any).error : {};\n\n const innerError: {\n type?: unknown;\n message?: unknown;\n fields?: unknown;\n } = innerErrorData instanceof Object ? innerErrorData : {};\n\n const type = `${innerError.type || \"unknown\"}`;\n const message = `${innerError.message || responseBody}`;\n const fields = innerError.fields;\n\n const fullMessage =\n `${message} (status code ${statusCode})` +\n (fields ? ` | ${JSON.stringify(fields)}` : \"\");\n\n return new OnfidoApiError(\n fullMessage,\n responseBody,\n statusCode,\n type,\n fields\n );\n }\n\n public isClientError(): boolean {\n return this.statusCode < 500;\n }\n}\n","import { Readable } from \"stream\";\nimport { IFormData } from \"./types/formData\";\n\n// Using require because \"form-data\" exports this object as a default export which breaks integration when esModuleInterop: false\n// tslint:disable-next-line: no-var-requires\nconst FormData = require(\"form-data\");\n\nexport type SimpleObject = { [key: string]: unknown };\n\ntype ContentsAndOptions = {\n contents: Readable;\n filepath: string;\n contentType?: string;\n};\n\nexport type FileLike = Readable | ContentsAndOptions;\n\nconst snakeCase = (camelCaseString: string): string =>\n camelCaseString.replace(/[A-Z]/g, char => `_${char.toLowerCase()}`);\n\nconst camelCase = (snakeCaseString: string): string =>\n snakeCaseString\n .replace(/_[0-9]/g, underscoreDigit => underscoreDigit[1])\n .replace(/_[a-z]/g, underscoreChar => underscoreChar[1].toUpperCase());\n\nconst deepMapObjectKeys = (value: unknown, f: (key: string) => string): any => {\n if (!(value instanceof Object)) {\n return value;\n } else if (Array.isArray(value)) {\n return value.map(item => deepMapObjectKeys(item, f));\n } else {\n return Object.keys(value).reduce<SimpleObject>((acc, key) => {\n acc[f(key)] = deepMapObjectKeys((value as SimpleObject)[key], f);\n return acc;\n }, {});\n }\n};\n\nexport const convertObjectToSnakeCase = (requestBody: unknown): unknown => {\n // Converting to JSON and back first handles things like dates, circular references etc.\n requestBody = JSON.parse(JSON.stringify(requestBody));\n\n return deepMapObjectKeys(requestBody, snakeCase);\n};\n\nexport const convertObjectToCamelCase = (\n responseBody: SimpleObject\n): SimpleObject => deepMapObjectKeys(responseBody, camelCase);\n\nexport const toFormData = (object: SimpleObject): IFormData => {\n return Object.entries(object).reduce((formData, [key, value]) => {\n if (value instanceof Object && \"contents\" in value) {\n const { contents, ...options } = value as ContentsAndOptions;\n formData.append(snakeCase(key), contents, options);\n } else if (value !== undefined && value !== null) {\n if (value instanceof Object) {\n for (const [elementKey, elementValue] of Object.entries(value)) {\n formData.append(snakeCase(key + \"[\" + elementKey + \"]\"), elementValue);\n }\n } else {\n formData.append(snakeCase(key), value);\n }\n }\n return formData;\n }, new FormData());\n};\n","import { IncomingMessage } from \"http\";\nimport { PassThrough, Readable } from \"stream\";\n\nexport class OnfidoDownload {\n private readonly incomingMessage: IncomingMessage;\n\n constructor(incomingMessage: IncomingMessage) {\n this.incomingMessage = incomingMessage;\n }\n\n public asStream(): Readable {\n // Use a PassThrough stream so the IncomingMessage isn't exposed.\n const passThroughStream = new PassThrough();\n this.incomingMessage.pipe(passThroughStream);\n return passThroughStream;\n }\n\n public get contentType(): string {\n return this.incomingMessage.headers[\"content-type\"]!;\n }\n}\n","import { AxiosInstance, AxiosPromise, AxiosResponse } from \"axios\";\nimport { IncomingMessage } from \"http\";\nimport { Readable } from \"stream\";\nimport { OnfidoApiError } from \"./errors/OnfidoApiError\";\nimport { OnfidoError } from \"./errors/OnfidoError\";\nimport {\n convertObjectToCamelCase,\n convertObjectToSnakeCase,\n SimpleObject,\n toFormData\n} from \"./formatting\";\nimport { OnfidoDownload } from \"./OnfidoDownload\";\n\nexport enum Method {\n GET = \"get\",\n POST = \"post\",\n PUT = \"put\",\n DELETE = \"delete\"\n}\n\nconst isJson = (response: AxiosResponse<unknown>): boolean =>\n (response.headers[\"content-type\"] || \"\").includes(\"application/json\");\n\nconst readFullStream = (stream: Readable): Promise<unknown> =>\n new Promise((resolve): void => {\n let all = \"\";\n\n stream.on(\"data\", data => (all += data));\n stream.on(\"error\", () => resolve(\"An error occurred reading the response\"));\n stream.on(\"end\", () => {\n // Try to parse as JSON, but fall back to just returning the raw text.\n try {\n resolve(JSON.parse(all));\n } catch {\n resolve(all);\n }\n });\n });\n\nconst convertAxiosErrorToOnfidoError = async (\n error: any\n): Promise<OnfidoError> => {\n if (!error.response) {\n return new OnfidoError(\n error.message || \"An unknown error occurred making the request\"\n );\n }\n\n // Received a 4XX or 5XX response.\n const response: AxiosResponse = error.response;\n const data = response.data;\n\n // If we were downloading a file, we will have a stream instead of a string.\n const body = data instanceof Readable ? await readFullStream(data) : data;\n\n return OnfidoApiError.fromResponse(body, response.status);\n};\n\nconst handleResponse = async (request: AxiosPromise<any>): Promise<any> => {\n try {\n const response = await request;\n const data = response.data;\n return isJson(response) ? convertObjectToCamelCase(data) : data;\n } catch (error) {\n throw await convertAxiosErrorToOnfidoError(error);\n }\n};\n\nexport class Resource<T extends SimpleObject> {\n private readonly name: string;\n private readonly axiosInstance: AxiosInstance;\n\n protected constructor(name: string, axiosInstance: AxiosInstance) {\n this.name = name;\n this.axiosInstance = axiosInstance;\n }\n\n protected async request({\n method,\n path = \"\",\n body,\n query\n }: {\n method: Method;\n path?: string;\n body?: T;\n query?: SimpleObject;\n }): Promise<any> {\n const url = path === null ? `${this.name}` : `${this.name}/${path}`;\n const request = this.axiosInstance({\n method,\n url: url,\n data: body && convertObjectToSnakeCase(body),\n params: query && convertObjectToSnakeCase(query)\n });\n\n return handleResponse(request);\n }\n\n protected async upload(body: T): Promise<any> {\n const formData = toFormData(body);\n\n const request = this.axiosInstance({\n method: Method.POST,\n url: `${this.name}/`,\n data: formData,\n headers: formData.getHeaders()\n });\n\n return handleResponse(request);\n }\n\n protected async download(path: string): Promise<OnfidoDownload> {\n const request = this.axiosInstance({\n method: Method.GET,\n url: `${this.name}/${path}`,\n responseType: \"stream\",\n // Accept a response with any content type (e.g. image/png, application/pdf, video/mp4)\n headers: { Accept: \"*/*\" }\n });\n\n const stream: IncomingMessage = await handleResponse(request);\n return new OnfidoDownload(stream);\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\ntype AddressOptional = {\n flatNumber: string | null;\n buildingNumber: string | null;\n buildingName: string | null;\n street: string | null;\n subStreet: string | null;\n town: string | null;\n state: string | null;\n line1: string | null;\n line2: string | null;\n line3: string | null;\n};\n\nexport type AddressRequest = {\n postcode: string;\n country: string;\n} & Partial<AddressOptional>;\n\nexport type Address = {\n postcode: string;\n country: string;\n} & Partial<AddressOptional>;\n\nexport class Addresses extends Resource<never> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"addresses\", axiosInstance);\n }\n\n public async pick(postcode: string): Promise<Address[]> {\n const { addresses } = await this.request({\n method: Method.GET,\n path: \"pick\",\n query: { postcode }\n });\n\n return addresses;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\nimport { Address, AddressRequest } from \"./Addresses\";\nimport { IdNumber, IdNumberRequest } from \"./IdNumbers\";\nimport { Location, LocationRequest } from \"./Location\";\nimport { ConsentsRequest } from \"./ConsentsRequest\";\n\n// firstName and lastName are also optional, to allow updating.\nexport type ApplicantRequest = {\n firstName?: string | null;\n lastName?: string | null;\n email?: string | null;\n dob?: string | null;\n address?: AddressRequest | null;\n idNumbers?: IdNumberRequest[] | null;\n phoneNumber?: string | null;\n location?: LocationRequest | null;\n consents?: ConsentsRequest[] | null;\n};\n\nexport type Applicant = {\n id: string;\n createdAt: string;\n deleteAt: string | null;\n href: string;\n firstName: string;\n lastName: string;\n email: string | null;\n dob: string | null;\n address: Address | null;\n idNumbers: IdNumber[] | null;\n phoneNumber: string | null;\n location: Location | null;\n};\n\nexport class Applicants extends Resource<ApplicantRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"applicants\", axiosInstance);\n }\n\n public async create(applicantRequest: ApplicantRequest): Promise<Applicant> {\n return this.request({ method: Method.POST, body: applicantRequest });\n }\n\n public async find(id: string): Promise<Applicant> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async update(\n id: string,\n applicantRequest: ApplicantRequest\n ): Promise<Applicant> {\n return this.request({\n method: Method.PUT,\n path: id,\n body: applicantRequest\n });\n }\n\n public async delete(id: string): Promise<void> {\n await this.request({ method: Method.DELETE, path: id });\n }\n\n public async restore(id: string): Promise<void> {\n await this.request({ method: Method.POST, path: `${id}/restore` });\n }\n\n public async list({\n page,\n perPage,\n includeDeleted\n }: {\n page?: number;\n perPage?: number;\n includeDeleted?: boolean;\n } = {}): Promise<Applicant[]> {\n const { applicants } = await this.request({\n method: Method.GET,\n query: { page, perPage, includeDeleted }\n });\n\n return applicants;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type ExtractionResult = {\n documentId: string;\n documentClassification: {\n issuingCountry: string;\n documentType: string;\n issuingState?: string;\n };\n extractedData: {\n documentNumber?: string;\n firstName?: string;\n lastName?: string;\n middleName?: string;\n fullName?: string;\n gender?: string;\n dateOfBirth?: string;\n dateOfExpiry?: string;\n nationality?: string;\n mrzLine1?: string;\n mrzLine2?: string;\n mrzLine3?: string;\n addressLine1?: string;\n addressLine2?: string;\n addressLine3?: string;\n addressLine4?: string;\n addressLine5?: string;\n };\n};\n\ntype AutofillResource = {\n documentId: string;\n};\n\nexport class Autofill extends Resource<AutofillResource> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"extractions\", axiosInstance);\n }\n\n public async perform(documentId: string): Promise<ExtractionResult> {\n return this.request({\n method: Method.POST,\n body: { documentId }\n });\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type CheckRequest = {\n applicantId: string;\n reportNames: string[];\n documentIds?: string[] | null;\n applicantProvidesData?: boolean;\n asynchronous?: boolean;\n tags?: string[] | null;\n suppressFormEmails?: boolean;\n redirectUri?: string | null;\n privacyNoticesReadConsentGiven?: boolean;\n webhookIds?: string[] | null;\n subResult?: string;\n consider?: string[];\n};\n\nexport type Check = {\n id: string;\n reportIds: string[];\n createdAt: string;\n href: string;\n applicantId: string;\n applicantProvidesData: boolean;\n status: string;\n tags: string[];\n result: string | null;\n formUri: string | null;\n redirectUri: string | null;\n resultsUri: string;\n privacyNoticesReadConsentGiven: boolean;\n webhookIds: string[] | null;\n};\n\nexport class Checks extends Resource<CheckRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"checks\", axiosInstance);\n }\n\n public async create(checkRequest: CheckRequest): Promise<Check> {\n return this.request({ method: Method.POST, body: checkRequest });\n }\n\n public async find(id: string): Promise<Check> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<Check[]> {\n const { checks } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return checks;\n }\n\n public async resume(id: string): Promise<void> {\n await this.request({ method: Method.POST, path: `${id}/resume` });\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { FileLike } from \"../formatting\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\nimport { LocationRequest } from \"./Location\";\n\nexport type DocumentRequest = {\n applicantId?: string | null;\n file: FileLike;\n type: string;\n side?: string | null;\n issuingCountry?: string | null;\n validateImageQuality?: boolean | null;\n location?: LocationRequest | null;\n};\n\nexport type Document = {\n id: string;\n applicantId: string | null;\n createdAt: string;\n href: string;\n downloadHref: string;\n fileName: string;\n fileType: string;\n fileSize: number;\n type: string;\n side: string | null;\n issuingCountry: string | null;\n};\n\nexport class Documents extends Resource<DocumentRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"documents\", axiosInstance);\n }\n\n public async upload(documentRequest: DocumentRequest): Promise<Document> {\n return super.upload(documentRequest);\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n\n public async find(id: string): Promise<Document> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<Document[]> {\n const { documents } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return documents;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { FileLike } from \"../formatting\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type LivePhotoRequest = {\n applicantId: string;\n file: FileLike;\n advancedValidation?: string;\n};\n\nexport type LivePhoto = {\n id: string;\n createdAt: string;\n href: string;\n downloadHref: string;\n fileName: string;\n fileType: string;\n fileSize: number;\n};\n\nexport class LivePhotos extends Resource<LivePhotoRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"live_photos\", axiosInstance);\n }\n\n public async upload(livePhotoRequest: LivePhotoRequest): Promise<LivePhoto> {\n return super.upload(livePhotoRequest);\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n\n public async find(id: string): Promise<LivePhoto> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<LivePhoto[]> {\n const { livePhotos } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return livePhotos;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type LiveVideo = {\n id: string;\n createdAt: string;\n href: string;\n downloadHref: string;\n fileName: string;\n fileType: string;\n fileSize: number;\n};\n\nexport class LiveVideos extends Resource<never> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"live_videos\", axiosInstance);\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n\n public async frame(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/frame`);\n }\n\n public async find(id: string): Promise<LiveVideo> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<LiveVideo[]> {\n const { liveVideos } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return liveVideos;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type MotionCapture = {\n id: string;\n createdAt: string;\n href: string;\n downloadHref: string;\n fileName: string;\n fileType: string;\n fileSize: number;\n};\n\nexport class MotionCaptures extends Resource<never> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"motion_captures\", axiosInstance);\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n\n public async frame(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/frame`);\n }\n\n public async find(id: string): Promise<MotionCapture> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<MotionCapture[]> {\n const { motionCaptures } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return motionCaptures;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type Report = {\n id: string;\n createdAt: string;\n name: string;\n href: string;\n status: string;\n result: string | null;\n subResult: string | null;\n properties: object | null;\n breakdown: object | null;\n documents: Array<{ id: string }>;\n checkId: string;\n};\n\nexport class Reports extends Resource<never> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"reports\", axiosInstance);\n }\n\n public async find(id: string): Promise<Report> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(checkId: string): Promise<Report[]> {\n const { reports } = await this.request({\n method: Method.GET,\n query: { checkId }\n });\n\n return reports;\n }\n\n public async resume(id: string): Promise<void> {\n await this.request({ method: Method.POST, path: `${id}/resume` });\n }\n\n public async cancel(id: string): Promise<void> {\n await this.request({ method: Method.POST, path: `${id}/cancel` });\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type SdkTokenRequest = {\n applicantId: string;\n applicationId?: string | null;\n referrer?: string | null;\n crossDeviceUrl?: string | null;\n};\n\nexport class SdkTokens extends Resource<SdkTokenRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"sdk_token\", axiosInstance);\n }\n\n public async generate(sdkTokenRequest: SdkTokenRequest): Promise<string> {\n const { token } = await this.request({\n method: Method.POST,\n body: sdkTokenRequest\n });\n\n return token;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\n// url is also optional to allow updating.\nexport type WebhookRequest = {\n url?: string | null;\n enabled?: boolean;\n environments?: string[];\n events?: string[] | null;\n};\n\nexport type Webhook = {\n id: string;\n url: string;\n enabled: boolean;\n events: string[];\n token: string;\n href: string;\n environments: string[];\n};\n\nexport class Webhooks extends Resource<WebhookRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"webhooks\", axiosInstance);\n }\n\n public async create(webhookRequest: WebhookRequest): Promise<Webhook> {\n return this.request({ method: Method.POST, body: webhookRequest });\n }\n\n public async find(id: string): Promise<Webhook> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async update(\n id: string,\n webhookRequest: WebhookRequest\n ): Promise<Webhook> {\n return this.request({\n method: Method.PUT,\n path: id,\n body: webhookRequest\n });\n }\n\n public async delete(id: string): Promise<void> {\n await this.request({ method: Method.DELETE, path: id });\n }\n\n public async list(): Promise<Webhook[]> {\n const { webhooks } = await this.request({ method: Method.GET });\n\n return webhooks;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type WorkflowRunRequest = {\n applicantId: string;\n workflowId: string;\n customData?: any;\n};\n\ntype WorkflowRunError = {\n type:\tstring;\n message: string;\n}\n\ntype WorkflowRunLink = {\n url:\tstring;\n completed_redirect_url:\tstring;\n expired_redirect_url:\tstring;\n expires_at:\tstring;\n language: string;\n}\n\nexport type WorkflowRun = {\n id: string;\n applicantId: string;\n workflowId: string;\n workflowVersionId: number;\n dashboardUrl: string;\n status: string;\n output: any;\n reasons: string[] | null;\n error: WorkflowRunError | null;\n link: WorkflowRunLink | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type WorkflowRunListRequest = {\n page?: number;\n status?: string;\n created_at_gt?: string;\n created_at_lt?: string;\n}\n\nexport class WorkflowRuns extends Resource<WorkflowRunRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"workflow_runs\", axiosInstance);\n }\n\n public async create(workflowRunRequest: WorkflowRunRequest): Promise<WorkflowRun> {\n return this.request({ method: Method.POST, body: workflowRunRequest });\n }\n\n public async find(id: string): Promise<WorkflowRun> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(queryParams?: WorkflowRunListRequest): Promise<WorkflowRun[]> {\n const workflowRuns = await this.request({\n method: Method.GET,\n query: queryParams\n });\n\n return workflowRuns;\n }\n}\n","import axios, { AxiosInstance } from \"axios\";\nimport { version } from \"../package.json\";\nimport { Addresses } from \"./resources/Addresses\";\nimport { Applicants } from \"./resources/Applicants\";\nimport { Autofill } from \"./resources/Autofill\";\nimport { Checks } from \"./resources/Checks\";\nimport { Documents } from \"./resources/Documents\";\nimport { LivePhotos } from \"./resources/LivePhotos\";\nimport { LiveVideos } from \"./resources/LiveVideos\";\nimport { MotionCaptures } from \"./resources/MotionCaptures\";\nimport { Reports } from \"./resources/Reports\";\nimport { SdkTokens } from \"./resources/SdkTokens\";\nimport { Webhooks } from \"./resources/Webhooks\";\nimport { WorkflowRuns } from \"./resources/WorkflowRuns\";\n\nexport enum Region {\n EU = \"EU\",\n US = \"US\",\n CA = \"CA\"\n}\n\nexport type OnfidoOptions = {\n apiToken: string;\n region: Region;\n timeout?: number;\n unknownApiUrl?: string;\n};\n\nexport class Onfido {\n public readonly axiosInstance: AxiosInstance;\n // Core resources\n public readonly applicant: Applicants;\n public readonly document: Documents;\n public readonly livePhoto: LivePhotos;\n public readonly liveVideo: LiveVideos;\n public readonly motionCapture: MotionCaptures;\n public readonly check: Checks;\n public readonly report: Reports;\n public readonly workflowRun: WorkflowRuns;\n // Other endpoints\n public readonly address: Addresses;\n public readonly webhook: Webhooks;\n public readonly sdkToken: SdkTokens;\n public readonly autofill: Autofill;\n\n constructor({\n apiToken,\n region,\n timeout = 30_000,\n unknownApiUrl\n }: OnfidoOptions) {\n if (!apiToken) {\n throw new Error(\"No apiToken provided\");\n }\n if (!region || !Object.values(Region).includes(region)) {\n throw new Error(\n `Unknown or missing region '${region}'. ` +\n \"We previously defaulted to region 'EU', so if you previously didn’t \" +\n \"set a region or used api.onfido.com, please set your region to 'EU'\"\n );\n }\n\n const regionUrl = `https://api.${region.toLowerCase()}.onfido.com/v3.6/`;\n\n this.axiosInstance = axios.create({\n baseURL: unknownApiUrl || regionUrl,\n headers: {\n Authorization: `Token token=${apiToken}`,\n Accept: \"application/json\",\n \"User-Agent\": `onfido-node/${version}`\n },\n timeout\n });\n\n // Core resources\n this.applicant = new Applicants(this.axiosInstance);\n this.document = new Documents(this.axiosInstance);\n this.livePhoto = new LivePhotos(this.axiosInstance);\n this.liveVideo = new LiveVideos(this.axiosInstance);\n this.motionCapture = new MotionCaptures(this.axiosInstance);\n this.check = new Checks(this.axiosInstance);\n this.report = new Reports(this.axiosInstance);\n this.workflowRun = new WorkflowRuns(this.axiosInstance);\n // Other endpoints\n this.address = new Addresses(this.axiosInstance);\n this.webhook = new Webhooks(this.axiosInstance);\n this.sdkToken = new SdkTokens(this.axiosInstance);\n this.autofill = new Autofill(this.axiosInstance);\n }\n}\n","import { OnfidoError } from \"./errors/OnfidoError\";\nimport { convertObjectToCamelCase } from \"./formatting\";\n\n// Require crypto instead of importing, because Node can be built without crypto support.\nlet crypto: typeof import(\"crypto\") | undefined;\ntry {\n // tslint:disable-next-line: no-var-requires\n crypto = require(\"crypto\");\n} catch {\n // We throw an error when verifying webhooks instead.\n}\n\nexport type WebhookEvent = {\n resourceType: string;\n action: string;\n object: {\n id: string;\n status: string;\n href: string;\n completedAtIso8601: string;\n };\n};\n\nexport class WebhookEventVerifier {\n private readonly webhookToken: string;\n\n constructor(webhookToken: string) {\n this.webhookToken = webhookToken;\n }\n\n public readPayload(\n rawEventBody: string | Buffer,\n hexSignature: string\n ): WebhookEvent {\n if (!crypto) {\n throw new Error(\"Verifying webhook events requires crypto support\");\n }\n\n const givenSignature = Buffer.from(hexSignature, \"hex\");\n\n // Compute the the actual HMAC signature from the raw request body.\n const hmac = crypto.createHmac(\"sha256\", this.webhookToken);\n hmac.update(rawEventBody);\n const eventSignature = hmac.digest();\n\n // Use timingSafeEqual to prevent against timing attacks.\n if (!crypto.timingSafeEqual(givenSignature, eventSignature)) {\n throw new OnfidoError(\"Invalid signature for webhook event\");\n }\n\n const { payload } = JSON.parse(rawEventBody.toString());\n return convertObjectToCamelCase(payload) as WebhookEvent;\n }\n}\n"],"names":[],"mappings":";;;;;MAAa,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;KAC3B;CACF;;MCHY,cAAe,SAAQ,WAAW;IAM7C,YACE,OAAe,EACf,YAAqB,EACrB,UAAkB,EAClB,IAAY,EACZ,MAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAE7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC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au
|
|
|
7
7
|
var axios = _interopDefault(require('axios'));
|
|
8
8
|
var stream = require('stream');
|
|
9
9
|
|
|
10
|
-
var version = "2.
|
|
10
|
+
var version = "2.7.0";
|
|
11
11
|
|
|
12
12
|
class OnfidoError extends Error {
|
|
13
13
|
constructor(message) {
|
|
@@ -178,9 +178,10 @@ class Resource {
|
|
|
178
178
|
this.axiosInstance = axiosInstance;
|
|
179
179
|
}
|
|
180
180
|
async request({ method, path = "", body, query }) {
|
|
181
|
+
const url = path === null ? `${this.name}` : `${this.name}/${path}`;
|
|
181
182
|
const request = this.axiosInstance({
|
|
182
183
|
method,
|
|
183
|
-
url:
|
|
184
|
+
url: url,
|
|
184
185
|
data: body && convertObjectToSnakeCase(body),
|
|
185
186
|
params: query && convertObjectToSnakeCase(query)
|
|
186
187
|
});
|
|
@@ -441,6 +442,25 @@ class Webhooks extends Resource {
|
|
|
441
442
|
}
|
|
442
443
|
}
|
|
443
444
|
|
|
445
|
+
class WorkflowRuns extends Resource {
|
|
446
|
+
constructor(axiosInstance) {
|
|
447
|
+
super("workflow_runs", axiosInstance);
|
|
448
|
+
}
|
|
449
|
+
async create(workflowRunRequest) {
|
|
450
|
+
return this.request({ method: Method.POST, body: workflowRunRequest });
|
|
451
|
+
}
|
|
452
|
+
async find(id) {
|
|
453
|
+
return this.request({ method: Method.GET, path: id });
|
|
454
|
+
}
|
|
455
|
+
async list(queryParams) {
|
|
456
|
+
const workflowRuns = await this.request({
|
|
457
|
+
method: Method.GET,
|
|
458
|
+
query: queryParams
|
|
459
|
+
});
|
|
460
|
+
return workflowRuns;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
444
464
|
(function (Region) {
|
|
445
465
|
Region["EU"] = "EU";
|
|
446
466
|
Region["US"] = "US";
|
|
@@ -456,7 +476,7 @@ class Onfido {
|
|
|
456
476
|
"We previously defaulted to region 'EU', so if you previously didn’t " +
|
|
457
477
|
"set a region or used api.onfido.com, please set your region to 'EU'");
|
|
458
478
|
}
|
|
459
|
-
const regionUrl = `https://api.${region.toLowerCase()}.onfido.com/v3.
|
|
479
|
+
const regionUrl = `https://api.${region.toLowerCase()}.onfido.com/v3.6/`;
|
|
460
480
|
this.axiosInstance = axios.create({
|
|
461
481
|
baseURL: unknownApiUrl || regionUrl,
|
|
462
482
|
headers: {
|
|
@@ -474,6 +494,7 @@ class Onfido {
|
|
|
474
494
|
this.motionCapture = new MotionCaptures(this.axiosInstance);
|
|
475
495
|
this.check = new Checks(this.axiosInstance);
|
|
476
496
|
this.report = new Reports(this.axiosInstance);
|
|
497
|
+
this.workflowRun = new WorkflowRuns(this.axiosInstance);
|
|
477
498
|
// Other endpoints
|
|
478
499
|
this.address = new Addresses(this.axiosInstance);
|
|
479
500
|
this.webhook = new Webhooks(this.axiosInstance);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/errors/OnfidoError.ts","../src/errors/OnfidoApiError.ts","../src/formatting.ts","../src/OnfidoDownload.ts","../src/Resource.ts","../src/resources/Addresses.ts","../src/resources/Applicants.ts","../src/resources/Autofill.ts","../src/resources/Checks.ts","../src/resources/Documents.ts","../src/resources/LivePhotos.ts","../src/resources/LiveVideos.ts","../src/resources/MotionCaptures.ts","../src/resources/Reports.ts","../src/resources/SdkTokens.ts","../src/resources/Webhooks.ts","../src/Onfido.ts","../src/WebhookEventVerifier.ts"],"sourcesContent":["export class OnfidoError extends Error {\n constructor(message?: string) {\n super(message);\n this.name = \"OnfidoError\";\n }\n}\n","import { OnfidoError } from \"./OnfidoError\";\n\nexport class OnfidoApiError extends OnfidoError {\n public readonly responseBody: unknown;\n public readonly statusCode: number;\n public readonly type: string;\n public readonly fields: unknown;\n\n private constructor(\n message: string,\n responseBody: unknown,\n statusCode: number,\n type: string,\n fields: unknown\n ) {\n super(message);\n this.name = \"OnfidoApiError\";\n\n this.responseBody = responseBody;\n this.statusCode = statusCode;\n this.type = type;\n this.fields = fields;\n }\n\n public static fromResponse(\n responseBody: unknown,\n statusCode: number\n ): OnfidoApiError {\n const innerErrorData: unknown =\n responseBody instanceof Object ? (responseBody as any).error : {};\n\n const innerError: {\n type?: unknown;\n message?: unknown;\n fields?: unknown;\n } = innerErrorData instanceof Object ? innerErrorData : {};\n\n const type = `${innerError.type || \"unknown\"}`;\n const message = `${innerError.message || responseBody}`;\n const fields = innerError.fields;\n\n const fullMessage =\n `${message} (status code ${statusCode})` +\n (fields ? ` | ${JSON.stringify(fields)}` : \"\");\n\n return new OnfidoApiError(\n fullMessage,\n responseBody,\n statusCode,\n type,\n fields\n );\n }\n\n public isClientError(): boolean {\n return this.statusCode < 500;\n }\n}\n","import { Readable } from \"stream\";\nimport { IFormData } from \"./types/formData\";\n\n// Using require because \"form-data\" exports this object as a default export which breaks integration when esModuleInterop: false\n// tslint:disable-next-line: no-var-requires\nconst FormData = require(\"form-data\");\n\nexport type SimpleObject = { [key: string]: unknown };\n\ntype ContentsAndOptions = {\n contents: Readable;\n filepath: string;\n contentType?: string;\n};\n\nexport type FileLike = Readable | ContentsAndOptions;\n\nconst snakeCase = (camelCaseString: string): string =>\n camelCaseString.replace(/[A-Z]/g, char => `_${char.toLowerCase()}`);\n\nconst camelCase = (snakeCaseString: string): string =>\n snakeCaseString\n .replace(/_[0-9]/g, underscoreDigit => underscoreDigit[1])\n .replace(/_[a-z]/g, underscoreChar => underscoreChar[1].toUpperCase());\n\nconst deepMapObjectKeys = (value: unknown, f: (key: string) => string): any => {\n if (!(value instanceof Object)) {\n return value;\n } else if (Array.isArray(value)) {\n return value.map(item => deepMapObjectKeys(item, f));\n } else {\n return Object.keys(value).reduce<SimpleObject>((acc, key) => {\n acc[f(key)] = deepMapObjectKeys((value as SimpleObject)[key], f);\n return acc;\n }, {});\n }\n};\n\nexport const convertObjectToSnakeCase = (requestBody: unknown): unknown => {\n // Converting to JSON and back first handles things like dates, circular references etc.\n requestBody = JSON.parse(JSON.stringify(requestBody));\n\n return deepMapObjectKeys(requestBody, snakeCase);\n};\n\nexport const convertObjectToCamelCase = (\n responseBody: SimpleObject\n): SimpleObject => deepMapObjectKeys(responseBody, camelCase);\n\nexport const toFormData = (object: SimpleObject): IFormData => {\n return Object.entries(object).reduce((formData, [key, value]) => {\n if (value instanceof Object && \"contents\" in value) {\n const { contents, ...options } = value as ContentsAndOptions;\n formData.append(snakeCase(key), contents, options);\n } else if (value !== undefined && value !== null) {\n if (value instanceof Object) {\n for (const [elementKey, elementValue] of Object.entries(value)) {\n formData.append(snakeCase(key + \"[\" + elementKey + \"]\"), elementValue);\n }\n } else {\n formData.append(snakeCase(key), value);\n }\n }\n return formData;\n }, new FormData());\n};\n","import { IncomingMessage } from \"http\";\nimport { PassThrough, Readable } from \"stream\";\n\nexport class OnfidoDownload {\n private readonly incomingMessage: IncomingMessage;\n\n constructor(incomingMessage: IncomingMessage) {\n this.incomingMessage = incomingMessage;\n }\n\n public asStream(): Readable {\n // Use a PassThrough stream so the IncomingMessage isn't exposed.\n const passThroughStream = new PassThrough();\n this.incomingMessage.pipe(passThroughStream);\n return passThroughStream;\n }\n\n public get contentType(): string {\n return this.incomingMessage.headers[\"content-type\"]!;\n }\n}\n","import { AxiosInstance, AxiosPromise, AxiosResponse } from \"axios\";\nimport { IncomingMessage } from \"http\";\nimport { Readable } from \"stream\";\nimport { OnfidoApiError } from \"./errors/OnfidoApiError\";\nimport { OnfidoError } from \"./errors/OnfidoError\";\nimport {\n convertObjectToCamelCase,\n convertObjectToSnakeCase,\n SimpleObject,\n toFormData\n} from \"./formatting\";\nimport { OnfidoDownload } from \"./OnfidoDownload\";\n\nexport enum Method {\n GET = \"get\",\n POST = \"post\",\n PUT = \"put\",\n DELETE = \"delete\"\n}\n\nconst isJson = (response: AxiosResponse<unknown>): boolean =>\n (response.headers[\"content-type\"] || \"\").includes(\"application/json\");\n\nconst readFullStream = (stream: Readable): Promise<unknown> =>\n new Promise((resolve): void => {\n let all = \"\";\n\n stream.on(\"data\", data => (all += data));\n stream.on(\"error\", () => resolve(\"An error occurred reading the response\"));\n stream.on(\"end\", () => {\n // Try to parse as JSON, but fall back to just returning the raw text.\n try {\n resolve(JSON.parse(all));\n } catch {\n resolve(all);\n }\n });\n });\n\nconst convertAxiosErrorToOnfidoError = async (\n error: any\n): Promise<OnfidoError> => {\n if (!error.response) {\n return new OnfidoError(\n error.message || \"An unknown error occurred making the request\"\n );\n }\n\n // Received a 4XX or 5XX response.\n const response: AxiosResponse = error.response;\n const data = response.data;\n\n // If we were downloading a file, we will have a stream instead of a string.\n const body = data instanceof Readable ? await readFullStream(data) : data;\n\n return OnfidoApiError.fromResponse(body, response.status);\n};\n\nconst handleResponse = async (request: AxiosPromise<any>): Promise<any> => {\n try {\n const response = await request;\n const data = response.data;\n return isJson(response) ? convertObjectToCamelCase(data) : data;\n } catch (error) {\n throw await convertAxiosErrorToOnfidoError(error);\n }\n};\n\nexport class Resource<T extends SimpleObject> {\n private readonly name: string;\n private readonly axiosInstance: AxiosInstance;\n\n protected constructor(name: string, axiosInstance: AxiosInstance) {\n this.name = name;\n this.axiosInstance = axiosInstance;\n }\n\n protected async request({\n method,\n path = \"\",\n body,\n query\n }: {\n method: Method;\n path?: string;\n body?: T;\n query?: SimpleObject;\n }): Promise<any> {\n const request = this.axiosInstance({\n method,\n url: `${this.name}/${path}`,\n data: body && convertObjectToSnakeCase(body),\n params: query && convertObjectToSnakeCase(query)\n });\n\n return handleResponse(request);\n }\n\n protected async upload(body: T): Promise<any> {\n const formData = toFormData(body);\n\n const request = this.axiosInstance({\n method: Method.POST,\n url: `${this.name}/`,\n data: formData,\n headers: formData.getHeaders()\n });\n\n return handleResponse(request);\n }\n\n protected async download(path: string): Promise<OnfidoDownload> {\n const request = this.axiosInstance({\n method: Method.GET,\n url: `${this.name}/${path}`,\n responseType: \"stream\",\n // Accept a response with any content type (e.g. image/png, application/pdf, video/mp4)\n headers: { Accept: \"*/*\" }\n });\n\n const stream: IncomingMessage = await handleResponse(request);\n return new OnfidoDownload(stream);\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\ntype AddressOptional = {\n flatNumber: string | null;\n buildingNumber: string | null;\n buildingName: string | null;\n street: string | null;\n subStreet: string | null;\n town: string | null;\n state: string | null;\n line1: string | null;\n line2: string | null;\n line3: string | null;\n};\n\nexport type AddressRequest = {\n postcode: string;\n country: string;\n} & Partial<AddressOptional>;\n\nexport type Address = {\n postcode: string;\n country: string;\n} & Partial<AddressOptional>;\n\nexport class Addresses extends Resource<never> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"addresses\", axiosInstance);\n }\n\n public async pick(postcode: string): Promise<Address[]> {\n const { addresses } = await this.request({\n method: Method.GET,\n path: \"pick\",\n query: { postcode }\n });\n\n return addresses;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\nimport { Address, AddressRequest } from \"./Addresses\";\nimport { IdNumber, IdNumberRequest } from \"./IdNumbers\";\nimport { Location, LocationRequest } from \"./Location\";\nimport { ConsentsRequest } from \"./ConsentsRequest\";\n\n// firstName and lastName are also optional, to allow updating.\nexport type ApplicantRequest = {\n firstName?: string | null;\n lastName?: string | null;\n email?: string | null;\n dob?: string | null;\n address?: AddressRequest | null;\n idNumbers?: IdNumberRequest[] | null;\n phoneNumber?: string | null;\n location?: LocationRequest | null;\n consents?: ConsentsRequest[] | null;\n};\n\nexport type Applicant = {\n id: string;\n createdAt: string;\n deleteAt: string | null;\n href: string;\n firstName: string;\n lastName: string;\n email: string | null;\n dob: string | null;\n address: Address | null;\n idNumbers: IdNumber[] | null;\n phoneNumber: string | null;\n location: Location | null;\n};\n\nexport class Applicants extends Resource<ApplicantRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"applicants\", axiosInstance);\n }\n\n public async create(applicantRequest: ApplicantRequest): Promise<Applicant> {\n return this.request({ method: Method.POST, body: applicantRequest });\n }\n\n public async find(id: string): Promise<Applicant> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async update(\n id: string,\n applicantRequest: ApplicantRequest\n ): Promise<Applicant> {\n return this.request({\n method: Method.PUT,\n path: id,\n body: applicantRequest\n });\n }\n\n public async delete(id: string): Promise<void> {\n await this.request({ method: Method.DELETE, path: id });\n }\n\n public async restore(id: string): Promise<void> {\n await this.request({ method: Method.POST, path: `${id}/restore` });\n }\n\n public async list({\n page,\n perPage,\n includeDeleted\n }: {\n page?: number;\n perPage?: number;\n includeDeleted?: boolean;\n } = {}): Promise<Applicant[]> {\n const { applicants } = await this.request({\n method: Method.GET,\n query: { page, perPage, includeDeleted }\n });\n\n return applicants;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type ExtractionResult = {\n documentId: string;\n documentClassification: {\n issuingCountry: string;\n documentType: string;\n issuingState?: string;\n };\n extractedData: {\n documentNumber?: string;\n firstName?: string;\n lastName?: string;\n middleName?: string;\n fullName?: string;\n gender?: string;\n dateOfBirth?: string;\n dateOfExpiry?: string;\n nationality?: string;\n mrzLine1?: string;\n mrzLine2?: string;\n mrzLine3?: string;\n addressLine1?: string;\n addressLine2?: string;\n addressLine3?: string;\n addressLine4?: string;\n addressLine5?: string;\n };\n};\n\ntype AutofillResource = {\n documentId: string;\n};\n\nexport class Autofill extends Resource<AutofillResource> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"extractions\", axiosInstance);\n }\n\n public async perform(documentId: string): Promise<ExtractionResult> {\n return this.request({\n method: Method.POST,\n body: { documentId }\n });\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type CheckRequest = {\n applicantId: string;\n reportNames: string[];\n documentIds?: string[] | null;\n applicantProvidesData?: boolean;\n asynchronous?: boolean;\n tags?: string[] | null;\n suppressFormEmails?: boolean;\n redirectUri?: string | null;\n privacyNoticesReadConsentGiven?: boolean;\n webhookIds?: string[] | null;\n subResult?: string;\n consider?: string[];\n};\n\nexport type Check = {\n id: string;\n reportIds: string[];\n createdAt: string;\n href: string;\n applicantId: string;\n applicantProvidesData: boolean;\n status: string;\n tags: string[];\n result: string | null;\n formUri: string | null;\n redirectUri: string | null;\n resultsUri: string;\n privacyNoticesReadConsentGiven: boolean;\n webhookIds: string[] | null;\n};\n\nexport class Checks extends Resource<CheckRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"checks\", axiosInstance);\n }\n\n public async create(checkRequest: CheckRequest): Promise<Check> {\n return this.request({ method: Method.POST, body: checkRequest });\n }\n\n public async find(id: string): Promise<Check> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<Check[]> {\n const { checks } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return checks;\n }\n\n public async resume(id: string): Promise<void> {\n await this.request({ method: Method.POST, path: `${id}/resume` });\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { FileLike } from \"../formatting\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\nimport { LocationRequest } from \"./Location\";\n\nexport type DocumentRequest = {\n applicantId?: string | null;\n file: FileLike;\n type: string;\n side?: string | null;\n issuingCountry?: string | null;\n validateImageQuality?: boolean | null;\n location?: LocationRequest | null;\n};\n\nexport type Document = {\n id: string;\n applicantId: string | null;\n createdAt: string;\n href: string;\n downloadHref: string;\n fileName: string;\n fileType: string;\n fileSize: number;\n type: string;\n side: string | null;\n issuingCountry: string | null;\n};\n\nexport class Documents extends Resource<DocumentRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"documents\", axiosInstance);\n }\n\n public async upload(documentRequest: DocumentRequest): Promise<Document> {\n return super.upload(documentRequest);\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n\n public async find(id: string): Promise<Document> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<Document[]> {\n const { documents } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return documents;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { FileLike } from \"../formatting\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type LivePhotoRequest = {\n applicantId: string;\n file: FileLike;\n advancedValidation?: string;\n};\n\nexport type LivePhoto = {\n id: string;\n createdAt: string;\n href: string;\n downloadHref: string;\n fileName: string;\n fileType: string;\n fileSize: number;\n};\n\nexport class LivePhotos extends Resource<LivePhotoRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"live_photos\", axiosInstance);\n }\n\n public async upload(livePhotoRequest: LivePhotoRequest): Promise<LivePhoto> {\n return super.upload(livePhotoRequest);\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n\n public async find(id: string): Promise<LivePhoto> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<LivePhoto[]> {\n const { livePhotos } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return livePhotos;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type LiveVideo = {\n id: string;\n createdAt: string;\n href: string;\n downloadHref: string;\n fileName: string;\n fileType: string;\n fileSize: number;\n};\n\nexport class LiveVideos extends Resource<never> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"live_videos\", axiosInstance);\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n\n public async frame(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/frame`);\n }\n\n public async find(id: string): Promise<LiveVideo> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<LiveVideo[]> {\n const { liveVideos } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return liveVideos;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type MotionCapture = {\n id: string;\n createdAt: string;\n href: string;\n downloadHref: string;\n fileName: string;\n fileType: string;\n fileSize: number;\n};\n\nexport class MotionCaptures extends Resource<never> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"motion_captures\", axiosInstance);\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n\n public async frame(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/frame`);\n }\n\n public async find(id: string): Promise<MotionCapture> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<MotionCapture[]> {\n const { motionCaptures } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return motionCaptures;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type Report = {\n id: string;\n createdAt: string;\n name: string;\n href: string;\n status: string;\n result: string | null;\n subResult: string | null;\n properties: object | null;\n breakdown: object | null;\n documents: Array<{ id: string }>;\n checkId: string;\n};\n\nexport class Reports extends Resource<never> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"reports\", axiosInstance);\n }\n\n public async find(id: string): Promise<Report> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(checkId: string): Promise<Report[]> {\n const { reports } = await this.request({\n method: Method.GET,\n query: { checkId }\n });\n\n return reports;\n }\n\n public async resume(id: string): Promise<void> {\n await this.request({ method: Method.POST, path: `${id}/resume` });\n }\n\n public async cancel(id: string): Promise<void> {\n await this.request({ method: Method.POST, path: `${id}/cancel` });\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type SdkTokenRequest = {\n applicantId: string;\n applicationId?: string | null;\n referrer?: string | null;\n crossDeviceUrl?: string | null;\n};\n\nexport class SdkTokens extends Resource<SdkTokenRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"sdk_token\", axiosInstance);\n }\n\n public async generate(sdkTokenRequest: SdkTokenRequest): Promise<string> {\n const { token } = await this.request({\n method: Method.POST,\n body: sdkTokenRequest\n });\n\n return token;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\n// url is also optional to allow updating.\nexport type WebhookRequest = {\n url?: string | null;\n enabled?: boolean;\n environments?: string[];\n events?: string[] | null;\n};\n\nexport type Webhook = {\n id: string;\n url: string;\n enabled: boolean;\n events: string[];\n token: string;\n href: string;\n environments: string[];\n};\n\nexport class Webhooks extends Resource<WebhookRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"webhooks\", axiosInstance);\n }\n\n public async create(webhookRequest: WebhookRequest): Promise<Webhook> {\n return this.request({ method: Method.POST, body: webhookRequest });\n }\n\n public async find(id: string): Promise<Webhook> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async update(\n id: string,\n webhookRequest: WebhookRequest\n ): Promise<Webhook> {\n return this.request({\n method: Method.PUT,\n path: id,\n body: webhookRequest\n });\n }\n\n public async delete(id: string): Promise<void> {\n await this.request({ method: Method.DELETE, path: id });\n }\n\n public async list(): Promise<Webhook[]> {\n const { webhooks } = await this.request({ method: Method.GET });\n\n return webhooks;\n }\n}\n","import axios, { AxiosInstance } from \"axios\";\nimport { version } from \"../package.json\";\nimport { Addresses } from \"./resources/Addresses\";\nimport { Applicants } from \"./resources/Applicants\";\nimport { Autofill } from \"./resources/Autofill\";\nimport { Checks } from \"./resources/Checks\";\nimport { Documents } from \"./resources/Documents\";\nimport { LivePhotos } from \"./resources/LivePhotos\";\nimport { LiveVideos } from \"./resources/LiveVideos\";\nimport { MotionCaptures } from \"./resources/MotionCaptures\";\nimport { Reports } from \"./resources/Reports\";\nimport { SdkTokens } from \"./resources/SdkTokens\";\nimport { Webhooks } from \"./resources/Webhooks\";\n\nexport enum Region {\n EU = \"EU\",\n US = \"US\",\n CA = \"CA\"\n}\n\nexport type OnfidoOptions = {\n apiToken: string;\n region: Region;\n timeout?: number;\n unknownApiUrl?: string;\n};\n\nexport class Onfido {\n public readonly axiosInstance: AxiosInstance;\n // Core resources\n public readonly applicant: Applicants;\n public readonly document: Documents;\n public readonly livePhoto: LivePhotos;\n public readonly liveVideo: LiveVideos;\n public readonly motionCapture: MotionCaptures;\n public readonly check: Checks;\n public readonly report: Reports;\n // Other endpoints\n public readonly address: Addresses;\n public readonly webhook: Webhooks;\n public readonly sdkToken: SdkTokens;\n public readonly autofill: Autofill;\n\n constructor({\n apiToken,\n region,\n timeout = 30_000,\n unknownApiUrl\n }: OnfidoOptions) {\n if (!apiToken) {\n throw new Error(\"No apiToken provided\");\n }\n if (!region || !Object.values(Region).includes(region)) {\n throw new Error(\n `Unknown or missing region '${region}'. ` +\n \"We previously defaulted to region 'EU', so if you previously didn’t \" +\n \"set a region or used api.onfido.com, please set your region to 'EU'\"\n );\n }\n\n const regionUrl = `https://api.${region.toLowerCase()}.onfido.com/v3.5/`;\n\n this.axiosInstance = axios.create({\n baseURL: unknownApiUrl || regionUrl,\n headers: {\n Authorization: `Token token=${apiToken}`,\n Accept: \"application/json\",\n \"User-Agent\": `onfido-node/${version}`\n },\n timeout\n });\n\n // Core resources\n this.applicant = new Applicants(this.axiosInstance);\n this.document = new Documents(this.axiosInstance);\n this.livePhoto = new LivePhotos(this.axiosInstance);\n this.liveVideo = new LiveVideos(this.axiosInstance);\n this.motionCapture = new MotionCaptures(this.axiosInstance);\n this.check = new Checks(this.axiosInstance);\n this.report = new Reports(this.axiosInstance);\n // Other endpoints\n this.address = new Addresses(this.axiosInstance);\n this.webhook = new Webhooks(this.axiosInstance);\n this.sdkToken = new SdkTokens(this.axiosInstance);\n this.autofill = new Autofill(this.axiosInstance);\n }\n}\n","import { OnfidoError } from \"./errors/OnfidoError\";\nimport { convertObjectToCamelCase } from \"./formatting\";\n\n// Require crypto instead of importing, because Node can be built without crypto support.\nlet crypto: typeof import(\"crypto\") | undefined;\ntry {\n // tslint:disable-next-line: no-var-requires\n crypto = require(\"crypto\");\n} catch {\n // We throw an error when verifying webhooks instead.\n}\n\nexport type WebhookEvent = {\n resourceType: string;\n action: string;\n object: {\n id: string;\n status: string;\n href: string;\n completedAtIso8601: string;\n };\n};\n\nexport class WebhookEventVerifier {\n private readonly webhookToken: string;\n\n constructor(webhookToken: string) {\n this.webhookToken = webhookToken;\n }\n\n public readPayload(\n rawEventBody: string | Buffer,\n hexSignature: string\n ): WebhookEvent {\n if (!crypto) {\n throw new Error(\"Verifying webhook events requires crypto support\");\n }\n\n const givenSignature = Buffer.from(hexSignature, \"hex\");\n\n // Compute the the actual HMAC signature from the raw request body.\n const hmac = crypto.createHmac(\"sha256\", this.webhookToken);\n hmac.update(rawEventBody);\n const eventSignature = hmac.digest();\n\n // Use timingSafeEqual to prevent against timing attacks.\n if (!crypto.timingSafeEqual(givenSignature, eventSignature)) {\n throw new OnfidoError(\"Invalid signature for webhook event\");\n }\n\n const { payload } = JSON.parse(rawEventBody.toString());\n return convertObjectToCamelCase(payload) as WebhookEvent;\n }\n}\n"],"names":["PassThrough","Readable","Region"],"mappings":";;;;;;;;;;;MAAa,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;KAC3B;CACF;;MCHY,cAAe,SAAQ,WAAW;IAM7C,YACE,OAAe,EACf,YAAqB,EACrB,UAAkB,EAClB,IAAY,EACZ,MAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAE7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;KACtB;IAEM,OAAO,YAAY,CACxB,YAAqB,EACrB,UAAkB;QAElB,MAAM,cAAc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C3D,MAAM,IAAI,WAAW,CAAC,qCAAqC,CAAC,CAAC;SAC9D;QAED,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;QACxD,OAAO,wBAAwB,CAAC,OAAO,CAAiB,CAAC;KAC1D;CACF;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/errors/OnfidoError.ts","../src/errors/OnfidoApiError.ts","../src/formatting.ts","../src/OnfidoDownload.ts","../src/Resource.ts","../src/resources/Addresses.ts","../src/resources/Applicants.ts","../src/resources/Autofill.ts","../src/resources/Checks.ts","../src/resources/Documents.ts","../src/resources/LivePhotos.ts","../src/resources/LiveVideos.ts","../src/resources/MotionCaptures.ts","../src/resources/Reports.ts","../src/resources/SdkTokens.ts","../src/resources/Webhooks.ts","../src/resources/WorkflowRuns.ts","../src/Onfido.ts","../src/WebhookEventVerifier.ts"],"sourcesContent":["export class OnfidoError extends Error {\n constructor(message?: string) {\n super(message);\n this.name = \"OnfidoError\";\n }\n}\n","import { OnfidoError } from \"./OnfidoError\";\n\nexport class OnfidoApiError extends OnfidoError {\n public readonly responseBody: unknown;\n public readonly statusCode: number;\n public readonly type: string;\n public readonly fields: unknown;\n\n private constructor(\n message: string,\n responseBody: unknown,\n statusCode: number,\n type: string,\n fields: unknown\n ) {\n super(message);\n this.name = \"OnfidoApiError\";\n\n this.responseBody = responseBody;\n this.statusCode = statusCode;\n this.type = type;\n this.fields = fields;\n }\n\n public static fromResponse(\n responseBody: unknown,\n statusCode: number\n ): OnfidoApiError {\n const innerErrorData: unknown =\n responseBody instanceof Object ? (responseBody as any).error : {};\n\n const innerError: {\n type?: unknown;\n message?: unknown;\n fields?: unknown;\n } = innerErrorData instanceof Object ? innerErrorData : {};\n\n const type = `${innerError.type || \"unknown\"}`;\n const message = `${innerError.message || responseBody}`;\n const fields = innerError.fields;\n\n const fullMessage =\n `${message} (status code ${statusCode})` +\n (fields ? ` | ${JSON.stringify(fields)}` : \"\");\n\n return new OnfidoApiError(\n fullMessage,\n responseBody,\n statusCode,\n type,\n fields\n );\n }\n\n public isClientError(): boolean {\n return this.statusCode < 500;\n }\n}\n","import { Readable } from \"stream\";\nimport { IFormData } from \"./types/formData\";\n\n// Using require because \"form-data\" exports this object as a default export which breaks integration when esModuleInterop: false\n// tslint:disable-next-line: no-var-requires\nconst FormData = require(\"form-data\");\n\nexport type SimpleObject = { [key: string]: unknown };\n\ntype ContentsAndOptions = {\n contents: Readable;\n filepath: string;\n contentType?: string;\n};\n\nexport type FileLike = Readable | ContentsAndOptions;\n\nconst snakeCase = (camelCaseString: string): string =>\n camelCaseString.replace(/[A-Z]/g, char => `_${char.toLowerCase()}`);\n\nconst camelCase = (snakeCaseString: string): string =>\n snakeCaseString\n .replace(/_[0-9]/g, underscoreDigit => underscoreDigit[1])\n .replace(/_[a-z]/g, underscoreChar => underscoreChar[1].toUpperCase());\n\nconst deepMapObjectKeys = (value: unknown, f: (key: string) => string): any => {\n if (!(value instanceof Object)) {\n return value;\n } else if (Array.isArray(value)) {\n return value.map(item => deepMapObjectKeys(item, f));\n } else {\n return Object.keys(value).reduce<SimpleObject>((acc, key) => {\n acc[f(key)] = deepMapObjectKeys((value as SimpleObject)[key], f);\n return acc;\n }, {});\n }\n};\n\nexport const convertObjectToSnakeCase = (requestBody: unknown): unknown => {\n // Converting to JSON and back first handles things like dates, circular references etc.\n requestBody = JSON.parse(JSON.stringify(requestBody));\n\n return deepMapObjectKeys(requestBody, snakeCase);\n};\n\nexport const convertObjectToCamelCase = (\n responseBody: SimpleObject\n): SimpleObject => deepMapObjectKeys(responseBody, camelCase);\n\nexport const toFormData = (object: SimpleObject): IFormData => {\n return Object.entries(object).reduce((formData, [key, value]) => {\n if (value instanceof Object && \"contents\" in value) {\n const { contents, ...options } = value as ContentsAndOptions;\n formData.append(snakeCase(key), contents, options);\n } else if (value !== undefined && value !== null) {\n if (value instanceof Object) {\n for (const [elementKey, elementValue] of Object.entries(value)) {\n formData.append(snakeCase(key + \"[\" + elementKey + \"]\"), elementValue);\n }\n } else {\n formData.append(snakeCase(key), value);\n }\n }\n return formData;\n }, new FormData());\n};\n","import { IncomingMessage } from \"http\";\nimport { PassThrough, Readable } from \"stream\";\n\nexport class OnfidoDownload {\n private readonly incomingMessage: IncomingMessage;\n\n constructor(incomingMessage: IncomingMessage) {\n this.incomingMessage = incomingMessage;\n }\n\n public asStream(): Readable {\n // Use a PassThrough stream so the IncomingMessage isn't exposed.\n const passThroughStream = new PassThrough();\n this.incomingMessage.pipe(passThroughStream);\n return passThroughStream;\n }\n\n public get contentType(): string {\n return this.incomingMessage.headers[\"content-type\"]!;\n }\n}\n","import { AxiosInstance, AxiosPromise, AxiosResponse } from \"axios\";\nimport { IncomingMessage } from \"http\";\nimport { Readable } from \"stream\";\nimport { OnfidoApiError } from \"./errors/OnfidoApiError\";\nimport { OnfidoError } from \"./errors/OnfidoError\";\nimport {\n convertObjectToCamelCase,\n convertObjectToSnakeCase,\n SimpleObject,\n toFormData\n} from \"./formatting\";\nimport { OnfidoDownload } from \"./OnfidoDownload\";\n\nexport enum Method {\n GET = \"get\",\n POST = \"post\",\n PUT = \"put\",\n DELETE = \"delete\"\n}\n\nconst isJson = (response: AxiosResponse<unknown>): boolean =>\n (response.headers[\"content-type\"] || \"\").includes(\"application/json\");\n\nconst readFullStream = (stream: Readable): Promise<unknown> =>\n new Promise((resolve): void => {\n let all = \"\";\n\n stream.on(\"data\", data => (all += data));\n stream.on(\"error\", () => resolve(\"An error occurred reading the response\"));\n stream.on(\"end\", () => {\n // Try to parse as JSON, but fall back to just returning the raw text.\n try {\n resolve(JSON.parse(all));\n } catch {\n resolve(all);\n }\n });\n });\n\nconst convertAxiosErrorToOnfidoError = async (\n error: any\n): Promise<OnfidoError> => {\n if (!error.response) {\n return new OnfidoError(\n error.message || \"An unknown error occurred making the request\"\n );\n }\n\n // Received a 4XX or 5XX response.\n const response: AxiosResponse = error.response;\n const data = response.data;\n\n // If we were downloading a file, we will have a stream instead of a string.\n const body = data instanceof Readable ? await readFullStream(data) : data;\n\n return OnfidoApiError.fromResponse(body, response.status);\n};\n\nconst handleResponse = async (request: AxiosPromise<any>): Promise<any> => {\n try {\n const response = await request;\n const data = response.data;\n return isJson(response) ? convertObjectToCamelCase(data) : data;\n } catch (error) {\n throw await convertAxiosErrorToOnfidoError(error);\n }\n};\n\nexport class Resource<T extends SimpleObject> {\n private readonly name: string;\n private readonly axiosInstance: AxiosInstance;\n\n protected constructor(name: string, axiosInstance: AxiosInstance) {\n this.name = name;\n this.axiosInstance = axiosInstance;\n }\n\n protected async request({\n method,\n path = \"\",\n body,\n query\n }: {\n method: Method;\n path?: string;\n body?: T;\n query?: SimpleObject;\n }): Promise<any> {\n const url = path === null ? `${this.name}` : `${this.name}/${path}`;\n const request = this.axiosInstance({\n method,\n url: url,\n data: body && convertObjectToSnakeCase(body),\n params: query && convertObjectToSnakeCase(query)\n });\n\n return handleResponse(request);\n }\n\n protected async upload(body: T): Promise<any> {\n const formData = toFormData(body);\n\n const request = this.axiosInstance({\n method: Method.POST,\n url: `${this.name}/`,\n data: formData,\n headers: formData.getHeaders()\n });\n\n return handleResponse(request);\n }\n\n protected async download(path: string): Promise<OnfidoDownload> {\n const request = this.axiosInstance({\n method: Method.GET,\n url: `${this.name}/${path}`,\n responseType: \"stream\",\n // Accept a response with any content type (e.g. image/png, application/pdf, video/mp4)\n headers: { Accept: \"*/*\" }\n });\n\n const stream: IncomingMessage = await handleResponse(request);\n return new OnfidoDownload(stream);\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\ntype AddressOptional = {\n flatNumber: string | null;\n buildingNumber: string | null;\n buildingName: string | null;\n street: string | null;\n subStreet: string | null;\n town: string | null;\n state: string | null;\n line1: string | null;\n line2: string | null;\n line3: string | null;\n};\n\nexport type AddressRequest = {\n postcode: string;\n country: string;\n} & Partial<AddressOptional>;\n\nexport type Address = {\n postcode: string;\n country: string;\n} & Partial<AddressOptional>;\n\nexport class Addresses extends Resource<never> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"addresses\", axiosInstance);\n }\n\n public async pick(postcode: string): Promise<Address[]> {\n const { addresses } = await this.request({\n method: Method.GET,\n path: \"pick\",\n query: { postcode }\n });\n\n return addresses;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\nimport { Address, AddressRequest } from \"./Addresses\";\nimport { IdNumber, IdNumberRequest } from \"./IdNumbers\";\nimport { Location, LocationRequest } from \"./Location\";\nimport { ConsentsRequest } from \"./ConsentsRequest\";\n\n// firstName and lastName are also optional, to allow updating.\nexport type ApplicantRequest = {\n firstName?: string | null;\n lastName?: string | null;\n email?: string | null;\n dob?: string | null;\n address?: AddressRequest | null;\n idNumbers?: IdNumberRequest[] | null;\n phoneNumber?: string | null;\n location?: LocationRequest | null;\n consents?: ConsentsRequest[] | null;\n};\n\nexport type Applicant = {\n id: string;\n createdAt: string;\n deleteAt: string | null;\n href: string;\n firstName: string;\n lastName: string;\n email: string | null;\n dob: string | null;\n address: Address | null;\n idNumbers: IdNumber[] | null;\n phoneNumber: string | null;\n location: Location | null;\n};\n\nexport class Applicants extends Resource<ApplicantRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"applicants\", axiosInstance);\n }\n\n public async create(applicantRequest: ApplicantRequest): Promise<Applicant> {\n return this.request({ method: Method.POST, body: applicantRequest });\n }\n\n public async find(id: string): Promise<Applicant> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async update(\n id: string,\n applicantRequest: ApplicantRequest\n ): Promise<Applicant> {\n return this.request({\n method: Method.PUT,\n path: id,\n body: applicantRequest\n });\n }\n\n public async delete(id: string): Promise<void> {\n await this.request({ method: Method.DELETE, path: id });\n }\n\n public async restore(id: string): Promise<void> {\n await this.request({ method: Method.POST, path: `${id}/restore` });\n }\n\n public async list({\n page,\n perPage,\n includeDeleted\n }: {\n page?: number;\n perPage?: number;\n includeDeleted?: boolean;\n } = {}): Promise<Applicant[]> {\n const { applicants } = await this.request({\n method: Method.GET,\n query: { page, perPage, includeDeleted }\n });\n\n return applicants;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type ExtractionResult = {\n documentId: string;\n documentClassification: {\n issuingCountry: string;\n documentType: string;\n issuingState?: string;\n };\n extractedData: {\n documentNumber?: string;\n firstName?: string;\n lastName?: string;\n middleName?: string;\n fullName?: string;\n gender?: string;\n dateOfBirth?: string;\n dateOfExpiry?: string;\n nationality?: string;\n mrzLine1?: string;\n mrzLine2?: string;\n mrzLine3?: string;\n addressLine1?: string;\n addressLine2?: string;\n addressLine3?: string;\n addressLine4?: string;\n addressLine5?: string;\n };\n};\n\ntype AutofillResource = {\n documentId: string;\n};\n\nexport class Autofill extends Resource<AutofillResource> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"extractions\", axiosInstance);\n }\n\n public async perform(documentId: string): Promise<ExtractionResult> {\n return this.request({\n method: Method.POST,\n body: { documentId }\n });\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type CheckRequest = {\n applicantId: string;\n reportNames: string[];\n documentIds?: string[] | null;\n applicantProvidesData?: boolean;\n asynchronous?: boolean;\n tags?: string[] | null;\n suppressFormEmails?: boolean;\n redirectUri?: string | null;\n privacyNoticesReadConsentGiven?: boolean;\n webhookIds?: string[] | null;\n subResult?: string;\n consider?: string[];\n};\n\nexport type Check = {\n id: string;\n reportIds: string[];\n createdAt: string;\n href: string;\n applicantId: string;\n applicantProvidesData: boolean;\n status: string;\n tags: string[];\n result: string | null;\n formUri: string | null;\n redirectUri: string | null;\n resultsUri: string;\n privacyNoticesReadConsentGiven: boolean;\n webhookIds: string[] | null;\n};\n\nexport class Checks extends Resource<CheckRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"checks\", axiosInstance);\n }\n\n public async create(checkRequest: CheckRequest): Promise<Check> {\n return this.request({ method: Method.POST, body: checkRequest });\n }\n\n public async find(id: string): Promise<Check> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<Check[]> {\n const { checks } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return checks;\n }\n\n public async resume(id: string): Promise<void> {\n await this.request({ method: Method.POST, path: `${id}/resume` });\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { FileLike } from \"../formatting\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\nimport { LocationRequest } from \"./Location\";\n\nexport type DocumentRequest = {\n applicantId?: string | null;\n file: FileLike;\n type: string;\n side?: string | null;\n issuingCountry?: string | null;\n validateImageQuality?: boolean | null;\n location?: LocationRequest | null;\n};\n\nexport type Document = {\n id: string;\n applicantId: string | null;\n createdAt: string;\n href: string;\n downloadHref: string;\n fileName: string;\n fileType: string;\n fileSize: number;\n type: string;\n side: string | null;\n issuingCountry: string | null;\n};\n\nexport class Documents extends Resource<DocumentRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"documents\", axiosInstance);\n }\n\n public async upload(documentRequest: DocumentRequest): Promise<Document> {\n return super.upload(documentRequest);\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n\n public async find(id: string): Promise<Document> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<Document[]> {\n const { documents } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return documents;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { FileLike } from \"../formatting\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type LivePhotoRequest = {\n applicantId: string;\n file: FileLike;\n advancedValidation?: string;\n};\n\nexport type LivePhoto = {\n id: string;\n createdAt: string;\n href: string;\n downloadHref: string;\n fileName: string;\n fileType: string;\n fileSize: number;\n};\n\nexport class LivePhotos extends Resource<LivePhotoRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"live_photos\", axiosInstance);\n }\n\n public async upload(livePhotoRequest: LivePhotoRequest): Promise<LivePhoto> {\n return super.upload(livePhotoRequest);\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n\n public async find(id: string): Promise<LivePhoto> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<LivePhoto[]> {\n const { livePhotos } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return livePhotos;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type LiveVideo = {\n id: string;\n createdAt: string;\n href: string;\n downloadHref: string;\n fileName: string;\n fileType: string;\n fileSize: number;\n};\n\nexport class LiveVideos extends Resource<never> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"live_videos\", axiosInstance);\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n\n public async frame(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/frame`);\n }\n\n public async find(id: string): Promise<LiveVideo> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<LiveVideo[]> {\n const { liveVideos } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return liveVideos;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { OnfidoDownload } from \"../OnfidoDownload\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type MotionCapture = {\n id: string;\n createdAt: string;\n href: string;\n downloadHref: string;\n fileName: string;\n fileType: string;\n fileSize: number;\n};\n\nexport class MotionCaptures extends Resource<never> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"motion_captures\", axiosInstance);\n }\n\n public async download(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/download`);\n }\n\n public async frame(id: string): Promise<OnfidoDownload> {\n return super.download(`${id}/frame`);\n }\n\n public async find(id: string): Promise<MotionCapture> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(applicantId: string): Promise<MotionCapture[]> {\n const { motionCaptures } = await this.request({\n method: Method.GET,\n query: { applicantId }\n });\n\n return motionCaptures;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type Report = {\n id: string;\n createdAt: string;\n name: string;\n href: string;\n status: string;\n result: string | null;\n subResult: string | null;\n properties: object | null;\n breakdown: object | null;\n documents: Array<{ id: string }>;\n checkId: string;\n};\n\nexport class Reports extends Resource<never> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"reports\", axiosInstance);\n }\n\n public async find(id: string): Promise<Report> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(checkId: string): Promise<Report[]> {\n const { reports } = await this.request({\n method: Method.GET,\n query: { checkId }\n });\n\n return reports;\n }\n\n public async resume(id: string): Promise<void> {\n await this.request({ method: Method.POST, path: `${id}/resume` });\n }\n\n public async cancel(id: string): Promise<void> {\n await this.request({ method: Method.POST, path: `${id}/cancel` });\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type SdkTokenRequest = {\n applicantId: string;\n applicationId?: string | null;\n referrer?: string | null;\n crossDeviceUrl?: string | null;\n};\n\nexport class SdkTokens extends Resource<SdkTokenRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"sdk_token\", axiosInstance);\n }\n\n public async generate(sdkTokenRequest: SdkTokenRequest): Promise<string> {\n const { token } = await this.request({\n method: Method.POST,\n body: sdkTokenRequest\n });\n\n return token;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\n// url is also optional to allow updating.\nexport type WebhookRequest = {\n url?: string | null;\n enabled?: boolean;\n environments?: string[];\n events?: string[] | null;\n};\n\nexport type Webhook = {\n id: string;\n url: string;\n enabled: boolean;\n events: string[];\n token: string;\n href: string;\n environments: string[];\n};\n\nexport class Webhooks extends Resource<WebhookRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"webhooks\", axiosInstance);\n }\n\n public async create(webhookRequest: WebhookRequest): Promise<Webhook> {\n return this.request({ method: Method.POST, body: webhookRequest });\n }\n\n public async find(id: string): Promise<Webhook> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async update(\n id: string,\n webhookRequest: WebhookRequest\n ): Promise<Webhook> {\n return this.request({\n method: Method.PUT,\n path: id,\n body: webhookRequest\n });\n }\n\n public async delete(id: string): Promise<void> {\n await this.request({ method: Method.DELETE, path: id });\n }\n\n public async list(): Promise<Webhook[]> {\n const { webhooks } = await this.request({ method: Method.GET });\n\n return webhooks;\n }\n}\n","import { AxiosInstance } from \"axios\";\nimport { Method, Resource } from \"../Resource\";\n\nexport type WorkflowRunRequest = {\n applicantId: string;\n workflowId: string;\n customData?: any;\n};\n\ntype WorkflowRunError = {\n type:\tstring;\n message: string;\n}\n\ntype WorkflowRunLink = {\n url:\tstring;\n completed_redirect_url:\tstring;\n expired_redirect_url:\tstring;\n expires_at:\tstring;\n language: string;\n}\n\nexport type WorkflowRun = {\n id: string;\n applicantId: string;\n workflowId: string;\n workflowVersionId: number;\n dashboardUrl: string;\n status: string;\n output: any;\n reasons: string[] | null;\n error: WorkflowRunError | null;\n link: WorkflowRunLink | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type WorkflowRunListRequest = {\n page?: number;\n status?: string;\n created_at_gt?: string;\n created_at_lt?: string;\n}\n\nexport class WorkflowRuns extends Resource<WorkflowRunRequest> {\n constructor(axiosInstance: AxiosInstance) {\n super(\"workflow_runs\", axiosInstance);\n }\n\n public async create(workflowRunRequest: WorkflowRunRequest): Promise<WorkflowRun> {\n return this.request({ method: Method.POST, body: workflowRunRequest });\n }\n\n public async find(id: string): Promise<WorkflowRun> {\n return this.request({ method: Method.GET, path: id });\n }\n\n public async list(queryParams?: WorkflowRunListRequest): Promise<WorkflowRun[]> {\n const workflowRuns = await this.request({\n method: Method.GET,\n query: queryParams\n });\n\n return workflowRuns;\n }\n}\n","import axios, { AxiosInstance } from \"axios\";\nimport { version } from \"../package.json\";\nimport { Addresses } from \"./resources/Addresses\";\nimport { Applicants } from \"./resources/Applicants\";\nimport { Autofill } from \"./resources/Autofill\";\nimport { Checks } from \"./resources/Checks\";\nimport { Documents } from \"./resources/Documents\";\nimport { LivePhotos } from \"./resources/LivePhotos\";\nimport { LiveVideos } from \"./resources/LiveVideos\";\nimport { MotionCaptures } from \"./resources/MotionCaptures\";\nimport { Reports } from \"./resources/Reports\";\nimport { SdkTokens } from \"./resources/SdkTokens\";\nimport { Webhooks } from \"./resources/Webhooks\";\nimport { WorkflowRuns } from \"./resources/WorkflowRuns\";\n\nexport enum Region {\n EU = \"EU\",\n US = \"US\",\n CA = \"CA\"\n}\n\nexport type OnfidoOptions = {\n apiToken: string;\n region: Region;\n timeout?: number;\n unknownApiUrl?: string;\n};\n\nexport class Onfido {\n public readonly axiosInstance: AxiosInstance;\n // Core resources\n public readonly applicant: Applicants;\n public readonly document: Documents;\n public readonly livePhoto: LivePhotos;\n public readonly liveVideo: LiveVideos;\n public readonly motionCapture: MotionCaptures;\n public readonly check: Checks;\n public readonly report: Reports;\n public readonly workflowRun: WorkflowRuns;\n // Other endpoints\n public readonly address: Addresses;\n public readonly webhook: Webhooks;\n public readonly sdkToken: SdkTokens;\n public readonly autofill: Autofill;\n\n constructor({\n apiToken,\n region,\n timeout = 30_000,\n unknownApiUrl\n }: OnfidoOptions) {\n if (!apiToken) {\n throw new Error(\"No apiToken provided\");\n }\n if (!region || !Object.values(Region).includes(region)) {\n throw new Error(\n `Unknown or missing region '${region}'. ` +\n \"We previously defaulted to region 'EU', so if you previously didn’t \" +\n \"set a region or used api.onfido.com, please set your region to 'EU'\"\n );\n }\n\n const regionUrl = `https://api.${region.toLowerCase()}.onfido.com/v3.6/`;\n\n this.axiosInstance = axios.create({\n baseURL: unknownApiUrl || regionUrl,\n headers: {\n Authorization: `Token token=${apiToken}`,\n Accept: \"application/json\",\n \"User-Agent\": `onfido-node/${version}`\n },\n timeout\n });\n\n // Core resources\n this.applicant = new Applicants(this.axiosInstance);\n this.document = new Documents(this.axiosInstance);\n this.livePhoto = new LivePhotos(this.axiosInstance);\n this.liveVideo = new LiveVideos(this.axiosInstance);\n this.motionCapture = new MotionCaptures(this.axiosInstance);\n this.check = new Checks(this.axiosInstance);\n this.report = new Reports(this.axiosInstance);\n this.workflowRun = new WorkflowRuns(this.axiosInstance);\n // Other endpoints\n this.address = new Addresses(this.axiosInstance);\n this.webhook = new Webhooks(this.axiosInstance);\n this.sdkToken = new SdkTokens(this.axiosInstance);\n this.autofill = new Autofill(this.axiosInstance);\n }\n}\n","import { OnfidoError } from \"./errors/OnfidoError\";\nimport { convertObjectToCamelCase } from \"./formatting\";\n\n// Require crypto instead of importing, because Node can be built without crypto support.\nlet crypto: typeof import(\"crypto\") | undefined;\ntry {\n // tslint:disable-next-line: no-var-requires\n crypto = require(\"crypto\");\n} catch {\n // We throw an error when verifying webhooks instead.\n}\n\nexport type WebhookEvent = {\n resourceType: string;\n action: string;\n object: {\n id: string;\n status: string;\n href: string;\n completedAtIso8601: string;\n };\n};\n\nexport class WebhookEventVerifier {\n private readonly webhookToken: string;\n\n constructor(webhookToken: string) {\n this.webhookToken = webhookToken;\n }\n\n public readPayload(\n rawEventBody: string | Buffer,\n hexSignature: string\n ): WebhookEvent {\n if (!crypto) {\n throw new Error(\"Verifying webhook events requires crypto support\");\n }\n\n const givenSignature = Buffer.from(hexSignature, \"hex\");\n\n // Compute the the actual HMAC signature from the raw request body.\n const hmac = crypto.createHmac(\"sha256\", this.webhookToken);\n hmac.update(rawEventBody);\n const eventSignature = hmac.digest();\n\n // Use timingSafeEqual to prevent against timing attacks.\n if (!crypto.timingSafeEqual(givenSignature, eventSignature)) {\n throw new OnfidoError(\"Invalid signature for webhook event\");\n }\n\n const { payload } = JSON.parse(rawEventBody.toString());\n return convertObjectToCamelCase(payload) as WebhookEvent;\n }\n}\n"],"names":["PassThrough","Readable","Region"],"mappings":";;;;;;;;;;;MAAa,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;KAC3B;CACF;;MCHY,cAAe,SAAQ,WAAW;IAM7C,YACE,OAAe,EACf,YAAqB,EACrB,UAAkB,EAClB,IAAY,EACZ,MAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAE7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;KACtB;IAEM,OAAO,YAAY,CACxB,YAAqB,EACrB,UAAkB;QAElB,MAAM,cAAc,GAClB,YAAY,YAAY,MAAM,GAAI,YAAoB,CAAC,KAAK,GAAG,EAAE,CAAC;QAEpE,MAAM,UAAU,GAIZ,cAAc,YAAY,MAAM,GAAG,cAAc,GAAG,EAAE,CAAC;QAE3D,MAAM,IAAI,GAAG,GAAG,UAAU,CAAC,IAAI,IAAI,SAAS,EAAE,CAAC;QAC/C,MAAM,OAAO,GAAG,GAAG,UAAU,CAAC,OAAO,IAAI,YAAY,EAAE,CAAC;QACxD,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAEjC,MAAM,WAAW,GACf,GAAG,OAAO,iBAAiB,UAAU,GAAG;aACvC,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAEjD,OAAO,IAAI,cAAc,CACvB,WAAW,EACX,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,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AE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC5D,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC1B,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;;QAGrC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE;YAC3D,MAAM,IAAI,WAAW,CAAC,qCAAqC,CAAC,CAAC;SAC9D;QAED,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;QACxD,OAAO,wBAAwB,CAAC,OAAO,CAAiB,CAAC;KAC1D;CACF;;;;;;;;;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import { Resource } from "../Resource";
|
|
3
|
+
export declare type WorkflowRunRequest = {
|
|
4
|
+
applicantId: string;
|
|
5
|
+
workflowId: string;
|
|
6
|
+
customData?: any;
|
|
7
|
+
};
|
|
8
|
+
declare type WorkflowRunError = {
|
|
9
|
+
type: string;
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
12
|
+
declare type WorkflowRunLink = {
|
|
13
|
+
url: string;
|
|
14
|
+
completed_redirect_url: string;
|
|
15
|
+
expired_redirect_url: string;
|
|
16
|
+
expires_at: string;
|
|
17
|
+
language: string;
|
|
18
|
+
};
|
|
19
|
+
export declare type WorkflowRun = {
|
|
20
|
+
id: string;
|
|
21
|
+
applicantId: string;
|
|
22
|
+
workflowId: string;
|
|
23
|
+
workflowVersionId: number;
|
|
24
|
+
dashboardUrl: string;
|
|
25
|
+
status: string;
|
|
26
|
+
output: any;
|
|
27
|
+
reasons: string[] | null;
|
|
28
|
+
error: WorkflowRunError | null;
|
|
29
|
+
link: WorkflowRunLink | null;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
updatedAt: string;
|
|
32
|
+
};
|
|
33
|
+
export declare type WorkflowRunListRequest = {
|
|
34
|
+
page?: number;
|
|
35
|
+
status?: string;
|
|
36
|
+
created_at_gt?: string;
|
|
37
|
+
created_at_lt?: string;
|
|
38
|
+
};
|
|
39
|
+
export declare class WorkflowRuns extends Resource<WorkflowRunRequest> {
|
|
40
|
+
constructor(axiosInstance: AxiosInstance);
|
|
41
|
+
create(workflowRunRequest: WorkflowRunRequest): Promise<WorkflowRun>;
|
|
42
|
+
find(id: string): Promise<WorkflowRun>;
|
|
43
|
+
list(queryParams?: WorkflowRunListRequest): Promise<WorkflowRun[]>;
|
|
44
|
+
}
|
|
45
|
+
export {};
|