ident
All repositories: gitoria
2.2 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).
Branches
Latest commits
- 349cb502tests/invites: wait for hydration on the code page before entering the code (native GET submit raced the welcome form); mission 015 reportmre
- d1bf4720tests: no hard-coded ports — every gate's ports and fixture origins come from <GATE>_PORT / _CHROME env (defaults unchanged; Bob/fixture origins follow, selector cookie name too)mre
- 6280c92fre-vendor Hybriel 6f8a0689 (int 6–11: streaming cursors, #203 index heal + close() fix, fd403 listDir/cursor fds, hl:time browser side, hl:web batches 5+6)mre
- 147744bftests/migration: the fixture app origin follows MIGRATION_GATE_TESTAPP_PORT (oldstore-009 OLD_TESTAPP)mre
- 48cd36bctests/migration: ports from env (MIGRATION_GATE_PORT, MIGRATION_GATE_TESTAPP_PORT); 8395/8396 were taken by a foreign servermre
- 3d9b2fd8docker-compose: nofile 65536 (Hybriel int 6+ boot opened >1024 files in the tracker)mre
- 19b7e3c3deploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre
- c8a596f4re-vendor Hybriel 66c3db71 (web batch 4); e2e: main menu marked after in-place sign-in is a normal check; report 014mre
- 8f3dc1ectests: delivery allow-list for the stopped server's network errors uses the gate port, not 8700mre
- 9cc8eddftests: notify and iplimit gate Chrome ports from env (NOTIFY_GATE_CHROME, IPLIMIT_GATE_CHROME_A/B)mre
- d6da2d02tests: delivery and migration gate ports from env (DELIVERY_GATE_PORT, DELIVERY_GATE_CHROME, MIGRATION_GATE_CHROME) — hard-coded 8700-8719 collided with a worker during deploymre
- 7276a008ident mission 013: re-vendor Hybriel master f9614007 (#200, #202 mpackdb copy fix); gates and e2e rerunmre
- e13e30c3ident mission 013: report, mission, repro, LOGmre
- eff734f3ident mission 013: in-place sign-out also closes the code step (no leftover code form); checksmre
- b7a61546ident mission 013: e2e — in-place main-menu mark kept as a known gapmre
- 59b43d81ident mission 013: sign out everywhere keeps this browser's own (signed-out) session so the page goes on in placemre
- 716e14ffident mission 013: browser gate — Bob signs out everywhere (no second code request)mre
- 5885f1c9ident mission 013 step 2: stopgap reload removed (in-place sign-in/out reach the shell via emit, notices back, route-marked main menu), gates updatedmre
- 734ac0a9ident mission 013 step 1: re-vendor Hybriel ce6f2e0a (plugins whole; bin/ is git-ignored)mre
- b37875ccident mission 012 part 3: real-Chrome fixes (brand 44 px, identity form width), e2e walk, report, logmre