std/encoding/base64
std/encoding/src/base64.trb
Base64 (RFC 4648 sections 4 and 5): Base64Alphabet.Standard (+, /, everywhere nothing says otherwise) and
Base64Alphabet.UrlSafe (-, _, which need no escaping in a URL or a file name - a JSON Web Token's segments, a
JSON Web Key's modulus), each with or without the = padding.
bytesOfBase64 (String.base64Decoded of std/encoding) reads either alphabet, padded or not, in the same call:
the two agree on 62 of their 64 characters, so nothing is lost by not asking which one a text was written in, and a
caller with a JWT or an S3 signature never has to.
type EncodingError
type EncodingError with Show, Error
Bytes or text that do not fit the encoding being read: what was wrong, and the character it was found at.
type Base64Alphabet
type Base64Alphabet with Show, Equals, Hash
Which of RFC 4648's two Base64 alphabets a text is written in.
case Standard
case Standard
RFC 4648 section 4: A-Z, a-z, 0-9, + and /.
case UrlSafe
case UrlSafe
RFC 4648 section 5: + and / replaced by - and _.
fn encoded
fn encoded(bytes: Bytes, padded: Bool = true): String
bytes written in this alphabet, padded with = to a multiple of four characters unless padded is false.