Skip to content

Accept explicit application contexts for named stores - #50

Open
LucaCappelletti94 wants to merge 1 commit into
mainfrom
upstream/explicit-application-context
Open

LucaCappelletti94 wants to merge 1 commit into
mainfrom
upstream/explicit-application-context

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Collaborator

Named stores accept a caller-supplied application context for construction, existence checks and deletion without initializing ndk-context, addressing #49. Credential-protected and device-protected stores remain separate.

My real use case is a background FCM data-only message arriving after Android has reclaimed the application process. Android can start the service without an activity, and the handler may need a stored key to decrypt the message and render a notification before the user opens the app. The service already has an application context while the UI framework's ndk-context initialization may not have run at all.

The test starts ExplicitContextService directly to reproduce that startup ordering without depending on FCM delivery. The service writes and reads a credential fixture, then MainActivity initializes ndk-context and the store suite reads the same credential, representing the user opening the app afterward. The runner's token and bounded waits correlate these phases, and context-tested prevents fixture recreation in the activity.

@LucaCappelletti94 LucaCappelletti94 added the enhancement New feature or request label Oct 20, 2026
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.85714% with 34 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/context.rs 76.62% 18 Missing ⚠️
src/by_store/vault.rs 91.97% 13 Missing ⚠️
src/shared_preferences.rs 80.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@LucaCappelletti94
LucaCappelletti94 force-pushed the upstream/explicit-application-context branch from 4722b75 to 5a985c7 Compare October 21, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant