tracker
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
- a4047071RV28c: re-vendor Hybriel set day35 (source cb9e480d, bin 4bb25cfa)mre
- 765057fbMerge main into rv28c (LOG.md, STATUS.md: both sides kept)mre
- bf401884Tracker: RV28c startedmre
- 0ff4ecd4Tracker: RV28c briefmre
- 06565b1fRecords: day35 relay note, tickets subscription idmre
- c6dc3e86RV28b: switch to set day35mre
- 24e401b8Tracker: TR7 watch cleanmre
- b0412957Tracker: RV28b handed overmre
- 456940c8Tracker: RULINGS pathmre
- b87a8fdcTracker: worldapi-conductor paths backmre
- 641f3b54Tracker: Apollo answermre
- 8b3cbddaTracker: status, TR7 fix livemre
- ec30162aTracker: TR7 fix livemre
- 54cbec80compose: ignore SIGPIPE (TR7 crash loop, exit 141)mre
- 3e164b63Tracker: status after CL1mre
- 9d686bb3Tracker: CL1 reviewedmre
- b8bba562CL1: crash loop report (SIGPIPE confirmed, trap wrapper option)mre
- 298785f2Tracker: CL1 startedmre
- 36b22710Tracker: port slot, CL1 briefmre
- a401190fTracker: GO for the crash loopmre