calendar
All repositories: gitoria
2.7 KB
# hl:crypto — Web Push primitives (ticket #173)Beside passwords/hashing/base64 (see `server.hl`), hl:crypto carries what RFC 8030 / 8291 /8292 need, in Zig `std.crypto` (no OpenSSL) with a node:crypto twin in `server.js`.Everything takes and returns `Bytes`; calls that can be handed bad input answer `null`(or `false`) instead of throwing.| call | in | out ||---|---|---|| `base64urlEncode(data)` | String (its UTF-8) or Bytes | String, URL-safe alphabet, **no padding** || `base64urlDecode(text)` | String | Bytes, or `null` (not base64url; `+` `/` refused; padded or unpadded accepted) || `p256Generate()` | – | `{ privateKey: Bytes 32, publicKey: Bytes 65 }` (uncompressed `04‖X‖Y`); for ES256 **and** ECDH || `p256PublicKey(privateKey)` | Bytes 32 | Bytes 65, or `null` (invalid scalar) || `es256Sign(privateKey, message)` | Bytes 32, Bytes | Bytes 64 = raw `r‖s` (JWS, not DER); hedged (fresh noise per signature) || `es256Verify(publicKey, message, signature)` | Bytes 65, Bytes, Bytes 64 | Boolean (`false` for any malformed input) || `ecdhSharedSecret(privateKey, peerPublicKey)` | Bytes 32, Bytes 65 | Bytes 32 (the X coordinate), or `null` (peer not on the curve) || `hkdfExtract(salt, ikm)` | Bytes, Bytes | Bytes 32 (PRK); empty salt allowed || `hkdfExpand(prk, info, length)` | Bytes 32, Bytes, Number 1..8160 | Bytes `length` || `hkdf(salt, ikm, info, length)` | as above | extract then expand || `aes128gcmEncrypt(key, nonce, plaintext, aad)` | Bytes 16, Bytes 12, Bytes, Bytes or `null` | Bytes = ciphertext ‖ 16-byte tag (`plaintext.length + 16`) || `aes128gcmDecrypt(key, nonce, data, aad)` | Bytes 16, Bytes 12, Bytes (ct‖tag), Bytes or `null` | Bytes plaintext, or `null` when the tag fails / input shorter than 16 |Wrong-size key, nonce, private key or PRK is a located error (programmer mistake); a wrong*peer* value is `null`/`false` (remote data).Known-answer tests: `plugins/build.sh test` (RFC 5869 A.1–A.3, McGrew-Viega GCM cases 1, 2, 4,node:crypto P-256 key / ECDH secret / ES256 signature), `tests/pass/plugins/038_*` (the samethrough the language, plus both engines) and `tests/pass/plugins/037_crypto_rfc8291.hl`(RFC 8291 §5/Appendix A end to end, composed only from these calls).`timingSafeEqual(a, b)` compares Strings (their UTF-8 bytes), Bytes, or one of each.It returns a Boolean; equal byte sequences, including empty inputs, return true.Equal-length inputs are compared without depending on where they differ; unequalbyte lengths return false immediately (length is public). Other input types returnfalse. Native calls reuse `constantTimeEql`; Node calls `node:crypto` timingSafeEqual.The plugin has no browser half, so this call is not offered in the browser.Regression: `tests/pass/plugins/062_crypto_timing_safe_equal.hl`.
Branches
Latest commits
- f9b8f918Merge branch 'calendar-vendor-day61' into mainAtlas
- 66341793|||PR Vendor Hybriel day61Atlas
- 36fc596bMerge branch 'vendor-day59' into mainAtlas
- b37cc1da|||PR Vendor Hybriel day59Atlas
- 05665102Merge branch 'vendor-day56' into mainAtlas
- 687296fb|||PR Vendor Hybriel day56Atlas
- a6166d4eMerge branch 'hl-standard-3' into mainAtlas
- 6d0eb3b0|||PR Calendar day add buttons only when signed in (Kunibert minor)Atlas
- add4b499|||PR Make calendar day actions keyboard accessibleAtlas
- 79e49b4dMerge branch 'hl-standard' into mainAtlas
- e9fec7bb|||PR HL-STANDARD clean-up: typed parameters, plain locals, by-reference cacheAtlas
- eff166a4Re-vendor complete Hybriel plugins and runtime to day44mre
- cef81394Wait for the DST fixture page instead of an unused socketmre
- 42434f47Check lazy-session cookies after login with a stored anonymous fixturemre
- 728e84e3Re-vendor complete Hybriel day41 plugin directoriesmre
- cbd7ff43Backup tar: --hard-dereference, so mpackdb sidecars are never stored as hard links (Tracker's finding)mre
- 59d1da0acalendar: plain declarations instead of needless let in 9 files (calendar#17): 49 declarations that are never reassigned; reassigned ones and the timer closure's p stay letmre
- f5415cf9calendar: the Style blocks in the language's nested form (calendar#16): rules named after the View's own elements with their children nested, pseudo-classes and @media nested, merged duplicate select rule; same CSS, shots identical in Chrome at 4 sizesmre
- edb7c947calendar: the sign-in callback keeps the session it finds and signs it in (same cookie, nothing signed out; ident#28); security gate 56+4 failing → 60 passedmre
- bf8cc0fcStyles move into their components: the shell's styles into main.hl, the events and the editors into the month view's Style block; styles.hl keeps only the theme inherit, the accent and the message line; .gitignore ignores a bin symlink too; tests/styles-shots.mjs for the before/after pixel comparemre