Fingerprint reader client
Drives a USB fingerprint reader via the SladeID companion application. See Use a USB fingerprint reader for the companion-app prerequisite and install links.
import { createFingerprintReader, FingerprintReaderClient } from '@sladeid/slade-id-sdk';
const reader: FingerprintReaderClient = createFingerprintReader({
getToken: () => Promise.resolve('<bearer token>'),
});Methods
| Method | Returns |
|---|---|
reader.status | ReaderStatus |
refreshStatus() | Promise<ReaderStatus> |
enroll(input) | Promise<EnrollmentResult> |
verify(input) | Promise<VerificationResult> |
search() | Promise<SearchResult> |
testCapture(opts?) | Promise<TestCaptureResult> |
createEnrollmentSession(input) | EnrollmentSession |
createVerificationSession(input) | VerificationSession |
createSearchSession() | SearchSession |
dispose() | void |
Client events
connected, disconnected, device-attached, device-detached, poll-failed, status.
poll-failed fires with an HwsError whenever a background /status poll fails — including the very first poll before the client ever went connected. It is de-duped by error code, so a stuck failure (e.g. an empty token) emits once rather than every 3s. The same error is also available synchronously on reader.status.lastError, which is cleared on the next successful poll.
Session events
All three session types (EnrollmentSession, VerificationSession, SearchSession) emit ready, scanning, captured, and error. Sessions are single-shot; call cancel() to abort an in-flight request.