Skip to content

feat(ai): persist AWS Bedrock credentials in secure storage #1193

Description

@HankYuLinksys

Description

AWS Bedrock credentials entered in the AI Assistant config screen are held only in memory. They are lost on every app restart, so the user has to paste the access key and secret key again each time.

Current behaviour

lib/page/ai_assistant/views/router_assistant_view.dart:

  • _tryInitController() first attempts AWSConfig.fromEnvironment()
  • On ConfigurationException it falls back to a manual entry screen (access key / secret key / model dropdown)
  • _initControllerWithManualConfig() builds an AWSConfig and constructs the controller — nothing is persisted
  • Pressing the settings icon discards the controller and returns to the config screen

Region is also hardcoded to us-west-2.

Proposed approach

Persist credentials using flutter_secure_storage (already a project dependency):

  • Save access key / secret key / selected model after a successful connection
  • On view init, try AWSConfig.fromEnvironment() first, then fall back to stored credentials, then to the manual entry screen
  • Provide an explicit way to clear stored credentials (the existing "Change configuration" flow is the natural place)
  • Do not log credential values

Out of scope

Moving credential handling to a backend proxy is the proper long-term fix (the frontend should not hold AWS credentials at all), but that is a cross-team effort and is not covered here. This issue only removes the re-entry friction while keeping storage local and encrypted.

Acceptance criteria

  • Credentials persist across app restarts via flutter_secure_storage
  • Stored credentials are used automatically when environment config is unavailable
  • Users can clear stored credentials from the UI
  • Credential values never appear in logs
  • Selected model is persisted alongside the credentials
  • Unit test covers the load / save / clear paths

Context

Follow-up to #929. Related to the AI Assistant still being in PoC state.

Metadata

Metadata

Assignees

Labels

2.xLabeled for 2.x versionUIenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions