Skip to content

Commit 5b6da6f

Browse files
Add support for base64-1.0
1 parent 77b735b commit 5b6da6f

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

flake.nix

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
(final: prev: {
2020
myHaskellPackages = prev.haskellPackages.override {
2121
overrides = hpFinal: hpPrev: {
22+
base64 = hpPrev.base64_1_0;
2223
matrix-client =
2324
hpPrev.callCabal2nix "matrix-client" ./matrix-client/. { };
2425
matrix-bot =

matrix-client/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.1.6.0
4+
5+
- Support base64-1.0
6+
37
## 0.1.5.0
48

59
- Convert userDisplayName into a Maybe value [#30](https://github.com/softwarefactory-project/matrix-client-haskell/issues/30)

matrix-client/matrix-client.cabal

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.4
22
name: matrix-client
3-
version: 0.1.5.0
3+
version: 0.1.6.0
44
synopsis: A matrix client library
55
description:
66
Matrix client is a library to interface with https://matrix.org.
@@ -48,7 +48,7 @@ common common-options
4848

4949
common lib-depends
5050
build-depends: SHA ^>= 1.6
51-
, base64 >= 0.4.2 && < 0.5
51+
, base64 >= 1.0
5252
, bytestring >= 0.11.3 && < 0.13
5353
, containers >= 0.6.5 && < 0.8
5454
, exceptions >= 0.10.4 && < 0.11

matrix-client/src/Network/Matrix/Identity.hs

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ where
3838

3939
import Control.Monad (mzero)
4040
import Data.Aeson (FromJSON (..), Value (Object, String), encode, object, (.:), (.=))
41+
import Data.Base64.Types (extractBase64)
4142
import Data.ByteString.Lazy (fromStrict)
42-
import Data.ByteString.Lazy.Base64.URL (encodeBase64Unpadded)
43+
import Data.ByteString.Lazy.Base64.URL (encodeBase64)
4344
import Data.Digest.Pure.SHA (bytestringDigest, sha256)
4445
#if MIN_VERSION_aeson(2,0,0)
4546
import qualified Data.Aeson.KeyMap as KeyMap
@@ -166,7 +167,7 @@ identitiesLookup session ilr = do
166167
-- >>> encodeSHA256 "[email protected] email matrixrocks"
167168
-- "4kenr7N9drpCJ4AfalmlGQVsOn3o2RHjkADUpXJWZUc"
168169
encodeSHA256 :: Text -> Text
169-
encodeSHA256 = toStrict . encodeBase64Unpadded . bytestringDigest . sha256 . fromStrict . encodeUtf8
170+
encodeSHA256 = toStrict . extractBase64 . encodeBase64 . bytestringDigest . sha256 . fromStrict . encodeUtf8
170171

171172
data Identity = Email Text | Msisdn Text deriving (Show, Eq)
172173

0 commit comments

Comments
 (0)