Skip to content

Commit b6f690e

Browse files
Merge branch 'master' into issue-339
2 parents b4422b0 + 792665d commit b6f690e

File tree

5 files changed

+23
-13
lines changed

5 files changed

+23
-13
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Changes for next
2+
3+
- Allow http-client-0.6
4+
5+
- Change to use `cryptohash-sha1` (before `cryptohash`)
6+
17
## Changes for 0.20
28

39
- Add ratelimit endpoint

github.cabal

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,11 @@ Library
149149
base-compat >=0.10.4 && <0.11,
150150
base16-bytestring >=0.1.1.6 && <0.2,
151151
binary-orphans >=0.1.8.0 && <0.2,
152-
byteable >=0.1.1 && <0.2,
153-
cryptohash >=0.11.9 && <0.12,
152+
cryptohash-sha1 >=0.11.100.1 && <0.12,
154153
deepseq-generics >=0.2.0.0 && <0.3,
155154
exceptions >=0.10.0 && <0.11,
156155
hashable >=1.2.7.0 && <1.3,
157-
http-client >=0.5.12 && <0.6,
156+
http-client >=0.5.12 && <0.7,
158157
http-client-tls >=0.3.5.3 && <0.4,
159158
http-link-header >=1.0.3.1 && <1.1,
160159
http-types >=0.12.1 && <0.13,
@@ -189,7 +188,7 @@ test-suite github-test
189188
GitHub.UsersSpec
190189
main-is: Spec.hs
191190
ghc-options: -Wall
192-
build-tool-depends: hspec-discover:hspec-discover >=2.5.6 && <2.6
191+
build-tool-depends: hspec-discover:hspec-discover >=2.6.1 && <2.7
193192
build-depends: base,
194193
base-compat,
195194
aeson,
@@ -198,4 +197,4 @@ test-suite github-test
198197
vector,
199198
unordered-containers,
200199
file-embed,
201-
hspec >= 2.5.6 && <2.6
200+
hspec >= 2.6.1 && <2.7

src/GitHub.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ module GitHub (
156156
-- * Edit an organization
157157
publicOrganizationsForR,
158158
publicOrganizationR,
159+
organizationsR,
159160
-- ** Members
160161
-- | See <https://developer.github.com/v3/orgs/members/>
161162
--

src/GitHub/Data/Webhooks/Validate.hs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ module GitHub.Data.Webhooks.Validate (
1212
import GitHub.Internal.Prelude
1313
import Prelude ()
1414

15-
import Crypto.Hash (HMAC, SHA1, hmac, hmacGetDigest)
16-
import Data.Byteable (constEqBytes, toBytes)
17-
import Data.ByteString (ByteString)
15+
import Crypto.Hash.SHA1 (hmac)
16+
import Data.ByteString (ByteString)
1817

1918
import qualified Data.ByteString.Base16 as Hex
2019
import qualified Data.Text.Encoding as TE
@@ -30,10 +29,9 @@ isValidPayload
3029
-- including the 'sha1=...' prefix
3130
-> ByteString -- ^ the body
3231
-> Bool
33-
isValidPayload secret shaOpt payload = maybe False (constEqBytes sign) shaOptBS
32+
isValidPayload secret shaOpt payload = maybe False (sign ==) shaOptBS
3433
where
3534
shaOptBS = TE.encodeUtf8 <$> shaOpt
36-
hexDigest = Hex.encode . toBytes . hmacGetDigest
37-
38-
hm = hmac (TE.encodeUtf8 secret) payload :: HMAC SHA1
35+
hexDigest = Hex.encode
36+
hm = hmac (TE.encodeUtf8 secret) payload
3937
sign = "sha1=" <> hexDigest hm

src/GitHub/Endpoints/Organizations.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module GitHub.Endpoints.Organizations (
1111
publicOrganization,
1212
publicOrganization',
1313
publicOrganizationR,
14+
organizationsR,
1415
module GitHub.Data,
1516
) where
1617

@@ -32,7 +33,12 @@ publicOrganizationsFor' auth org =
3233
publicOrganizationsFor :: Name User -> IO (Either Error (Vector SimpleOrganization))
3334
publicOrganizationsFor = publicOrganizationsFor' Nothing
3435

35-
-- | List user organizations.
36+
-- | List all user organizations.
37+
-- See <https://developer.github.com/v3/orgs/#list-your-organizations>
38+
organizationsR :: FetchCount -> Request k (Vector SimpleOrganization)
39+
organizationsR = pagedQuery ["user", "orgs"] []
40+
41+
-- | List public user organizations.
3642
-- See <https://developer.github.com/v3/orgs/#list-user-organizations>
3743
publicOrganizationsForR :: Name User -> FetchCount -> Request k (Vector SimpleOrganization)
3844
publicOrganizationsForR user = pagedQuery ["users", toPathPart user, "orgs"] []

0 commit comments

Comments
 (0)