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


-- | A modern Base64 library
--   
--   A performant, featureful RFC 4648 and 7049-compliant Base64
--   implementation
@package base64
@version 1.0


-- | This module contains the <a>Base64</a> type definition,
--   <a>Alphabet</a> datatype, alphabet constraints, and various quality of
--   life combinators for working with <a>Base64</a>-wrapped data.
module Data.Base64.Types

-- | The different kinds of supported Base64 encodings
data Alphabet

-- | Standard base64 according to <a>RFC 4648 §4</a> Padding is always
--   inserted when encoding, and required when decoding
StdPadded :: Alphabet

-- | Standard base64 according to <a>RFC 4648 §4</a> Padding is never
--   inserted when encoding, and optional when decoding per <a>RFC
--   7049</a>.
UrlPadded :: Alphabet

-- | URL-safe base64 according to <a>RFC 4648 §5</a> aka base64url Padding
--   is never inserted when encoding, and optional when decoding
UrlUnpadded :: Alphabet

-- | Any non-standard, non RFC 4648-compliant base64 encoding. Can only be
--   decoded using lenient decoders.
NonStandard :: Alphabet

-- | Wraps a value, asserting that it is or is intended to be in a
--   particular kind of Base64 encoding use <tt>extractBase64</tt> to
--   extract the value, and <tt>assertBase64</tt> to tag a value as
--   base64-encoded
data Base64 (k :: Alphabet) a

-- | Assert the provenance of a value encoded in a particular base64
--   alphabet.
--   
--   <i>Warning</i>: This is a blind assertion that a particular value is
--   base64 encoded in some alphabet. If you are not sure of the provenance
--   of the value, you may experience odd behavior when attempting to
--   decode. Use at your own risk. If I see any issues logged on this
--   project from negligent use of this or <a>coerceBase64</a>, I will
--   smite you.
assertBase64 :: forall (k :: Alphabet) a. a -> Base64 k a

-- | Forget the provenance of a base64-encoded value.
extractBase64 :: forall (k :: Alphabet) a. Base64 k a -> a

-- | Coerce the alphabet of a base64-encoded bytestring
--   
--   <i>Warning</i>: This is a blind assertion that a particular value is
--   base64 encoded in some alphabet. If you are not sure of the provenance
--   of the value, you may experience odd behavior when attempting to
--   decode. Use at your own risk. If I see any issues logged on this
--   project from negligent use of this or <a>assertBase64</a>, I will
--   smite you.
coerceBase64 :: forall (j :: Alphabet) (k :: Alphabet) a. Base64 k a -> Base64 j a

-- | The type family of Url-safe alphabets
--   
--   This type family defines the union of compatible Url-safe base64
--   types. To write a function that is parametric over such types, issue a
--   constraint like `forall k. UrlAlphabet k`.
type family UrlAlphabet (k :: Alphabet)

-- | The type family of standard alphabets
--   
--   This type family defines the union of compatible standard alphabet
--   base64 types
type family StdAlphabet (k :: Alphabet)

-- | The type family of non-standard alphabets
--   
--   Only untyped variants of encodeBase64/decodeBase64 can interact with
--   this type family, in addition to assertion/coercion/extraction of
--   these types of values.
type family NonStandardAlphabet (k :: Alphabet)


-- | This module contains <a>ByteString</a>-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 <a>ByteString</a> value as Base64 <a>Text</a> with padding.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64 "Sun"
--   "U3Vu"
--   </pre>
encodeBase64 :: ByteString -> Base64 'StdPadded Text

-- | Encode a <a>ByteString</a> value as a Base64 <a>ByteString</a> value
--   with padding.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64' "Sun"
--   "U3Vu"
--   </pre>
encodeBase64' :: ByteString -> Base64 'StdPadded ByteString

-- | Decode a padded Base64-encoded <a>ByteString</a> value.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'StdPadded "U3Vu"
--   "Sun"
--   </pre>
decodeBase64 :: forall (k :: Alphabet). StdAlphabet k => Base64 k ByteString -> ByteString

-- | Decode a padded untyped Base64-encoded <a>ByteString</a> value.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "U3Vu"
--   Right "Sun"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "U3V"
--   Left "Base64-encoded bytestring requires padding"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "U3V="
--   Left "non-canonical encoding detected at offset: 2"
--   </pre>
decodeBase64Untyped :: ByteString -> Either Text ByteString

-- | Leniently decode an untyped Base64-encoded <a>ByteString</a> 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.
--   
--   <b>Note:</b> This is not RFC 4648-compliant.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "U3Vu"
--   "Sun"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "U3V"
--   "Su"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "U3V="
--   "Su"
--   </pre>
decodeBase64Lenient :: ByteString -> ByteString

-- | Tell whether a <a>ByteString</a> value is base64 encoded.
--   
--   This function will also detect non-canonical encodings such as
--   <tt>ZE==</tt>, which are externally valid Base64-encoded values, but
--   are internally inconsistent "impossible" values.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64 "U3Vu"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64 "U3V"
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64 "U3V="
--   False
--   </pre>
isBase64 :: ByteString -> Bool

-- | Tell whether a <a>ByteString</a> 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 <a>ByteString</a> value, use
--   <a>isBase64</a>.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "U3Vu"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "U3V"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "U3V="
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "%"
--   False
--   </pre>
isValidBase64 :: ByteString -> Bool


-- | This module contains <a>ByteString</a>-valued combinators for
--   implementing the RFC 4648 specification of the url-safe Base64
--   (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 <a>ByteString</a> value as a Base64url <a>Text</a> value with
--   padding.
--   
--   See: <a>RFC-4648 section 5</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64 "&lt;&lt;?&gt;&gt;"
--   "PDw_Pj4="
--   </pre>
encodeBase64 :: ByteString -> Base64 'UrlPadded Text

-- | Encode a <a>ByteString</a> as a Base64url <a>ByteString</a> value with
--   padding.
--   
--   See: <a>RFC-4648 section 5</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64' "&lt;&lt;?&gt;&gt;"
--   "PDw_Pj4="
--   </pre>
encodeBase64' :: ByteString -> Base64 'UrlPadded ByteString

-- | Encode a <a>ByteString</a> value as Base64url <a>Text</a> 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: <a>RFC-4648 section 3.2</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64Unpadded "&lt;&lt;?&gt;&gt;"
--   "PDw_Pj4"
--   </pre>
encodeBase64Unpadded :: ByteString -> Base64 'UrlUnpadded Text

-- | Encode a <a>ByteString</a> 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: <a>RFC-4648 section 3.2</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64Unpadded' "&lt;&lt;?&gt;&gt;"
--   "PDw_Pj4"
--   </pre>
encodeBase64Unpadded' :: ByteString -> Base64 'UrlUnpadded ByteString

-- | Decode a Base64url encoded <a>ByteString</a> value, either padded or
--   unpadded. The correct decoding function is dispatched based on the
--   existence of padding.
--   
--   For typed values: - If a padded value is required, use
--   <a>decodeBase64Padded</a> - If an unpadded value is required, use
--   <a>decodeBase64Unpadded</a>
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'UrlPadded "PDw_Pj4="
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'UrlUnpadded "PDw_Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64 :: forall (k :: Alphabet). UrlAlphabet k => Base64 k ByteString -> ByteString

-- | Decode an untyped Base64url encoded <a>ByteString</a> 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 to decode untyped values of incorrect size: -
--   If a padded value is required, use <a>decodeBase64PaddedUntyped</a> -
--   If an unpadded value is required, use
--   <a>decodeBase64UnpaddedUntyped</a>
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw_Pj4="
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw_Pj4"
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw-Pg="
--   Left "Base64-encoded bytestring has invalid padding"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw-Pg"
--   Right "&lt;&lt;&gt;&gt;"
--   </pre>
decodeBase64Untyped :: ByteString -> Either Text ByteString

-- | Decode an unpadded Base64url-encoded <a>ByteString</a> value. Input
--   strings are required to be unpadded, and will undergo validation prior
--   to decoding to confirm.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Unpadded $ assertBase64 @'UrlUnpadded "PDw_Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64Unpadded :: Base64 'UrlUnpadded ByteString -> ByteString

-- | Decode an unpadded, untyped Base64url-encoded <a>ByteString</a> 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 <a>decodeBase64Untyped</a>.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64UnpaddedUntyped "PDw_Pj4"
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64UnpaddedUntyped "PDw_Pj4="
--   Left "Base64-encoded bytestring has invalid padding"
--   </pre>
decodeBase64UnpaddedUntyped :: ByteString -> Either Text ByteString

-- | Decode a padded Base64url-encoded <a>ByteString</a> value. Input
--   strings are required to be correctly padded, and will be validated
--   prior to decoding to confirm.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Padded $ assertBase64 @'UrlPadded "PDw_Pj4="
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64Padded :: Base64 'UrlPadded ByteString -> ByteString

-- | Decode a padded, untyped Base64url-encoded <a>ByteString</a> 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 <a>decodeBase64Untyped</a>.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64PaddedUntyped "PDw_Pj4="
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64PaddedUntyped :: ByteString -> Either Text ByteString

-- | Leniently decode an unpadded, untyped Base64url-encoded
--   <a>ByteString</a>. 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.
--   
--   <b>Note:</b> This is not RFC 4648-compliant.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "PDw_Pj4="
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "PDw_%%%$}Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64Lenient :: ByteString -> ByteString

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

-- | Tell whether a <a>ByteString</a> 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 <a>ByteString</a> value, use
--   <a>isBase64Url</a>.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64Url "PDw_Pj4="
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64Url "PDw_Pj"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64Url "%"
--   False
--   </pre>
isValidBase64Url :: ByteString -> Bool


-- | This module contains <a>ByteString</a>-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 <a>ByteString</a> value as Base64 <tt>Text</tt> with padding.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64 "Sun"
--   "U3Vu"
--   </pre>
encodeBase64 :: ByteString -> Base64 'StdPadded Text

-- | Encode a <a>ByteString</a> value as a Base64 <a>ByteString</a> value
--   with padding.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64' "Sun"
--   "U3Vu"
--   </pre>
encodeBase64' :: ByteString -> Base64 'StdPadded ByteString

-- | Decode a padded Base64-encoded <a>ByteString</a> value.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'StdPadded "U3Vu"
--   "Sun"
--   </pre>
decodeBase64 :: forall (k :: Alphabet). StdAlphabet k => Base64 k ByteString -> ByteString

-- | Decode a padded untyped Base64-encoded <a>ByteString</a> value.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "U3Vu"
--   Right "Sun"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "U3V"
--   Left "Base64-encoded bytestring requires padding"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "U3V="
--   Left "non-canonical encoding detected at offset: 2"
--   </pre>
decodeBase64Untyped :: ByteString -> Either Text ByteString

-- | Leniently decode an unpadded Base64-encoded <a>ByteString</a> 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.
--   
--   <b>Note:</b> This is not RFC 4648-compliant.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "U3Vu"
--   "Sun"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "U3V"
--   "Su"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "U3V="
--   "Su"
--   </pre>
decodeBase64Lenient :: ByteString -> ByteString

-- | Tell whether a <a>ByteString</a> value is base64 encoded.
--   
--   This function will also detect non-canonical encodings such as
--   <tt>ZE==</tt>, which are externally valid Base64-encoded values, but
--   are internally inconsistent "impossible" values.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64 "U3Vu"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64 "U3V"
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64 "U3V="
--   False
--   </pre>
isBase64 :: ByteString -> Bool

-- | Tell whether a <a>ByteString</a> 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 <a>ByteString</a> value, use
--   <a>isBase64</a>.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "U3Vu"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "U3V"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "U3V="
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "%"
--   False
--   </pre>
isValidBase64 :: ByteString -> Bool


-- | This module contains <a>ByteString</a>-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 <a>ByteString</a> value as a Base64url <tt>Text</tt> value
--   with padding.
--   
--   See: <a>RFC-4648 section 5</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64 "&lt;&lt;?&gt;&gt;"
--   "PDw_Pj4="
--   </pre>
encodeBase64 :: ByteString -> Base64 'UrlPadded Text

-- | Encode a <a>ByteString</a> as a Base64url <a>ByteString</a> value with
--   padding.
--   
--   See: <a>RFC-4648 section 5</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64' "&lt;&lt;?&gt;&gt;"
--   "PDw_Pj4="
--   </pre>
encodeBase64' :: ByteString -> Base64 'UrlPadded ByteString

-- | Encode a <a>ByteString</a> value as Base64url <tt>Text</tt> without
--   padding.
--   
--   See: <a>RFC-4648 section 3.2</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64Unpadded "&lt;&lt;?&gt;&gt;"
--   "PDw_Pj4"
--   </pre>
encodeBase64Unpadded :: ByteString -> Base64 'UrlUnpadded Text

-- | Encode a <a>ByteString</a> value as Base64url without padding.
--   
--   See: <a>RFC-4648 section 3.2</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64Unpadded' "&lt;&lt;?&gt;&gt;"
--   "PDw_Pj4"
--   </pre>
encodeBase64Unpadded' :: ByteString -> Base64 'UrlUnpadded ByteString

-- | Decode a Base64url encoded <a>ByteString</a> value, either padded or
--   unpadded. The correct decoding function is dispatched based on the
--   existence of padding.
--   
--   For typed values: - If a padded value is required, use
--   <a>decodeBase64Padded</a> - If an unpadded value is required, use
--   <a>decodeBase64Unpadded</a>
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'UrlPadded "PDw_Pj4="
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'UrlUnpadded "PDw_Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'UrlUnpadded "PDw-Pg"
--   "&lt;&lt;&gt;&gt;"
--   </pre>
decodeBase64 :: forall (k :: Alphabet). UrlAlphabet k => Base64 k ByteString -> ByteString

-- | Decode a padded Base64url encoded <a>ByteString</a> 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 to decode untyped values of incorrect size: -
--   If a padded value is required, use <a>decodeBase64PaddedUntyped</a> -
--   If an unpadded value is required, use
--   <a>decodeBase64UnpaddedUntyped</a>
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw_Pj4="
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw_Pj4"
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw-Pg="
--   Left "Base64-encoded bytestring has invalid padding"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw-Pg"
--   Right "&lt;&lt;&gt;&gt;"
--   </pre>
decodeBase64Untyped :: ByteString -> Either Text ByteString

-- | Decode an unpadded Base64url-encoded <a>ByteString</a> value.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Unpadded $ assertBase64 @'UrlUnpadded "PDw_Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64Unpadded :: Base64 'UrlUnpadded ByteString -> ByteString

-- | Decode an unpadded, untyped Base64url-encoded <a>ByteString</a> 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 <a>decodeBase64Untyped</a>.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64UnpaddedUntyped "PDw_Pj4"
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64UnpaddedUntyped "PDw_Pj4="
--   Left "Base64-encoded bytestring has invalid padding"
--   </pre>
decodeBase64UnpaddedUntyped :: ByteString -> Either Text ByteString

-- | Decode a padded Base64url-encoded <a>ByteString</a> value.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Unpadded $ assertBase64 @'UrlUnpadded "PDw_Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64Padded :: Base64 'UrlPadded ByteString -> ByteString

-- | Decode a padded, untyped Base64url-encoded <a>ByteString</a> 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 <a>decodeBase64</a>.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64PaddedUntyped "PDw_Pj4="
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64PaddedUntyped "PDw_Pj4"
--   Left "Base64-encoded bytestring requires padding"
--   </pre>
decodeBase64PaddedUntyped :: ByteString -> Either Text ByteString

-- | Leniently decode an unpadded, untyped Base64url-encoded
--   <a>ByteString</a>. 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.
--   
--   <b>Note:</b> This is not RFC 4648-compliant.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "PDw_Pj4="
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "PDw_%%%$}Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64Lenient :: ByteString -> ByteString

-- | Tell whether an untyped <a>ByteString</a> is Base64url-encoded.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64Url "PDw_Pj4="
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64Url "PDw_Pj4"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64Url "PDw_Pj"
--   False
--   </pre>
isBase64Url :: ByteString -> Bool

-- | Tell whether an untyped <a>ByteString</a> 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 <a>ByteString</a> value, use
--   <a>isBase64Url</a>.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64Url "PDw_Pj4="
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64Url "PDw_Pj"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64Url "%"
--   False
--   </pre>
isValidBase64Url :: ByteString -> Bool


-- | This module contains <a>ShortByteString</a>-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 <a>ShortByteString</a> value as Base64 <a>ShortText</a> with
--   padding.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64 "Sun"
--   "U3Vu"
--   </pre>
encodeBase64 :: ShortByteString -> Base64 'StdPadded ShortText

-- | Encode a <a>ShortByteString</a> value as a Base64
--   <a>ShortByteString</a> value with padding.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64' "Sun"
--   "U3Vu"
--   </pre>
encodeBase64' :: ShortByteString -> Base64 'StdPadded ShortByteString

-- | Decode a padded Base64-encoded <a>ShortByteString</a> value.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'StdPadded "U3Vu"
--   "Sun"
--   </pre>
decodeBase64 :: forall (k :: Alphabet). StdAlphabet k => Base64 k ShortByteString -> ShortByteString

-- | Decode a padded Base64-encoded <a>ShortByteString</a> value.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "U3Vu"
--   Right "Sun"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "U3V"
--   Left "Base64-encoded bytestring requires padding"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "U3V="
--   Left "non-canonical encoding detected at offset: 2"
--   </pre>
decodeBase64Untyped :: ShortByteString -> Either Text ShortByteString

-- | Leniently decode an unpadded Base64-encoded <a>ShortByteString</a>
--   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.
--   
--   <b>Note:</b> This is not RFC 4648-compliant.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "U3Vu"
--   "Sun"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "U3V"
--   "Su"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "U3V="
--   "Su"
--   </pre>
decodeBase64Lenient :: ShortByteString -> ShortByteString

-- | Tell whether a <a>ShortByteString</a> value is base64 encoded.
--   
--   This function will also detect non-canonical encodings such as
--   <tt>ZE==</tt>, which are externally valid Base64-encoded values, but
--   are internally inconsistent "impossible" values.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64 "U3Vu"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64 "U3V"
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64 "U3V="
--   False
--   </pre>
isBase64 :: ShortByteString -> Bool

-- | Tell whether a <a>ShortByteString</a> 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 <a>ShortByteString</a> value, use
--   <a>isBase64</a>.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "U3Vu"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "U3V"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "U3V="
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "%"
--   False
--   </pre>
isValidBase64 :: ShortByteString -> Bool


-- | This module contains <a>ShortByteString</a>-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 <a>ShortByteString</a> value as a Base64url <a>Text</a> value
--   with padding.
--   
--   See: <a>RFC-4648 section 5</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64 "&lt;&lt;?&gt;&gt;"
--   "PDw_Pj4="
--   </pre>
encodeBase64 :: ShortByteString -> Base64 'UrlPadded ShortText

-- | Encode a <a>ShortByteString</a> as a Base64url <a>ShortByteString</a>
--   value with padding.
--   
--   See: <a>RFC-4648 section 5</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64' "&lt;&lt;?&gt;&gt;"
--   "PDw_Pj4="
--   </pre>
encodeBase64' :: ShortByteString -> Base64 'UrlPadded ShortByteString

-- | Encode a <a>ShortByteString</a> value as Base64url <a>Text</a> without
--   padding.
--   
--   See: <a>RFC-4648 section 3.2</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64Unpadded "&lt;&lt;?&gt;&gt;"
--   "PDw_Pj4"
--   </pre>
encodeBase64Unpadded :: ShortByteString -> Base64 'UrlUnpadded ShortText

-- | Encode a <a>ShortByteString</a> value as Base64url without padding.
--   
--   See: <a>RFC-4648 section 3.2</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64Unpadded' "&lt;&lt;?&gt;&gt;"
--   "PDw_Pj4"
--   </pre>
encodeBase64Unpadded' :: ShortByteString -> Base64 'UrlUnpadded ShortByteString

-- | Decode a Base64url encoded <a>ShortByteString</a> value, either padded
--   or unpadded. The correct decoding function is dispatched based on the
--   existence of padding.
--   
--   For typed values: - If a padded value is required, use
--   <a>decodeBase64Padded</a> - If an unpadded value is required, use
--   <a>decodeBase64Unpadded</a>
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'UrlPadded "PDw_Pj4="
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'UrlUnpadded "PDw_Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64 :: forall (k :: Alphabet). UrlAlphabet k => Base64 k ShortByteString -> ShortByteString

-- | Decode an untyped Base64url encoded <tt>ByteString</tt> 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 to decode untyped values of incorrect size: -
--   If a padded value is required, use <a>decodeBase64PaddedUntyped</a> -
--   If an unpadded value is required, use
--   <a>decodeBase64UnpaddedUntyped</a>
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw_Pj4="
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw_Pj4"
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw-Pg="
--   Left "Base64-encoded bytestring has invalid padding"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw-Pg"
--   Right "&lt;&lt;&gt;&gt;"
--   </pre>
decodeBase64Untyped :: ShortByteString -> Either Text ShortByteString

-- | Decode an unpadded Base64url-encoded <a>ShortByteString</a> value.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Unpadded $ assertBase64 @'UrlUnpadded "PDw_Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64Unpadded :: Base64 'UrlUnpadded ShortByteString -> ShortByteString

-- | Decode an unpadded, untyped Base64url encoded <tt>ByteString</tt>
--   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.
--   
--   In general, unless unpadded Base64url is explicitly required, it is
--   safer to call <a>decodeBase64</a>.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64UnpaddedUntyped "PDw_Pj4"
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64UnpaddedUntyped "PDw-Pg="
--   Left "Base64-encoded bytestring has invalid padding"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64UnpaddedUntyped "PDw-Pg"
--   Right "&lt;&lt;&gt;&gt;"
--   </pre>
decodeBase64UnpaddedUntyped :: ShortByteString -> Either Text ShortByteString

-- | Decode a padded Base64url-encoded <a>ShortByteString</a> value.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Padded $ assertBase64 @'UrlPadded "PDw_Pj4="
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64Padded :: Base64 'UrlPadded ShortByteString -> ShortByteString

-- | Decode a padded, untyped Base64url encoded <tt>ByteString</tt> value.
--   
--   For a decoder that fails on unpadded input of incorrect size, use
--   <a>decodeBase64UnpaddedUntyped</a>.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64PaddedUntyped "PDw_Pj4="
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64PaddedUntyped "PDw_Pj4"
--   Left "Base64-encoded bytestring requires padding"
--   </pre>
decodeBase64PaddedUntyped :: ShortByteString -> Either Text ShortByteString

-- | Leniently decode an unpadded, untyped Base64url-encoded
--   <a>ShortByteString</a>. 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.
--   
--   <b>Note:</b> This is not RFC 4648-compliant.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "PDw_Pj4="
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "PDw_%%%$}Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64Lenient :: ShortByteString -> ShortByteString

-- | Tell whether an untyped <a>ShortByteString</a> is Base64url-encoded.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64Url "PDw_Pj4="
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64Url "PDw_Pj4"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64Url "PDw_Pj"
--   False
--   </pre>
isBase64Url :: ShortByteString -> Bool

-- | Tell whether an untyped <a>ShortByteString</a> 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 <a>ShortByteString</a> value, use
--   <a>isBase64Url</a>.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64Url "PDw_Pj4="
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64Url "PDw_Pj"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64Url "%"
--   False
--   </pre>
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 <a>Text</a> 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.Classes.Eq e => GHC.Classes.Eq (Data.Text.Encoding.Base64.Error.Base64Error e)
instance GHC.Internal.Exception.Type.Exception e => GHC.Internal.Exception.Type.Exception (Data.Text.Encoding.Base64.Error.Base64Error e)
instance GHC.Internal.Generics.Generic (Data.Text.Encoding.Base64.Error.Base64Error e)
instance Control.DeepSeq.NFData e => Control.DeepSeq.NFData (Data.Text.Encoding.Base64.Error.Base64Error e)
instance GHC.Internal.Show.Show e => GHC.Internal.Show.Show (Data.Text.Encoding.Base64.Error.Base64Error e)


-- | This module contains <a>Text</a>-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 <a>Text</a> value in Base64 with padding.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64 "Sun"
--   "U3Vu"
--   </pre>
encodeBase64 :: Text -> Base64 'StdPadded Text

-- | Decode a padded Base64-encoded <a>Text</a> value.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'StdPadded "U3Vu"
--   "Sun"
--   </pre>
decodeBase64 :: forall (k :: Alphabet). StdAlphabet k => Base64 k Text -> Text

-- | Decode a padded, untyped Base64-encoded <a>Text</a> value.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "U3Vu"
--   Right "Sun"
--   </pre>
decodeBase64Untyped :: Text -> Either Text Text

-- | Attempt to decode an untyped <a>Text</a> value as Base64, converting
--   from <a>ByteString</a> to <a>Text</a> according to some encoding
--   function. In practice, This is something like <a>decodeUtf8'</a>,
--   which may produce an error.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Example</b>:</h3>
--   
--   <pre>
--   <a>decodeBase64UntypedWith</a> <a>decodeUtf8'</a>
--     :: <a>ByteString</a> -&gt; <a>Either</a> (<a>Base64Error</a> <tt>UnicodeException</tt>) <a>Text</a>
--   </pre>
decodeBase64UntypedWith :: (ByteString -> Either err Text) -> ByteString -> Either (Base64Error err) Text

-- | Leniently decode an untyped Base64-encoded <a>Text</a> 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.
--   
--   <b>Note:</b> This is not RFC 4648-compliant.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "U3Vu"
--   "Sun"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "U3V"
--   "Su"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "U3V="
--   "Su"
--   </pre>
decodeBase64Lenient :: Text -> Text

-- | Tell whether an untyped <a>Text</a> value is Base64-encoded.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64 "U3Vu"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64 "U3V"
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64 "U3V="
--   False
--   </pre>
isBase64 :: Text -> Bool

-- | Tell whether an untyped <a>Text</a> 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 <a>Text</a> value, use
--   <a>isBase64</a>.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "U3Vu"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "U3V"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "U3V="
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "%"
--   False
--   </pre>
isValidBase64 :: Text -> Bool


-- | This module contains <a>Text</a>-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 <a>Text</a> value in Base64url with padding.
--   
--   See: <a>RFC-4648 section 5</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64 "&lt;&lt;?&gt;&gt;"
--   "PDw_Pj4="
--   </pre>
encodeBase64 :: Text -> Base64 'UrlPadded Text

-- | Encode a <a>Text</a> value in Base64url without padding.
--   
--   See: <a>RFC-4648 section 3.2</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64Unpadded "&lt;&lt;?&gt;&gt;"
--   "PDw_Pj4"
--   </pre>
encodeBase64Unpadded :: Text -> Base64 'UrlUnpadded Text

-- | Decode a Base64url encoded <a>Text</a> value, either padded or
--   unpadded. The correct decoding function is dispatched based on the
--   existence of padding.
--   
--   For typed values: - If a padded value is required, use
--   <a>decodeBase64Padded</a> - If an unpadded value is required, use
--   <a>decodeBase64Unpadded</a>
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'UrlPadded "PDw_Pj4="
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'UrlUnpadded "PDw_Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64 :: forall (k :: Alphabet). UrlAlphabet k => Base64 k Text -> Text

-- | Decode an untyped Base64url encoded <a>Text</a> 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 to decode untyped values of incorrect size: -
--   If a padded value is required, use <a>decodeBase64PaddedUntyped</a> -
--   If an unpadded value is required, use
--   <a>decodeBase64UnpaddedUntyped</a>
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw_Pj4="
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw_Pj4"
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw-Pg="
--   Left "Base64-encoded bytestring has invalid padding"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw-Pg"
--   Right "&lt;&lt;&gt;&gt;"
--   </pre>
decodeBase64Untyped :: Text -> Either Text Text

-- | Attempt to decode an untyped <a>ByteString</a> value as Base64url,
--   converting from <a>ByteString</a> to <a>Text</a> according to some
--   encoding function. In practice, This is something like
--   <a>decodeUtf8'</a>, which may produce an error.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   <a>decodeBase64UntypedWith</a> <a>decodeUtf8'</a>
--     :: <a>Text</a> -&gt; <a>Either</a> (<a>Base64Error</a> <tt>UnicodeException</tt>) <a>Text</a>
--   </pre>
decodeBase64UntypedWith :: (ByteString -> Either err Text) -> ByteString -> Either (Base64Error err) Text

-- | Decode an unpadded Base64url encoded <a>Text</a> value.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Unpadded $ assertBase64 @'UrlUnpadded "PDw_Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64Unpadded :: Base64 'UrlUnpadded Text -> Text

-- | Decode a unpadded, untyped Base64url-encoded <a>Text</a> 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
--   <a>decodeBase64PaddedUntyped</a>
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64UnpaddedUntyped "PDw_Pj4"
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64UnpaddedUntyped "PDw-Pg="
--   Left "Base64-encoded bytestring has invalid padding"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64UnpaddedUntyped "PDw-Pg"
--   Right "&lt;&lt;&gt;&gt;"
--   </pre>
decodeBase64UnpaddedUntyped :: Text -> Either Text Text

-- | Attempt to decode an untyped, unpadded <a>ByteString</a> value as
--   Base64url, converting from <a>ByteString</a> to <a>Text</a> according
--   to some encoding function. In practice, This is something like
--   <a>decodeUtf8'</a>, which may produce an error.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Example</b>:</h3>
--   
--   <pre>
--   <a>decodeBase64UnpaddedUntypedWith</a> <a>decodeUtf8'</a>
--     :: <a>ByteString</a> -&gt; <a>Either</a> (<a>Base64Error</a> <tt>UnicodeException</tt>) <a>Text</a>
--   </pre>
decodeBase64UnpaddedUntypedWith :: (ByteString -> Either err Text) -> ByteString -> Either (Base64Error err) Text

-- | Decode a padded Base64url encoded <a>Text</a> value
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Padded $ assertBase64 @'UrlPadded "PDw_Pj4="
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64Padded :: Base64 'UrlPadded Text -> Text

-- | Decode an untyped, padded Base64url encoded <a>Text</a> value
--   
--   For a decoder that fails on padded input, use
--   <a>decodeBase64UnpaddedUntyped</a>
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64PaddedUntyped "PDw_Pj4="
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64PaddedUntyped :: Text -> Either Text Text

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

-- | Leniently decode an untyped Base64url-encoded <a>Text</a>. 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.
--   
--   <b>Note:</b> This is not RFC 4648-compliant.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "PDw_Pj4="
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "PDw_%%%$}Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64Lenient :: Text -> Text

-- | Tell whether an untyped <a>Text</a> value is Base64url-encoded.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64Url "PDw_Pj4="
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64Url "PDw_Pj4"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64Url "PDw_Pj"
--   False
--   </pre>
isBase64Url :: Text -> Bool

-- | Tell whether an untyped <a>Text</a> 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 <a>Text</a> value, use
--   <a>isBase64Url</a>.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64Url "PDw_Pj4="
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64Url "PDw_Pj"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64Url "%"
--   False
--   </pre>
isValidBase64Url :: Text -> Bool


-- | This module contains <a>Text</a>-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 <a>Text</a> value in Base64 with padding.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64 "Sun"
--   "U3Vu"
--   </pre>
encodeBase64 :: Text -> Base64 'StdPadded Text

-- | Decode a padded Base64-encoded <a>Text</a> value
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'StdPadded "U3Vu"
--   "Sun"
--   </pre>
decodeBase64 :: forall (k :: Alphabet). StdAlphabet k => Base64 k Text -> Text

-- | Decode a padded, untyped Base64-encoded <a>Text</a> value
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "U3Vu"
--   Right "Sun"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "U3V"
--   Left "Base64-encoded bytestring requires padding"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "U3V="
--   Left "non-canonical encoding detected at offset: 2"
--   </pre>
decodeBase64Untyped :: Text -> Either Text Text

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

-- | Leniently decode an untyped Base64-encoded <a>Text</a> 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.
--   
--   <b>Note:</b> This is not RFC 4648-compliant.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "U3Vu"
--   "Sun"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "U3V"
--   "Su"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "U3V="
--   "Su"
--   </pre>
decodeBase64Lenient :: Text -> Text

-- | Tell whether an untyped <a>Text</a> value is Base64-encoded.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64 "U3Vu"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64 "U3V"
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64 "U3V="
--   False
--   </pre>
isBase64 :: Text -> Bool

-- | Tell whether an untyped <a>Text</a> 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 <a>Text</a> value, use
--   <a>isBase64</a>.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "U3Vu"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "U3V"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "U3V="
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "%"
--   False
--   </pre>
isValidBase64 :: Text -> Bool


-- | This module contains <a>Text</a>-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 <a>Text</a> value in Base64url with padding.
--   
--   See: <a>RFC-4648 section 5</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64 "&lt;&lt;?&gt;&gt;"
--   "PDw_Pj4="
--   </pre>
encodeBase64 :: Text -> Base64 'UrlPadded Text

-- | Encode a <a>Text</a> 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: <a>RFC-4648 section 3.2</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64Unpadded "&lt;&lt;?&gt;&gt;"
--   "PDw_Pj4"
--   </pre>
encodeBase64Unpadded :: Text -> Base64 'UrlUnpadded Text

-- | Decode an arbitrarily Base64url-encoded <a>Text</a> value.
--   
--   For typed values: - If a padded value is required, use
--   <a>decodeBase64Padded</a> - If an unpadded value is required, use
--   <a>decodeBase64Unpadded</a>
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'UrlPadded "PDw_Pj4="
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'UrlUnpadded "PDw_Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64 :: forall (k :: Alphabet). UrlAlphabet k => Base64 k Text -> Text

-- | Decode an untyped Base64url-encoded <a>Text</a> 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
--   <a>decodeBase64Unpadded</a>.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw_Pj4="
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw_Pj4"
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw-Pg="
--   Left "Base64-encoded bytestring has invalid padding"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw-Pg"
--   Right "&lt;&lt;&gt;&gt;"
--   </pre>
decodeBase64Untyped :: Text -> Either Text Text

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

-- | Decode an unpadded Base64url encoded <tt>Text</tt> value.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Unpadded $ assertBase64 @'UrlUnpadded "PDw_Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64Unpadded :: Base64 'UrlUnpadded Text -> Text

-- | Decode an unpadded, untyped Base64url encoded <a>Text</a> value.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64UnpaddedUntyped "PDw_Pj4"
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64UnpaddedUntyped "PDw_Pj4="
--   Left "Base64-encoded bytestring has invalid padding"
--   </pre>
decodeBase64UnpaddedUntyped :: Text -> Either Text Text

-- | Attempt to decode an unpadded, untyped lazy <a>ByteString</a> value as
--   Base64url, converting from <a>ByteString</a> to <a>Text</a> according
--   to some encoding function. In practice, This is something like
--   <a>decodeUtf8'</a>, which may produce an error.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   <a>decodeBase64UnpaddedUntypedWith</a> <a>decodeUtf8'</a>
--     :: <a>ByteString</a> -&gt; <a>Either</a> (<a>Base64Error</a> <tt>UnicodeException</tt>) <a>Text</a>
--   </pre>
decodeBase64UnpaddedUntypedWith :: (ByteString -> Either err Text) -> ByteString -> Either (Base64Error err) Text

-- | Decode a padded Base64url encoded <a>Text</a> value
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Padded $ assertBase64 @'UrlPadded "PDw_Pj4="
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64Padded :: Base64 'UrlPadded Text -> Text

-- | Decode an untyped, padded Base64url encoded <tt>Text</tt> value
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64PaddedUntyped "PDw_Pj4="
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64PaddedUntyped :: Text -> Either Text Text

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

-- | Leniently decode an untyped Base64url-encoded <a>Text</a>. 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.
--   
--   <b>Note:</b> This is not RFC 4648-compliant.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "PDw_Pj4="
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "PDw_%%%$}Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64Lenient :: Text -> Text

-- | Tell whether an untyped <a>Text</a> value is Base64url-encoded
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64Url "PDw_Pj4="
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64Url "PDw_Pj4"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64Url "PDw_Pj"
--   False
--   </pre>
isBase64Url :: Text -> Bool

-- | Tell whether an untyped <a>Text</a> 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 <a>Text</a> value, use
--   <a>isBase64Url</a>.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64Url "PDw_Pj4="
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64Url "PDw_Pj"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64Url "%"
--   False
--   </pre>
isValidBase64Url :: Text -> Bool


-- | This module contains <a>ShortText</a>-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 <a>ShortText</a> value in Base64 with padding.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64 "Sun"
--   "U3Vu"
--   </pre>
encodeBase64 :: ShortText -> Base64 'StdPadded ShortText

-- | Decode a padded Base64-encoded <a>ShortText</a> value
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'StdPadded "U3Vu"
--   "Sun"
--   </pre>
decodeBase64 :: forall (k :: Alphabet). StdAlphabet k => Base64 k ShortText -> ShortText

-- | Decode a padded Base64-encoded <a>ShortText</a> value
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "U3Vu"
--   Right "Sun"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "U3V"
--   Left "Base64-encoded bytestring requires padding"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "U3V="
--   Left "non-canonical encoding detected at offset: 2"
--   </pre>
decodeBase64Untyped :: ShortText -> Either Text ShortText

-- | Attempt to decode an untyped <a>ShortByteString</a> value as Base64,
--   converting from <tt>ByteString</tt> to <a>ShortText</a> according to
--   some encoding function. In practice, This is something like
--   <tt>decodeUtf8'</tt>, which may produce an error.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Example</b>:</h3>
--   
--   <pre>
--   <a>decodeBase64UntypedWith</a> <a>decodeUtf8'</a>
--     :: <a>ShortByteString</a> -&gt; <a>Either</a> (<a>Base64Error</a> <tt>UnicodeException</tt>) <a>ShortText</a>
--   </pre>
decodeBase64UntypedWith :: (ShortByteString -> Either err ShortText) -> ShortByteString -> Either (Base64Error err) ShortText

-- | Leniently decode an untyped Base64-encoded <a>ShortText</a> 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.
--   
--   <b>Note:</b> This is not RFC 4648-compliant.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "U3Vu"
--   "Sun"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "U3V"
--   "Su"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "U3V="
--   "Su"
--   </pre>
decodeBase64Lenient :: ShortText -> ShortText

-- | Tell whether an untyped <a>ShortText</a> value is Base64-encoded.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64 "U3Vu"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64 "U3V"
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64 "U3V="
--   False
--   </pre>
isBase64 :: ShortText -> Bool

-- | Tell whether an untyped <a>ShortText</a> 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 <a>ShortText</a> value, use
--   <a>isBase64</a>.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "U3Vu"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "U3V"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "U3V="
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64 "%"
--   False
--   </pre>
isValidBase64 :: ShortText -> Bool


-- | This module contains <a>ShortText</a>-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 <a>ShortText</a> value in Base64url with padding.
--   
--   See: <a>RFC-4648 section 5</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64 "&lt;&lt;?&gt;&gt;"
--   "PDw_Pj4="
--   </pre>
encodeBase64 :: ShortText -> Base64 'UrlPadded ShortText

-- | Encode a <a>ShortText</a> value in Base64url without padding.
--   
--   See: <a>RFC-4648 section 3.2</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; encodeBase64Unpadded "&lt;&lt;?&gt;&gt;"
--   "PDw_Pj4"
--   </pre>
encodeBase64Unpadded :: ShortText -> Base64 'UrlUnpadded ShortText

-- | Decode an arbitrarily padded Base64url-encoded <a>ShortText</a> value.
--   
--   For typed values: - If a padded value is required, use
--   <a>decodeBase64Padded</a> - If an unpadded value is required, use
--   <a>decodeBase64Unpadded</a>
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'UrlPadded "PDw_Pj4="
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64 $ assertBase64 @'UrlUnpadded "PDw_Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64 :: forall (k :: Alphabet). UrlAlphabet k => Base64 k ShortText -> ShortText

-- | Decode an untyped padded Base64url-encoded <a>ShortText</a> 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
--   <a>decodeBase64Unpadded</a>.
--   
--   <i>Note:</i> This function makes sure that decoding is total by
--   deferring to <a>decodeUtf8</a>. 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 <tt>decodeBase64With</tt> and pass in a custom decode
--   function.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw_Pj4="
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw_Pj4"
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw-Pg="
--   Left "Base64-encoded bytestring has invalid padding"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Untyped "PDw-Pg"
--   Right "&lt;&lt;&gt;&gt;"
--   </pre>
decodeBase64Untyped :: ShortText -> Either Text ShortText

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

-- | Decode an unpadded Base64url encoded <a>ShortText</a> value.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Unpadded $ assertBase64 @'UrlUnpadded "PDw_Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64Unpadded :: Base64 'UrlUnpadded ShortText -> ShortText

-- | Decode an untyped, unpadded Base64url encoded <a>ShortText</a> value.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64UnpaddedUntyped "PDw_Pj4"
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64UnpaddedUntyped "PDw_Pj4="
--   Left "Base64-encoded bytestring has invalid padding"
--   </pre>
decodeBase64UnpaddedUntyped :: ShortText -> Either Text ShortText

-- | Attempt to decode an untyped, unpadded <a>ShortByteString</a> value as
--   Base64url, converting from <a>ShortByteString</a> to <a>ShortText</a>
--   according to some encoding function. In practice, This is something
--   like <tt>decodeUtf8'</tt>, which may produce an error.
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   <tt>decodeBase64UnpaddedWith</tt> <a>decodeUtf8'</a>
--     :: <a>ShortByteString</a> -&gt; <a>Either</a> (<a>Base64Error</a> <tt>UnicodeException</tt>) <a>ShortText</a>
--   </pre>
decodeBase64UnpaddedUntypedWith :: (ShortByteString -> Either err ShortText) -> ShortByteString -> Either (Base64Error err) ShortText

-- | Decode a padded Base64url encoded <a>ShortText</a> value
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Padded $ assertBase64 @'UrlPadded "PDw_Pj4="
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64Padded :: Base64 'UrlPadded ShortText -> ShortText

-- | Decode an untyped, padded Base64url encoded <a>ShortText</a> value
--   
--   See: <a>RFC-4648 section 4</a>
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64PaddedUntyped "PDw_Pj4="
--   Right "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64PaddedUntyped "PDw_Pj4"
--   Left "Base64-encoded bytestring requires padding"
--   </pre>
decodeBase64PaddedUntyped :: ShortText -> Either Text ShortText

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

-- | Leniently decode an untyped, unpadded Base64url-encoded
--   <a>ShortText</a>. 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.
--   
--   <b>Note:</b> This is not RFC 4648-compliant.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "PDw_Pj4="
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decodeBase64Lenient "PDw_%%%$}Pj4"
--   "&lt;&lt;?&gt;&gt;"
--   </pre>
decodeBase64Lenient :: ShortText -> ShortText

-- | Tell whether an untyped <a>ShortText</a> value is Base64url-encoded.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64Url "PDw_Pj4="
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64Url "PDw_Pj4"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isBase64Url "PDw_Pj"
--   False
--   </pre>
isBase64Url :: ShortText -> Bool

-- | Tell whether an untyped <a>ShortText</a> 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 <a>ShortText</a> value, use
--   <a>isBase64Url</a>.
--   
--   <h3><b>Examples</b>:</h3>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64Url "PDw_Pj4="
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64Url "PDw_Pj"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isValidBase64Url "%"
--   False
--   </pre>
isValidBase64Url :: ShortText -> Bool
