flutter_corelibrary icon indicating copy to clipboard operation
flutter_corelibrary copied to clipboard

Add configurable FlutterSecureStorage to FlutterSecureCredentialsStorage

Open Copilot opened this issue 4 months ago • 2 comments

The FlutterSecureCredentialsStorage class previously created the underlying FlutterSecureStorage with default options, making it impossible to configure platform-specific settings like KeyChain accessibility on iOS.

This PR adds an optional storage parameter to the constructor, allowing users to provide a custom FlutterSecureStorage instance with specific configuration options:

// Default usage (unchanged)
const storage = FlutterSecureCredentialsStorage();

// Custom configuration with iOS KeyChain accessibility
const customStorage = FlutterSecureCredentialsStorage(
  storage: FlutterSecureStorage(
    iOptions: IOSOptions(
      accessibility: KeychainAccessibility.first_unlock_this_device,
    ),
    aOptions: AndroidOptions(
      encryptedSharedPreferences: true,
    ),
  ),
);

Key features:

  • Fully backward compatible - existing code works unchanged
  • Enables platform-specific configurations for Android, iOS, macOS, Linux, Windows, and Web
  • Well-documented with clear usage examples
  • Comprehensive test coverage

The implementation uses a private field to store the custom storage and a getter that falls back to the default instance when no custom storage is provided, ensuring minimal code changes while preserving all existing functionality.

Fixes #478.

[!WARNING]

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl-ssl.google.com
    • Triggering command: curl -fsSL REDACTED (dns block)
  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)
  • https://api.github.com/repos/flutter/flutter/releases/latest
    • Triggering command: curl -s REDACTED (http block)
  • https://storage.googleapis.com/flutter_infra_release/flutter/1e9a811bf8e70466596bcf0ea3a8b5adb5f17f7f/dart-sdk-linux-x64.zip
    • Triggering command: curl --retry 3 --continue-at - --location --output /tmp/flutter/bin/cache/dart-sdk-linux-x64.zip REDACTED (http block)
  • https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.24.3-stable.tar.xz
    • Triggering command: wget -q REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar Aug 22 '25 09:08 Copilot

@copilot Update the changelog and the package version

PiotrRogulski avatar Aug 22 '25 10:08 PiotrRogulski

@copilot Update the changelog and the package version

Updated package version to 3.1.0 and added changelog entry describing the new configurable FlutterSecureStorage feature. Commit 784bcd9

Copilot avatar Aug 22 '25 10:08 Copilot