@scandit/web-id-bolt
v2.3.0
Published
ID Bolt is a pre-built ID scanning workflow that seamlessly integrates into any website allowing users to scan their identity documentation in just one second. ID Bolt works on-device, via desktop and mobile in a unified solution, ensuring no identity inf
Keywords
Readme
Scandit ID Bolt
ID Bolt is a pre-built ID scanning workflow that seamlessly integrates into any website allowing users to scan their identity documentation in just one second. ID Bolt works on-device, via desktop and mobile in a unified solution, ensuring no identity information is collected by third-party servers and reduces latency for quick scanning performance.
Learn more about ID Bolt at https://www.scandit.com/products/id-bolt/.
Get started
Add the ID Bolt client as a dependency:
npm i @scandit/web-id-boltCopy the following snippet to get started.
Your application defines when the ID Bolt pop-up is opened. In this snippet, we open it after a click on a button present in the page:
import {
Passport,
IdCard,
DriverLicense,
VisaIcao,
DocumentSelection,
IdBoltSession,
Region,
ReturnDataMode,
Validators,
} from "@scandit/web-id-bolt";
const ID_BOLT_URL = "https://app.id-scanning.com";
async function startIdBolt() {
// initialization of the ID Bolt session
const idBoltSession = IdBoltSession.create(ID_BOLT_URL, {
licenseKey: "<<YOUR LICENSE KEY>>",
// define which documents are allowed to be scanned. More complex rules can be added.
documentSelection: DocumentSelection.create({
accepted: [
new Passport(Region.Any),
new IdCard(Region.Any),
new DriverLicense(Region.Any),
new VisaIcao(Region.Any),
],
}),
// define what data you expect in the onCompletion listener (set below)
returnDataMode: ReturnDataMode.Full,
// add validation rules on the scanned document
validation: [Validators.notExpired()],
locale: "en-US",
onCompletion: (result) => {
// the ID has been captured and validation was successful. In this example the result
// will contain the document data because `returnDataMode` was set to ReturnDataMode.Full.
alert(`Thank you ${result.capturedId?.fullName ?? ""}`);
},
onCancellation: (reason) => {
// the ID Bolt pop-up has been terminated without a succesful scan
},
});
// open the pop-up
await idBoltSession.start();
}
// open ID Bolt when some button is clicked
const someButton = document.getElementById("someButton");
someButton.addEventListener("click", startIdBolt);For completeness this is the HTML you will need for the example:
<button id="someButton">Start ID Bolt</button>If you have Content-Security-Policy headers (CSP) which prevent loading iframes on your page, you need to adapt the value like so:
frame-src 'self' https://app.id-scanning.com https://id-service.scandit.comFull documentation
Find the complete documentation on the ID Bolt documentation website.
