Repository navigation
state_exec: sha256, sha256-hex and random-token builtins - #911
Merged
Merged
Conversation
- (sha256 x) / (sha256-hex x): the SHA-256 of a string's UTF-8 bytes or a bytes value, as 32 bytes or 64 lowercase hex digits (libcvc's own cvc::sha256_hex). - (random-token nbytes ["base64url"|"hex"]): 1..256 bytes from the OS CSPRNG (getentropy; crypto.getRandomValues under Emscripten; rand_s on Windows) as unpadded base64url (default) or hex. - Not in Ariadne's read-lane allowlist. Tests: NIST known answers, the raw digest, token lengths and alphabets, and argument errors. Docs: the developer guide.
transfix
added a commit
to cy-pca/cypkg
that referenced
this pull request
Oct 30, 2026
Account > Sign in with a browser runs cvcpkg's device pairing, its OIDC route for a terminal: a random verifier (random-token), its SHA-256 sent to /v1/auth/device, the code and an absolute approval URL shown, and a poll of /v1/auth/device/token at the server's interval (slow_down honoured) with capture_auth taking the access and refresh tokens into the host. Cancel stops it; a denied or expired code says so. main.ari re-asks the host once a token is captured. Sign out revokes a paired session on the server before forgetting it. bin/cypkg keeps the sign-in in ari's credential store (--credential-store cypkg, 0600) unless --no-remember. Pairing needs sha256-hex and random-token (transfix/libcvc#911); CI now merges #911 and #912, and the resolver keeps both sides of docs and test conflicts between open PRs. The fixture plays the pairing endpoints, with /_approve standing in for a person at /link; pairing_test.ari covers approve, revoke, deny, cancel.
transfix
added a commit
to cy-pca/cypkg
that referenced
this pull request
Oct 30, 2026
…th a token or a browser (#6) * Snappier search: facets only for a new query, prefetched pages, a progress bar Next was slow because every page asked cvcpkg.org for facets, which makes it count every match: 1.2 s for page 2 of everything and 2.4 s for page 2 of zlib, against 0.2 s and 0.4 s without. Now only a new query or filter asks for facets (the honest package count); paging reuses that count. After showing a page the search module prefetches the next one in the background and keeps the page it left, so Next and Prev are answered with no request. Requests wait in 50 ms slices (http-get-async and await with a timeout), and between slices the module draws an indeterminate progress bar at the bottom of its view; the package module does too. lib.ari gains search-key, body-text and progress-bar, and search-query takes facets. The fixture logs its requests (/_requests) and answers a slow: name after a second. Module tests show a new query asks for facets and paging doesn't, Next and Prev make no request, and the bar draws during a slow request and clears after; with prefetch disabled they fail. * wip: windows * Menu bar and windows: builders, builds, activity, account; API-token sign-in A View menu opens a window per page the registry's site has: Builders, Builds (by status, paged), Activity and Account, beside Search. Each is a module in share/cypkg/, started when its window first opens, refreshing about every 10 s while open (idle-wait answers a click at once), with a progress bar at its bottom. Signing in: bin/cypkg --token-env VAR hands a cvctok_ token to ari (--credential-env, bound to the registry by a policy file for the run). main.ari asks the host (has? works only at the top level) and hands auth.* to the modules through a hole; every request then sends the token. Account shows whoami and signs out; a refused token is dropped. Browser sign-in (device pairing) waits on sha256-hex and random-token in libcvc. net.ari holds fetch, now shared by every module, so lib.ari stays pure. --progress off makes plain blocking requests, for a browser ari without transfix/libcvc#914, which CI's browser build now merges. The fixture serves builders, builds, activity and whoami; tests cover each module, the account signed in and out, each window's frame, and opening Builders from the View menu in FTXUI and tvision. * Sign in with a browser: device pairing, remembered between runs Account > Sign in with a browser runs cvcpkg's device pairing, its OIDC route for a terminal: a random verifier (random-token), its SHA-256 sent to /v1/auth/device, the code and an absolute approval URL shown, and a poll of /v1/auth/device/token at the server's interval (slow_down honoured) with capture_auth taking the access and refresh tokens into the host. Cancel stops it; a denied or expired code says so. main.ari re-asks the host once a token is captured. Sign out revokes a paired session on the server before forgetting it. bin/cypkg keeps the sign-in in ari's credential store (--credential-store cypkg, 0600) unless --no-remember. Pairing needs sha256-hex and random-token (transfix/libcvc#911); CI now merges #911 and #912, and the resolver keeps both sides of docs and test conflicts between open PRs. The fixture plays the pairing endpoints, with /_approve standing in for a person at /link; pairing_test.ari covers approve, revoke, deny, cancel. * CI: read ari's outputs before grepping them, so grep -q can't SIGPIPE the writer
added 3 commits
October 30, 2026 19:42
# Conflicts: # src/cvc/tests/state_exec_builtins_test.cpp
# Conflicts: # docs/STATE_EXEC_DEVELOPER_GUIDE.md
# Conflicts: # docs/STATE_EXEC_DEVELOPER_GUIDE.md
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.
For cypkg's OIDC sign-in by device pairing against cvcpkg:
POST /v1/auth/devicewithverifier_hash, the hex SHA-256 of a random secret (cvcpkg'spairing.py:hashlib.sha256(verifier.encode()).hexdigest())./v1/auth/device/tokenwith the verifier.The DSL had no hash function, and its only randomness was
math.random, which is not a CSPRNG.Builtins
(sha256 x)and(sha256-hex x)hash a string's UTF-8 bytes, or a bytes value's octets.TypeError.cvc::sha256_hex(state_blob_store.h), so there is no new dependency.(sha256-hex verifier)equals Python'shashlib.sha256(verifier.encode()).hexdigest().(random-token nbytes ["base64url"|"hex"])returns 1..256 bytes from the OS CSPRNG as text."hex"gives lowercase hex.getentropy(Linux, macOS, POSIX), Emscripten'sgetentropy(crypto.getRandomValues), orrand_son Windows.ValueError; a non-integer count is aTypeError.bind:,visible_when:); theinit:and action lanes get all three.Tests
state_exec_builtins_test(73 pass locally) adds:"","abc", the 448-bit NIST message);state_exec_exceptions_testandariadne_runtime_testalso pass.Docs: docs/STATE_EXEC_DEVELOPER_GUIDE.md, "Hashing and Secure Randomness".