Skip to content

crypto: encode base64url digests directly into the WTF string buffer - #32320

Closed
robobun wants to merge 3 commits into
mainfrom
farm/f981a627/base64url-digest-no-alloc
Closed

robobun wants to merge 3 commits into
mainfrom
farm/f981a627/base64url-digest-no-alloc

test: cover digest('base64url') across all hash output sizes

8485e93
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jun 15, 2026 in 10m 49s

Code review found 1 potential issue

Found 1 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit test/js/bun/util/base64-url-safe-encode.test.ts:101-107 New test does not exercise the changed Rust code path

Annotations

Check warning on line 107 in test/js/bun/util/base64-url-safe-encode.test.ts

See this annotation in the file changed.

@claude claude / Claude Code Review

New test does not exercise the changed Rust code path

This test's comment says it covers `Encoding::encode_with_max_size` so a mis-sized buffer would show up here, but `createHash` from `node:crypto` is implemented in C++ (`JSHash.cpp` → `StringBytes::encode`) and never reaches the Rust `encode_with_max_size` arm this PR modifies — only `Bun.CryptoHasher`, `Bun.CSRF.generate`, and `Bun.randomUUIDv7` go through it. Switch to `new Bun.CryptoHasher(algo)` (or add it alongside) so the test actually exercises the in-place encode it claims to cover; the