Programmatic control
Methods
Section titled “Methods”import type { TechsignKycElement } from '@techsign/kyc';
const kyc = document.querySelector('techsign-kyc') as TechsignKycElement;
await kyc.start(); // restart the flowkyc.stop(); // stop the camera and detectionkyc.destroy(); // clean up the componentkyc.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 stepawait kyc.previousStep(); // go back one stepawait kyc.retryStep(); // retake the current stepawait 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.
Uploading to your own service (host mode)
Section titled “Uploading to your own service (host mode)”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).