Module Http.Base64

base64 and base64url codecs.

As defined in RFC 4684.

Decode errors

type error =
| Invalid_letter of bool * int * char(*

index and letter.

| Unexpected_eoi of bool

The type for decoding errors. The boolean is true if that was a base64url decode.

val error_message : error -> string

error_message e is an error message for e.

val error_string : ('aerror) Stdlib.result -> ('a, string) Stdlib.result

error_string r is Result.map_error error_message r.


val encode : string -> string

encode s is the base64 encoding of s.

val decode : string -> (string, error) Stdlib.result

decode s is the base64 decode of s.


val url_encode : string -> string

url_encode is like encode but for the base64url encoding.

val url_decode : string -> (string, error) Stdlib.result

url_decode is like decode but for the base64url encoding.