Merged
Conversation
974da3f to
8c82bea
Compare
e048970 to
d27aa71
Compare
…o avoid native compiler crash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: btoa/atob, encodeURIComponent, crypto.pbkdf2
Adds several Web API globals and a key derivation primitive:
btoa/atob,encodeURIComponent/decodeURIComponent, andcrypto.pbkdf2. Includes a newuri-bridge.cfor percent-encoding, docs for all new APIs plus URL/URLSearchParams (merged separately), and CI fixes for artifact packaging and cross-compile reliability.What's new
btoa/atobencodeURIComponent/decodeURIComponentRFC 3986 compliant — only unreserved chars (
A-Z a-z 0-9 - _ . ~) are left unencoded.crypto.pbkdf2(password, salt, iterations, keylen)Uses OpenSSL
PKCS5_PBKDF2_HMACwith SHA-256. Known test vector:pbkdf2("password", "salt", 1, 20)→"0c60c80f961f0e71f3a9b524af6012062fe037a6".Implementation
c_bridges/base64-bridge.c— addedcs_btoaandcs_atobto existing base64 bridge. Handles standard base64 with padding.c_bridges/uri-bridge.c(new) —cs_encode_uri_componentandcs_decode_uri_componentusing GC-aware allocation.src/codegen/expressions/calls.ts— dispatch forbtoa,atob,encodeURIComponent,decodeURIComponentas global functions (same pattern asparseInt/isNaN).src/codegen/stdlib/crypto.ts—generatePbkdf2using OpenSSL PKCS5 PBKDF2 HMAC.CI fixes
scripts/build-target-sdk.sh— adduri-bridge.oto cross-compile SDK tarball..github/workflows/ci.yml— adduri-bridge.oto all 4 artifact locations (Linux verify, Linux release, macOS verify, macOS release). Also add--target-cpu=x86-64to stage0 compilation so native code doesn't use AVX/newer instructions that crash GitHub's baseline x86-64 runners.tests/self-hosting.test.ts— pass--target-cpu=x86-64to stage0 build.Docs
docs/stdlib/encoding.md(new) —btoa/atob,encodeURIComponent/decodeURIComponentdocs/stdlib/crypto.md— addedcrypto.pbkdf2sectiondocs/stdlib/url.md(new) —URLandURLSearchParams(feature landed in add url and urlsearchparams classes with c bridge #107, docs here)docs/stdlib/index.md— updated globals example