Webs_base64
base64
and base64url
codecs.
As defined in RFC 4684, with or without padding. Decoding errors on non-canonical encodings to ensure that no two different encodings decode to the same byte sequence (see this paper).
The type for specifing padding.
error_message enc e
is an error message for error e
while decoding encoding enc
.
base64
val encode : padding -> string -> string
encode p s
is the base64
encoding of s
padded according to p
.
decode' p s
is the base64
decode of s
. If p
is:
`Padding
the decode expects a padded encoding. The decode errors with Invalid_length
if the padding is missing.`Unpadded
the decode expect no padding. The decode errors with Invalid_letter
if there is a padding.All decodes error with Non_canonical_encoding
if a padding letter has a non-zero padding.
val decode : padding -> string -> (string, string) Stdlib.result
decode
is like decode'
with errors mapped by error_message
`Base64
.
base64url
val encode_base64url : padding -> string -> string
val decode_base64url : padding -> string -> (string, string) Stdlib.result
decode_base64url
is like decode_base64url'
with errors mapped by error_message
`Base64url
.