Skip to content

feat: add typed encrypt/decrypt for subscription metadata - #894

Merged
Calebux merged 1 commit into
Calebux:mainfrom
JoyAdah:feat/encrypt-decrypt-metadata-839
Jun 23, 2026
Merged

feat: add typed encrypt/decrypt for subscription metadata#894
Calebux merged 1 commit into
Calebux:mainfrom
JoyAdah:feat/encrypt-decrypt-metadata-839

Conversation

@JoyAdah

@JoyAdah JoyAdah commented Jun 23, 2026

Copy link
Copy Markdown

Summary

  • Added SubscriptionMetadata interface with typed fields (name, price, cycle, provider)
  • Implemented encryptSubscriptionMetadata(key, metadata){ ciphertext, nonce, tag }
  • Implemented decryptSubscriptionMetadata(key, encrypted)SubscriptionMetadata
  • Uses AES-256-GCM (authenticated encryption) with random 96-bit nonce per call
  • JSON serialization before encryption, schema validation after decryption
  • Added comprehensive tests: round-trip fidelity, tamper rejection, nonce uniqueness, wrong key rejection, all cycle types

Closes #839

Test plan

  • Verify round-trip encrypt → decrypt preserves all metadata fields
  • Verify tampered ciphertext is rejected (authentication tag check)
  • Verify nonce is unique per encryption call
  • Verify wrong key decryption is rejected
  • Run npm test in shared/ to confirm all tests pass

🤖 Generated with Claude Code

Add encryptSubscriptionMetadata and decryptSubscriptionMetadata
functions that handle SubscriptionMetadata objects with JSON
serialization and schema validation. Uses AES-256-GCM with random
96-bit nonce per encryption. Includes tests for round-trip fidelity,
tamper rejection, nonce uniqueness, and all cycle types.

Closes Calebux#839

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@JoyAdah
JoyAdah requested a review from Calebux as a code owner June 23, 2026 21:03
@drips-wave

drips-wave Bot commented Jun 23, 2026

Copy link
Copy Markdown

@JoyAdah Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Calebux
Calebux merged commit 924189a into Calebux:main Jun 23, 2026
14 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P1] Encryption: Build encrypt/decrypt module for subscription metadata

3 participants