Skip to content

Commit

Permalink
add FACETEC_SERVER_API_KEY
Browse files Browse the repository at this point in the history
  • Loading branch information
calebtuttle committed Oct 30, 2024
1 parent 5545535 commit a09a616
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 17 deletions.
11 changes: 6 additions & 5 deletions src/constants/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ export const relayerURL =
"https://relayer.holonym-internal.net";

export const facetecServerBaseURL =
// process.env.NODE_ENV === "development"
// ? "http://localhost:8080"
// // TODO: facetec: Update this to the production URL of _our_ deployed facetec server
// :
"https://api.facetec.com/api/v3.1/biometrics";
process.env.NODE_ENV === "development"
? "http://localhost:8080"
// TODO: facetec: Update this to the production URL of _our_ deployed facetec server
:
"todo"
// "https://api.facetec.com/api/v3.1/biometrics";

const supportedChainIds = [
1, // Ethereum
Expand Down
3 changes: 1 addition & 2 deletions src/services/facetec/enrollment-3d.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ export async function enrollment3d(req, res) {
"Content-Type": "application/json",
'X-Device-Key': req.headers['x-device-key'],
'X-User-Agent': req.headers['x-user-agent'],
// TODO: facetec: create FACETEC_API_KEY env var
// "X-Api-Key": process.env.FACETEC_API_KEY,
"X-Api-Key": process.env.FACETEC_SERVER_API_KEY,
},
}
)
Expand Down
4 changes: 1 addition & 3 deletions src/services/facetec/match-3d-2d-idscan-and-get-creds.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,7 @@ export async function match3d2dIdScanAndGetCreds(req, res) {
"Content-Type": "application/json",
'X-Device-Key': req.headers['x-device-key'],
'X-User-Agent': req.headers['x-user-agent'],
// TODO: facetec: create FACETEC_API_KEY env var
// "X-Api-Key": process.env.FACETEC_API_KEY,
"X-Api-Key": process.env.FACETEC_SERVER_API_KEY,
},
}
)
Expand Down Expand Up @@ -560,7 +559,6 @@ export async function match3d2dIdScanAndGetCreds(req, res) {
scanResultBlob: data.scanResultBlob
});

// --
// --- Forward response from FaceTec server ---


Expand Down
3 changes: 1 addition & 2 deletions src/services/facetec/match-3d-2d-idscan.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ export async function match3d2dIdScan(req, res) {
"Content-Type": "application/json",
'X-Device-Key': req.headers['x-device-key'],
'X-User-Agent': req.headers['x-user-agent'],
// TODO: facetec: create FACETEC_API_KEY env var
// "X-Api-Key": process.env.FACETEC_API_KEY,
"X-Api-Key": process.env.FACETEC_SERVER_API_KEY,
},
}
)
Expand Down
3 changes: 1 addition & 2 deletions src/services/facetec/session-token.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ export async function sessionToken(req, res) {
"Content-Type": "application/json",
'X-Device-Key': req.headers['x-device-key'],
// 'X-User-Agent': req.headers['x-user-agent'],
// TODO: facetec: create FACETEC_API_KEY env var
// "X-Api-Key": process.env.FACETEC_API_KEY,
"X-Api-Key": process.env.FACETEC_SERVER_API_KEY,
},
}
)
Expand Down
6 changes: 3 additions & 3 deletions src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import sgMail from "@sendgrid/mail";
export function getDateAsInt(date) {
// Format input
const [year, month, day] = date.split("-");
assert.ok(year && month && day); // Make sure Y M D all given
assert.ok(year >= 1900 && year <= 2099); // Make sure date is in a reasonable range, otherwise it's likely the input was malformatted and it's best to be safe by stopping -- we can always allow more edge cases if needed later
assert.ok(year && month && day, `Missing year, month, or day. Values: ${year}, ${month}, ${day}`); // Make sure Y M D all given
assert.ok(year >= 1900 && year <= 2099, `Parsed year (${year}) doesn't satisfy: year >= 1900 && year <= 2099`); // Make sure date is in a reasonable range, otherwise it's likely the input was malformatted and it's best to be safe by stopping -- we can always allow more edge cases if needed later
const time = new Date(date).getTime() / 1000 + 2208988800; // 2208988800000 is 70 year offset; Unix timestamps below 1970 are negative and we want to allow from approximately 1900.
assert.ok(!isNaN(time));
assert.ok(!isNaN(time), `Failed to convert date into a time. Date: ${date}`); // Make sure we parsed the date correctly
return time;
}

Expand Down

0 comments on commit a09a616

Please sign in to comment.