createSession

abstract fun createSession(referencePortrait: ByteString): FaceMatcherSession

Creates a new FaceMatcherSession driving an interactive verification session to verify that the user in front of the camera matches the provided referencePortrait.

The implementation is required to verify both:

  1. Liveness: Ensuring that the subject in front of the camera is a live, physically present human being rather than a presentation attack (e.g. a printed photograph, digital replay, or 3D mask).

  2. Matching: Ensuring that the facial biometric features of the live subject match the provided referencePortrait.

The implementation is free to achieve this verification however it pleases (for example, using active head-pose challenges, gaze tracking, passive texture/depth analysis, multi-frame biometric scoring, or third-party biometric services).

Throughout the verification session, the implementation can feed back real-time information, instructions, status messages, and visual overlays to the user through the use of FaceMatcherSession.updateState.

The normal way to use this function is through the prompt machinery via org.multipaz.prompt.showFaceMatcherPrompt.

The referencePortrait parameter must be an encoded image in one of the supported formats:

  • PNG (Portable Network Graphics)

  • JPEG (Joint Photographic Experts Group)

  • JPEG 2000 (JP2 container format or raw J2K codestream)

Return

a new FaceMatcherSession instance for this verification session.

Parameters

referencePortrait

the reference portrait image bytes in PNG, JPEG, or JPEG 2000 format to verify against.

Throws

if referencePortrait is empty, corrupted, or not in a supported image format.