Skip to content

feat: add flet-local-auth extension - #6759

Open
mccre110 wants to merge 9 commits into
flet-dev:release/flet-1.0from
mccre110:feature/flet-local-auth
Open

feat: add flet-local-auth extension#6759
mccre110 wants to merge 9 commits into
flet-dev:release/flet-1.0from
mccre110:feature/flet-local-auth

Conversation

@mccre110

@mccre110 mccre110 commented Aug 6, 2026

Copy link
Copy Markdown

Description

Adds the flet-local-auth extension with a LocalAuthentication service for on-device biometric and credential authentication on Android, iOS, macOS, and Windows via local_auth 3.0.2. Linux and Web are explicitly unsupported.

Stacks on: the Android host PR (FlutterFragmentActivity + AppCompat LaunchTheme). Merge that PR first.

API:

  • is_device_supported(), can_check_biometrics(), get_available_biometrics()
  • authenticate() — raises LocalAuthException on failure (upstream local_auth parity)
  • stop_authentication()
  • Platform auth message types (AndroidAuthMessages, IOSAuthMessages, etc.) aligned with local_auth 3.x

Includes Python package, Flutter extension, client registration, CI, docs, example, and integration tests.

Related: closes #3192 (supersedes closed #3682).

Test code

import flet as ft
import flet_local_auth as auth


async def main(page: ft.Page):
  local_auth = auth.LocalAuthentication()
  print(await local_auth.is_device_supported())
  print(await local_auth.can_check_biometrics())
  print(await local_auth.get_available_biometrics())
  try:
    ok = await local_auth.authenticate("Unlock to continue")
    print("authenticated:", ok)
  except auth.LocalAuthException as e:
    print("failed:", e.code)


ft.run(main)

Integration tests: sdk/python/packages/flet/integration_tests/extensions/local_auth/test_local_auth.py

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • I signed the CLA.
  • I have performed a self-review of my own code.
  • My code follows the style guidelines of this project.
  • I have commented my code, particularly in hard-to-understand areas.
  • My changes generate no new warnings.
  • New and existing tests pass locally with my changes.
  • I have made corresponding documentation changes, if applicable.
  • I have added changelog entries for user-facing changes, if applicable.
  • I have updated release guide pages and website/sidebars.yml for breaking changes, removals, and deprecations, if applicable.

Screenshots

Service invokes the OS biometric modal; no custom Flet UI.

Additional details

N/A

Summary by Sourcery

Add a new cross-platform local authentication service and extension, wiring it into the client, build tooling, and documentation so apps can use on-device biometrics and credentials on supported platforms.

New Features:

  • Introduce the flet-local-auth Python package and Flutter extension exposing a LocalAuthentication service with methods for capability checks and user authentication on Android, iOS, macOS, and Windows.
  • Provide an example app and gallery metadata demonstrating how to use LocalAuthentication and customize platform-specific auth messages.

Enhancements:

  • Register the local_auth plugins on Windows and macOS, and enable the flet-local-auth extension in the client so authentication works across desktop and mobile targets.
  • Switch Android host activities and app templates to FlutterFragmentActivity with an AppCompat LaunchTheme to support biometric dialogs and modern theming.
  • Add a biometric cross-platform permission bundle and NSFaceIDUsageDescription defaults for iOS and macOS builds.
  • Wire flet-local-auth into the workspace, tooling, and build/test configs, including dependency lists and crocodocs sources.

Documentation:

  • Add user-facing documentation pages for the LocalAuthentication service and its related types, and link them into the docs sidebar and built-in extensions list.
  • Extend macOS publishing docs with guidance on Touch ID/Face ID usage, signing requirements, and keychain considerations for local authentication.

Tests:

  • Add Flutter unit tests for enum/error-code mapping in the local auth utility and Python integration tests validating platform support and device capability APIs for LocalAuthentication.

cursoragent and others added 8 commits August 6, 2026 18:49
Switch the dev client and flet build template to FlutterFragmentActivity,
which local_auth requires for biometric dialogs on Android.

Re-parent LaunchTheme to Theme.AppCompat.DayNight.NoActionBar in light and
night styles so the biometric dialog does not crash on API 24-27.

Add a biometric cross-platform permission bundle for NSFaceIDUsageDescription
on iOS and macOS builds, document FlutterFragmentActivity R8 keep rules, and
note Touch ID signing requirements in macOS publish docs.

Co-authored-by: Corey McCrea <mccre110@users.noreply.github.com>
Co-authored-by: Corey McCrea <mccre110@users.noreply.github.com>
Co-authored-by: Corey McCrea <mccre110@users.noreply.github.com>
Remove flet-local-auth references from the host PR so docs build
passes before the extension lands.

Co-authored-by: Corey McCrea <mccre110@users.noreply.github.com>
Add the flet-local-auth service wrapping local_auth 3.0.2 with upstream-parity
LocalAuthException handling, platform auth message types, docs, example, and
integration tests.

Depends on the Android host FlutterFragmentActivity / AppCompat LaunchTheme
changes in the base branch.

Co-authored-by: Corey McCrea <mccre110@users.noreply.github.com>
local_auth 3.x simplified AndroidAuthMessages and IOSAuthMessages and
removed customizable Windows dialog strings. Update Python @ft.value types
and Dart parsers to match the pinned platform packages.

Co-authored-by: Corey McCrea <mccre110@users.noreply.github.com>
Co-authored-by: Corey McCrea <mccre110@users.noreply.github.com>
Document sandbox, signing, and SecureStorage entitlement notes alongside
the extension service docs.

Co-authored-by: Corey McCrea <mccre110@users.noreply.github.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Map local_auth 3.x iris biometrics in the Python enum and add
NSFaceIDUsageDescription to the macOS dev client Info.plist.

Co-authored-by: Corey McCrea <mccre110@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants