Commit 3fc914f9 authored by dtati's avatar dtati

first commit

parent 53e158dc
Pipeline #527 failed with stages
# Getting Started with Create React App
# Getting Started with Create ReactSkyIdentification
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Project setup
npm install
## Available Scripts
......@@ -11,60 +13,13 @@ In the project directory, you can run:
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
The page will reload when you make changes.\
You may also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
### Analyzing the Bundle Size
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
### Making a Progressive Web App
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
### Advanced Configuration
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
### Deployment
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
### `npm run build` fails to minify
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
......@@ -11,9 +11,11 @@
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.6.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"skyid-sdk-web": "^1.1.2",
"web-vitals": "^2.1.4"
}
},
......@@ -5324,6 +5326,29 @@
"node": ">=4"
}
},
"node_modules/axios": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz",
"integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==",
"dependencies": {
"follow-redirects": "^1.15.0",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
},
"node_modules/axios/node_modules/form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/axobject-query": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.2.1.tgz",
......@@ -14447,6 +14472,11 @@
"node": ">= 0.10"
}
},
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
"node_modules/psl": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",
......@@ -15640,6 +15670,11 @@
"resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz",
"integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="
},
"node_modules/skyid-sdk-web": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/skyid-sdk-web/-/skyid-sdk-web-1.1.2.tgz",
"integrity": "sha512-Uuoi4tbcfUmaUQAQTti/CE40+xzklt7cljc8AZ1kZInHYa1enZmsNop2VbVqHt78cg/0/K7kasQdIDRP/URoxQ=="
},
"node_modules/slash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
......@@ -21631,6 +21666,28 @@
"resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.7.0.tgz",
"integrity": "sha512-M0JtH+hlOL5pLQwHOLNYZaXuhqmvS8oExsqB1SBYgA4Dk7u/xx+YdGHXaK5pyUfed5mYXdlYiphWq3G8cRi5JQ=="
},
"axios": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz",
"integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==",
"requires": {
"follow-redirects": "^1.15.0",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
},
"dependencies": {
"form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
}
}
},
"axobject-query": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.2.1.tgz",
......@@ -28044,6 +28101,11 @@
}
}
},
"proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
"psl": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",
......@@ -28916,6 +28978,11 @@
"resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz",
"integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="
},
"skyid-sdk-web": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/skyid-sdk-web/-/skyid-sdk-web-1.1.2.tgz",
"integrity": "sha512-Uuoi4tbcfUmaUQAQTti/CE40+xzklt7cljc8AZ1kZInHYa1enZmsNop2VbVqHt78cg/0/K7kasQdIDRP/URoxQ=="
},
"slash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
.App {
.wrapper{
height: 100vh;
background-color: rgba(209, 209, 209, 0.799);
}
input[type="file"] {
position: relative;
}
input[type="file"]::file-selector-button {
width: 136px;
color: transparent;
}
/* Faked label styles and icon */
input[type="file"]::before {
position: absolute;
pointer-events: none;
top: 10px;
left: 16px;
height: 20px;
width: 20px;
content: "";
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230964B0'%3E%3Cpath d='M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zM7 9l1.41 1.41L11 7.83V16h2V7.83l2.59 2.58L17 9l-5-5-5 5z'/%3E%3C/svg%3E");
}
input[type="file"]::after {
position: absolute;
pointer-events: none;
top: 11px;
left: 40px;
color: #0964b0;
content: "Upload File";
}
/* ------- From Step 1 ------- */
/* file upload button */
input[type="file"]::file-selector-button {
border-radius: 4px;
padding: 0 16px;
height: 40px;
cursor: pointer;
background-color: white;
border: 1px solid rgba(0, 0, 0, 0.16);
box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.05);
margin-right: 16px;
transition: background-color 200ms;
}
/* file upload button hover state */
input[type="file"]::file-selector-button:hover {
background-color: #f3f4f6;
}
/* file upload button active state */
input[type="file"]::file-selector-button:active {
background-color: #e5e7eb;
}
.smart_ocr_get_info{
width: 200px;
background-color: #4361ee;
border-radius: 30pc;
color: white;
/* text-align: center; */
height: 40px;
margin: auto;
cursor: pointer;
/* justify-content: center; */
text-align: center;
display: flex;
justify-content: center;
margin-top: 20px;
align-items: center;
}
.code-json{
border: 2px dashed #f0f2f5;
padding: 1rem;
height: 100%;
pre{
background-color: #f0f2f5;
padding: 1rem;
}
}
.loader {
margin-top: 2%;
margin-bottom: 2%;
width: 48px;
height: 48px;
margin: auto;
border: 5px solid #FFF;
border-bottom-color: #4361ee;
border-radius: 50%;
display: block;
box-sizing: border-box;
animation: rotation 1s linear infinite;
}
@keyframes rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
/* STYLE COMPONENT */
h1 {
text-align: center;
}
h2 {
margin: 0;
}
#multi-step-form-container {
margin-top: 5rem;
}
.text-center {
text-align: center;
}
.mx-auto {
margin-left: auto;
margin-right: auto;
}
.pl-0 {
padding-left: 0;
}
.button {
padding: 0.7rem 1.5rem;
border: 1px solid #4361ee;
background-color: #4361ee;
color: #fff;
border-radius: 5px;
cursor: pointer;
}
.submit-btn {
border: 1px solid #0e9594;
background-color: #0e9594;
}
.mt-3 {
margin-top: 2rem;
}
.d-none {
display: none;
}
.form-step {
border: 1px solid rgba(0, 0, 0, 0.1);
border-radius: 20px;
padding: 3rem;
}
.font-normal {
font-weight: normal;
}
ul.form-stepper {
counter-reset: section;
margin-bottom: 3rem;
}
ul.form-stepper .form-stepper-circle {
position: relative;
}
ul.form-stepper .form-stepper-circle span {
position: absolute;
top: 50%;
left: 50%;
transform: translateY(-50%) translateX(-50%);
}
.form-stepper-horizontal {
position: relative;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
ul.form-stepper > li:not(:last-of-type) {
margin-bottom: 0.625rem;
-webkit-transition: margin-bottom 0.4s;
-o-transition: margin-bottom 0.4s;
transition: margin-bottom 0.4s;
}
.form-stepper-horizontal > li:not(:last-of-type) {
margin-bottom: 0 !important;
}
.form-stepper-horizontal li {
position: relative;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
-webkit-box-align: start;
-ms-flex-align: start;
align-items: start;
-webkit-transition: 0.5s;
transition: 0.5s;
}
.form-stepper-horizontal li:not(:last-child):after {
position: relative;
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
height: 1px;
content: "";
top: 32%;
}
.form-stepper-horizontal li:after {
background-color: #dee2e6;
}
.form-stepper-horizontal li.form-stepper-completed:after {
background-color: #4da3ff;
}
.form-stepper-horizontal li:last-child {
flex: unset;
}
ul.form-stepper li a .form-stepper-circle {
display: inline-block;
width: 40px;
height: 40px;
margin-right: 0;
line-height: 1.7rem;
text-align: center;
background: rgba(0, 0, 0, 0.38);
border-radius: 50%;
}
.form-stepper .form-stepper-active .form-stepper-circle {
background-color: #4361ee !important;
color: #fff;
}
.form-stepper .form-stepper-active .label {
color: #4361ee !important;
}
.form-stepper .form-stepper-active .form-stepper-circle:hover {
background-color: #4361ee !important;
color: #fff !important;
}
.form-stepper .form-stepper-unfinished .form-stepper-circle {
background-color: #f8f7ff;
}
.form-stepper .form-stepper-completed .form-stepper-circle {
background-color: #0e9594 !important;
color: #fff;
}
.form-stepper .form-stepper-completed .label {
color: #0e9594 !important;
}
.form-stepper .form-stepper-completed .form-stepper-circle:hover {
background-color: #0e9594 !important;
color: #fff !important;
}
.form-stepper .form-stepper-active span.text-muted {
color: #fff !important;
}
.form-stepper .form-stepper-completed span.text-muted {
color: #fff !important;
}
.form-stepper .label {
font-size: 1rem;
margin-top: 0.5rem;
}
.form-stepper a {
cursor: default;
}
.smart_ocr_get_info{
width: 200px;
background-color: #4361ee;
border-radius: 30pc;
color: white;
/* text-align: center; */
height: 40px;
margin: auto;
cursor: pointer;
/* justify-content: center; */
text-align: center;
display: flex;
justify-content: center;
margin-top: 20px;
align-items: center;
}
.App-logo {
height: 40vmin;
input[type="file"] {
position: relative;
}
input[type="file"]::file-selector-button {
width: 136px;
color: transparent;
}
/* Faked label styles and icon */
input[type="file"]::before {
position: absolute;
pointer-events: none;
top: 10px;
left: 16px;
height: 20px;
width: 20px;
content: "";
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230964B0'%3E%3Cpath d='M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zM7 9l1.41 1.41L11 7.83V16h2V7.83l2.59 2.58L17 9l-5-5-5 5z'/%3E%3C/svg%3E");
}
@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
input[type="file"]::after {
position: absolute;
pointer-events: none;
top: 11px;
left: 40px;
color: #0964b0;
content: "Upload File";
}
/* ------- From Step 1 ------- */
/* file upload button */
input[type="file"]::file-selector-button {
border-radius: 4px;
padding: 0 16px;
height: 40px;
cursor: pointer;
background-color: white;
border: 1px solid rgba(0, 0, 0, 0.16);
box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.05);
margin-right: 16px;
transition: background-color 200ms;
}
/* file upload button hover state */
input[type="file"]::file-selector-button:hover {
background-color: #f3f4f6;
}
.App-header {
background-color: #282c34;
min-height: 100vh;
/* file upload button active state */
input[type="file"]::file-selector-button:active {
background-color: #e5e7eb;
}
/* ------------------------ */
/* default boilerplate to center input */
body {
/* min-height: 100vh;
max-width: 100vw;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
padding: 5vmax;
box-sizing: border-box; */
}
.App-link {
color: #61dafb;
.main_container{
background-color: #E6E6E6;
}
/* spiner */
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
.loader {
margin-top: 20px;
margin-bottom: 20px;
width: 48px;
height: 48px;
margin: auto;
border: 5px solid #FFF;
border-bottom-color: #4361ee;
border-radius: 50%;
display: inline-block;
box-sizing: border-box;
animation: rotation 1s linear infinite;
}
to {
transform: rotate(360deg);
@keyframes rotation {
0% {
transform: rotate(0deg);
}
}
100% {
transform: rotate(360deg);
}
}
.IndatacoreIdentity{
display: flex;
margin: auto;
background-color: #263269;
width: 70px;
padding: 10px;
border-radius: 20px;
}
/* drag and drop style */
.code-json{
border: 2px dashed #f0f2f5;
padding: 1rem;
height: 100%;
pre{
background-color: #f0f2f5;
padding: 1rem;
}
}
\ No newline at end of file
import logo from './logo.svg';
import './App.css';
import SkyIdentification from './Components/SkyIdentification';
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
<SkyIdentification/>
</div>
);
}
......
import React, { useState, useEffect } from 'react';
import axios from 'axios';
import helper from '../config/helperConfig';
import * as skyid from 'skyid-sdk-web';
const SkyIdentification = () => {
const [selectedFile, setSelectedFile] = useState(null);
const [responseLogin, setResponseLogin] = useState(null);
const [responseOcr, setResponseOcr] = useState(null);
const [responseLiveness, setResponseLiveness] = useState(null);
const [responseFaceMatching, setResponseFaceMatching] = useState(null);
const [displaybtn, setdisplaybtn] = useState(null);
const handleFileChange = (event) => {
readImage(event.target.files[0]);
};
const readImage = (file) => {
const reader = new FileReader();
reader.readAsDataURL(file);
setSelectedFile(file);
skyid_extract_info_from_doc_request(file, responseLogin.response_data.access_token);
};
const login = async () => {
const formData = new FormData();
formData.append("username", helper.skyid_fa_sdk_user);
formData.append("password", helper.skyid_fa_sdk_password);
axios.post(helper.API_url, formData)
.then(response => {
setResponseLogin(response.data);
if (response.data.status_code === "000") {
get_parameters(response.data.response_data.access_token);
}
})
.catch(error => {
console.error('Error login', error);
});
};
const get_parameters = async (bearToken) => {
const formData = new FormData();
formData.append("token", helper.skyid_fa_sdk_token);
formData.append("application_id", helper.skyid_fa_sdk_appId);
axios.post(helper.SKYID_FA_SDK_PARAMS_url, formData, {
headers: {
Authorization: `Bearer ${bearToken}`,
'Content-Type': 'multipart/form-data',
}
})
.then(response => {
console.log('get_params success', response.data);
if (response.data.status_code === "000") {
skyid.skyid_fa_init_sdk(response.data.response_data);
}
})
.catch(error => {
console.error('get_params error', error);
});
};
const skyid_extract_info_from_doc_request = (myImage, bearToken) => {
const formData = new FormData();
formData.append("token", helper.skyid_fa_sdk_token);
formData.append("document", myImage);
formData.append('institution_id', helper.institution_id);
formData.append('application_id', helper.skyid_fa_sdk_appId);
formData.append('channel_id', "02");
formData.append('service_id', "01");
formData.append('sub_service_id', "005");
formData.append("request_data", '{"doc_type":"01"}');
axios.post(helper.OCR_url, formData, {
headers: {
Authorization: `Bearer ${bearToken}`,
'Content-Type': 'multipart/form-data',
}
})
.then(response => {
console.log('ocr success', response.data);
if (response.data.status_code === "000") {
setResponseOcr(response.data);
init();
}
})
.catch(error => {
console.error('ocr error', error);
});
};
const startScanFace = () => {
skyid.skyid_fa_start_face_scan(skyidFaFaceScanEndCallback, processFaTimeOut);
};
const skyidFaFaceScanEndCallback = async (frame) => {
const face_image = helper.setFileImage(frame);
const formData = new FormData();
const bearToken = responseLogin.response_data.access_token;
formData.append("selfie", face_image);
axios.post(helper.LIVENESS_url, formData, {
headers: {
Authorization: `Bearer ${bearToken}`,
'Content-Type': 'multipart/form-data',
}
})
.then(response => {
console.log('ocr success', response.data);
if (response.data.status_code === "000") {
setResponseLiveness(response.data);
skyid.skyid_fa_start_face_scan(skyid_face_scan_end_callbackfacematching, processFaTimeOut);
}
})
.catch(error => {
console.error('ocr error', error);
});
};
const skyid_face_scan_end_callbackfacematching = async (frame) => {
const face_image = helper.setFileImage(frame);
const formData = new FormData();
const bearToken = responseLogin.response_data.access_token;
formData.append("doc_1_1", selectedFile);
formData.append("slf_1", face_image);
formData.append('guid', "101010303");
formData.append("token", helper.skyid_fa_sdk_token);
formData.append("application_id", helper.skyid_fa_sdk_appId);
axios.post(helper.FACE_MATCHING_url, formData, {
headers: {
Authorization: `Bearer ${bearToken}`,
'Content-Type': 'multipart/form-data',
}
})
.then(response => {
console.log('ocr success', response.data);
if (response.data.status_code === "000") {
setResponseFaceMatching(response.data);
}
})
.catch(error => {
console.error('ocr error', error);
});
};
const processFaTimeOut = () => {
console.log("processFaTimeOut");
};
const init = () => {
setdisplaybtn(true);
let skyid_liveness = document.getElementById('skyid_liveness');
skyid_liveness.innerHTML = skyid.skyid_component;
skyid.skyid_fa_setup_sdk();
}
useEffect(() => {
login();
}, []);
return (
<div className="main_container">
<div>
<img src="/assets/IndatacoreIdentity.png" className="IndatacoreIdentity" alt="" />
</div>
<h1>It only takes one more click to discover Sky ID on the web channel.</h1>
<div id="multi-step-form-container">
<input type="file" onChange={handleFileChange} />
<br/>
{responseLogin && (
<div>
<h2>Server Response Login :</h2>
<pre>{JSON.stringify(responseLogin, null, 2)}</pre>
</div>
)}
<br />
{responseOcr && (
<div>
<h2>Server Response OCR:</h2>
<pre>{JSON.stringify(responseOcr, null, 2)}</pre>
</div>
)}
<br/>
<div id="skyid_liveness"></div>
<br/>
{displaybtn && (
<button onClick={startScanFace}>Start Scan Face</button>
)}
<div>
<br />
{responseLiveness && (
<div>
<h2>Server Response Liveness:</h2>
<pre>{JSON.stringify(responseLiveness, null, 2)}</pre>
</div>
)}
</div>
<br />
<div>
{responseFaceMatching && (
<div>
<h2>Server Response Face Matching :</h2>
<pre>{JSON.stringify(responseFaceMatching, null, 2)}</pre>
</div>
)}
</div>
</div>
</div>
);
};
export default SkyIdentification;
export default {
// information sent after creation of applicationId by mail
API_url : "***",
OCR_url : "***",
OCR_url_status : "***",
LIVENESS_url : "***",
FACE_MATCHING_url : "***",
SKYID_FA_SDK_PARAMS_url : "***",
Recover_Face_Matching_Result_URL : "***",
institution_id : "***",
skyid_fa_sdk_user : "***",
skyid_fa_sdk_password : "***",
skyid_fa_sdk_token : "***",
skyid_fa_sdk_appId : "***",
setFileImage(my_selfie_canvas) {
console.log(my_selfie_canvas)
const canvas_bin = this.skyid_fa_canvas2binary(my_selfie_canvas);
return new File([canvas_bin], "skyid_fa_selected_frame.jpg", { type: "application/octet-stream" })
},
skyid_fa_canvas2binary(req_canvas) {
let skyid_fa_canvas_data = req_canvas.toDataURL('image/jpeg', 1.0);
skyid_fa_canvas_data = skyid_fa_canvas_data.replace('data:image/jpeg;base64,', '');
return this.skyid_fa_base64ToArrayBuffer(skyid_fa_canvas_data)
},
skyid_fa_base64ToArrayBuffer(base64) {
const binary_string = window.atob(base64);
const len = binary_string.length;
var bytes = new Uint8Array(len);
for (var i = 0; i < len; i++) {
bytes[i] = binary_string.charCodeAt(i);
}
return bytes.buffer;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment