Skip to content

add req.queryString, crypto.hmacSha256, btoa/atob, encodeURIComponent…#93

Open
cs01 wants to merge 2 commits intomainfrom
http-usability
Open

add req.queryString, crypto.hmacSha256, btoa/atob, encodeURIComponent…#93
cs01 wants to merge 2 commits intomainfrom
http-usability

Conversation

@cs01
Copy link
Owner

@cs01 cs01 commented Mar 5, 2026

Summary

  • req.queryString — expose query string from HTTP requests. lws-bridge now splits the path at ? and populates a new query_string field on the request struct; codegen and type definitions updated accordingly.
  • crypto.hmacSha256 / crypto.pbkdf2 — HMAC-SHA256 and PBKDF2 key derivation via OpenSSL (HMAC(), PKCS5_PBKDF2_HMAC).
  • btoa / atob — base64 encode/decode via new c_bridges/base64-bridge.c.
  • encodeURIComponent / decodeURIComponent — percent-encoding per RFC 3986 via new c_bridges/uri-bridge.c.

Test plan

  • tests/fixtures/encoding/base64.ts — round-trip encode/decode, known value check
  • tests/fixtures/encoding/uri.ts — round-trip encode/decode, known value check
  • tests/fixtures/crypto/hmac.ts — known HMAC-SHA256 vector (f7bc83f4...)
  • npm test — 412 passing, 5 failing (all pre-existing: os-basic, static-fields, static-methods, string-lastindexof, promise-race-test)

cs01 added 2 commits March 4, 2026 23:04
…/decodeURIComponent

- lws-bridge: parse query string from path, expose as query_string field
- http-server codegen: add queryString to request struct and handler metadata
- crypto: add hmacSha256 (openssl HMAC) and pbkdf2 (PKCS5_PBKDF2_HMAC)
- base64-bridge.c: cs_btoa/cs_atob for base64 encode/decode
- uri-bridge.c: cs_encode_uri_component/cs_decode_uri_component
- calls.ts: dispatch btoa, atob, encodeURIComponent, decodeURIComponent
- type-inference: return string type for all new global functions
- llvm-declarations: gate new externs behind usesBase64/usesUri flags
- compiler/native-compiler-lib: link base64 and uri bridge objects
- tests: add fixtures for base64, uri encoding, hmac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant