Skip to content

feat: 'encrypt' keyword scrambles hero text (inverse of 'decrypt') - #97

Merged
ronaldtse merged 1 commit into
mainfrom
feat/encrypt-keyword
Jul 23, 2026
Merged

ronaldtse merged 1 commit into
mainfrom
feat/encrypt-keyword

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Summary

encrypt now drives a separate, inverse hero animation. Previously both encrypt and decrypt fired the same rnp:replay-hero event (decryption scramble). They're now distinct:

  • decrypt → rnp:replay-hero: garbage settles L→R into readable text (existing behavior)
  • encrypt → rnp:encrypt-hero: readable text scrambles L→R and stays mangled — type decrypt (or refresh) to restore

One-way semantics match the metaphor: encryption without the key leaves ciphertext opaque. Refreshing the page still auto-plays the decrypt animation on mount via the existing reduced-motion-aware run() call.

Changes

  • HeroDecrypt.vue: new runEncrypt() does the scramble wave and stops at the final mangled state (no auto-decrypt cycle). Listener registered for rnp:encrypt-hero.
  • FingerprintPlayground.vue: input watcher dispatches rnp:replay-hero for /decrypt/i or rnp:encrypt-hero for /encrypt/i. Decrypt wins if both appear. Substring match (no word boundaries) so either fires appended to the default LibrePGP seed, standalone, or inside a longer word. The decrypt regex was also loosened from /\bdecrypt\b/ to /decrypt/ for the same reason.
  • EasterEggs.vue: global keypress (anywhere outside inputs) now branches on endsWith('decrypt') vs endsWith('encrypt'), with distinct toasts (Replaying decryption… / Encrypting…). Help text (rnp.help()) lists them as separate entries with their distinct effects.

Test plan

  • curl http://localhost:4322/ — page renders cleanly
  • HeroDecrypt listens for both rnp:replay-hero and rnp:encrypt-hero
  • FingerprintPlayground dispatches the correct event per keyword
  • EasterEggs global keypress branches correctly
  • Help text shows two separate entries
  • Visual review: type encrypt in the fingerprint box → text scrambles and stays; type decrypt → text settles back

The hero animation now has two modes driven by separate events:
- rnp:replay-hero ('decrypt'): garbage settles L→R into readable text
- rnp:encrypt-hero ('encrypt'): readable text scrambles L→R and stays
  mangled — type 'decrypt' (or refresh) to restore

One-way semantics match the metaphor: encryption without the key leaves
ciphertext opaque.

Wiring:
- HeroDecrypt.vue: new runEncrypt() does the scramble wave and stops at
  the final mangled state (no auto-decrypt cycle)
- FingerprintPlayground.vue: input watcher dispatches rnp:replay-hero
  for /decrypt/ or rnp:encrypt-hero for /encrypt/. Decrypt wins if both
  appear. Substring match so either fires appended to the default seed,
  standalone, or inside a longer word. Also loosened the decrypt regex
  from /\bdecrypt\b/ to /decrypt/ so it triggers in more contexts.
- EasterEggs.vue: global keypress (anywhere outside inputs) now branches
  on endsWith('decrypt') vs endsWith('encrypt'), with distinct toasts
  ('Replaying decryption…' / 'Encrypting…')

rnp.help() / help() updated to list decrypt and encrypt as separate
entries with their distinct effects.
@ronaldtse
ronaldtse merged commit 33332eb into main Jul 23, 2026
4 of 5 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.

1 participant