Skip to content

Base64URL #4692

@dcposch

Description

@dcposch

🧐 Motivation

OZ has a great Base64 encoder. (And, as far as I can tell, the only audited one.)

There's a lot of interest in passkey-based wallets now, which offer an excellent self-custody UX. These rely on the WebAuthn standard, which uses Base64URL.

For that use case and for completeness, it would be great to have a canonical, audited onchain Base64URL encoder.

📝 Details

Encoding Input Output
Base64 hello world aGVsbG8gd29ybGQ=
Base64URL hello world aGVsbG8gd29ybGQ

I think this can be done with contract derived from Base64.sol with two straightforward modifications:

  • Change two characters in the lookup table
  • Remove the trailing = padding

If there's interest, I'm happy to send a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions