-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | A modern RFC 4648-compliant Base64 library
--   
--   RFC 4648-compliant Base64 with an eye towards performance and
--   modernity (additional support for RFC 7049 standards)
@package base64
@version 0.4.2.4

-- | This module contains ByteString-valued combinators for
--   implementing the RFC 4648 specification of the Base64 encoding format.
--   This includes lenient decoding variants, as well as internal and
--   external validation for canonicity.
module Data.ByteString.Base64

-- | Encode a ByteString value as Base64 Text with padding.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> encodeBase64 "Sun"
--   "U3Vu"
--   
encodeBase64 :: ByteString -> Text

-- | Encode a ByteString value as a Base64 ByteString value
--   with padding.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> encodeBase64' "Sun"
--   "U3Vu"
--   
encodeBase64' :: ByteString -> ByteString

-- | Decode a padded Base64-encoded ByteString value.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64 "U3Vu"
--   Right "Sun"
--   
--   
--   
--   >>> decodeBase64 "U3V"
--   Left "Base64-encoded bytestring requires padding"
--   
--   
--   
--   >>> decodebase64 "U3V="
--   Left "non-canonical encoding detected at offset: 2"
--   
decodeBase64 :: ByteString -> Either Text ByteString

-- | Leniently decode an unpadded Base64-encoded ByteString value.
--   This function will not generate parse errors. If input data contains
--   padding chars, then the input will be parsed up until the first pad
--   character.
--   
--   Note: This is not RFC 4648-compliant.
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Lenient "U3Vu"
--   "Sun"
--   
--   
--   
--   >>> decodeBase64Lenient "U3V"
--   "Su"
--   
--   
--   
--   >>> decodebase64Lenient "U3V="
--   "Su"
--   
decodeBase64Lenient :: ByteString -> ByteString

-- | Tell whether a ByteString value is base64 encoded.
--   
--   This function will also detect non-canonical encodings such as
--   ZE==, which are externally valid Base64url-encoded values,
--   but are internally inconsistent "impossible" values.
--   
--   
Examples:
--   
--   
--   >>> isBase64 "U3Vu"
--   True
--   
--   
--   
--   >>> isBase64 "U3V"
--   False
--   
--   
--   
--   >>> isBase64 "U3V="
--   False
--   
isBase64 :: ByteString -> Bool

-- | Tell whether a ByteString value is a valid Base64 format.
--   
--   This will not tell you whether or not this is a correct Base64url
--   representation, only that it conforms to the correct shape. To check
--   whether it is a true Base64 encoded ByteString value, use
--   isBase64.
--   
--   
Examples:
--   
--   
--   >>> isValidBase64 "U3Vu"
--   True
--   
--   
--   
--   >>> isValidBase64 "U3V"
--   True
--   
--   
--   
--   >>> isValidBase64 "U3V="
--   True
--   
--   
--   
--   >>> isValidBase64 "%"
--   False
--   
isValidBase64 :: ByteString -> Bool

-- | This module contains ByteString-valued combinators for
--   implementing the RFC 4648 specification of the Base64url encoding
--   format. This includes strictly padded/unpadded and lenient decoding
--   variants, as well as internal and external validation for canonicity.
module Data.ByteString.Base64.URL

-- | Encode a ByteString value as a Base64url Text value with
--   padding.
--   
--   See: RFC-4648 section 5
--   
--   
Examples:
--   
--   
--   >>> encodeBase64 "<<?>>"
--   "PDw_Pj4="
--   
encodeBase64 :: ByteString -> Text

-- | Encode a ByteString as a Base64url ByteString value with
--   padding.
--   
--   See: RFC-4648 section 5
--   
--   
Examples:
--   
--   
--   >>> encodeBase64' "<<?>>"
--   "PDw_Pj4="
--   
encodeBase64' :: ByteString -> ByteString

-- | Encode a ByteString value as Base64url Text without
--   padding. Note that for Base64url, padding is optional. If you call
--   this function, you will simply be encoding as Base64url and stripping
--   padding chars from the output.
--   
--   See: RFC-4648 section 3.2
--   
--   
Examples:
--   
--   
--   >>> encodeBase64Unpadded "<<?>>"
--   "PDw_Pj4"
--   
encodeBase64Unpadded :: ByteString -> Text

-- | Encode a ByteString value as Base64url without padding. Note
--   that for Base64url, padding is optional. If you call this function,
--   you will simply be encoding as Base64url and stripping padding chars
--   from the output.
--   
--   See: RFC-4648 section 3.2
--   
--   
Examples:
--   
--   
--   >>> encodeBase64Unpadded' "<<?>>"
--   "PDw_Pj4"
--   
encodeBase64Unpadded' :: ByteString -> ByteString

-- | Decode a padded Base64url encoded ByteString value. If its
--   length is not a multiple of 4, then padding chars will be added to
--   fill out the input to a multiple of 4 for safe decoding as
--   Base64url-encoded values are optionally padded.
--   
--   For a decoder that fails on unpadded input of incorrect size, use
--   decodeBase64Unpadded.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64 "PDw_Pj4="
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64 "PDw_Pj4"
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64 "PDw-Pg="
--   Left "Base64-encoded bytestring has invalid padding"
--   
--   
--   
--   >>> decodeBase64 "PDw-Pg"
--   Right "<<>>"
--   
decodeBase64 :: ByteString -> Either Text ByteString

-- | Decode an unpadded Base64url-encoded ByteString value. Input
--   strings are required to be unpadded, and will undergo validation prior
--   to decoding to confirm.
--   
--   In general, unless unpadded Base64url is explicitly required, it is
--   safer to call decodeBase64.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Unpadded "PDw_Pj4"
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64Unpadded "PDw_Pj4="
--   Left "Base64-encoded bytestring has invalid padding"
--   
decodeBase64Unpadded :: ByteString -> Either Text ByteString

-- | Decode a padded Base64url-encoded ByteString value. Input
--   strings are required to be correctly padded, and will be validated
--   prior to decoding to confirm.
--   
--   In general, unless padded Base64url is explicitly required, it is
--   safer to call decodeBase64.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Padded "PDw_Pj4="
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64Padded "PDw_Pj4"
--   Left "Base64-encoded bytestring requires padding"
--   
decodeBase64Padded :: ByteString -> Either Text ByteString

-- | Leniently decode an unpadded Base64url-encoded ByteString. This
--   function will not generate parse errors. If input data contains
--   padding chars, then the input will be parsed up until the first pad
--   character.
--   
--   Note: This is not RFC 4648-compliant.
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Lenient "PDw_Pj4="
--   "<<?>>"
--   
--   
--   
--   >>> decodeBase64Lenient "PDw_%%%$}Pj4"
--   "<<?>>"
--   
decodeBase64Lenient :: ByteString -> ByteString

-- | Tell whether a ByteString is encoded in padded or
--   unpadded Base64url format.
--   
--   This function will also detect non-canonical encodings such as
--   ZE==, which are externally valid Base64url-encoded values,
--   but are internally inconsistent "impossible" values.
--   
--   
Examples:
--   
--   
--   >>> isBase64Url "PDw_Pj4="
--   True
--   
--   
--   
--   >>> isBase64Url "PDw_Pj4"
--   True
--   
--   
--   
--   >>> isBase64Url "PDw_Pj"
--   False
--   
isBase64Url :: ByteString -> Bool

-- | Tell whether a ByteString is a valid Base64url format.
--   
--   This will not tell you whether or not this is a correct Base64url
--   representation, only that it conforms to the correct shape. To check
--   whether it is a true Base64 encoded ByteString value, use
--   isBase64Url.
--   
--   
Examples:
--   
--   
--   >>> isValidBase64Url "PDw_Pj4="
--   True
--   
--   
--   
--   >>> isValidBase64Url "PDw_Pj"
--   True
--   
--   
--   
--   >>> isValidBase64Url "%"
--   False
--   
isValidBase64Url :: ByteString -> Bool

-- | This module contains ByteString-valued combinators for
--   implementing the RFC 4648 specification of the Base64 encoding format.
--   This includes lenient decoding variants, as well as internal and
--   external validation for canonicity.
module Data.ByteString.Lazy.Base64

-- | Encode a ByteString value as Base64 Text with padding.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> encodeBase64 "Sun"
--   "U3Vu"
--   
encodeBase64 :: ByteString -> Text

-- | Encode a ByteString value as a Base64 ByteString value
--   with padding.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> encodeBase64' "Sun"
--   "U3Vu"
--   
encodeBase64' :: ByteString -> ByteString

-- | Decode a padded Base64-encoded ByteString value.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64 "U3Vu"
--   Right "Sun"
--   
--   
--   
--   >>> decodeBase64 "U3V"
--   Left "Base64-encoded bytestring requires padding"
--   
--   
--   
--   >>> decodebase64 "U3V="
--   Left "non-canonical encoding detected at offset: 2"
--   
decodeBase64 :: ByteString -> Either Text ByteString

-- | Leniently decode an unpadded Base64-encoded ByteString value.
--   This function will not generate parse errors. If input data contains
--   padding chars, then the input will be parsed up until the first pad
--   character.
--   
--   Note: This is not RFC 4648-compliant.
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Lenient "U3Vu"
--   "Sun"
--   
--   
--   
--   >>> decodeBase64Lenient "U3V"
--   "Su"
--   
--   
--   
--   >>> decodebase64Lenient "U3V="
--   "Su"
--   
decodeBase64Lenient :: ByteString -> ByteString

-- | Tell whether a ByteString value is base64 encoded.
--   
--   This function will also detect non-canonical encodings such as
--   ZE==, which are externally valid Base64url-encoded values,
--   but are internally inconsistent "impossible" values.
--   
--   
Examples:
--   
--   
--   >>> isBase64 "U3Vu"
--   True
--   
--   
--   
--   >>> isBase64 "U3V"
--   False
--   
--   
--   
--   >>> isBase64 "U3V="
--   False
--   
isBase64 :: ByteString -> Bool

-- | Tell whether a ByteString value is a valid Base64 format.
--   
--   This will not tell you whether or not this is a correct Base64url
--   representation, only that it conforms to the correct shape. To check
--   whether it is a true Base64 encoded ByteString value, use
--   isBase64.
--   
--   
Examples:
--   
--   
--   >>> isValidBase64 "U3Vu"
--   True
--   
--   
--   
--   >>> isValidBase64 "U3V"
--   True
--   
--   
--   
--   >>> isValidBase64 "U3V="
--   True
--   
--   
--   
--   >>> isValidBase64 "%"
--   False
--   
isValidBase64 :: ByteString -> Bool

-- | This module contains ByteString-valued combinators for
--   implementing the RFC 4648 specification of the Base64url encoding
--   format. This includes strictly padded/unpadded and lenient decoding
--   variants, as well as internal and external validation for canonicity.
module Data.ByteString.Lazy.Base64.URL

-- | Encode a ByteString value as a Base64url Text value
--   with padding.
--   
--   See: RFC-4648 section 5
--   
--   
Examples:
--   
--   
--   >>> encodeBase64 "<<?>>"
--   "PDw_Pj4="
--   
encodeBase64 :: ByteString -> Text

-- | Encode a ByteString as a Base64url ByteString value with
--   padding.
--   
--   See: RFC-4648 section 5
--   
--   
Examples:
--   
--   
--   >>> encodeBase64' "<<?>>"
--   "PDw_Pj4="
--   
encodeBase64' :: ByteString -> ByteString

-- | Encode a ByteString value as Base64url Text without
--   padding. Note that for Base64url, padding is optional. If you call
--   this function, you will simply be encoding as Base64url and stripping
--   padding chars from the output.
--   
--   See: RFC-4648 section 3.2
--   
--   
Examples:
--   
--   
--   >>> encodeBase64Unpadded "<<?>>"
--   "PDw_Pj4"
--   
encodeBase64Unpadded :: ByteString -> Text

-- | Encode a ByteString value as Base64url without padding. Note
--   that for Base64url, padding is optional. If you call this function,
--   you will simply be encoding as Base64url and stripping padding chars
--   from the output.
--   
--   See: RFC-4648 section 3.2
--   
--   
Examples:
--   
--   
--   >>> encodeBase64Unpadded' "<<?>>"
--   "PDw_Pj4"
--   
encodeBase64Unpadded' :: ByteString -> ByteString

-- | Decode a padded Base64url encoded ByteString value. If its
--   length is not a multiple of 4, then padding chars will be added to
--   fill out the input to a multiple of 4 for safe decoding as
--   Base64url-encoded values are optionally padded.
--   
--   For a decoder that fails on unpadded input of incorrect size, use
--   decodeBase64Unpadded.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64 "PDw_Pj4="
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64 "PDw_Pj4"
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64 "PDw-Pg="
--   Left "Base64-encoded bytestring has invalid padding"
--   
--   
--   
--   >>> decodeBase64 "PDw-Pg"
--   Right "<<>>"
--   
decodeBase64 :: ByteString -> Either Text ByteString

-- | Decode an unpadded Base64url-encoded ByteString value. Input
--   strings are required to be unpadded, and will undergo validation prior
--   to decoding to confirm.
--   
--   In general, unless unpadded Base64url is explicitly required, it is
--   safer to call decodeBase64.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Unpadded "PDw_Pj4"
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64Unpadded "PDw_Pj4="
--   Left "Base64-encoded bytestring has invalid padding"
--   
decodeBase64Unpadded :: ByteString -> Either Text ByteString

-- | Decode a padded Base64url-encoded ByteString value. Input
--   strings are required to be correctly padded, and will be validated
--   prior to decoding to confirm.
--   
--   In general, unless padded Base64url is explicitly required, it is
--   safer to call decodeBase64.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Padded "PDw_Pj4="
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64Padded "PDw_Pj4"
--   Left "Base64-encoded bytestring requires padding"
--   
decodeBase64Padded :: ByteString -> Either Text ByteString

-- | Leniently decode an unpadded Base64url-encoded ByteString. This
--   function will not generate parse errors. If input data contains
--   padding chars, then the input will be parsed up until the first pad
--   character.
--   
--   Note: This is not RFC 4648-compliant.
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Lenient "PDw_Pj4="
--   "<<?>>"
--   
--   
--   
--   >>> decodeBase64Lenient "PDw_%%%$}Pj4"
--   "<<?>>"
--   
decodeBase64Lenient :: ByteString -> ByteString

-- | Tell whether a ByteString is Base64url-encoded.
--   
--   
Examples:
--   
--   
--   >>> isBase64Url "PDw_Pj4="
--   True
--   
--   
--   
--   >>> isBase64Url "PDw_Pj4"
--   True
--   
--   
--   
--   >>> isBase64Url "PDw_Pj"
--   False
--   
isBase64Url :: ByteString -> Bool

-- | Tell whether a ByteString is a valid Base64url format.
--   
--   This will not tell you whether or not this is a correct Base64url
--   representation, only that it conforms to the correct shape. To check
--   whether it is a true Base64 encoded ByteString value, use
--   isBase64Url.
--   
--   
Examples:
--   
--   
--   >>> isValidBase64Url "PDw_Pj4="
--   True
--   
--   
--   
--   >>> isValidBase64Url "PDw_Pj"
--   True
--   
--   
--   
--   >>> isValidBase64Url "%"
--   False
--   
isValidBase64Url :: ByteString -> Bool

-- | This module contains ShortByteString-valued combinators for
--   implementing the RFC 4648 specification of the Base64 encoding format.
--   This includes lenient decoding variants, as well as internal and
--   external validation for canonicity.
module Data.ByteString.Short.Base64

-- | Encode a ShortByteString value as Base64 ShortText with
--   padding.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> encodeBase64 "Sun"
--   "U3Vu"
--   
encodeBase64 :: ShortByteString -> ShortText

-- | Encode a ShortByteString value as a Base64
--   ShortByteString value with padding.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> encodeBase64' "Sun"
--   "U3Vu"
--   
encodeBase64' :: ShortByteString -> ShortByteString

-- | Decode a padded Base64-encoded ShortByteString value.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64 "U3Vu"
--   Right "Sun"
--   
--   
--   
--   >>> decodeBase64 "U3V"
--   Left "Base64-encoded bytestring requires padding"
--   
--   
--   
--   >>> decodebase64 "U3V="
--   Left "non-canonical encoding detected at offset: 2"
--   
decodeBase64 :: ShortByteString -> Either Text ShortByteString

-- | Leniently decode an unpadded Base64-encoded ShortByteString
--   value. This function will not generate parse errors. If input data
--   contains padding chars, then the input will be parsed up until the
--   first pad character.
--   
--   Note: This is not RFC 4648-compliant.
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Lenient "U3Vu"
--   "Sun"
--   
--   
--   
--   >>> decodeBase64Lenient "U3V"
--   "Su"
--   
--   
--   
--   >>> decodebase64Lenient "U3V="
--   "Su"
--   
decodeBase64Lenient :: ShortByteString -> ShortByteString

-- | Tell whether a ShortByteString value is base64 encoded.
--   
--   
Examples:
--   
--   
--   >>> isBase64 "U3Vu"
--   True
--   
--   
--   
--   >>> isBase64 "U3V"
--   False
--   
--   
--   
--   >>> isBase64 "U3V="
--   False
--   
isBase64 :: ShortByteString -> Bool

-- | Tell whether a ShortByteString value is a valid Base64 format.
--   
--   This will not tell you whether or not this is a correct Base64url
--   representation, only that it conforms to the correct shape. To check
--   whether it is a true Base64 encoded ShortByteString value, use
--   isBase64.
--   
--   
Examples:
--   
--   
--   >>> isValidBase64 "U3Vu"
--   True
--   
--   
--   
--   >>> isValidBase64 "U3V"
--   True
--   
--   
--   
--   >>> isValidBase64 "U3V="
--   True
--   
--   
--   
--   >>> isValidBase64 "%"
--   False
--   
isValidBase64 :: ShortByteString -> Bool

-- | This module contains ShortByteString-valued combinators for
--   implementing the RFC 4648 specification of the Base64url encoding
--   format. This includes strictly padded/unpadded and lenient decoding
--   variants, as well as internal and external validation for canonicity.
module Data.ByteString.Short.Base64.URL

-- | Encode a ShortByteString value as a Base64url Text value
--   with padding.
--   
--   See: RFC-4648 section 5
--   
--   
Examples:
--   
--   
--   >>> encodeBase64 "<<?>>"
--   "PDw_Pj4="
--   
encodeBase64 :: ShortByteString -> ShortText

-- | Encode a ShortByteString as a Base64url ShortByteString
--   value with padding.
--   
--   See: RFC-4648 section 5
--   
--   
Examples:
--   
--   
--   >>> encodeBase64' "<<?>>"
--   "PDw_Pj4="
--   
encodeBase64' :: ShortByteString -> ShortByteString

-- | Encode a ShortByteString value as Base64url Text without
--   padding. Note that for Base64url, padding is optional. If you call
--   this function, you will simply be encoding as Base64url and stripping
--   padding chars from the output.
--   
--   See: RFC-4648 section 3.2
--   
--   
Examples:
--   
--   
--   >>> encodeBase64Unpadded "<<?>>"
--   "PDw_Pj4"
--   
encodeBase64Unpadded :: ShortByteString -> ShortText

-- | Encode a ShortByteString value as Base64url without padding.
--   Note that for Base64url, padding is optional. If you call this
--   function, you will simply be encoding as Base64url and stripping
--   padding chars from the output.
--   
--   See: RFC-4648 section 3.2
--   
--   
Examples:
--   
--   
--   >>> encodeBase64Unpadded' "<<?>>"
--   "PDw_Pj4"
--   
encodeBase64Unpadded' :: ShortByteString -> ShortByteString

-- | Decode a padded Base64url encoded ShortByteString value. If its
--   length is not a multiple of 4, then padding chars will be added to
--   fill out the input to a multiple of 4 for safe decoding as
--   Base64url-encoded values are optionally padded.
--   
--   For a decoder that fails on unpadded input of incorrect size, use
--   decodeBase64Unpadded.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64 "PDw_Pj4="
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64 "PDw_Pj4"
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64 "PDw-Pg="
--   Left "Base64-encoded bytestring has invalid padding"
--   
--   
--   
--   >>> decodeBase64 "PDw-Pg"
--   Right "<<>>"
--   
decodeBase64 :: ShortByteString -> Either Text ShortByteString

-- | Decode an unpadded Base64url-encoded ShortByteString value.
--   Input strings are required to be unpadded, and will undergo validation
--   prior to decoding to confirm.
--   
--   In general, unless unpadded Base64url is explicitly required, it is
--   safer to call decodeBase64.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Unpadded "PDw_Pj4"
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64Unpadded "PDw_Pj4="
--   Left "Base64-encoded bytestring has invalid padding"
--   
decodeBase64Unpadded :: ShortByteString -> Either Text ShortByteString

-- | Decode a padded Base64url-encoded ShortByteString value. Input
--   strings are required to be correctly padded, and will be validated
--   prior to decoding to confirm.
--   
--   In general, unless padded Base64url is explicitly required, it is
--   safer to call decodeBase64.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Padded "PDw_Pj4="
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64Padded "PDw_Pj4"
--   Left "Base64-encoded bytestring requires padding"
--   
decodeBase64Padded :: ShortByteString -> Either Text ShortByteString

-- | Leniently decode an unpadded Base64url-encoded ShortByteString.
--   This function will not generate parse errors. If input data contains
--   padding chars, then the input will be parsed up until the first pad
--   character.
--   
--   Note: This is not RFC 4648-compliant.
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Lenient "PDw_Pj4="
--   "<<?>>"
--   
--   
--   
--   >>> decodeBase64Lenient "PDw_%%%$}Pj4"
--   "<<?>>"
--   
decodeBase64Lenient :: ShortByteString -> ShortByteString

-- | Tell whether a ShortByteString is Base64url-encoded.
--   
--   
Examples:
--   
--   
--   >>> isBase64Url "PDw_Pj4="
--   True
--   
--   
--   
--   >>> isBase64Url "PDw_Pj4"
--   True
--   
--   
--   
--   >>> isBase64Url "PDw_Pj"
--   False
--   
isBase64Url :: ShortByteString -> Bool

-- | Tell whether a ShortByteString is a valid Base64url format.
--   
--   This will not tell you whether or not this is a correct Base64url
--   representation, only that it conforms to the correct shape. To check
--   whether it is a true Base64 encoded ShortByteString value, use
--   isBase64Url.
--   
--   
Examples:
--   
--   
--   >>> isValidBase64Url "PDw_Pj4="
--   True
--   
--   
--   
--   >>> isValidBase64Url "PDw_Pj"
--   True
--   
--   
--   
--   >>> isValidBase64Url "%"
--   False
--   
isValidBase64Url :: ShortByteString -> Bool

-- | This module contains the error types raised (not as exceptions!) in
--   the decoding process.
module Data.Text.Encoding.Base64.Error

-- | This data type represents the type of decoding errors of various kinds
--   as they pertain to decoding Text values. Namely, to distinguish
--   between decoding errors from opaque unicode exceptions caught in the
--   unicode decoding process.
data Base64Error e

-- | The error associated with decoding failure as a result of the Base64
--   decoding process
DecodeError :: Text -> Base64Error e

-- | The error associated with the decoding failure as a result of the
--   conversion process
ConversionError :: e -> Base64Error e
instance GHC.Generics.Generic (Data.Text.Encoding.Base64.Error.Base64Error e)
instance GHC.Show.Show e => GHC.Show.Show (Data.Text.Encoding.Base64.Error.Base64Error e)
instance GHC.Classes.Eq e => GHC.Classes.Eq (Data.Text.Encoding.Base64.Error.Base64Error e)
instance GHC.Exception.Type.Exception e => GHC.Exception.Type.Exception (Data.Text.Encoding.Base64.Error.Base64Error e)
instance Control.DeepSeq.NFData e => Control.DeepSeq.NFData (Data.Text.Encoding.Base64.Error.Base64Error e)

-- | This module contains Text-valued combinators for implementing
--   the RFC 4648 specification of the Base64 encoding format. This
--   includes lenient decoding variants, as well as internal and external
--   validation for canonicity.
module Data.Text.Encoding.Base64

-- | Encode a Text value in Base64 with padding.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> encodeBase64 "Sun"
--   "U3Vu"
--   
encodeBase64 :: Text -> Text

-- | Decode a padded Base64-encoded Text value.
--   
--   Note: This function makes sure that decoding is total by
--   deferring to decodeLatin1. This will always round trip for any
--   valid Base64-encoded text value, but it may not round trip for bad
--   inputs. The onus is on the caller to make sure inputs are valid. If
--   unsure, defer to decodeBase64With and pass in a custom decode
--   function.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64 "U3Vu"
--   Right "Sun"
--   
--   
--   
--   >>> decodeBase64 "U3V"
--   Left "Base64-encoded bytestring requires padding"
--   
--   
--   
--   >>> decodebase64 "U3V="
--   Left "non-canonical encoding detected at offset: 2"
--   
decodeBase64 :: Text -> Either Text Text

-- | Attempt to decode a Text value as Base64, converting from
--   ByteString to Text according to some encoding function.
--   In practice, This is something like decodeUtf8', which may
--   produce an error.
--   
--   See: RFC-4648 section 4
--   
--   
Example:
--   
--   
--   decodeBase64With decodeUtf8'
--     :: ByteString -> Either (Base64Error UnicodeException) Text
--   
decodeBase64With :: (ByteString -> Either err Text) -> ByteString -> Either (Base64Error err) Text

-- | Leniently decode a Base64-encoded Text value. This function
--   will not generate parse errors. If input data contains padding chars,
--   then the input will be parsed up until the first pad character.
--   
--   Note: This is not RFC 4648-compliant.
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Lenient "U3Vu"
--   "Sun"
--   
--   
--   
--   >>> decodeBase64Lenient "U3V"
--   "Su"
--   
--   
--   
--   >>> decodebase64Lenient "U3V="
--   "Su"
--   
decodeBase64Lenient :: Text -> Text

-- | Tell whether a Text value is Base64-encoded.
--   
--   
Examples:
--   
--   
--   >>> isBase64 "U3Vu"
--   True
--   
--   
--   
--   >>> isBase64 "U3V"
--   False
--   
--   
--   
--   >>> isBase64 "U3V="
--   False
--   
isBase64 :: Text -> Bool

-- | Tell whether a Text value is a valid Base64 format.
--   
--   This will not tell you whether or not this is a correct Base64
--   representation, only that it conforms to the correct shape. To check
--   whether it is a true Base64 encoded Text value, use
--   isBase64.
--   
--   
Examples:
--   
--   
--   >>> isValidBase64 "U3Vu"
--   True
--   
--   
--   
--   >>> isValidBase64 "U3V"
--   True
--   
--   
--   
--   >>> isValidBase64 "U3V="
--   True
--   
--   
--   
--   >>> isValidBase64 "%"
--   False
--   
isValidBase64 :: Text -> Bool

-- | This module contains Text-valued combinators for implementing
--   the RFC 4648 specification of the Base64url encoding format. This
--   includes strictly padded/unpadded and lenient decoding variants, as
--   well as internal and external validation for canonicity.
module Data.Text.Encoding.Base64.URL

-- | Encode a Text value in Base64url with padding.
--   
--   See: RFC-4648 section 5
--   
--   
Examples:
--   
--   
--   >>> encodeBase64 "<<?>>"
--   "PDw_Pj4="
--   
encodeBase64 :: Text -> Text

-- | Encode a Text value in Base64url without padding. Note that for
--   Base64url, padding is optional. If you call this function, you will
--   simply be encoding as Base64url and stripping padding chars from the
--   output.
--   
--   See: RFC-4648 section 3.2
--   
--   
Examples:
--   
--   
--   >>> encodeBase64Unpadded "<<?>>"
--   "PDw_Pj4"
--   
encodeBase64Unpadded :: Text -> Text

-- | Decode a padded Base64url-encoded Text value. If its length is
--   not a multiple of 4, then padding chars will be added to fill out the
--   input to a multiple of 4 for safe decoding as base64url encodings are
--   optionally padded.
--   
--   For a decoder that fails on unpadded input, use
--   decodeBase64Unpadded
--   
--   Note: This function makes sure that decoding is total by
--   deferring to decodeLatin1. This will always round trip for any
--   valid Base64-encoded text value, but it may not round trip for bad
--   inputs. The onus is on the caller to make sure inputs are valid. If
--   unsure, defer to decodeBase64With and pass in a custom decode
--   function.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64 "PDw_Pj4="
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64 "PDw_Pj4"
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64 "PDw-Pg="
--   Left "Base64-encoded bytestring has invalid padding"
--   
--   
--   
--   >>> decodeBase64 "PDw-Pg"
--   Right "<<>>"
--   
decodeBase64 :: Text -> Either Text Text

-- | Attempt to decode a ByteString value as Base64url, converting
--   from ByteString to Text according to some encoding
--   function. In practice, This is something like decodeUtf8',
--   which may produce an error.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   decodeBase64With decodeUtf8'
--     :: Text -> Either (Base64Error UnicodeException) Text
--   
decodeBase64With :: (ByteString -> Either err Text) -> ByteString -> Either (Base64Error err) Text

-- | Decode an unpadded Base64url encoded Text value.
--   
--   Note: This function makes sure that decoding is total by
--   deferring to decodeLatin1. This will always round trip for any
--   valid Base64-encoded text value, but it may not round trip for bad
--   inputs. The onus is on the caller to make sure inputs are valid. If
--   unsure, defer to decodeBase64UnpaddedWith and pass in a custom
--   decode function.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Unpadded "PDw_Pj4"
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64Unpadded "PDw_Pj4="
--   Left "Base64-encoded bytestring has invalid padding"
--   
decodeBase64Unpadded :: Text -> Either Text Text

-- | Attempt to decode an unpadded ByteString value as Base64url,
--   converting from ByteString to Text according to some
--   encoding function. In practice, This is something like
--   decodeUtf8', which may produce an error.
--   
--   See: RFC-4648 section 4
--   
--   
Example:
--   
--   
--   decodeBase64UnpaddedWith decodeUtf8'
--     :: ByteString -> Either (Base64Error UnicodeException) Text
--   
decodeBase64UnpaddedWith :: (ByteString -> Either err Text) -> ByteString -> Either (Base64Error err) Text

-- | Decode an padded Base64url encoded Text value
--   
--   Note: This function makes sure that decoding is total by
--   deferring to decodeLatin1. This will always round trip for any
--   valid Base64-encoded text value, but it may not round trip for bad
--   inputs. The onus is on the caller to make sure inputs are valid. If
--   unsure, defer to decodeBase64PaddedWith and pass in a custom
--   decode function.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Padded "PDw_Pj4="
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64Padded "PDw_Pj4"
--   Left "Base64-encoded bytestring requires padding"
--   
decodeBase64Padded :: Text -> Either Text Text

-- | Attempt to decode a padded ByteString value as Base64url,
--   converting from ByteString to Text according to some
--   encoding function. In practice, This is something like
--   decodeUtf8', which may produce an error.
--   
--   See: RFC-4648 section 4
--   
--   
Example:
--   
--   
--   decodeBase64PaddedWith decodeUtf8'
--     :: ByteString -> Either (Base64Error UnicodeException) Text
--   
decodeBase64PaddedWith :: (ByteString -> Either err Text) -> ByteString -> Either (Base64Error err) Text

-- | Leniently decode an unpadded Base64url-encoded Text. This
--   function will not generate parse errors. If input data contains
--   padding chars, then the input will be parsed up until the first pad
--   character.
--   
--   Note: This is not RFC 4648-compliant.
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Lenient "PDw_Pj4="
--   "<<?>>"
--   
--   
--   
--   >>> decodeBase64Lenient "PDw_%%%$}Pj4"
--   "<<?>>"
--   
decodeBase64Lenient :: Text -> Text

-- | Tell whether a Text value is Base64url-encoded.
--   
--   
Examples:
--   
--   
--   >>> isBase64Url "PDw_Pj4="
--   True
--   
--   
--   
--   >>> isBase64Url "PDw_Pj4"
--   True
--   
--   
--   
--   >>> isBase64Url "PDw_Pj"
--   False
--   
isBase64Url :: Text -> Bool

-- | Tell whether a Text value is a valid Base64url format.
--   
--   This will not tell you whether or not this is a correct Base64url
--   representation, only that it conforms to the correct shape. To check
--   whether it is a true Base64 encoded Text value, use
--   isBase64Url.
--   
--   
Examples:
--   
--   
--   >>> isValidBase64Url "PDw_Pj4="
--   True
--   
--   
--   
--   >>> isValidBase64Url "PDw_Pj"
--   True
--   
--   
--   
--   >>> isValidBase64Url "%"
--   False
--   
isValidBase64Url :: Text -> Bool

-- | This module contains Text-valued combinators implementing the
--   RFC 4648 specification for the Base64 encoding format. This includes
--   lenient decoding variants, and external + internal validations for
--   canonicity.
module Data.Text.Lazy.Encoding.Base64

-- | Encode a Text value in Base64 with padding.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> encodeBase64 "Sun"
--   "U3Vu"
--   
encodeBase64 :: Text -> Text

-- | Decode a padded Base64-encoded Text value
--   
--   See: RFC-4648 section 4
--   
--   Note: This function makes sure that decoding is total by
--   deferring to decodeLatin1. This will always round trip for any
--   valid Base64-encoded text value, but it may not round trip for bad
--   inputs. The onus is on the caller to make sure inputs are valid. If
--   unsure, defer to decodeBase64With and pass in a custom decode
--   function.
--   
--   
Examples:
--   
--   
--   >>> decodeBase64 "U3Vu"
--   Right "Sun"
--   
--   
--   
--   >>> decodeBase64 "U3V"
--   Left "Base64-encoded bytestring requires padding"
--   
--   
--   
--   >>> decodebase64 "U3V="
--   Left "non-canonical encoding detected at offset: 2"
--   
decodeBase64 :: Text -> Either Text Text

-- | Attempt to decode a ByteString value as Base64, converting from
--   ByteString to Text according to some encoding function.
--   In practice, This is something like decodeUtf8', which may
--   produce an error.
--   
--   See: RFC-4648 section 4
--   
--   
Example:
--   
--   
--   decodeBase64With decodeUtf8'
--     :: ByteString -> Either (Base64Error UnicodeException) Text
--   
decodeBase64With :: (ByteString -> Either err Text) -> ByteString -> Either (Base64Error err) Text

-- | Leniently decode a Base64-encoded Text value. This function
--   will not generate parse errors. If input data contains padding chars,
--   then the input will be parsed up until the first pad character.
--   
--   Note: This is not RFC 4648-compliant.
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Lenient "U3Vu"
--   "Sun"
--   
--   
--   
--   >>> decodeBase64Lenient "U3V"
--   "Su"
--   
--   
--   
--   >>> decodebase64Lenient "U3V="
--   "Su"
--   
decodeBase64Lenient :: Text -> Text

-- | Tell whether a Text value is Base64-encoded.
--   
--   
Examples:
--   
--   
--   >>> isBase64 "U3Vu"
--   True
--   
--   
--   
--   >>> isBase64 "U3V"
--   False
--   
--   
--   
--   >>> isBase64 "U3V="
--   False
--   
isBase64 :: Text -> Bool

-- | Tell whether a Text value is a valid Base64 format.
--   
--   This will not tell you whether or not this is a correct Base64
--   representation, only that it conforms to the correct shape. To check
--   whether it is a true Base64 encoded Text value, use
--   isBase64.
--   
--   
Examples:
--   
--   
--   >>> isValidBase64 "U3Vu"
--   True
--   
--   
--   
--   >>> isValidBase64 "U3V"
--   True
--   
--   
--   
--   >>> isValidBase64 "U3V="
--   True
--   
--   
--   
--   >>> isValidBase64 "%"
--   False
--   
isValidBase64 :: Text -> Bool

-- | This module contains Text-valued combinators for implementing
--   the RFC 4648 specification of the Base64url encoding format. This
--   includes strictly padded/unpadded and lenient decoding variants, as
--   well as internal and external validation for canonicity.
module Data.Text.Lazy.Encoding.Base64.URL

-- | Encode a Text value in Base64url with padding.
--   
--   See: RFC-4648 section 5
--   
--   
Examples:
--   
--   
--   >>> encodeBase64 "<<?>>"
--   "PDw_Pj4="
--   
encodeBase64 :: Text -> Text

-- | Encode a Text value in Base64url without padding. Note that for
--   Base64url, padding is optional. If you call this function, you will
--   simply be encoding as Base64url and stripping padding chars from the
--   output.
--   
--   See: RFC-4648 section 3.2
--   
--   
Examples:
--   
--   
--   >>> encodeBase64Unpadded "<<?>>"
--   "PDw_Pj4"
--   
encodeBase64Unpadded :: Text -> Text

-- | Decode a padded Base64url-encoded Text value. If its length is
--   not a multiple of 4, then padding chars will be added to fill out the
--   input to a multiple of 4 for safe decoding as base64url encodings are
--   optionally padded.
--   
--   For a decoder that fails on unpadded input, use
--   decodeBase64Unpadded.
--   
--   Note: This function makes sure that decoding is total by
--   deferring to decodeLatin1. This will always round trip for any
--   valid Base64-encoded text value, but it may not round trip for bad
--   inputs. The onus is on the caller to make sure inputs are valid. If
--   unsure, defer to decodeBase64With and pass in a custom decode
--   function.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64 "PDw_Pj4="
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64 "PDw_Pj4"
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64 "PDw-Pg="
--   Left "Base64-encoded bytestring has invalid padding"
--   
--   
--   
--   >>> decodeBase64 "PDw-Pg"
--   Right "<<>>"
--   
decodeBase64 :: Text -> Either Text Text

-- | Attempt to decode a lazy ByteString value as Base64url,
--   converting from ByteString to Text according to some
--   encoding function. In practice, This is something like
--   decodeUtf8', which may produce an error.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   decodeBase64With decodeUtf8'
--     :: ByteString -> Either (Base64Error UnicodeException) Text
--   
decodeBase64With :: (ByteString -> Either err Text) -> ByteString -> Either (Base64Error err) Text

-- | Decode an unpadded Base64url encoded Text value.
--   
--   Note: This function makes sure that decoding is total by
--   deferring to decodeLatin1. This will always round trip for any
--   valid Base64-encoded text value, but it may not round trip for bad
--   inputs. The onus is on the caller to make sure inputs are valid. If
--   unsure, defer to decodeBase64WUnpaddedWith and pass in a
--   custom decode function.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Unpadded "PDw_Pj4"
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64Unpadded "PDw_Pj4="
--   Left "Base64-encoded bytestring has invalid padding"
--   
decodeBase64Unpadded :: Text -> Either Text Text

-- | Attempt to decode an unpadded lazy ByteString value as
--   Base64url, converting from ByteString to Text according
--   to some encoding function. In practice, This is something like
--   decodeUtf8', which may produce an error.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   decodeBase64UnpaddedWith decodeUtf8'
--     :: ByteString -> Either (Base64Error UnicodeException) Text
--   
decodeBase64UnpaddedWith :: (ByteString -> Either err Text) -> ByteString -> Either (Base64Error err) Text

-- | Decode an padded Base64url encoded Text value
--   
--   Note: This function makes sure that decoding is total by
--   deferring to decodeLatin1. This will always round trip for any
--   valid Base64-encoded text value, but it may not round trip for bad
--   inputs. The onus is on the caller to make sure inputs are valid. If
--   unsure, defer to decodeBase64PaddedWith and pass in a custom
--   decode function.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Padded "PDw_Pj4="
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64Padded "PDw_Pj4"
--   Left "Base64-encoded bytestring requires padding"
--   
decodeBase64Padded :: Text -> Either Text Text

-- | Attempt to decode a padded lazy ByteString value as Base64url,
--   converting from ByteString to Text according to some
--   encoding function. In practice, This is something like
--   decodeUtf8', which may produce an error.
--   
--   See: RFC-4648 section 4
--   
--   
Example:
--   
--   
--   decodeBase64PaddedWith decodeUtf8'
--     :: ByteString -> Either (Base64Error UnicodeException) Text
--   
decodeBase64PaddedWith :: (ByteString -> Either err Text) -> ByteString -> Either (Base64Error err) Text

-- | Leniently decode an unpadded Base64url-encoded Text. This
--   function will not generate parse errors. If input data contains
--   padding chars, then the input will be parsed up until the first pad
--   character.
--   
--   Note: This is not RFC 4648-compliant.
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Lenient "PDw_Pj4="
--   "<<?>>"
--   
--   
--   
--   >>> decodeBase64Lenient "PDw_%%%$}Pj4"
--   "<<?>>"
--   
decodeBase64Lenient :: Text -> Text

-- | Tell whether a Text value is Base64url-encoded
--   
--   
Examples:
--   
--   
--   >>> isBase64Url "PDw_Pj4="
--   True
--   
--   
--   
--   >>> isBase64Url "PDw_Pj4"
--   True
--   
--   
--   
--   >>> isBase64Url "PDw_Pj"
--   False
--   
isBase64Url :: Text -> Bool

-- | Tell whether a Text value is a valid Base64url format.
--   
--   This will not tell you whether or not this is a correct Base64url
--   representation, only that it conforms to the correct shape. To check
--   whether it is a true Base64 encoded Text value, use
--   isBase64Url.
--   
--   
Examples:
--   
--   
--   >>> isValidBase64Url "PDw_Pj4="
--   True
--   
--   
--   
--   >>> isValidBase64Url "PDw_Pj"
--   True
--   
--   
--   
--   >>> isValidBase64Url "%"
--   False
--   
isValidBase64Url :: Text -> Bool

-- | This module contains ShortText-valued combinators implementing
--   the RFC 4648 specification for the Base64 encoding format. This
--   includes lenient decoding variants, and external + internal
--   validations for canonicity.
module Data.Text.Short.Encoding.Base64

-- | Encode a ShortText value in Base64 with padding.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> encodeBase64 "Sun"
--   "U3Vu"
--   
encodeBase64 :: ShortText -> ShortText

-- | Decode a padded Base64-encoded ShortText value
--   
--   Note: This function makes sure that decoding is total by
--   deferring to decodeLatin1. This will always round trip for any
--   valid Base64-encoded text value, but it may not round trip for bad
--   inputs. The onus is on the caller to make sure inputs are valid. If
--   unsure, defer to decodeBase64With and pass in a custom decode
--   function.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64 "U3Vu"
--   Right "Sun"
--   
--   
--   
--   >>> decodeBase64 "U3V"
--   Left "Base64-encoded bytestring requires padding"
--   
--   
--   
--   >>> decodebase64 "U3V="
--   Left "non-canonical encoding detected at offset: 2"
--   
decodeBase64 :: ShortText -> Either Text ShortText

-- | Attempt to decode a ShortByteString value as Base64, converting
--   from ByteString to ShortText according to some
--   encoding function. In practice, This is something like
--   decodeUtf8', which may produce an error.
--   
--   See: RFC-4648 section 4
--   
--   
Example:
--   
--   
--   decodeBase64With decodeUtf8'
--     :: ShortByteString -> Either (Base64Error UnicodeException) ShortText
--   
decodeBase64With :: (ShortByteString -> Either err ShortText) -> ShortByteString -> Either (Base64Error err) ShortText

-- | Leniently decode a Base64-encoded ShortText value. This
--   function will not generate parse errors. If input data contains
--   padding chars, then the input will be parsed up until the first pad
--   character.
--   
--   Note: This is not RFC 4648-compliant.
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Lenient "U3Vu"
--   "Sun"
--   
--   
--   
--   >>> decodeBase64Lenient "U3V"
--   "Su"
--   
--   
--   
--   >>> decodebase64Lenient "U3V="
--   "Su"
--   
decodeBase64Lenient :: ShortText -> ShortText

-- | Tell whether a ShortText value is Base64-encoded.
--   
--   
Examples:
--   
--   
--   >>> isBase64 "U3Vu"
--   True
--   
--   
--   
--   >>> isBase64 "U3V"
--   False
--   
--   
--   
--   >>> isBase64 "U3V="
--   False
--   
isBase64 :: ShortText -> Bool

-- | Tell whether a ShortText value is a valid Base64 format.
--   
--   This will not tell you whether or not this is a correct Base64
--   representation, only that it conforms to the correct shape. To check
--   whether it is a true Base64 encoded ShortText value, use
--   isBase64.
--   
--   
Examples:
--   
--   
--   >>> isValidBase64 "U3Vu"
--   True
--   
--   
--   
--   >>> isValidBase64 "U3V"
--   True
--   
--   
--   
--   >>> isValidBase64 "U3V="
--   True
--   
--   
--   
--   >>> isValidBase64 "%"
--   False
--   
isValidBase64 :: ShortText -> Bool

