ditr-ekyc-sdk
v1.0.6
Published
for testing only
Downloads
11
Readme
Install via NPM
On the command line, navigate to the root directory of your project:
cd /path/to/project
Run the following command:
npm init
Answer the questions in the command line questionnaire.
Install ditr-ekyc-sdk
:
npm i ditr-ekyc-sdk
For example:
- index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Ditr Component</title>
<style>
.mainLayout {
max-width: max-content;
margin: auto;
}
.showComponent {
width: 500px;
height: 700px;
}
</style>
<script src="./node_modules/ditr-ekyc-sdk/ditr-ekyc-sdk.bundle.js"></script>
</head>
<body class="mainLayout">
<div class="showComponent">
<h2>Ditr Component</h2>
<ditr-ekyc></ditr-ekyc>
</div>
<script src="./index.js"></script>
</body>
</html>
- index.js
const ditrEkyc = document.getElementsByTagName("ditr-ekyc")[0];
function ditrListener(result) {
if (result.detail.action === "START_PROCESS") {
console.log(JSON.stringify(result.detail));
}
if (result.detail.action === "FINISH_PROCESS") {
if (result.detail.result.status === "true") {
console.log(JSON.stringify(result.detail));
} else {
console.log(JSON.stringify(result.detail));
}
}
}
ditrEkyc.addEventListener("ditr-ekyc", ditrListener);
Noted
Accessing camera devices requires a secure browsing context. Broadly speaking, this means that you need to serve your web application over HTTPS (or localhost for local development). For insecure contexts CameraPlatform.availableCameras might throw a CameraException with the permissionDenied error code.