Skip to main content

IBiometrics

Namespace: BlazorNative.Device

DI-injectable façade over biometric authentication (Face ID / Touch ID / fingerprint). Inject this rather than the low-level BlazorNative.Core.IMobileBridge; IBiometrics.AuthenticateAsync(String, CancellationToken) proves who is holding the device and returns a BlazorNative.Core.BiometricStatus value (failure, cancellation, lockout and no-hardware are DATA, never an exception), while IBiometrics.IsAvailableAsync(CancellationToken) reports presence and enrolment without prompting. Register it with ServiceCollectionExtensions.AddBlazorNativeDevice(IServiceCollection).

public interface IBiometrics

Methods

AuthenticateAsync(String, CancellationToken)

Shows an OS biometric prompt (Face ID / Touch ID / fingerprint) with reason as its message and returns the terminal BlazorNative.Core.BiometricStatus — a failure / cancellation / lockout / no-hardware outcome is DATA, never a throw. Returns no token and no secret: the status is the whole answer.

ValueTask<BiometricStatus> AuthenticateAsync(string reason, CancellationToken ct = null)

Parameters

reason String

ct CancellationToken

Returns

ValueTask<BiometricStatus>

IsAvailableAsync(CancellationToken)

Reads whether biometric authentication is available (hardware present AND at least one biometric enrolled) WITHOUT prompting — for a UI that wants to show state before offering a biometric action.

ValueTask<bool> IsAvailableAsync(CancellationToken ct = null)

Parameters

ct CancellationToken

Returns

ValueTask<Boolean>