Skip to content

Programmatic control

import type { TechsignKycElement } from '@techsign/kyc';
const kyc = document.querySelector('techsign-kyc') as TechsignKycElement;
await kyc.start(); // restart the flow
kyc.stop(); // stop the camera and detection
kyc.destroy(); // clean up the component
kyc.selectType('IDCARD'); // pick the document type from code
kyc.getStep(); // e.g. 'card-front'
kyc.getSteps(); // ['select', 'card-front', …, 'complete']
kyc.getSession(); // captured document and face data
await kyc.nextStep(); // go to the next step
await kyc.previousStep(); // go back one step
await kyc.retryStep(); // retake the current step
await kyc.goToStep('face'); // jump to a specific step
Method When
nextStep() To continue the flow after your own checks
retryStep() To have the user retake the same step
previousStep() To go back one step
goToStep(step) To jump to a known step in the flow; 'complete' fires the complete event
getSession() To read every capture

The component cleans up after itself when it is removed from the page.

To send the media to your own service instead of Prove ID, use validation-mode="host". In this mode the SDK makes no requests to Prove ID and does not advance automatically after a capture; you drive the steps.

<techsign-kyc
validation-mode="host"
include-images="true"
show-result-screen="false"
></techsign-kyc>
const kyc = document.querySelector('techsign-kyc');
kyc.addEventListener('captured', async (e) => {
const { step, blob, video } = e.detail;
const body = blob || video;
const response = await fetch('/your-api/upload', {
method: 'POST',
headers: { 'X-Step': step },
body,
});
if (response.ok) {
await kyc.nextStep();
} else {
await kyc.retryStep();
}
});
kyc.addEventListener('complete', (e) => {
console.log('done', e.detail);
});

You can call these methods in cloud mode too (for example retryStep() after an error).