aws-cloudfront-signed-cookies- Generate signed cookies for AWS CloudFront

Safe HaskellNone




base64Encode :: ByteString -> Text Source #

The base 64 encoding scheme used for AWS CloudFront signed cookies. We use this to encode both the policy and the signature.

Excerpts from Setting Signed Cookies Using a Custom Policy:

  1. Base64-encode the string using MIME base64 encoding. For more information, see Section 6.8, Base64 Content-Transfer-Encoding in RFC 2045, MIME (Multipurpose Internet Mail Extensions) Part One: Format of Internet Message Bodies.
  2. Replace characters that are invalid in a URL query string with characters that are valid. The following table lists invalid and valid characters.

    Replace these          With these
    invalid characters     valid characters
    ------------------     ----------------
    +                      - (hyphen)
    =                      _ (underscore)
    /                      ~ (tilde)

base64Decode :: Text -> Either String ByteString Source #

The inverse of base64Encode. Produces a Left value with an error message if decoding fails.