unsecure
IntroductionCryptoGenerateSafetyRecipes
  • Recipes
  • Verify a webhook
  • Login with 2FA
  • Store passwords
  • Issue API tokens
  • Derive keys
  • Parse untrusted JSON
  • Import from a CDN

Recipes

Whole tasks rather than single functions: what to call, in what order, and what to store between calls.

Each page here is one job, written the way you would actually ship it.

Verify a webhook

Read the raw body, check the signature, and keep the failure path shaped like the success path.

Login with 2FA

Password, then a one-time password, with replay refused and the timing flat.

Store passwords

Argon2 with a pepper, lazy rehashing, and the absent-account branch.

Issue API tokens

Generate, store only the digest, look up by digest, compare in constant time.

Derive keys

One secret, many labelled keys, imported once.

Parse untrusted JSON

One call that parses and strips prototype-pollution keys.

Import from a CDN

A browser page that downloads one module and nothing else.

Edit this page
Previous Errors Next Verify a webhook

unsecure  Cryptographic utilities on the Web Crypto API.