-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A Haskell implementation of OAuth 1.0a protocol.
--
-- This library implements all PLAINTEXT, HMAC-SHA1 and RSA-SHA1
-- signatures as defined in the specification 1.0. Currently it supports
-- only consumer related functions, but there are plans to add
-- support service providers as well. More info at:
-- http://oauth.net/
@package hoauth
@version 0.1.2
module Network.Protocol.OAuth.Request
-- | The HTTP request which must be properly authenticated with oauth. It
-- is not meant to represent the full HTTP request, instead the data
-- which matters for oauth authentication.
data Request
HTTP :: Bool -> HTTPMethod -> String -> Int -> String -> [Parameter] -> Request
-- | True means HTTPS and false means HTTP
ssl :: Request -> Bool
method :: Request -> HTTPMethod
-- | The hostname or ip address (e.g. bitforest.org)
host :: Request -> String
-- | The tcp port (e.g. 80)
port :: Request -> Int
-- | The request path (e.g. /foo/bar/)
path :: Request -> String
-- | The request parameters (both GET and POST)
params :: Request -> [Parameter]
-- | The possible HTTP methods
data HTTPMethod
GET :: HTTPMethod
POST :: HTTPMethod
DELETE :: HTTPMethod
PUT :: HTTPMethod
-- | A pair which represents a parameter (key,value).
type Parameter = (String, Maybe String)
-- | Refer to http://en.wikipedia.org/wiki/Percent-encoding for more
-- information
class PercentEncoding a
encode :: (PercentEncoding a) => a -> ByteString
encodes :: (PercentEncoding a) => [a] -> ByteString
decode :: (PercentEncoding a) => ByteString -> (a, ByteString)
decodes :: (PercentEncoding a) => ByteString -> [a]
-- | Convenience function to append an item in request's parameters list
append_param :: Request -> (String, Maybe String) -> Request
-- | Show the entire url, including possibly any oauth parameter which may
-- be present.
show_url :: Request -> ByteString
-- | The URL to perform the oauth request
show_oauthurl :: Request -> ByteString
-- | The Authorization or WWW-Authenticated headers to perform oauth
-- authentication.
show_oauthheader :: String -> Request -> ByteString
-- | Produces a urlencoded string. For convenience, it sorts the parameters
-- first, as demands the oauth protocol.
show_urlencoded :: [Parameter] -> ByteString
-- | Parses a urlencoded string.
read_urlencoded :: ByteString -> [Parameter]
-- | Convenience operator to append an item in request's parameters list
(>>+) :: Request -> (String, Maybe String) -> Request
instance Show Request
instance Read Request
instance Eq Request
instance Show HTTPMethod
instance Read HTTPMethod
instance Eq HTTPMethod
instance PercentEncoding Char
-- | Implements PLAINTEXT and HMAC-SHA1 signatures of oauth spec
-- http://oauth.net/core/1.0a#signing_process
module Network.Protocol.OAuth.Signature
-- | The signature method which will be used to sign requests.
data Method
-- | The PLAINTEXT consumer_key token_secret method
-- does not provide any security protection and SHOULD only be used over
-- a secure channel such as HTTPS. It does not use the Signature
-- Base String.
PLAINTEXT :: String -> (Maybe String) -> Method
-- | The HMAC_SHA1 consumer_key token_secret signature
-- method uses the HMAC-SHA1 signature algorithm as defined in
-- http://tools.ietf.org/html/rfc2104 where the Signature Base
-- String is the text and the key is the concatenated values (each first
-- encoded per Parameter Encoding) of the Consumer Secret and Token
-- Secret, separated by an & character (ASCII code 38) even if
-- empty.
HMAC_SHA1 :: String -> (Maybe String) -> Method
-- | The RSA_SHA1 rsa_privkey signature method uses the
-- RSASSA-PKCS1-v1_5 signature algorithm as defined in [RFC3447] section
-- 8.2 (more simply known as PKCS#1), using SHA-1 as the hash function
-- for EMSA-PKCS1-v1_5. It is assumed that the Consumer has provided its
-- RSA public key in a verified way to the Service Provider.
RSA_SHA1 :: PrivateKey -> Method
-- | Functions to sign requests according oauth spec.
class Signer a
sign :: (Signer a) => a -> Request -> String
instance Show Method
instance Signer Method
-- | A pure library that implements oauth authentication protocol as
-- defined in http://oauth.net/core/1.0a.
--
-- Refer to http://oauth.net/ for more information about the oauth
-- protocol.
module Network.Protocol.OAuth.Consumer
-- | OAuth uses Tokens generated by the Service Provider instead of the
-- User's credentials in Protected Resources requests.
data Token
-- | The application which needs to authenticate using oauth.
data Consumer
-- | Creates a consumer with consumer_key and consumer_secret
Unauthenticated :: String -> String -> Consumer
-- | A consumer with consumer_key, consumer_secret and a
-- Token
Authenticated :: String -> String -> Token -> Consumer
-- | Sign a request for oauth request. Use this either to sign requests
-- with a proper Access token or to use the oauth protocol to get a token
-- from service provider.
--
-- The request you provide must contain oauth_nonce and
-- oauth_timestamp parameters properly defined.
request :: (Signer s, Show s) => Consumer -> s -> Request -> Request
-- | Process the response of the service provider. The response should be
-- an urlencoded string.
response :: Consumer -> ByteString -> Maybe Consumer
oauth_token :: Token -> String
oauth_token_secret :: Token -> String
oauth_extra :: Token -> [Parameter]
-- | The PLAINTEXT signature for a given consumer
plaintext_signature :: Consumer -> Method
-- | The HMAC-SHA1 signature for a given consumer
hmacsha1_signature :: Consumer -> Method
instance Show Consumer
instance Read Consumer
instance Eq Consumer
instance Show Token
instance Read Token
instance Eq Token