Skip to content

Commit 7c67983

Browse files
author
Marcus Oliver
committed
version 0.0.12
1 parent 40e304a commit 7c67983

4 files changed

Lines changed: 191 additions & 2 deletions

File tree

data/response.json

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
{
2+
"id": "nk9UrFURG",
3+
"status": "completed",
4+
"version": 3,
5+
"submitted": "2021-04-16T08:20:40+00:00",
6+
"updatedAt": "2021-04-16T08:33:35+00:00",
7+
"surveyPoll": null,
8+
"surveyMessage": null,
9+
"surveyAt": null,
10+
"completed": true,
11+
"accountGroupId": null,
12+
"accountGroupSid": null,
13+
"secondaryPhotos": null,
14+
"accountId": null,
15+
"review": null,
16+
"reviewSuccess": null,
17+
"reviewedAt": null,
18+
"accountReviewed": null,
19+
"stage": null,
20+
"request": {
21+
"type": "id-verification",
22+
"callbackURL": "https://webhook.site/6ee606ee-0a1c-49ee-a956-14311a34064c",
23+
"requestInfo": {
24+
"ipaddress": "::ffff:172.24.0.1",
25+
"useragent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)",
26+
"referer": null
27+
},
28+
"parameters": {
29+
"idUri": "jobs/nk9UrFURG/9M9GIfkd6T.jpeg",
30+
"idDimensions": { "width": 1611, "height": 1024 },
31+
"idTextUri": "jobs/nk9UrFURG/CXZiq4mfyW.jpeg",
32+
"idTextDimensions": { "width": 1624, "height": 1024 },
33+
"idAlignedUri": "jobs/nk9UrFURG/5pUI8yxUDq.jpeg",
34+
"idAlignedDimensions": { "width": 1586, "height": 1024 },
35+
"dob": "02/11/1995",
36+
"firstName": "John",
37+
"lastName": "Bao",
38+
"userPhotoUrl": null,
39+
"userDistancePhotoUrl": null,
40+
"selfieDetectUrl": null,
41+
"idPhotoUrl": "https://storage.googleapis.com/dev-woollylabs/jobs/nk9UrFURG/9M9GIfkd6T.jpeg?GoogleAccessId=yash-dev-woollylabs%40woolly-148004.iam.gserviceaccount.com&Expires=1618562975&Signature=FiNAryXhB2tZ2vijIFGOBuFi4WiuVk7cTp5ihoDyiVvDI6Wdu8JoMEMOLUa154rTdGTxR7shoXWXzkZvAilQBTb9EaXh25V2B7hTAg3JytEkWOntDvDPw9ATE6HeEQJ2svT38nzo3hkvwzaYqtBXpV40ssAxnT4pKLuYIpF6xwtwk3AlirH5X3HvEpaLAlMn5nixqOCdpRKYLqK1FNWf4oYf2yu0LTqQAyiH12QXJ%2Fvt2z%2BwN9ajq%2BsZs8uDnvBw2p9VKRLopNoEmO8B6l%2BsDwOrSRZhzi6pqNlZpcKU6Lqj%2Fn9248b0zj%2Brq%2B7Fv%2FKzWS4%2F7S5f6B4m0uPqyopAQA%3D%3D",
42+
"idDistancePhotoUrl": null,
43+
"idTextPhotoUrl": "https://storage.googleapis.com/dev-woollylabs/jobs/nk9UrFURG/CXZiq4mfyW.jpeg?GoogleAccessId=yash-dev-woollylabs%40woolly-148004.iam.gserviceaccount.com&Expires=1618562976&Signature=QdBuKsseOaOk43crlr0GeZzQ8%2F61MQwuDWQ%2Bx9fCTgT9N9sJkX%2BFVHqt8NgLDpQBrEa97YwaLLVQ9ObRq0YIQgxvP9V2ntjt9pAMKofIXYWz9bNPTOoT9Pd%2BXmvY4MBTLX%2FULdz2IkCgYjRPZQB6H5cRoVZCshV3A%2F5XkUlmNsayNDjS3f29hX%2BflV21fVGpOSEjxDYXPv559ArkYKTCUAOOrQEeyvcXG94qpT8fs6CfBoX2ra1ZDVFWPYXQY6I8v4WfziIr26ItcWX7rHrFcKNzBzO7uS8FlxZiFsejZYeQvJT%2FqnjPqUxVbcZCNMH5VkT5KmfsQfFKon4ELN9nyQ%3D%3D",
44+
"backIdPhotoUrl": null,
45+
"backIdTextPhotoUrl": null,
46+
"dotPhotoUrl": null,
47+
"carInsurancePhotoUrl": null,
48+
"twicPhotoUrl": null,
49+
"idPhotoDetectUrl": "https://storage.googleapis.com/dev-woollylabs/jobs/nk9UrFURG/CXZiq4mfyW.jpeg?GoogleAccessId=yash-dev-woollylabs%40woolly-148004.iam.gserviceaccount.com&Expires=1618562976&Signature=QdBuKsseOaOk43crlr0GeZzQ8%2F61MQwuDWQ%2Bx9fCTgT9N9sJkX%2BFVHqt8NgLDpQBrEa97YwaLLVQ9ObRq0YIQgxvP9V2ntjt9pAMKofIXYWz9bNPTOoT9Pd%2BXmvY4MBTLX%2FULdz2IkCgYjRPZQB6H5cRoVZCshV3A%2F5XkUlmNsayNDjS3f29hX%2BflV21fVGpOSEjxDYXPv559ArkYKTCUAOOrQEeyvcXG94qpT8fs6CfBoX2ra1ZDVFWPYXQY6I8v4WfziIr26ItcWX7rHrFcKNzBzO7uS8FlxZiFsejZYeQvJT%2FqnjPqUxVbcZCNMH5VkT5KmfsQfFKon4ELN9nyQ%3D%3D",
50+
"userPhotoDetectUrl": null,
51+
"userPhotoDetectDimensions": null,
52+
"userPhotoDimensions": null,
53+
"idPhotoDimensions": { "width": 1611, "height": 1024 },
54+
"idPhotoDetectDimensions": { "width": 1624, "height": 1024 },
55+
"backIdPhotoDimensions": null
56+
},
57+
"properties": [{ "name": "internal_id", "value": "sdjklfd" }]
58+
},
59+
"result": {
60+
"idRequireSide": null,
61+
"successWithSuggestion": false,
62+
"warnings": true,
63+
"idSide": "front",
64+
"idFields": [
65+
{ "name": "firstName" },
66+
{ "name": "lastName" },
67+
{ "name": "birthDate" },
68+
{ "name": "class" },
69+
{ "name": "id" },
70+
{ "name": "expireDate" },
71+
{ "name": "issueDate" },
72+
{ "name": "address" },
73+
{ "name": "endorsements" },
74+
{ "name": "lastName" },
75+
{ "name": "middleName" }
76+
],
77+
"id": "TL545796",
78+
"firstName": "THOR",
79+
"middleName": "THUNDER",
80+
"lastName": "ODINSON",
81+
"crosscheck": null,
82+
"watchlist": null,
83+
"gender": {
84+
"gender": "man",
85+
"genderDistribution": { "woman": null, "man": 0.0001 }
86+
},
87+
"aamva": {
88+
"enabled": true,
89+
"hasErrors": false,
90+
"hasWarnings": false,
91+
"createdAt": null,
92+
"updatedAt": null,
93+
"status": null,
94+
"statusMessage": "",
95+
"completedAt": null,
96+
"confidenceScore": null
97+
},
98+
"dob": "06/22/1970",
99+
"expireDate": "06/22/2018",
100+
"issueDate": "06/01/2013",
101+
"endorsements": null,
102+
"motorcycle": null,
103+
"birthDate": "06/22/1970",
104+
"class": "D",
105+
"ipAddress": null,
106+
"unverifiedIdAddress": ["8 69 BIG HAMMER LN", "COLUMBUS , OH 43223"],
107+
"hasPDF417Back": null,
108+
"idAddress": null,
109+
"type": "drivers-license",
110+
"state": "OH",
111+
"country": "US",
112+
"confidences": {
113+
"id": 0.8286,
114+
"selfie": null,
115+
"faceMatch": null,
116+
"nameMatch": 0,
117+
"selfieSunglasses": null,
118+
"selfieEyeglasses": null,
119+
"idMatch": 0,
120+
"birthDateMatch": 0,
121+
"idQuality": 0.9006,
122+
"idGlareQuality": 1,
123+
"idExpired": 0,
124+
"idCrosscheckDarkweb": null,
125+
"idCrosscheckActivity": null,
126+
"idCrosscheckIdentity": null,
127+
"idWatchlist": null,
128+
"idFraud": null,
129+
"barcode": null,
130+
"barcodeMatch": null
131+
},
132+
"success": false,
133+
"featuresEnabled": {
134+
"aamvaEnabled": true,
135+
"aamvaBillable": true,
136+
"crosscheckEnabled": true,
137+
"crosscheckBillable": true,
138+
"darkwebEnabled": true,
139+
"darkwebBillable": true,
140+
"idvEnabled": true,
141+
"idvBillable": true,
142+
"physicalAddressEnabled": true,
143+
"physicalAddressBillable": true,
144+
"ipAddressEnabled": true,
145+
"ipAddressBillable": true
146+
}
147+
},
148+
"errors": [
149+
{ "type": "InvalidIdPhotoError", "message": "Invalid or unsupported id" },
150+
{
151+
"type": "NameMatchError",
152+
"message": "Name is below the confidence threshold"
153+
},
154+
{
155+
"type": "BirthDateMatchError",
156+
"message": "Birth date is below the confidence threshold"
157+
},
158+
{
159+
"type": "ExpiredIdError",
160+
"message": "Expired ID",
161+
"suggestion": "Expired ID",
162+
"warning": true
163+
}
164+
],
165+
"signals": []
166+
}
167+

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"main": "dist/client/index.js",
33
"name": "vouched-rest-nodejs",
4-
"version": "0.0.11",
4+
"version": "0.0.12",
55
"license": "Apache-2.0",
66
"author": "John Cao",
77
"private": true,
@@ -20,6 +20,7 @@
2020
"test": "jest -i --runInBand "
2121
},
2222
"dependencies": {
23+
"crypto": "^1.0.1",
2324
"dotenv": "^8.2.0",
2425
"express": "^4.17.1",
2526
"mime-types": "^2.1.21",

src/client.test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const path = require('path');
22
const { fetchApi, imageToBase64 } = require('./client');
3+
const crypto = require('crypto');
4+
const config = require('./config');
35

46
describe('invites', () => {
57
test('invites unauthorized', async () => {
@@ -567,3 +569,21 @@ describe('aamva tests', () => {
567569
30 * 1000
568570
);
569571
});
572+
573+
describe('webhook tests', () => {
574+
test(
575+
'job endpoint webhook validation',
576+
async () => {
577+
const api_key = config.API_KEY || "vcP*ywx#zQ.K57#G3wfP!ZwR5xzqv~"
578+
const generated_token = config.X_SIGNATURE || "BeXsClk0e/aIQfhPtHDKQzGnCj8=";
579+
const data = require("../data/response.json");
580+
const dataString = JSON.stringify(data);
581+
const token_value = crypto
582+
.createHmac('sha1', Buffer.from(api_key, 'utf-8'))
583+
.update(Buffer.from(dataString, 'utf-8'))
584+
.digest('base64');
585+
expect(token_value === generated_token).toBe(true);
586+
},
587+
30 * 1000
588+
);
589+
});

src/config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ require('dotenv').config();
22

33
module.exports = {
44
API_KEY: process.env.API_KEY,
5-
API_URL: process.env.API_URL || 'https://verify.vouched.id/api'
5+
API_URL: process.env.API_URL || 'https://verify.vouched.id/api',
6+
X_SIGNATURE: process.env.X_SIGNATURE
67
};

0 commit comments

Comments
 (0)