-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca62d6f
commit d5197cb
Showing
23 changed files
with
595 additions
and
340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
node_modules/ | ||
src/static/yarn.lock | ||
.env* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
EXAMPLE_SERVER_PORT=8080 | ||
PORT=8080 | ||
BASE_URL=https://eu.rp.secure.iproov.me | ||
API_KEY= | ||
API_SECRET= | ||
|
||
NPM_ACCESS_TOKEN= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,42 @@ | ||
FROM node:lts-alpine | ||
# BASE | ||
FROM node:18-alpine as base | ||
|
||
ARG NPM_ACCESS_TOKEN="${NPM_ACCESS_TOKEN}" | ||
ENV NPM_ACCESS_TOKEN $NPM_ACCESS_TOKEN | ||
|
||
|
||
# INSTALLER | ||
FROM base as installer | ||
|
||
WORKDIR /app | ||
|
||
COPY ./src ./src | ||
COPY ./package.json ./package.json | ||
COPY ./yarn.lock ./yarn.lock | ||
|
||
# 1. install server deps | ||
RUN yarn install --ignore-scripts --frozen-lockfile | ||
|
||
# XXX:NOTE: There are no npm build for the FE app | ||
# 2. install separately only web-sdk in "static" as static module | ||
RUN npm config set '//registry.npmjs.org/:_authToken' "${NPM_ACCESS_TOKEN}" | ||
RUN cd src/static && yarn install --ignore-scripts --frozen-lockfile | ||
|
||
|
||
# BUILDER | ||
FROM base as builder | ||
|
||
WORKDIR /app | ||
|
||
# There are no build for the server - just copy what is required | ||
COPY --from=installer /app . | ||
|
||
|
||
# RUNNER | ||
FROM base as runner | ||
|
||
WORKDIR /app | ||
ADD src/yarn.lock . | ||
ADD src/package.json . | ||
RUN yarn | ||
ADD src/static/package.json ./static/ | ||
RUN cd /app/static && yarn && cd /app | ||
ADD src/ . | ||
|
||
EXPOSE 80 | ||
COPY --from=builder /app . | ||
|
||
ENTRYPOINT ["node", "server.js"] | ||
CMD yarn start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
This demo is a self-contained NodeJS server and minimal frontend which covers: | ||
|
||
* Running a server with a `BASE_URL`, `API_KEY` and `API_SECRET` that you can obtain from https://portal.iproov.com; | ||
* Running a server with a `BASE_URL`, `API_KEY`, `API_SECRET` that you can obtain from https://portal.iproov.com and `NPM_ACCESS_TOKEN` that you can create once your get access to our private NPM registry (please contact [email protected]). | ||
* Creating tokens for Genuine Presence and Liveness transactions; | ||
* Enrolling and verifying; | ||
* Customising iProov Web with web component slots and CustomEvents. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "@iproov/web-demo-sample", | ||
"version": "2.0.0", | ||
"description": "A demo of iProov's Web SDK integration", | ||
"main": "server.js", | ||
"author": "iProov Team", | ||
"license": "GPL", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"start": "node src/server.js" | ||
}, | ||
"dependencies": { | ||
"@hapi/basic": "^6.0.0", | ||
"@hapi/hapi": "^20.2.2", | ||
"@hapi/inert": "^6.0.4", | ||
"dotenv": "^8.6.0", | ||
"prettier": "^2.7.1", | ||
"superagent": "^6.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,44 +5,52 @@ | |
* @return {{API_KEY: *, API_SECRET: *, BASE_URL: *, EXAMPLE_SERVER_PORT: *, PORT: *}} | ||
*/ | ||
export function configure(env) { | ||
const { BASE_URL, API_KEY, API_SECRET } = env | ||
let { PORT, EXAMPLE_SERVER_PORT } = env | ||
const errors = [] | ||
const { BASE_URL, API_KEY, API_SECRET } = env; | ||
let { PORT, EXAMPLE_SERVER_PORT } = env; | ||
const errors = []; | ||
if (!BASE_URL) { | ||
errors.push("BASE_URL is undefined. Example: https://eu.rp.secure.iproov.me.") | ||
errors.push( | ||
"BASE_URL is undefined. Example: https://eu.rp.secure.iproov.me." | ||
); | ||
} | ||
if (!API_KEY) { | ||
errors.push("API_KEY is undefined. You can obtain one from https://portal.iproov.com.") | ||
errors.push( | ||
"API_KEY is undefined. You can obtain one from https://portal.iproov.com." | ||
); | ||
} else if (API_KEY.length < 40) { | ||
errors.push("API_KEY seems incorrect, it should be a 40 character alphanumeric string.") | ||
errors.push( | ||
"API_KEY seems incorrect, it should be a 40 character alphanumeric string." | ||
); | ||
} | ||
if (!API_SECRET) { | ||
errors.push( | ||
"API_SECRET is undefined. It must correspond to your API_KEY. If lost, reset it at https://portal.iproov.com." | ||
) | ||
); | ||
} else if (API_SECRET.length < 40) { | ||
errors.push("API_SECRET seems incorrect, it should be a 40 character alphanumeric string.") | ||
errors.push( | ||
"API_SECRET seems incorrect, it should be a 40 character alphanumeric string." | ||
); | ||
} | ||
|
||
if (!PORT) { | ||
// This is the internal container port that the EXAMPLE_SERVER_PORT should map to. Best left at 80. | ||
PORT = 80 | ||
PORT = 80; | ||
} | ||
if (!EXAMPLE_SERVER_PORT) { | ||
console.warn("EXAMPLE_SERVER_PORT not specified, using port 80.") | ||
EXAMPLE_SERVER_PORT = 80 | ||
console.warn("EXAMPLE_SERVER_PORT not specified, using port 80."); | ||
EXAMPLE_SERVER_PORT = 80; | ||
} | ||
if (errors.length) { | ||
console.error("Configuration problems detected:") | ||
errors.forEach((e) => console.error(e)) | ||
console.error("Contact [email protected] for assistance.") | ||
process.exit(1) | ||
return | ||
console.error("Configuration problems detected:"); | ||
errors.forEach((e) => console.error(e)); | ||
console.error("Contact [email protected] for assistance."); | ||
process.exit(1); | ||
} | ||
return { | ||
BASE_URL, | ||
API_KEY, | ||
API_SECRET, | ||
PORT, | ||
EXAMPLE_SERVER_PORT, | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.key | ||
*.crt |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.