Skip to content

Add b64url_digest method for URL-safe base64 digests#8

Draft
toddr-bot wants to merge 22 commits into
gisle:masterfrom
Dual-Life:koan.toddr.bot/add-b64url-digest
Draft

Add b64url_digest method for URL-safe base64 digests#8
toddr-bot wants to merge 22 commits into
gisle:masterfrom
Dual-Life:koan.toddr.bot/add-b64url-digest

Conversation

@toddr-bot
Copy link
Copy Markdown

What

Adds b64url_digest() method to Digest::base — URL-safe base64 encoding of digests per RFC 4648 §5.

Why

Resolves #2. Embedding digests in URLs currently requires encode_base64url($ctx->digest) with a direct MIME::Base64 dependency at the call site. A first-class method completes the digest output format family (binary, hex, base64, base64url).

How

Reuses b64digest() and applies tr[+/][-_] — no new MIME::Base64 version requirement, works on Perl 5.006+.

Testing

  • 5 new tests in t/base.t: verifies no-op on digests without +/, and explicit +- and /_ translation using a binary digest mock.
  • Full test suite passes (28 tests).

🤖 Generated with Claude Code

toddr and others added 22 commits October 6, 2020 09:56
- meta-spec 2 resources format
- dependencies are static, set dynamic_config 0
- EUMM will set configure_requires on itself
- Test::More only used in tests
- boilerplate to clean out unsupported keys if installed with old EUMM
Makefile.PL - use meta-spec 2, fix prereqs, compatibility with old EUMM
base.t, file.t: unlink temporary files created during testing
Adds b64url_digest() to Digest::base, returning the digest using the
URL-safe base64 alphabet (- instead of +, _ instead of /) without
padding, per RFC 4648 section 5. This is a convenience shortcut for
the common pattern of encoding a digest for use in URLs and filenames.

Closes #2

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Companion to b64url_digest — provides the same URL-safe base64
output format through the file convenience API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Add b64url_digest method

5 participants