Enumeration
Base64URL
Namespace for URL-safe unpadded Base64 encoding (base64url).
enum Base64URL
Mentioned In
Overview
Base64URL implements the URL-safe, unpadded alphabet defined in RFC 4648 §5. The alphabet swaps + for - and / for _ relative to standard Base64, and strips the trailing = padding — producing strings that can be embedded directly in URLs, HTTP headers, JSON values, and filename segments without further escaping.
This encoding is the canonical transport form for JOSE (JWS per RFC 7515 and JWT per RFC 7519), WebAuthn credential blobs, Nostr NIP-19 identifiers, and DID documents. The namespace is caseless; call encode(_:) and decode(_:) as static entry points.
Note
This namespace is pure Swift on top of Foundation’s Data(base64Encoded:) / base64EncodedString(). It does not call into libcrypto and is not constant-time — do not feed it secret-dependent material that needs side-channel resistance.
See Also
encode(_:), decode(_:)
Topics
Type Methods