-- | This module contains ShortText-valued combinators implementing
--   the RFC 4648 specification for the Base64url encoding format. This
--   includes strictly padded/unpadded and lenient decoding variants, and
--   external + internal validations for canonicity.
module Data.Text.Short.Encoding.Base64.URL

-- | Encode a ShortText value in Base64url with padding.
--   
--   See: RFC-4648 section 5
--   
--   
Examples:
--   
--   
--   >>> encodeBase64 "<<?>>"
--   "PDw_Pj4="
--   
encodeBase64 :: ShortText -> ShortText

-- | Encode a ShortText value in Base64url without padding. Note
--   that for Base64url, padding is optional. If you call this function,
--   you will simply be encoding as Base64url and stripping padding chars
--   from the output.
--   
--   See: RFC-4648 section 3.2
--   
--   
Examples:
--   
--   
--   >>> encodeBase64Unpadded "<<?>>"
--   "PDw_Pj4"
--   
encodeBase64Unpadded :: ShortText -> ShortText

-- | Decode a padded Base64url-encoded ShortText value. If its
--   length is not a multiple of 4, then padding chars will be added to
--   fill out the input to a multiple of 4 for safe decoding as base64url
--   encodings are optionally padded.
--   
--   For a decoder that fails on unpadded input, use
--   decodeBase64Unpadded.
--   
--   Note: This function makes sure that decoding is total by
--   deferring to decodeLatin1. This will always round trip for any
--   valid Base64-encoded text value, but it may not round trip for bad
--   inputs. The onus is on the caller to make sure inputs are valid. If
--   unsure, defer to decodeBase64With and pass in a custom decode
--   function.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64 "PDw_Pj4="
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64 "PDw_Pj4"
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64 "PDw-Pg="
--   Left "Base64-encoded bytestring has invalid padding"
--   
--   
--   
--   >>> decodeBase64 "PDw-Pg"
--   Right "<<>>"
--   
decodeBase64 :: ShortText -> Either Text ShortText

-- | Attempt to decode a ShortByteString value as Base64url,
--   converting from ByteString to ShortText according to
--   some encoding function. In practice, This is something like
--   decodeUtf8', which may produce an error.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   decodeBase64With decodeUtf8'
--     :: ShortByteString -> Either (Base64Error UnicodeException) ShortText
--   
decodeBase64With :: (ShortByteString -> Either err ShortText) -> ShortByteString -> Either (Base64Error err) ShortText

-- | Decode an unpadded Base64url encoded ShortText value.
--   
--   Note: This function makes sure that decoding is total by
--   deferring to decodeLatin1. This will always round trip for any
--   valid Base64-encoded text value, but it may not round trip for bad
--   inputs. The onus is on the caller to make sure inputs are valid. If
--   unsure, defer to decodeBase64UnpaddedWith and pass in a custom
--   decode function.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Unpadded "PDw_Pj4"
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64Unpadded "PDw_Pj4="
--   Left "Base64-encoded bytestring has invalid padding"
--   
decodeBase64Unpadded :: ShortText -> Either Text ShortText

-- | Attempt to decode an unpadded ShortByteString value as
--   Base64url, converting from ShortByteString to ShortText
--   according to some encoding function. In practice, This is something
--   like decodeUtf8', which may produce an error.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   decodeBase64UnpaddedWith decodeUtf8'
--     :: ShortByteString -> Either (Base64Error UnicodeException) ShortText
--   
decodeBase64UnpaddedWith :: (ShortByteString -> Either err ShortText) -> ShortByteString -> Either (Base64Error err) ShortText

-- | Decode an padded Base64url encoded ShortText value
--   
--   Note: This function makes sure that decoding is total by
--   deferring to decodeLatin1. This will always round trip for any
--   valid Base64-encoded text value, but it may not round trip for bad
--   inputs. The onus is on the caller to make sure inputs are valid. If
--   unsure, defer to decodeBase64PaddedWith and pass in a custom
--   decode function.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Padded "PDw_Pj4="
--   Right "<<?>>"
--   
--   
--   
--   >>> decodeBase64Padded "PDw_Pj4"
--   Left "Base64-encoded bytestring requires padding"
--   
decodeBase64Padded :: ShortText -> Either Text ShortText

-- | Attempt to decode a padded ShortByteString value as Base64url,
--   converting from ByteString to ShortText according to
--   some encoding function. In practice, This is something like
--   decodeUtf8', which may produce an error.
--   
--   See: RFC-4648 section 4
--   
--   
Examples:
--   
--   
--   decodeBase64With decodeUtf8'
--     :: ShortByteString -> Either (Base64Error UnicodeException) ShortText
--   
decodeBase64PaddedWith :: (ShortByteString -> Either err ShortText) -> ShortByteString -> Either (Base64Error err) ShortText

-- | Leniently decode an unpadded Base64url-encoded ShortText. This
--   function will not generate parse errors. If input data contains
--   padding chars, then the input will be parsed up until the first pad
--   character.
--   
--   Note: This is not RFC 4648-compliant.
--   
--   
Examples:
--   
--   
--   >>> decodeBase64Lenient "PDw_Pj4="
--   "<<?>>"
--   
--   
--   
--   >>> decodeBase64Lenient "PDw_%%%$}Pj4"
--   "<<?>>"
--   
decodeBase64Lenient :: ShortText -> ShortText

-- | Tell whether a ShortText value is Base64url-encoded.
--   
--   
Examples:
--   
--   
--   >>> isBase64Url "PDw_Pj4="
--   True
--   
--   
--   
--   >>> isBase64Url "PDw_Pj4"
--   True
--   
--   
--   
--   >>> isBase64Url "PDw_Pj"
--   False
--   
isBase64Url :: ShortText -> Bool

-- | Tell whether a ShortText value is a valid Base64url format.
--   
--   This will not tell you whether or not this is a correct Base64url
--   representation, only that it conforms to the correct shape. To check
--   whether it is a true Base64 encoded ShortText value, use
--   isBase64Url.
--   
--   
Examples:
--   
--   
--   >>> isValidBase64Url "PDw_Pj4="
--   True
--   
--   
--   
--   >>> isValidBase64Url "PDw_Pj"
--   True
--   
--   
--   
--   >>> isValidBase64Url "%"
--   False
--   
isValidBase64Url :: ShortText -> Bool
