Skip to content

Angular components

biometry-angular-components provides the capture half of an integration: camera and microphone components that handle permissions, countdowns, recording windows and the challenge phrase, then hand you ordinary File objects.

It has no HTTP layer. Components capture media and emit files; you send those files with the Web SDK or your own backend. That separation is deliberate — your API token never has to reach the browser.

This is the library the Biometry Console itself uses for its own biometric sign-in, so it stays current with what the API expects.

Installation

npm install biometry-angular-components

The components are standalone: import the ones you need directly into a component’s imports array, with no module to register.

Components

SelectorPurposeEmits
bio-face-captureStill photo of a faceFile
bio-doc-scanPhoto of an identity documentFile
bio-face-recorderVideo with spoken challenge digits, for verification{ file, phrase }
bio-voice-recorderVoice enrollment across several takes{ files, phrases }

Each capture component emits twice: once when the media is captured (capture / recorded), and again once the person has confirmed it (confirmCapture / confirmRecording). Use the confirmed event for anything you upload — the first fires before the user has had a chance to retake.

Recording a verification

bio-face-recorder records a video of the user reading the challenge digits aloud. Upload the video — the voice is extracted from it server-side, from the same file that passed the liveness check, so there is no separate audio file to send.

<bio-face-recorder
[challengeDigits]="challenge"
[recordingSeconds]="10"
(confirmRecording)="onCaptured($event)">
</bio-face-recorder>
InputDefaultNotes
challengeDigits—The challenge your backend issued, e.g. "48719352" or [4, 8, 7, 1, 9, 3, 5, 2]. See below
recordingSeconds7Widen it when the challenge is longer than the default
countdownSeconds3Lead-in before recording starts
rectWidth / rectHeight720 / 1280Capture dimensions
emitAudiofalseAlso emit a separate audio file. Not needed for verification; see below

Use a challenge from your backend

The digits the user reads should be a challenge your backend issues: we recommend 8 distinct digits from 1–9, from a secure random source, stored against the user’s login attempt, valid for at most 5 minutes and used once. Pass it as challengeDigits, then have your backend send its own stored copy as phrase. See Liveness challenge for the rules and Node and Go examples.

<bio-face-recorder
*ngIf="challenge"
[challengeDigits]="challenge"
[recordingSeconds]="10"
(confirmRecording)="uploadVideoOnly($event.file)">
</bio-face-recorder>
challengeDigitsBehaviour
"48719352" or [4, 8, 7, 1, 9, 3, 5, 2] (2.0.0+ for the string form)Shown and emitted exactly as given.
Fewer than 7 or more than 12 digits, anything other than 0–9, spaces, an empty string or arrayThrows, reported through Angular’s ErrorHandler, and recording can’t start. The camera is still requested, so a later valid value works without a remount. It is never swapped for other digits.
null or unsetDeprecated: the component generates digits in the browser and logs a one-time console.warn per component instance. Existing apps keep working, with no replay protection.

Show the recorder once the challenge has arrived, so the user never starts with generated digits. A new value is applied only while the recorder is idle.

The payload’s phrase (the digits in words) and challenge (the digits as shown, 2.0.0+) are for display and logging. Don’t send them as the phrase your backend checks.

A phrase chosen or returned by the device doesn’t stop replays: someone who controls the device, or calls your backend directly, can pair a pre-recorded video of the user with whatever digits that video happens to say, and every lip-reading and voice check agrees. Only digits your backend chose, kept and compares against prove the video was recorded just now.

Enrolling a voice

bio-voice-recorder collects several takes and emits them together.

<bio-voice-recorder (confirmRecording)="onVoiceCaptured($event)"></bio-voice-recorder>
onVoiceCaptured(payload: { files: File[]; phrases: string[] }) {
// phrases are positional: phrases[i] was spoken in files[i]
}

It emits once, after every take is confirmed — a partial set is worse than none, so there is nothing to submit until the set is complete. takes defaults to 4, which is what the voice engine builds a print from.

Services

PermissionsService and RecorderService back the components and are exported for building your own capture UI. Reach for them only if the components do not fit — they are the parts most likely to change between releases.