Skip to content

fix : return specific error types from decryptToken #504

@tmdeveloper007

Description

@tmdeveloper007

Summary of What Needs to be Done:
The crypto.ts decryptToken function catches all errors and returns null, making it impossible to distinguish between missing encryption key, corrupted ciphertext, invalid IV, or other errors.

Changes that Need to be Done:

  • File: src/lib/crypto.ts
  • Create specific error classes (EncryptionKeyError, TokenDecryptionError)
  • Throw specific errors instead of returning null for different failure modes

Impact that it would Provide:

  • Improves debuggability of production issues
  • Allows calling code to handle different error cases appropriately
  • Better error monitoring and logging

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions