Safe Haskell | None |
---|---|
Language | Haskell2010 |
- decode :: Maybe Salt -> SecretKeyBase -> Cookie -> Maybe RubyObject
- decodeEither :: Maybe Salt -> SecretKeyBase -> Cookie -> Either String RubyObject
- decrypt :: Maybe Salt -> SecretKeyBase -> Cookie -> Either String DecryptedData
- csrfToken :: RubyObject -> Maybe ByteString
- sessionId :: RubyObject -> Maybe ByteString
- lookupString :: ByteString -> RubyStringEncoding -> RubyObject -> Maybe ByteString
- lookupFixnum :: ByteString -> RubyStringEncoding -> RubyObject -> Maybe Int
- data Cookie
- mkCookie :: ByteString -> Cookie
- data Salt
- mkSalt :: ByteString -> Salt
- data SecretKeyBase
- mkSecretKeyBase :: ByteString -> SecretKeyBase
- data DecryptedData
- unwrapDecryptedData :: DecryptedData -> ByteString
Decoding
decode :: Maybe Salt -> SecretKeyBase -> Cookie -> Maybe RubyObject Source #
Decode a cookie encrypted by Rails.
decodeEither :: Maybe Salt -> SecretKeyBase -> Cookie -> Either String RubyObject Source #
Decode a cookie encrypted by Rails and retain some error information on failure.
Decrypting
decrypt :: Maybe Salt -> SecretKeyBase -> Cookie -> Either String DecryptedData Source #
Decrypts a cookie encrypted by Rails. Use this if you are using a serialisation format other than Ruby's Marshal format.
Utilities
csrfToken :: RubyObject -> Maybe ByteString Source #
Helper function for looking up the csrf token in a cooie.
sessionId :: RubyObject -> Maybe ByteString Source #
Helper function for looking up the session id in a cookie.
lookupString :: ByteString -> RubyStringEncoding -> RubyObject -> Maybe ByteString Source #
Lookup string for a given key and throw away encoding information.
lookupFixnum :: ByteString -> RubyStringEncoding -> RubyObject -> Maybe Int Source #
Lookup integer for a given key.
Lifting weaker types into stronger types
Wrapper around raw cookie.
mkCookie :: ByteString -> Cookie Source #
Lift a cookie into a richer type.
mkSalt :: ByteString -> Salt Source #
Lift salt into a richer type.
data SecretKeyBase Source #
Wrapper around secret key base.
mkSecretKeyBase :: ByteString -> SecretKeyBase Source #
Lifts secret into a richer type.
data DecryptedData Source #
Wrapper around data after it has been decrypted.