diff --git a/changelog.d/3-bug-fixes/client-id-leading-zeros b/changelog.d/3-bug-fixes/client-id-leading-zeros new file mode 100644 index 0000000000..1bfbbeaf43 --- /dev/null +++ b/changelog.d/3-bug-fixes/client-id-leading-zeros @@ -0,0 +1 @@ +Prevent client IDs with leading zeros from being generated. This works around a type mismatch in the protobuf API, where client IDs are represented as uint64. diff --git a/libs/wire-api/src/Wire/API/User/Client/Prekey.hs b/libs/wire-api/src/Wire/API/User/Client/Prekey.hs index ff861a3078..5e7b43252b 100644 --- a/libs/wire-api/src/Wire/API/User/Client/Prekey.hs +++ b/libs/wire-api/src/Wire/API/User/Client/Prekey.hs @@ -40,6 +40,7 @@ import Data.ByteString.Conversion (toByteString') import Data.Id import Data.OpenApi qualified as S import Data.Schema +import Data.Text qualified as T import Data.Text.Ascii (encodeBase16) import Data.Text.Encoding (decodeUtf8, encodeUtf8) import Imports @@ -70,6 +71,9 @@ instance ToSchema Prekey where clientIdFromPrekey :: Prekey -> ClientId clientIdFromPrekey = ClientId + -- FIXME the clients expect UInts on the protobufs, + -- We will eventually not need this change anymore + . T.dropWhile (== '0') . decodeUtf8 . toByteString' . encodeBase16