CodeKits.shopNew developer offer

The CodeKits notebook

Ideas into working code.

Practical tutorials, project walkthroughs and development notes. Explore the code, understand the structure, and build something of your own.

8 articles · Newest first

Browser encrypts, Ciphertext storage, and Browser decrypts

Security

Build browser-encrypted one-time text links

Encrypt text in the browser, put the random key in a URL fragment, and combine ciphertext storage with explicit one-time retrieval and trust limits.

· 4 min read

Known action, Allowlisted fields, and Restricted audit sink

Security

Create useful audit logs without recording secrets

Create structured audit events with allowlisted actions and internal identifiers, while excluding tokens, credentials, request bodies and private messages.

· 4 min read

Record + field, Authenticated envelope, and Managed keyring

Security

Encrypt sensitive MySQL fields in Node.js

Use authenticated field encryption with record-bound context, versioned envelopes and managed keys while keeping database and application threats distinct.

· 4 min read

Lock one row, Consume + commit, and Return ciphertext

Security

Make read-once links race-safe with MySQL

Serialize one-time secret consumption with an InnoDB row lock, commit before responding, and document why at-most-once retrieval cannot guarantee delivery.

· 4 min read

Verified session, Object permission, and Private response

Security

Protect admin APIs and private downloads

Enforce authentication and object-level authorization at every server entry point, with negative tests for direct API calls and private-file access.

· 4 min read

Owner revokes, Fresh checks fail, and Existing copies remain

Security

Revoke temporary links and understand the limits

Implement server-side link revocation with owner-scoped updates, explicit cache policy and a clear distinction between future grants and existing copies.

· 4 min read

Read old + new, Write new key, and Migrate + verify

Security

Rotate encryption keys without losing records

Introduce a new write key without breaking old ciphertext, migrate records with conflict checks, and prove historical backups remain recoverable.

· 4 min read

Safe landing GET, Deliberate POST, and Atomic consumption

Security

Stop link previews from consuming one-time secrets

Keep landing-page GET and HEAD requests non-consuming, require an explicit reveal POST, and avoid mistaking preview protection for recipient authentication.

· 4 min read

Follow the RSS feed
Coding tutorials & development notes | CodeKits | CodeKits.shop