hoauth 0.1.2 → 0.1.3
raw patch · 2 files changed
+36/−4 lines, 2 filesdep +binarydep +old-localedep +system-uuiddep ~base
Dependencies added: binary, old-locale, system-uuid, time
Dependency ranges changed: base
Files
hoauth.cabal view
@@ -1,5 +1,5 @@ name: hoauth-version: 0.1.2+version: 0.1.3 category: Network,Protocol,OAuth license: BSD3 license-file: LICENSE@@ -18,7 +18,16 @@ More info at: <http://oauth.net/> library- build-depends: base>=3&&<=4,bytestring>=0.9.0.1,SHA>=1.4.0,RSA>=1.0.2,base64-string>=0.1,utf8-string>=0.3.3+ build-depends: base>=4&&<5+ ,bytestring>=0.9.0.1+ ,SHA>=1.4.0+ ,RSA>=1.0.2+ ,base64-string>=0.1+ ,utf8-string>=0.3.3+ ,binary>=0.5+ ,time>=1.1.4+ ,old-locale+ ,system-uuid>=1.1.0 exposed-modules: Network.Protocol.OAuth.Consumer,Network.Protocol.OAuth.Request,Network.Protocol.OAuth.Signature hs-source-dirs: src/main/haskell ghc-options: -Wall -fwarn-tabs@@ -28,7 +37,17 @@ Default: False executable test_hoauth- build-depends: base>=3&&<=4,bytestring>=0.9.0.1,SHA>=1.4.0,RSA>=1.0.2,base64-string>=0.1,utf8-string>=0.3.3,HUnit>=1.2.0.0+ build-depends: base>=4&&<5+ ,bytestring>=0.9.0.1+ ,SHA>=1.4.0+ ,RSA>=1.0.2+ ,base64-string>=0.1+ ,utf8-string>=0.3.3+ ,binary>=0.5+ ,time>=1.1.4+ ,old-locale+ ,system-uuid>=1.1.0+ ,HUnit>=1.2.0.0 ghc-options: -fno-ignore-asserts -fwarn-tabs hs-source-dirs: src/main/haskell,src/test/haskell main-is: Tests.hs
src/main/haskell/Network/Protocol/OAuth/Request.hs view
@@ -24,7 +24,7 @@ -- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -module Network.Protocol.OAuth.Request (Request(..),HTTPMethod(..),Parameter,PercentEncoding(encode,encodes,decode,decodes),append_param,show_url,show_oauthurl,show_oauthheader,show_urlencoded,read_urlencoded,(>>+)) where+module Network.Protocol.OAuth.Request (Request(..),HTTPMethod(..),Parameter,PercentEncoding(encode,encodes,decode,decodes),nonce_and_timestamp,append_param,show_url,show_oauthurl,show_oauthheader,show_urlencoded,read_urlencoded,(>>+)) where import Data.Bits as B import qualified Data.ByteString.Lazy as B1@@ -33,6 +33,12 @@ import qualified Data.Word as W import qualified Data.Char as C import qualified Data.List as L+import qualified Data.Time.Clock as T+import qualified Data.Time.Format as F+import qualified System.Locale as L+import qualified System.UUID.V1 as U+import qualified Text.Printf as P+import qualified Data.Binary as Bn -- | A pair which represents a parameter (key,value). type Parameter = (String,Maybe String)@@ -127,6 +133,13 @@ -- For convenience, it sorts the parameters first, as demands the oauth protocol. show_urlencoded :: [Parameter] -> B1.ByteString show_urlencoded = _urlencode encodes 0x26++-- | Generates the oauth_nonce and oauth_timestamp parameters.+nonce_and_timestamp :: Request -> IO Request+nonce_and_timestamp r = do+ timestamp <- fmap (F.formatTime L.defaultTimeLocale "%s") T.getCurrentTime+ nonce <- fmap (concatMap (P.printf "%02x") . B3.unpack . Bn.encode) U.uuid+ return (r >>+ ("oauth_nonce",Just nonce) >>+ ("oauth_timestamp",Just timestamp)) -- | Convenience operator to append an item in request's parameters list (>>+) :: Request -> (String,Maybe String) -> Request