Skip to content

feat(frappe-api): implement StorageAuthService for persistent credentials storage #38

Description

@rohansaini-02

Problem

The current MockAuthService in poc-frappe-api/src/AuthService.ts keeps credentials entirely in memory. This means credentials are lost whenever the app is reloaded or restarted, forcing users to re-authenticate.

Proposed Solution

Create a new StorageAuthService implementing the IAuthService interface that utilizes a storage provider to persist authentication credentials:

  1. Reuse or define a storage provider abstraction compatible with the existing persistence layer design.
  2. Implement saveCredentials, getCredentials, and clearCredentials by serializing/deserializing the token key-pairs to persistent storage.
  3. Storage reads should gracefully handle missing or malformed persisted credential state.
  4. The implementation should remain compatible with both synchronous and asynchronous storage backends.
  5. Keep MockAuthService available for tests and non-persistent environments.

Acceptance Criteria

  • StorageAuthService is defined in AuthService.ts.
  • Credentials can be persisted, retrieved, and cleared correctly through the storage interface.
  • Unit tests mock storage access and verify read/write cycles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions