Skip to content

Commit 5d83820

Browse files
Fix Identity base64 usage to use Unpadded encoding
1 parent 6abf733 commit 5d83820

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.1.6.1
4+
5+
- Use Unpadded base64 encoding, as it was done in v0.1.5.0
6+
37
## 0.1.6.0
48

59
- Support base64-1.0

matrix-client.cabal

Lines changed: 1 addition & 1 deletion
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.6.0
3+
version: 0.1.6.1
44
synopsis: A matrix client library
55
description:
66
Matrix client is a library to interface with https://matrix.org.

src/Network/Matrix/Identity.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import Control.Monad (mzero)
4141
import Data.Aeson (FromJSON (..), Value (Object, String), encode, object, (.:), (.=))
4242
import Data.Base64.Types (extractBase64)
4343
import Data.ByteString.Lazy (fromStrict)
44-
import Data.ByteString.Lazy.Base64.URL (encodeBase64)
44+
import Data.ByteString.Lazy.Base64.URL (encodeBase64Unpadded)
4545
import Data.Digest.Pure.SHA (bytestringDigest, sha256)
4646
#if MIN_VERSION_aeson(2,0,0)
4747
import qualified Data.Aeson.KeyMap as KeyMap
@@ -171,7 +171,7 @@ identitiesLookup session ilr = do
171171
"4kenr7N9drpCJ4AfalmlGQVsOn3o2RHjkADUpXJWZUc"
172172
-}
173173
encodeSHA256 :: Text -> Text
174-
encodeSHA256 = toStrict . extractBase64 . encodeBase64 . bytestringDigest . sha256 . fromStrict . encodeUtf8
174+
encodeSHA256 = toStrict . extractBase64 . encodeBase64Unpadded . bytestringDigest . sha256 . fromStrict . encodeUtf8
175175

176176
data Identity = Email Text | Msisdn Text deriving (Show, Eq)
177177

0 commit comments

Comments
 (0)