From 834466960391bcccc407b884024faae98439a518 Mon Sep 17 00:00:00 2001 From: Owen Harvey Date: Tue, 22 Aug 2023 21:33:56 +1000 Subject: [PATCH] WPB-3798 incorrect json field names (#3518) * WPB-3798: Updating code and tests after renaming fields * WPB-3798: More updates to names after finding more JSON prefix mangling * WPB-3798: Fixing schema instances for SAML data * WPB-3798: Fixing instances that had errors, found by tests * WPB-3798: Adding changelogs * WPB-3798: PR feedback. * WPB-3798: Fixing an error with a field called `data'` The trailing ' would end up in the JSON representation. I've changed it to use a leading `_` like other structures, and wrote a newtype to handle the minimal prefix stripping. Also cleaning up the diff in regards to imports. * WPB-3798: Cleaning up imports to minimise the diff --- changelog.d/1-api-changes/WPB-3798 | 1 + changelog.d/5-internal/WPB-3798 | 3 + libs/types-common/src/Data/Code.hs | 4 +- libs/types-common/src/Data/Json/Util.hs | 12 +- libs/types-common/src/Util/Options.hs | 10 +- libs/types-common/src/Util/Options/Common.hs | 9 +- .../src/Wire/API/Federation/API/Brig.hs | 25 +- .../src/Wire/API/Federation/API/Cargohold.hs | 8 +- .../src/Wire/API/Federation/API/Galley.hs | 134 ++++---- .../Federation/Golden/ConversationCreated.hs | 44 +-- .../Federation/Golden/NewConnectionRequest.hs | 12 +- libs/wire-api/src/Wire/API/Provider.hs | 14 +- .../src/Wire/API/User/IdentityProvider.hs | 29 +- libs/wire-api/src/Wire/API/User/Orphans.hs | 13 +- libs/wire-api/src/Wire/API/User/Saml.hs | 2 +- libs/wire-api/src/Wire/API/Util/Aeson.hs | 33 +- .../CompletePasswordReset_provider.hs | 120 +++---- .../Golden/Generated/EmailUpdate_provider.hs | 40 +-- .../Generated/PasswordChange_provider.hs | 80 ++--- .../Generated/PasswordReset_provider.hs | 40 +-- .../src/Wire/BackgroundWorker.hs | 2 +- .../src/Wire/Defederation.hs | 5 +- .../background-worker/test/Test/Wire/Util.hs | 2 +- services/brig/src/Brig/API/Federation.hs | 20 +- services/brig/src/Brig/API/MLS/KeyPackages.hs | 4 +- services/brig/src/Brig/App.hs | 21 +- services/brig/src/Brig/Provider/API.hs | 6 +- services/brig/src/Brig/Run.hs | 4 +- services/brig/src/Brig/User/Search/Index.hs | 16 +- .../brig/test/integration/API/Federation.hs | 20 +- .../test/integration/API/Internal/Util.hs | 6 +- .../brig/test/integration/API/Provider.hs | 2 +- .../brig/test/integration/API/User/Auth.hs | 14 +- .../test/integration/API/User/Connection.hs | 78 ++--- services/brig/test/integration/Main.hs | 13 +- services/brig/test/integration/Util.hs | 8 +- .../cargohold/src/CargoHold/API/Federation.hs | 4 +- services/cargohold/src/CargoHold/API/V3.hs | 8 +- services/cargohold/src/CargoHold/AWS.hs | 10 +- services/cargohold/src/CargoHold/App.hs | 29 +- .../cargohold/src/CargoHold/Federation.hs | 10 +- services/cargohold/src/CargoHold/Options.hs | 42 +-- services/cargohold/src/CargoHold/Run.hs | 12 +- services/cargohold/src/CargoHold/S3.hs | 4 +- services/cargohold/test/integration/API.hs | 4 +- .../test/integration/API/Federation.hs | 48 +-- .../cargohold/test/integration/API/Util.hs | 12 +- services/cargohold/test/integration/App.hs | 14 +- .../cargohold/test/integration/TestSetup.hs | 10 +- services/federator/default.nix | 1 - services/federator/federator.cabal | 1 - services/federator/src/Federator/Run.hs | 16 +- .../integration/Test/Federator/IngressSpec.hs | 4 +- .../integration/Test/Federator/InwardSpec.hs | 10 +- .../test/integration/Test/Federator/JSON.hs | 2 +- .../test/integration/Test/Federator/Util.hs | 22 +- .../test/unit/Test/Federator/Client.hs | 2 +- services/galley/src/Galley/API/Action.hs | 24 +- services/galley/src/Galley/API/Federation.hs | 133 ++++---- services/galley/src/Galley/API/Internal.hs | 14 +- .../src/Galley/API/LegalHold/Conflicts.hs | 2 +- .../galley/src/Galley/API/MLS/GroupInfo.hs | 4 +- services/galley/src/Galley/API/MLS/Message.hs | 28 +- .../galley/src/Galley/API/MLS/Propagate.hs | 12 +- services/galley/src/Galley/API/Mapping.hs | 33 +- services/galley/src/Galley/API/Message.hs | 36 +-- services/galley/src/Galley/API/Query.hs | 6 +- services/galley/src/Galley/API/Teams.hs | 14 +- .../src/Galley/API/Teams/Features/Get.hs | 30 +- services/galley/src/Galley/API/Update.hs | 18 +- services/galley/src/Galley/API/Util.hs | 67 ++-- services/galley/src/Galley/App.hs | 43 +-- services/galley/src/Galley/Aws.hs | 6 +- .../galley/src/Galley/Cassandra/Client.hs | 2 +- services/galley/src/Galley/Cassandra/Code.hs | 2 +- services/galley/src/Galley/Cassandra/Team.hs | 2 +- services/galley/src/Galley/Env.hs | 7 +- .../Galley/Intra/BackendNotificationQueue.hs | 2 +- services/galley/src/Galley/Intra/Federator.hs | 7 +- .../galley/src/Galley/Intra/Push/Internal.hs | 2 +- services/galley/src/Galley/Intra/User.hs | 4 +- services/galley/src/Galley/Intra/Util.hs | 17 +- services/galley/src/Galley/Options.hs | 114 +++---- services/galley/src/Galley/Run.hs | 14 +- services/galley/src/Galley/Validation.hs | 2 +- services/galley/test/integration/API.hs | 297 +++++++++--------- .../galley/test/integration/API/Federation.hs | 57 ++-- .../galley/test/integration/API/MLS/Mocks.hs | 2 +- .../galley/test/integration/API/MLS/Util.hs | 44 +-- services/galley/test/integration/API/Teams.hs | 8 +- .../test/integration/API/Teams/Feature.hs | 26 +- .../test/integration/API/Teams/LegalHold.hs | 4 +- .../integration/API/Teams/LegalHold/Util.hs | 14 +- services/galley/test/integration/API/Util.hs | 80 +++-- .../test/integration/API/Util/TeamFeature.hs | 4 +- .../galley/test/integration/Federation.hs | 22 +- services/galley/test/integration/Main.hs | 32 +- .../galley/test/integration/TestHelpers.hs | 4 +- services/galley/test/integration/TestSetup.hs | 8 +- .../galley/test/unit/Test/Galley/Mapping.hs | 6 +- services/gundeck/src/Gundeck/Aws.hs | 17 +- services/gundeck/src/Gundeck/Env.hs | 37 +-- services/gundeck/src/Gundeck/Notification.hs | 6 +- .../gundeck/src/Gundeck/Notification/Data.hs | 16 +- services/gundeck/src/Gundeck/Options.hs | 62 ++-- services/gundeck/src/Gundeck/Push.hs | 16 +- services/gundeck/src/Gundeck/Push/Native.hs | 30 +- services/gundeck/src/Gundeck/React.hs | 4 +- services/gundeck/src/Gundeck/Run.hs | 8 +- .../src/Gundeck/ThreadBudget/Internal.hs | 18 +- services/gundeck/test/integration/API.hs | 13 +- services/gundeck/test/integration/Main.hs | 17 +- services/gundeck/test/integration/Util.hs | 8 +- services/gundeck/test/unit/ThreadBudget.hs | 2 +- services/spar/src/Spar/API.hs | 59 ++-- services/spar/src/Spar/App.hs | 20 +- services/spar/src/Spar/Run.hs | 28 +- .../src/Spar/Sem/IdPConfigStore/Cassandra.hs | 33 +- .../spar/src/Spar/Sem/IdPConfigStore/Mem.hs | 8 +- .../test-integration/Test/Spar/APISpec.hs | 54 ++-- .../test-integration/Test/Spar/AppSpec.hs | 2 +- .../test-integration/Test/Spar/DataSpec.hs | 8 +- .../Test/Spar/Scim/UserSpec.hs | 4 +- services/spar/test-integration/Util/Core.hs | 72 +++-- services/spar/test-integration/Util/Scim.hs | 2 +- services/spar/test-integration/Util/Types.hs | 11 +- services/spar/test/Arbitrary.hs | 5 +- tools/stern/src/Stern/API.hs | 2 +- tools/stern/src/Stern/App.hs | 2 +- tools/stern/src/Stern/Types.hs | 4 +- tools/stern/test/integration/Main.hs | 2 +- 131 files changed, 1505 insertions(+), 1437 deletions(-) create mode 100644 changelog.d/1-api-changes/WPB-3798 create mode 100644 changelog.d/5-internal/WPB-3798 diff --git a/changelog.d/1-api-changes/WPB-3798 b/changelog.d/1-api-changes/WPB-3798 new file mode 100644 index 00000000000..42435b4730f --- /dev/null +++ b/changelog.d/1-api-changes/WPB-3798 @@ -0,0 +1 @@ +The JSON schema of `NonConnectedBackends` has changed to have its single field now called `non_connected_backends`. \ No newline at end of file diff --git a/changelog.d/5-internal/WPB-3798 b/changelog.d/5-internal/WPB-3798 new file mode 100644 index 00000000000..625e4d9b15a --- /dev/null +++ b/changelog.d/5-internal/WPB-3798 @@ -0,0 +1,3 @@ +JSON derived schemas have been changed to no longer pre-process record fields to drop prefixes that were required to disambiguate fields. +Prefix processing still exists to drop leading underscores from field names, as we are using prefixed field names with `makeLenses`. +Code has been updated to use `OverloadedRecordDot` with the changed field names. \ No newline at end of file diff --git a/libs/types-common/src/Data/Code.hs b/libs/types-common/src/Data/Code.hs index 8d9d3c783d4..1820d85f403 100644 --- a/libs/types-common/src/Data/Code.hs +++ b/libs/types-common/src/Data/Code.hs @@ -119,8 +119,8 @@ deriving instance Cql Value -- (but without a type, using plain fields). This will make it easier to re-use a key/value -- pair in the API, keeping "code" in the JSON for backwards compatibility data KeyValuePair = KeyValuePair - { kcKey :: !Key, - kcCode :: !Value + { key :: !Key, + code :: !Value } deriving (Eq, Generic, Show) diff --git a/libs/types-common/src/Data/Json/Util.hs b/libs/types-common/src/Data/Json/Util.hs index 5235a039b48..62e7168d728 100644 --- a/libs/types-common/src/Data/Json/Util.hs +++ b/libs/types-common/src/Data/Json/Util.hs @@ -172,20 +172,16 @@ instance ToSchema A.Object where -- toJSONFieldName -- | Convenient helper to convert field names to use as JSON fields. --- it removes the prefix (assumed to be anything before an uppercase --- character) and converts the rest to underscore +-- it converts the field names to snake_case. -- -- Example: --- newtype TeamName = TeamName { tnTeamName :: Text } --- deriveJSON toJSONFieldName ''tnTeamName +-- newtype TeamName = TeamName { teamName :: Text } +-- deriveJSON toJSONFieldName ''teamName -- -- would generate {To/From}JSON instances where -- the field name is "team_name" toJSONFieldName :: A.Options -toJSONFieldName = A.defaultOptions {A.fieldLabelModifier = A.camelTo2 '_' . dropPrefix} - where - dropPrefix :: String -> String - dropPrefix = dropWhile (not . isUpper) +toJSONFieldName = A.defaultOptions {A.fieldLabelModifier = A.camelTo2 '_'} -------------------------------------------------------------------------------- diff --git a/libs/types-common/src/Util/Options.hs b/libs/types-common/src/Util/Options.hs index 925a8be7560..823f9bcc68a 100644 --- a/libs/types-common/src/Util/Options.hs +++ b/libs/types-common/src/Util/Options.hs @@ -75,8 +75,8 @@ urlPort u = do makeLenses ''AWSEndpoint data Endpoint = Endpoint - { _epHost :: !Text, - _epPort :: !Word16 + { _host :: !Text, + _port :: !Word16 } deriving (Show, Generic) @@ -85,14 +85,14 @@ deriveFromJSON toOptionFieldName ''Endpoint makeLenses ''Endpoint data CassandraOpts = CassandraOpts - { _casEndpoint :: !Endpoint, - _casKeyspace :: !Text, + { _endpoint :: !Endpoint, + _keyspace :: !Text, -- | If this option is unset, use all available nodes. -- If this option is set, use only cassandra nodes in the given datacentre -- -- This option is most likely only necessary during a cassandra DC migration -- FUTUREWORK: remove this option again, or support a datacentre migration feature - _casFilterNodesByDatacentre :: !(Maybe Text) + _filterNodesByDatacentre :: !(Maybe Text) } deriving (Show, Generic) diff --git a/libs/types-common/src/Util/Options/Common.hs b/libs/types-common/src/Util/Options/Common.hs index 97ac6a9cefd..c052a53c33b 100644 --- a/libs/types-common/src/Util/Options/Common.hs +++ b/libs/types-common/src/Util/Options/Common.hs @@ -28,12 +28,11 @@ import System.Posix.Env qualified as Posix -- NOTE: We typically use this for options in the configuration files! -- If you are looking into converting record field name to JSON to be used -- over the API, look for toJSONFieldName in the Data.Json.Util module. --- It removes the prefix (assumed to be anything before an uppercase --- character) and lowers the first character +-- It converts field names into snake_case -- -- Example: --- newtype TeamName = TeamName { tnTeamName :: Text } --- deriveJSON toJSONFieldName ''tnTeamName +-- newtype TeamName = TeamName { teamName :: Text } +-- deriveJSON toJSONFieldName ''teamName -- -- would generate {To/From}JSON instances where -- the field name is "teamName" @@ -44,7 +43,7 @@ toOptionFieldName = defaultOptions {fieldLabelModifier = lowerFirst . dropPrefix lowerFirst (x : xs) = toLower x : xs lowerFirst [] = "" dropPrefix :: String -> String - dropPrefix = dropWhile (not . isUpper) + dropPrefix = dropWhile ('_' ==) optOrEnv :: (a -> b) -> Maybe a -> (String -> b) -> String -> IO b optOrEnv getter conf reader var = case conf of diff --git a/libs/wire-api-federation/src/Wire/API/Federation/API/Brig.hs b/libs/wire-api-federation/src/Wire/API/Federation/API/Brig.hs index 66963015786..eebc121ea0d 100644 --- a/libs/wire-api-federation/src/Wire/API/Federation/API/Brig.hs +++ b/libs/wire-api-federation/src/Wire/API/Federation/API/Brig.hs @@ -75,26 +75,29 @@ type BrigApi = :<|> FedEndpoint "get-not-fully-connected-backends" DomainSet NonConnectedBackends newtype DomainSet = DomainSet - { dsDomains :: Set Domain + { domains :: Set Domain } deriving stock (Eq, Show, Generic) deriving (ToJSON, FromJSON) via (CustomEncoded DomainSet) newtype NonConnectedBackends = NonConnectedBackends + -- TODO: + -- The encoding rules that were in place would make this "connectedBackends" over the wire. + -- I do not think that this was intended, so I'm leaving this note as it will be an API break. { nonConnectedBackends :: Set Domain } deriving stock (Eq, Show, Generic) deriving (ToJSON, FromJSON) via (CustomEncoded NonConnectedBackends) newtype GetUserClients = GetUserClients - { gucUsers :: [UserId] + { users :: [UserId] } deriving stock (Eq, Show, Generic) deriving (ToJSON, FromJSON) via (CustomEncoded GetUserClients) data MLSClientsRequest = MLSClientsRequest - { mcrUserId :: UserId, -- implicitly qualified by the local domain - mcrSignatureScheme :: SignatureSchemeTag + { userId :: UserId, -- implicitly qualified by the local domain + signatureScheme :: SignatureSchemeTag } deriving stock (Eq, Show, Generic) deriving (ToJSON, FromJSON) via (CustomEncoded MLSClientsRequest) @@ -117,10 +120,10 @@ data MLSClientsRequest = MLSClientsRequest data NewConnectionRequest = NewConnectionRequest { -- | The 'from' userId is understood to always have the domain of the backend making the connection request - ncrFrom :: UserId, + from :: UserId, -- | The 'to' userId is understood to always have the domain of the receiving backend. - ncrTo :: UserId, - ncrAction :: RemoteConnectionAction + to :: UserId, + action :: RemoteConnectionAction } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform NewConnectionRequest) @@ -144,9 +147,9 @@ type UserDeletedNotificationMaxConnections = 1000 data UserDeletedConnectionsNotification = UserDeletedConnectionsNotification { -- | This is qualified implicitly by the origin domain - udcnUser :: UserId, + user :: UserId, -- | These are qualified implicitly by the target domain - udcnConnections :: Range 1 UserDeletedNotificationMaxConnections [UserId] + connections :: Range 1 UserDeletedNotificationMaxConnections [UserId] } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform UserDeletedConnectionsNotification) @@ -154,10 +157,10 @@ data UserDeletedConnectionsNotification = UserDeletedConnectionsNotification data ClaimKeyPackageRequest = ClaimKeyPackageRequest { -- | The user making the request, implictly qualified by the origin domain. - ckprClaimant :: UserId, + claimant :: UserId, -- | The user whose key packages are being claimed, implictly qualified by -- the target domain. - ckprTarget :: UserId + target :: UserId } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform ClaimKeyPackageRequest) diff --git a/libs/wire-api-federation/src/Wire/API/Federation/API/Cargohold.hs b/libs/wire-api-federation/src/Wire/API/Federation/API/Cargohold.hs index bcff826a17b..debe7a2a5d5 100644 --- a/libs/wire-api-federation/src/Wire/API/Federation/API/Cargohold.hs +++ b/libs/wire-api-federation/src/Wire/API/Federation/API/Cargohold.hs @@ -29,19 +29,19 @@ import Wire.Arbitrary (Arbitrary, GenericUniform (..)) data GetAsset = GetAsset { -- | User requesting the asset. Implictly qualified with the source domain. - gaUser :: UserId, + user :: UserId, -- | Asset key for the asset to download. Implictly qualified with the -- target domain. - gaKey :: AssetKey, + key :: AssetKey, -- | Optional asset token. - gaToken :: Maybe AssetToken + token :: Maybe AssetToken } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform GetAsset) deriving (ToJSON, FromJSON) via (CustomEncoded GetAsset) data GetAssetResponse = GetAssetResponse - {gaAvailable :: Bool} + {available :: Bool} deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform GetAssetResponse) deriving (ToJSON, FromJSON) via (CustomEncoded GetAssetResponse) diff --git a/libs/wire-api-federation/src/Wire/API/Federation/API/Galley.hs b/libs/wire-api-federation/src/Wire/API/Federation/API/Galley.hs index fdd17aa6f68..faf5a71fbcb 100644 --- a/libs/wire-api-federation/src/Wire/API/Federation/API/Galley.hs +++ b/libs/wire-api-federation/src/Wire/API/Federation/API/Galley.hs @@ -41,7 +41,7 @@ import Wire.API.MakesFederatedCall import Wire.API.Message import Wire.API.Routes.Public.Galley.Messaging import Wire.API.Unreachable -import Wire.API.Util.Aeson (CustomEncoded (..)) +import Wire.API.Util.Aeson (CustomEncoded (..), CustomEncodedLensable (..)) import Wire.Arbitrary (Arbitrary, GenericUniform (..)) -- FUTUREWORK: data types, json instances, more endpoints. See @@ -134,9 +134,9 @@ type GalleyApi = :<|> FedEndpoint "on-connection-removed" Domain EmptyResponse data TypingDataUpdateRequest = TypingDataUpdateRequest - { tdurTypingStatus :: TypingStatus, - tdurUserId :: UserId, - tdurConvId :: ConvId + { typingStatus :: TypingStatus, + userId :: UserId, + convId :: ConvId } deriving stock (Eq, Show, Generic) deriving (FromJSON, ToJSON) via (CustomEncoded TypingDataUpdateRequest) @@ -148,37 +148,37 @@ data TypingDataUpdateResponse deriving (FromJSON, ToJSON) via (CustomEncoded TypingDataUpdateResponse) data TypingDataUpdated = TypingDataUpdated - { tudTime :: UTCTime, - tudOrigUserId :: Qualified UserId, + { time :: UTCTime, + origUserId :: Qualified UserId, -- | Implicitely qualified by sender's domain - tudConvId :: ConvId, + convId :: ConvId, -- | Implicitely qualified by receiver's domain - tudUsersInConv :: [UserId], - tudTypingStatus :: TypingStatus + usersInConv :: [UserId], + typingStatus :: TypingStatus } deriving stock (Eq, Show, Generic) deriving (FromJSON, ToJSON) via (CustomEncoded TypingDataUpdated) data ClientRemovedRequest = ClientRemovedRequest - { crrUser :: UserId, - crrClient :: ClientId, - crrConvs :: [ConvId] + { user :: UserId, + client :: ClientId, + convs :: [ConvId] } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform ClientRemovedRequest) deriving (FromJSON, ToJSON) via (CustomEncoded ClientRemovedRequest) data GetConversationsRequest = GetConversationsRequest - { gcrUserId :: UserId, - gcrConvIds :: [ConvId] + { userId :: UserId, + convIds :: [ConvId] } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform GetConversationsRequest) deriving (ToJSON, FromJSON) via (CustomEncoded GetConversationsRequest) data RemoteConvMembers = RemoteConvMembers - { rcmSelfRole :: RoleName, - rcmOthers :: [OtherMember] + { selfRole :: RoleName, + others :: [OtherMember] } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform RemoteConvMembers) @@ -191,17 +191,17 @@ data RemoteConvMembers = RemoteConvMembers data RemoteConversation = RemoteConversation { -- | Id of the conversation, implicitly qualified with the domain of the -- backend that created this value. - rcnvId :: ConvId, - rcnvMetadata :: ConversationMetadata, - rcnvMembers :: RemoteConvMembers, - rcnvProtocol :: Protocol + id :: ConvId, + metadata :: ConversationMetadata, + members :: RemoteConvMembers, + protocol :: Protocol } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform RemoteConversation) deriving (FromJSON, ToJSON) via (CustomEncoded RemoteConversation) newtype GetConversationsResponse = GetConversationsResponse - { gcresConvs :: [RemoteConversation] + { convs :: [RemoteConversation] } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform GetConversationsResponse) @@ -213,30 +213,30 @@ newtype GetConversationsResponse = GetConversationsResponse -- separarate data type that can be reused in several data types in this module. data ConversationCreated conv = ConversationCreated { -- | The time when the conversation was created - ccTime :: UTCTime, + time :: UTCTime, -- | The user that created the conversation. This is implicitly qualified -- by the requesting domain, since it is impossible to create a regular/group -- conversation on a remote backend. - ccOrigUserId :: UserId, + origUserId :: UserId, -- | The conversation ID, local to the backend invoking the RPC - ccCnvId :: conv, + cnvId :: conv, -- | The conversation type - ccCnvType :: ConvType, - ccCnvAccess :: [Access], - ccCnvAccessRoles :: Set AccessRole, + cnvType :: ConvType, + cnvAccess :: [Access], + cnvAccessRoles :: Set AccessRole, -- | The conversation name, - ccCnvName :: Maybe Text, + cnvName :: Maybe Text, -- | Members of the conversation apart from the creator - ccNonCreatorMembers :: Set OtherMember, - ccMessageTimer :: Maybe Milliseconds, - ccReceiptMode :: Maybe ReceiptMode, - ccProtocol :: Protocol + nonCreatorMembers :: Set OtherMember, + messageTimer :: Maybe Milliseconds, + receiptMode :: Maybe ReceiptMode, + protocol :: Protocol } deriving stock (Eq, Show, Generic, Functor) deriving (ToJSON, FromJSON) via (CustomEncoded (ConversationCreated conv)) ccRemoteOrigUserId :: ConversationCreated (Remote ConvId) -> Remote UserId -ccRemoteOrigUserId cc = qualifyAs (ccCnvId cc) (ccOrigUserId cc) +ccRemoteOrigUserId cc = qualifyAs cc.cnvId cc.origUserId data ConversationUpdate = ConversationUpdate { cuTime :: UTCTime, @@ -263,10 +263,10 @@ instance FromJSON ConversationUpdate data LeaveConversationRequest = LeaveConversationRequest { -- | The conversation is assumed to be owned by the target domain, which -- allows us to protect against relay attacks - lcConvId :: ConvId, + convId :: ConvId, -- | The leaver is assumed to be owned by the origin domain, which allows us -- to protect against spoofing attacks - lcLeaver :: UserId + leaver :: UserId } deriving stock (Generic, Eq, Show) deriving (ToJSON, FromJSON) via (CustomEncoded LeaveConversationRequest) @@ -286,27 +286,27 @@ data RemoveFromConversationError -- federation RPC), and for conversations with an arbitrary Qualified or Remote id -- (e.g. as the argument of the corresponding handler). data RemoteMessage conv = RemoteMessage - { rmTime :: UTCTime, - rmData :: Maybe Text, - rmSender :: Qualified UserId, - rmSenderClient :: ClientId, - rmConversation :: conv, - rmPriority :: Maybe Priority, - rmPush :: Bool, - rmTransient :: Bool, - rmRecipients :: UserClientMap Text + { time :: UTCTime, + _data :: Maybe Text, + sender :: Qualified UserId, + senderClient :: ClientId, + conversation :: conv, + priority :: Maybe Priority, + push :: Bool, + transient :: Bool, + recipients :: UserClientMap Text } deriving stock (Eq, Show, Generic, Functor) deriving (Arbitrary) via (GenericUniform (RemoteMessage conv)) - deriving (ToJSON, FromJSON) via (CustomEncoded (RemoteMessage conv)) + deriving (ToJSON, FromJSON) via (CustomEncodedLensable (RemoteMessage conv)) data RemoteMLSMessage = RemoteMLSMessage - { rmmTime :: UTCTime, - rmmMetadata :: MessageMetadata, - rmmSender :: Qualified UserId, - rmmConversation :: ConvId, - rmmRecipients :: [(UserId, ClientId)], - rmmMessage :: Base64ByteString + { time :: UTCTime, + metadata :: MessageMetadata, + sender :: Qualified UserId, + conversation :: ConvId, + recipients :: [(UserId, ClientId)], + message :: Base64ByteString } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform RemoteMLSMessage) @@ -321,11 +321,11 @@ data RemoteMLSMessageResponse data ProteusMessageSendRequest = ProteusMessageSendRequest { -- | Conversation is assumed to be owned by the target domain, this allows -- us to protect against relay attacks - pmsrConvId :: ConvId, + convId :: ConvId, -- | Sender is assumed to be owned by the origin domain, this allows us to -- protect against spoofing attacks - pmsrSender :: UserId, - pmsrRawMessage :: Base64ByteString + sender :: UserId, + rawMessage :: Base64ByteString } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform ProteusMessageSendRequest) @@ -334,18 +334,18 @@ data ProteusMessageSendRequest = ProteusMessageSendRequest data MLSMessageSendRequest = MLSMessageSendRequest { -- | Conversation (or sub conversation) is assumed to be owned by the target -- domain, this allows us to protect against relay attacks - mmsrConvOrSubId :: ConvOrSubConvId, + convOrSubId :: ConvOrSubConvId, -- | Sender is assumed to be owned by the origin domain, this allows us to -- protect against spoofing attacks - mmsrSender :: UserId, - mmsrRawMessage :: Base64ByteString + sender :: UserId, + rawMessage :: Base64ByteString } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform MLSMessageSendRequest) deriving (ToJSON, FromJSON) via (CustomEncoded MLSMessageSendRequest) newtype MessageSendResponse = MessageSendResponse - {msResponse :: PostOtrResponse MessageSendingStatus} + {response :: PostOtrResponse MessageSendingStatus} deriving stock (Eq, Show) deriving (ToJSON, FromJSON) @@ -355,7 +355,7 @@ newtype MessageSendResponse = MessageSendResponse ) newtype LeaveConversationResponse = LeaveConversationResponse - {leaveResponse :: Either RemoveFromConversationError ()} + {response :: Either RemoveFromConversationError ()} deriving stock (Eq, Show) deriving (ToJSON, FromJSON) @@ -365,9 +365,9 @@ type UserDeletedNotificationMaxConvs = 1000 data UserDeletedConversationsNotification = UserDeletedConversationsNotification { -- | This is qualified implicitly by the origin domain - udcvUser :: UserId, + user :: UserId, -- | These are qualified implicitly by the target domain - udcvConversations :: Range 1 UserDeletedNotificationMaxConvs [ConvId] + conversations :: Range 1 UserDeletedNotificationMaxConvs [ConvId] } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform UserDeletedConversationsNotification) @@ -376,11 +376,11 @@ data UserDeletedConversationsNotification = UserDeletedConversationsNotification data ConversationUpdateRequest = ConversationUpdateRequest { -- | The user that is attempting to perform the action. This is qualified -- implicitly by the origin domain - curUser :: UserId, + user :: UserId, -- | Id of conversation the action should be performed on. The is qualified -- implicity by the owning backend which receives this request. - curConvId :: ConvId, - curAction :: SomeConversationAction + convId :: ConvId, + action :: SomeConversationAction } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform ConversationUpdateRequest) @@ -399,7 +399,7 @@ data ConversationUpdateResponse -- | A wrapper around a raw welcome message newtype MLSWelcomeRequest = MLSWelcomeRequest - { unMLSWelcomeRequest :: Base64ByteString + { mlsWelcomeRequest :: Base64ByteString } deriving stock (Eq, Generic, Show) deriving (Arbitrary) via (GenericUniform MLSWelcomeRequest) @@ -428,10 +428,10 @@ data MLSMessageResponse data GetGroupInfoRequest = GetGroupInfoRequest { -- | Conversation is assumed to be owned by the target domain, this allows -- us to protect against relay attacks - ggireqConv :: ConvId, + conv :: ConvId, -- | Sender is assumed to be owned by the origin domain, this allows us to -- protect against spoofing attacks - ggireqSender :: UserId + sender :: UserId } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform GetGroupInfoRequest) diff --git a/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/ConversationCreated.hs b/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/ConversationCreated.hs index 6f0765b8138..c5f6c5687bd 100644 --- a/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/ConversationCreated.hs +++ b/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/ConversationCreated.hs @@ -34,14 +34,14 @@ import Wire.API.Provider.Service testObject_ConversationCreated1 :: ConversationCreated ConvId testObject_ConversationCreated1 = ConversationCreated - { ccTime = read "1864-04-12 12:22:43.673 UTC", - ccOrigUserId = Id (fromJust (UUID.fromString "eed9dea3-5468-45f8-b562-7ad5de2587d0")), - ccCnvId = Id (fromJust (UUID.fromString "d13dbe58-d4e3-450f-9c0c-1e632f548740")), - ccCnvType = RegularConv, - ccCnvAccess = [InviteAccess, CodeAccess], - ccCnvAccessRoles = Set.fromList [TeamMemberAccessRole, NonTeamMemberAccessRole], - ccCnvName = Just "gossip", - ccNonCreatorMembers = + { time = read "1864-04-12 12:22:43.673 UTC", + origUserId = Id (fromJust (UUID.fromString "eed9dea3-5468-45f8-b562-7ad5de2587d0")), + cnvId = Id (fromJust (UUID.fromString "d13dbe58-d4e3-450f-9c0c-1e632f548740")), + cnvType = RegularConv, + cnvAccess = [InviteAccess, CodeAccess], + cnvAccessRoles = Set.fromList [TeamMemberAccessRole, NonTeamMemberAccessRole], + cnvName = Just "gossip", + nonCreatorMembers = Set.fromList [ OtherMember { omQualifiedId = @@ -66,23 +66,23 @@ testObject_ConversationCreated1 = omConvRoleName = roleNameWireMember } ], - ccMessageTimer = Just (Ms 1000), - ccReceiptMode = Just (ReceiptMode 42), - ccProtocol = ProtocolProteus + messageTimer = Just (Ms 1000), + receiptMode = Just (ReceiptMode 42), + protocol = ProtocolProteus } testObject_ConversationCreated2 :: ConversationCreated ConvId testObject_ConversationCreated2 = ConversationCreated - { ccTime = read "1864-04-12 12:22:43.673 UTC", - ccOrigUserId = Id (fromJust (UUID.fromString "eed9dea3-5468-45f8-b562-7ad5de2587d0")), - ccCnvId = Id (fromJust (UUID.fromString "d13dbe58-d4e3-450f-9c0c-1e632f548740")), - ccCnvType = One2OneConv, - ccCnvAccess = [], - ccCnvAccessRoles = Set.fromList [TeamMemberAccessRole, NonTeamMemberAccessRole], - ccCnvName = Nothing, - ccNonCreatorMembers = Set.fromList [], - ccMessageTimer = Nothing, - ccReceiptMode = Nothing, - ccProtocol = ProtocolMLS (ConversationMLSData (GroupId "group") (Epoch 3) MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519) + { time = read "1864-04-12 12:22:43.673 UTC", + origUserId = Id (fromJust (UUID.fromString "eed9dea3-5468-45f8-b562-7ad5de2587d0")), + cnvId = Id (fromJust (UUID.fromString "d13dbe58-d4e3-450f-9c0c-1e632f548740")), + cnvType = One2OneConv, + cnvAccess = [], + cnvAccessRoles = Set.fromList [TeamMemberAccessRole, NonTeamMemberAccessRole], + cnvName = Nothing, + nonCreatorMembers = Set.fromList [], + messageTimer = Nothing, + receiptMode = Nothing, + protocol = ProtocolMLS (ConversationMLSData (GroupId "group") (Epoch 3) MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519) } diff --git a/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/NewConnectionRequest.hs b/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/NewConnectionRequest.hs index 514cb18a53d..de8b20ca950 100644 --- a/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/NewConnectionRequest.hs +++ b/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/NewConnectionRequest.hs @@ -25,15 +25,15 @@ import Wire.API.Federation.API.Brig testObject_NewConnectionRequest1 :: NewConnectionRequest testObject_NewConnectionRequest1 = NewConnectionRequest - { ncrFrom = Id (fromJust (UUID.fromString "69f66843-6cf1-48fb-8c05-1cf58c23566a")), - ncrTo = Id (fromJust (UUID.fromString "1669240c-c510-43e0-bf1a-33378fa4ba55")), - ncrAction = RemoteConnect + { from = Id (fromJust (UUID.fromString "69f66843-6cf1-48fb-8c05-1cf58c23566a")), + to = Id (fromJust (UUID.fromString "1669240c-c510-43e0-bf1a-33378fa4ba55")), + action = RemoteConnect } testObject_NewConnectionRequest2 :: NewConnectionRequest testObject_NewConnectionRequest2 = NewConnectionRequest - { ncrFrom = Id (fromJust (UUID.fromString "69f66843-6cf1-48fb-8c05-1cf58c23566a")), - ncrTo = Id (fromJust (UUID.fromString "1669240c-c510-43e0-bf1a-33378fa4ba55")), - ncrAction = RemoteRescind + { from = Id (fromJust (UUID.fromString "69f66843-6cf1-48fb-8c05-1cf58c23566a")), + to = Id (fromJust (UUID.fromString "1669240c-c510-43e0-bf1a-33378fa4ba55")), + action = RemoteRescind } diff --git a/libs/wire-api/src/Wire/API/Provider.hs b/libs/wire-api/src/Wire/API/Provider.hs index 67bec9b77cb..99b58238b2d 100644 --- a/libs/wire-api/src/Wire/API/Provider.hs +++ b/libs/wire-api/src/Wire/API/Provider.hs @@ -255,7 +255,7 @@ instance FromJSON DeleteProvider where -- Password Change/Reset -- | The payload for initiating a password reset. -newtype PasswordReset = PasswordReset {nprEmail :: Email} +newtype PasswordReset = PasswordReset {email :: Email} deriving stock (Eq, Show) deriving newtype (Arbitrary) @@ -263,9 +263,9 @@ deriveJSON toJSONFieldName ''PasswordReset -- | The payload for completing a password reset. data CompletePasswordReset = CompletePasswordReset - { cpwrKey :: Code.Key, - cpwrCode :: Code.Value, - cpwrPassword :: PlainTextPassword6 + { key :: Code.Key, + code :: Code.Value, + password :: PlainTextPassword6 } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform CompletePasswordReset) @@ -274,8 +274,8 @@ deriveJSON toJSONFieldName ''CompletePasswordReset -- | The payload for changing a password. data PasswordChange = PasswordChange - { cpOldPassword :: PlainTextPassword6, - cpNewPassword :: PlainTextPassword6 + { oldPassword :: PlainTextPassword6, + newPassword :: PlainTextPassword6 } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform PasswordChange) @@ -283,7 +283,7 @@ data PasswordChange = PasswordChange deriveJSON toJSONFieldName ''PasswordChange -- | The payload for updating an email address -newtype EmailUpdate = EmailUpdate {euEmail :: Email} +newtype EmailUpdate = EmailUpdate {email :: Email} deriving stock (Eq, Show, Generic) deriving newtype (Arbitrary) diff --git a/libs/wire-api/src/Wire/API/User/IdentityProvider.hs b/libs/wire-api/src/Wire/API/User/IdentityProvider.hs index 0295cab6d37..e17db47e465 100644 --- a/libs/wire-api/src/Wire/API/User/IdentityProvider.hs +++ b/libs/wire-api/src/Wire/API/User/IdentityProvider.hs @@ -39,6 +39,7 @@ import SAML2.WebSSO qualified as SAML import SAML2.WebSSO.Types.TH (deriveJSONOptions) import Servant.API as Servant hiding (MkLink, URI (..)) import Wire.API.User.Orphans (samlSchemaOptions) +import Wire.API.Util.Aeson (defaultOptsDropChar) import Wire.Arbitrary (Arbitrary, GenericUniform (GenericUniform)) -- | The identity provider type used in Spar. @@ -48,17 +49,17 @@ newtype IdPHandle = IdPHandle {unIdPHandle :: Text} deriving (Eq, Ord, Show, FromJSON, ToJSON, ToSchema, Arbitrary, Generic) data WireIdP = WireIdP - { _wiTeam :: TeamId, + { _team :: TeamId, -- | list of issuer names that this idp has replaced, most recent first. this is used -- for finding users that are still stored under the old issuer, see -- 'findUserWithOldIssuer', 'moveUserToNewIssuer'. - _wiApiVersion :: Maybe WireIdPAPIVersion, - _wiOldIssuers :: [SAML.Issuer], + _apiVersion :: Maybe WireIdPAPIVersion, + _oldIssuers :: [SAML.Issuer], -- | the issuer that has replaced this one. this is set iff a new issuer is created -- with the @"replaces"@ query parameter, and it is used to decide whether users not -- existing on this IdP can be auto-provisioned (if 'isJust', they can't). - _wiReplacedBy :: Maybe SAML.IdPId, - _wiHandle :: IdPHandle + _replacedBy :: Maybe SAML.IdPId, + _handle :: IdPHandle } deriving (Eq, Show, Generic) @@ -80,7 +81,9 @@ defWireIdPAPIVersion = WireIdPAPIV1 makeLenses ''WireIdP deriveJSON deriveJSONOptions ''WireIdPAPIVersion -deriveJSON deriveJSONOptions ''WireIdP + +-- Changing the encoder since we've dropped the field prefixes +deriveJSON (defaultOptsDropChar '_') ''WireIdP instance BSC.ToByteString WireIdPAPIVersion where builder = @@ -124,13 +127,14 @@ instance Cql.Cql WireIdPAPIVersion where -- | A list of 'IdP's, returned by some endpoints. Wrapped into an object to -- allow extensibility later on. data IdPList = IdPList - { _idplProviders :: [IdP] + { _providers :: [IdP] } deriving (Eq, Show, Generic) makeLenses ''IdPList -deriveJSON deriveJSONOptions ''IdPList +-- Same as WireIdP, we want the lenses, so we have to drop a prefix +deriveJSON (defaultOptsDropChar '_') ''IdPList -- | JSON-encoded information about metadata: @{"value": }@. (Here we could also -- implement @{"uri": , "cert": }@. check both the certificate we get @@ -167,14 +171,19 @@ instance ToJSON IdPMetadataInfo where -- Swagger instances +-- Same as WireIdP, check there for why this has different handling instance ToSchema IdPList where - declareNamedSchema = genericDeclareNamedSchema samlSchemaOptions + declareNamedSchema = genericDeclareNamedSchema $ fromAesonOptions $ defaultOptsDropChar '_' instance ToSchema WireIdPAPIVersion where declareNamedSchema = genericDeclareNamedSchema samlSchemaOptions instance ToSchema WireIdP where - declareNamedSchema = genericDeclareNamedSchema samlSchemaOptions + -- We don't want to use `samlSchemaOptions`, as it pulls from saml2-web-sso json options which + -- as a `dropWhile not . isUpper` modifier. All we need is to drop the underscore prefix and + -- keep the rest of the default processing. This isn't strictly in line with WPB-3798's requirements + -- but it is close, and maintains the lens template haskell. + declareNamedSchema = genericDeclareNamedSchema $ fromAesonOptions $ defaultOptsDropChar '_' -- TODO: would be nice to add an example here, but that only works for json? diff --git a/libs/wire-api/src/Wire/API/User/Orphans.hs b/libs/wire-api/src/Wire/API/User/Orphans.hs index f2b29ccdf8b..05f49534e4f 100644 --- a/libs/wire-api/src/Wire/API/User/Orphans.hs +++ b/libs/wire-api/src/Wire/API/User/Orphans.hs @@ -21,6 +21,8 @@ module Wire.API.User.Orphans where import Control.Lens +import Data.Aeson qualified as A +import Data.Char import Data.Currency qualified as Currency import Data.ISO3166_CountryCodes import Data.LanguageCodes @@ -51,9 +53,18 @@ instance ToSchema CountryCode -- | The options to use for schema generation. Must match the options used -- for 'ToJSON' instances elsewhere. +-- +-- FUTUREWORK: This should be removed once the saml2-web-sso types are updated to remove their prefixes. +-- FUTUREWORK: Ticket for these changes https://wearezeta.atlassian.net/browse/WPB-3972 +-- Preserve the old prefix semantics for types that are coming from outside of this repo. samlSchemaOptions :: SchemaOptions -samlSchemaOptions = fromAesonOptions deriveJSONOptions +samlSchemaOptions = fromAesonOptions $ deriveJSONOptions {A.fieldLabelModifier = fieldMod . dropPrefix} + where + fieldMod = A.fieldLabelModifier deriveJSONOptions + dropPrefix = dropWhile (not . isUpper) +-- This type comes from a seperate repo, so we're keeping the prefix dropping +-- for the moment. instance ToSchema SAML.XmlText where declareNamedSchema = genericDeclareNamedSchema samlSchemaOptions diff --git a/libs/wire-api/src/Wire/API/User/Saml.hs b/libs/wire-api/src/Wire/API/User/Saml.hs index e42fbbf8f63..8ff2e27c954 100644 --- a/libs/wire-api/src/Wire/API/User/Saml.hs +++ b/libs/wire-api/src/Wire/API/User/Saml.hs @@ -56,7 +56,7 @@ type AssId = ID Assertion -- so that the verdict handler can act on it. data VerdictFormat = VerdictFormatWeb - | VerdictFormatMobile {_verdictFormatGrantedURI :: URI, _verdictFormatDeniedURI :: URI} + | VerdictFormatMobile {_formatGrantedURI :: URI, _formatDeniedURI :: URI} deriving (Eq, Show, Generic) makeLenses ''VerdictFormat diff --git a/libs/wire-api/src/Wire/API/Util/Aeson.hs b/libs/wire-api/src/Wire/API/Util/Aeson.hs index b1a28f1fdf1..209d55efb7e 100644 --- a/libs/wire-api/src/Wire/API/Util/Aeson.hs +++ b/libs/wire-api/src/Wire/API/Util/Aeson.hs @@ -17,12 +17,15 @@ module Wire.API.Util.Aeson ( customEncodingOptions, + customEncodingOptionsDropChar, + defaultOptsDropChar, CustomEncoded (..), + CustomEncodedLensable (..), ) where import Data.Aeson -import Data.Char qualified as Char +import Data.Json.Util (toJSONFieldName) import GHC.Generics (Rep) import Imports hiding (All) @@ -31,9 +34,22 @@ import Imports hiding (All) -- -- For example, it converts @_recordFieldLabel@ into @field_label@. customEncodingOptions :: Options -customEncodingOptions = +customEncodingOptions = toJSONFieldName + +-- This is useful for structures that are also creating lenses. +-- If the field name doesn't have a leading underscore then the +-- default `makeLenses` call won't make any lenses. +customEncodingOptionsDropChar :: Char -> Options +customEncodingOptionsDropChar c = + toJSONFieldName + { fieldLabelModifier = fieldLabelModifier toJSONFieldName . dropWhile (c ==) + } + +-- Similar to customEncodingOptionsDropChar, but not doing snake_case +defaultOptsDropChar :: Char -> Options +defaultOptsDropChar c = defaultOptions - { fieldLabelModifier = camelTo2 '_' . dropWhile (not . Char.isUpper) + { fieldLabelModifier = fieldLabelModifier defaultOptions . dropWhile (c ==) } newtype CustomEncoded a = CustomEncoded {unCustomEncoded :: a} @@ -43,3 +59,14 @@ instance (Generic a, GToJSON Zero (Rep a)) => ToJSON (CustomEncoded a) where instance (Generic a, GFromJSON Zero (Rep a)) => FromJSON (CustomEncoded a) where parseJSON = fmap CustomEncoded . genericParseJSON @a customEncodingOptions + +-- Similar to CustomEncoded except that it will first strip off leading '_' characters. +-- This is important for records with field names that would otherwise be keywords, like type or data +-- It is also useful if the record has lenses being generated. +newtype CustomEncodedLensable a = CustomEncodedLensable {unCustomEncodedLensable :: a} + +instance (Generic a, GToJSON Zero (Rep a)) => ToJSON (CustomEncodedLensable a) where + toJSON = genericToJSON @a (customEncodingOptionsDropChar '_') . unCustomEncodedLensable + +instance (Generic a, GFromJSON Zero (Rep a)) => FromJSON (CustomEncodedLensable a) where + parseJSON = fmap CustomEncodedLensable . genericParseJSON @a (customEncodingOptionsDropChar '_') diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/CompletePasswordReset_provider.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/CompletePasswordReset_provider.hs index 36c405ce542..e96883648e2 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/CompletePasswordReset_provider.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/CompletePasswordReset_provider.hs @@ -27,9 +27,9 @@ import Wire.API.Provider (CompletePasswordReset (..)) testObject_CompletePasswordReset_provider_1 :: CompletePasswordReset testObject_CompletePasswordReset_provider_1 = CompletePasswordReset - { cpwrKey = Key {asciiKey = unsafeRange (fromRight undefined (validate "Cd9b4n7KaooqOhOciMIf"))}, - cpwrCode = Value {asciiValue = unsafeRange (fromRight undefined (validate "W0CLFxLOL"))}, - cpwrPassword = + { key = Key {asciiKey = unsafeRange (fromRight undefined (validate "Cd9b4n7KaooqOhOciMIf"))}, + code = Value {asciiValue = unsafeRange (fromRight undefined (validate "W0CLFxLOL"))}, + password = plainTextPassword6Unsafe "\1012683\1112273\39028\&5\168679\169133rs\93986\&4wo~\1002561l=\1032023\13042\SI1nt\35892\1050889N\46503>?\"\aT\69782\USgg\\f\SYN\165120#tS\NAK8\DC1C\36700q\r!2d\DC4\189369m\SUB\a\\V'W\\\110825,\r\143398?\ACKx\agVQy9\SI3'h]\78709n0ue\b\1032695?@\ETB1zJ6\NULI\a;DL\ENQ\37006c\92669\US\ETBz\1097017?0\NUL\184657\"A&&\36577E\157691\US7fG\1081322Vpx\DELI'\1102879\DLE\1008567g,\NULH\DC2@+\1085033\1064315\DC4\1091186\STXJ\1103240dPQ\STX|\EOT9^9_\1033902\SO]\a\1022683Of'd\SYN\"^\EOTw\1073515_\1113440\DLE}\95632\DC1s5\161851N1\1078798RkTZ&\150149X\1065364~''v{4MDK\153974\US\SOH|oB\143604'q,HU\1025306\SUB\NUL\1060487+%~v\DEL\97853V|5\127943|\999498\1059223HTFhF\FSdelLB\CAN\SUBbiC\1027783\n\110976u}g!\38540M\141506\1037727Pt$2(W%\149078\&0i-H\SUB@ii\1037533\NAK2\2636hg\50874\28429#{\23697\SO\NUL\146715\f\f\1039241A\GS:\EOT]\99785qf\SOH'\DELx\139534\SYN\f\DLE\nT\149322sK5O\EOT\SYN^&3\SOf!\150976\GS\SYN\f\1112187wy\1052535\1091937\1045148\SYN\ACKijjq\58477&\RS\"\DC2\1063939e\129001\ETX-\\\DC2E\ETX\40256\39310Z\DC3\22084iD7Xv\137008m\SUB>~\CANW\139109\33037YYZE\1022090J|\5247\CAN.\137437p\1011705\ETXS:Y<.YBcP\31609\1107733v4U\f\987772\1070124W!9Z\1035690;\1106506\DLE\132101\SOH(kH\SUB\"\vdX\136713\10837x\154948\&6/b$A\"jH\133538\48869\&9\DC3,\144088\1091851{\DC2\12495&>\1040461" } @@ -37,9 +37,9 @@ testObject_CompletePasswordReset_provider_1 = testObject_CompletePasswordReset_provider_2 :: CompletePasswordReset testObject_CompletePasswordReset_provider_2 = CompletePasswordReset - { cpwrKey = Key {asciiKey = unsafeRange (fromRight undefined (validate "8XosCtq4Dzhyo=UoMRg_"))}, - cpwrCode = Value {asciiValue = unsafeRange (fromRight undefined (validate "EoNo4PH=cFSyQ-yuHhP"))}, - cpwrPassword = + { key = Key {asciiKey = unsafeRange (fromRight undefined (validate "8XosCtq4Dzhyo=UoMRg_"))}, + code = Value {asciiValue = unsafeRange (fromRight undefined (validate "EoNo4PH=cFSyQ-yuHhP"))}, + password = plainTextPassword6Unsafe "\DC3~d{ \988098\1008471\&7\DLE\NULd\1065586\SOH?NT.\186651\1106270JJ\64065^rd\146603N[\43292\SOHt#dn\142707}u\SO\1022368<\1094323\18349\51616\GS\CANn\n05\983885\&4Z\vIJXz1ia\20698&\SYN'<\162555\v\19677B\ENQ\SI\1049058\DLE1dt\1038032)$\135798\&1b\97041Fvi\36729J\a_T(-`S\NAK\fU\20849dBbTgi\167678\rfp\171973ED=\STX\1086228\SUBXa<*#\1037916<\1106037\191075^%Xx\ESCOM\DEL\994881\1059244X _3\DC4K\GS\a(&6\59167\&8[\1045759\1111435M\681>f]o\ENQ`m\DEL\1112157\1102641\11945\f\161652)Q1\1018093q\1005011\&9\1102348UD]$\41477\f6j\190919\&3jAG\1007534!ys\NAKs?\17249Z\160153cfpz\fGC_\SIf%xb\99796\&1\ESCj\94762\&4K\rQ7\150803:\55009%:\r\"-Zq\DELU|\DLENa>\131324K\131830G\ACK3#\"V\NAK-w\ACK\1081085(\23629\1091792\\H\21182\ENQ\1049732\1036941~M;FHW$X\988437Wy|x5N\CANTrX\US,\n!\51726U==I}\ACK\1067103\1041045\1085401\EOT\983701{ }1\144729yu8_\DC2p\1053610l)S\128946fZ7\ETB>hnRX\458M{U~Hw;\69816\1035492v=J\8990:\1000731\1096086\70367o\ESCs=\NAK\1017016\SOH\NULb\1111472\152433H%f\1040890\EOT" } @@ -47,9 +47,9 @@ testObject_CompletePasswordReset_provider_2 = testObject_CompletePasswordReset_provider_3 :: CompletePasswordReset testObject_CompletePasswordReset_provider_3 = CompletePasswordReset - { cpwrKey = Key {asciiKey = unsafeRange (fromRight undefined (validate "=aYXtgLJZX77qMIx0Oah"))}, - cpwrCode = Value {asciiValue = unsafeRange (fromRight undefined (validate "RMQ-RtgFDI-b"))}, - cpwrPassword = + { key = Key {asciiKey = unsafeRange (fromRight undefined (validate "=aYXtgLJZX77qMIx0Oah"))}, + code = Value {asciiValue = unsafeRange (fromRight undefined (validate "RMQ-RtgFDI-b"))}, + password = plainTextPassword6Unsafe "\1073786\1022541\1030619|@\DLE\1050256\58722\5028\SOH\25945J\EMkH\986937=\11472\"SP\\\FSw\95016lR[.29\137466\&1W_\64827\96388M\RSU\a!\GS\43687NKv\993525\1097611X\50069;?\157751\&47.\CAN\1103688\137799\186574}\v8\STX3fj\DC1\SI\181630=-3ZmNn10\DC1\997119\1059249\161874CT\NUL:N\"\SYN\\@|q\128174\FSv_u\95666\1080533J-*\1034203;\1068818hC (_u\161608g\43952\33809\NAK\US',m}\a\30792\DC2Dt\171459\152195Him\395|\125271q\161223r\110828\&27A\NAK\EOT\FSgP\1090390\US\993009\62450\1042020O9\EOTEB]\DLE<\156612\127142\133358\1015398rJu\t\1027420\1050082F\bfxm/f\a\rC\152680t~D\ESCO]_i\US\39307\SOH\35670>\SYN\1086602\NAK\STXDz\DC3\1048748ZC\DC1x0bLFjXI\148199\EMZ\GSR2!\ENQ\DC3\\Mffm\986388\1043076\94041F\1096421u\7179*\DLEM.q\33878\a\1106357GdxHmu\DELSTrb`cn\NAK+(@KZ\ENQ]\1034430QEf?fw\ETX\177531.W\STX~k\ENQ\993340\1112261\US\tB\SO-\STX4b\185882o,\CAN}P\SOKD\v\1100259O*\b\1061589\RS\1106367\ACK\NAK=\1048333eh\DLE\EMY\12994\986285\185764\GS\DC1#)v>a\1050729L\DEL\16992&gh1\SO\24688\&18\DC1\1091353(\167196\1031220lc\ACK#\1096547Poe\178761~\ETX[%e\133630{\1020978\&31\99380\45215\SOHI1z\1093633s#y\1048198\FS\8988g\USPE5P\SO/\n\1089996 *Z\DC3\2954\33162p}sh;[Sr\STX\1015744\ESC\tO\152390\STX/_Q^a\157142\1101351\985165y" } @@ -67,9 +67,9 @@ testObject_CompletePasswordReset_provider_4 = testObject_CompletePasswordReset_provider_5 :: CompletePasswordReset testObject_CompletePasswordReset_provider_5 = CompletePasswordReset - { cpwrKey = Key {asciiKey = unsafeRange (fromRight undefined (validate "OU56F44t-0ybJj7eKUaS"))}, - cpwrCode = Value {asciiValue = unsafeRange (fromRight undefined (validate "rr3lleg-Tu4eJ"))}, - cpwrPassword = + { key = Key {asciiKey = unsafeRange (fromRight undefined (validate "OU56F44t-0ybJj7eKUaS"))}, + code = Value {asciiValue = unsafeRange (fromRight undefined (validate "rr3lleg-Tu4eJ"))}, + password = plainTextPassword6Unsafe "k\1044075Pnu'6Z\NAK\1017783\149108\ENQ\129297l\18438[\1054432TMgddIb\186517mt.TCQW\1025717O\1111819M\ETX\27672\ETX\ETB\1083603\1091383F\RS^\182596C\SOH<\rs\f#\STX?A\n\170555\68821\t 88|;\SUB\1015442&\n\1042330'\1003626\151074 <\63465\v\EOT\1043258w\1012648\DC3l\62396\FS2)\SYN\1003311o4G\161486\&1;0IVKt6t$Y\":\13086\156982\1055032\"\GS\6275$y\ESC\15469)#\1011445H\SUB \SYNLk|\DLE$\GSh;\19798G(?ft*V%|\9608\bC\b,\131877\SYN\7628eI?:T1\ENQ2\1042416B+\STX\\\GS>4\1042921\1015196\DEL\1050654\ENQ\RSdH\NAK\SI\vK\NUL\1020294\a\b:9\163015\&3\53363%^[X\r:\1044970c\n\1035333kk'RA\78616\1054694\24158\1051573c\RS!\167908\28730\ENQ\SI\1068557\r/\SUB\1106472\&1ott&\SOK" } @@ -77,9 +77,9 @@ testObject_CompletePasswordReset_provider_5 = testObject_CompletePasswordReset_provider_6 :: CompletePasswordReset testObject_CompletePasswordReset_provider_6 = CompletePasswordReset - { cpwrKey = Key {asciiKey = unsafeRange (fromRight undefined (validate "54Yh4fa_ClTVqjEEubnW"))}, - cpwrCode = Value {asciiValue = unsafeRange (fromRight undefined (validate "RcplMOQiGa-JY"))}, - cpwrPassword = + { key = Key {asciiKey = unsafeRange (fromRight undefined (validate "54Yh4fa_ClTVqjEEubnW"))}, + code = Value {asciiValue = unsafeRange (fromRight undefined (validate "RcplMOQiGa-JY"))}, + password = plainTextPassword6Unsafe "\1068965Mz\1112587\\b\988910\33388\1081682\FSSi8:\"\r3\GSc\989625I=8L>uA'\SI&I\94104!W\995368\&7z;r\ENQnj_+3u/8\31470{\32573\170260\EM$vy\rB)\125105l\58284\1022117'iN8\SO}vd\1025869\132023uw\996610\&17\ETBF#\154217:s\1019264\EOT\CAN\12331\127284p$\53580\&2\14658\DLE\13233\SUB\59635Hl\25906\SOHw\1054216\&4[\171724\DC1\RS\SO!lS\EM\1073106\66443\\(\47504\61628N\1029483M\NUL\"\SOHd\1088943 \58859U?\31664d\138217(o\RS'\47111\v\1097785{A\ETBb=\1039402\1096760?o\n\164402*\12095P\SO84,Qf\1065714D\EMZ\SOHux\1096460<\v)\1109779\185595\25160\69876\&8t\136448Ya\GS\ENQ\9575\NUL`\US7\1022950p\1032880\&42\32304h\68036\EOT+W\a\1022685aH+XE\1016645p\SUB\8531\n\DLE\136210\1080841\1069380\119885\t\31849k\1020979\159730\RS\99244\1100479\14782G\nh\168920\SUB\DC4{\1107942\&5,\US\DC2L\DC1(\137496<|\bZ\172359\SIK\EM7\t2V|K\ETX,\SYN)F\50452\20991\100678\1098846\1109927\tJ\SYN)\133930" } @@ -87,9 +87,9 @@ testObject_CompletePasswordReset_provider_6 = testObject_CompletePasswordReset_provider_7 :: CompletePasswordReset testObject_CompletePasswordReset_provider_7 = CompletePasswordReset - { cpwrKey = Key {asciiKey = unsafeRange (fromRight undefined (validate "muTkNflRkN4ZV2Tsx=ZS"))}, - cpwrCode = Value {asciiValue = unsafeRange (fromRight undefined (validate "X-ySKT"))}, - cpwrPassword = + { key = Key {asciiKey = unsafeRange (fromRight undefined (validate "muTkNflRkN4ZV2Tsx=ZS"))}, + code = Value {asciiValue = unsafeRange (fromRight undefined (validate "X-ySKT"))}, + password = plainTextPassword6Unsafe ")jtk/z\184222F!N~\ETX\990448\1055900{8\73979\153166!D\1043025%\135850\168364u7WynrV\ETB\148520p\1077327Lt\842e^}?\1093891l`.`Y\vZ\STX\1112581P}[~\30935=}L\1095875\a\v!\1028719\ETBH)>5\ETX{\NAKD\ETXUEh^ ~\EOTCC\ETX\SO\16392p\38296z3jt\NAK\984409\bB7 P\CANSu_\183789o\17912\DC2\178168I\v`,\1022887N8\\\DC1^\10311m\CAN\1030400\FSZ_\"$\ETBB/\NUL!\SI[\DC3\vy\f\ENQ\ESC\137923OC\SIt\12293:\EOTl\\\b\EOTrG@\US\45550J\95310\166637-\10023\&8tTT#MD\FS\DC4lJQ9s\64189\25142\DC1jlVF\96794P{\5228\25037\NAKKEC\1098620[kg2*C\991918\NUL[\35874&\74062\188051?\182094\&8\145055\rSYlf\95342q\30892\94613\NULM.\b\t\1102963\1018631;\DC3_\1029835|@\SYNd\1082087)\n$an\SI\RSp\n=\1013045D+\97624\f\1106118\988197\1113\GSb\181818\SI\1091492YQx]\1063062c\18044\993702\148181\1072483\1042478J:\ESC\RS\1052622\186566<>\EOT\DC1\FS,\1076029i4@\ENQu^\178972\1082722Dd\63135\1006290\EOT\66041>Tx\1091471#u\\`\STX\1093786,Kt-\1035926D\1024804\154425,I.\190722:\15722&3n\v!\40042Pm\41694$\n\SOH\183103\75035\1093394\3121>ihpLGl@L\DEL\ENQ\ETB\182031\SOH \21434\SI)D` wC\STX\v\ENQ`\54406}$\39750\DLE[\"\1087944'q\1043619tP\EOT%\ENQeG\r\1058468\1110447C\DC3g\1038268#\FSYrht\164459@\1085349tMo\ACKWM\SUB\v\40317o&}~45\160190\&4K\1104579\CANl!x\167229k\ESC\\h\ENQ/4,\177887Yp\995759d\98258N\1108317vw\ESCK\1098528\FS\ETBRSf0\DLE\148633\93011*Wukxd3>\ACK'gN\1044418\DC38;2FN\747 '\1005699Yt<\1105770\21737\1045228\DC3]\13220\ETX@\f\1101655\42506f9i.\1005751\&5\n\131677\&2%$\1047618N\169552Y~47\986154\SO\1007292\1001379\31676\&3\1056996le\1059155\&4\DLE1Q\FS\986744#5?\73770\1092436\1011458\171368\167096\&4l<\1069261H7]=\DC1a\62925od\1064417A\GS:l\SI4q^b\1057856D\173253\1059916$b _oH'\DC1Kv\\n<-\t\US\1083436\163231\ESC\1098850F\1329\STX-\ENQ,\CANG$\NUL\38340.\1107219;\125009\169728\167O\ENQH\1018301%\ACK\1025545\1011306j\RS\994143\1094533mEB\120644\1031761A\20411\180256YN\STXFRm\US\ETXQ\1072397V`+\95270m\SYN1\1013314\b\1024313\&1}O\1108229\1002097\49175\f\1007287j$t\47188\&4!8%#v\f=\t<\49120\61960\ACKM\1056844\SUB3\"\r\989243\SUBX%~n+:\NULM\134421X\DEL-v\72197\f\ETB\996041\EOT\DLE07\1009115\CANU},,}\141362\bHy\fLa\\\n\64444\983949;jo0\157407\1061450\1041761\EOTMlW\DLE7\45112\1113654\984581B\1087787Z \1067937/\1027501R5F]X\ENQF|`\162826E\128973\r\v\984688c\1100696\1074387T\1041206\SO*(\RS\ACKbNs\1056623ST\139333\170914K\1032627?\SOH\1095798\1006647\13962\"S[TY};\SOH*r55\aT\1006364\SYN\SOH\1111555\1082650\RSZ\a\1020940s\162901t\1055866}\1055756deI\153662\46739\rR\\]'\1084483\1056412\\y\135616\FS)@o\30437Ci\1081016\1042881|[Q}}\1025142\SOH^\1085438|S\EOTWa\nE\DEL,\1014498S\DLEq\DC3s\"h\36770)\1084960\RSB:" } @@ -97,9 +97,9 @@ testObject_CompletePasswordReset_provider_7 = testObject_CompletePasswordReset_provider_8 :: CompletePasswordReset testObject_CompletePasswordReset_provider_8 = CompletePasswordReset - { cpwrKey = Key {asciiKey = unsafeRange (fromRight undefined (validate "4h1kCFffI4sHePSIIfS1"))}, - cpwrCode = Value {asciiValue = unsafeRange (fromRight undefined (validate "jgfbzV60"))}, - cpwrPassword = + { key = Key {asciiKey = unsafeRange (fromRight undefined (validate "4h1kCFffI4sHePSIIfS1"))}, + code = Value {asciiValue = unsafeRange (fromRight undefined (validate "jgfbzV60"))}, + password = plainTextPassword6Unsafe "[_.VrDh\1015708\1032560\&3\DC2=M\163597rhfOlZuP\65504\DC1\SUB\f\rx\FSJ5\f\DEL\181294si\166877{P\CAN\GSG3%'O\a\f\RSa\1092468x:\1053642\61514\1073484+\39638fMP\1054011B\\nu\\\SI:a4\15010qI\n{\1029779\NAK\1041484(r\44941EI\13466G\141832>\FS\1022348\EM@*y\US4{,\ETB\151574p\ACK\1107549R\1055583H,\DC1\v\US\1009911C!\SYN\1027699i}2\1006393\1013086pu\t?4\ETB\35803\44095\NUL\t7&\f\94064\993295\1068521\1077762\t&\ab\160257'\NULM:\29880oI\DC3\ENQtG\DC3`/0\RS\166279v\b_c}m\UST7;he\155120#\99948\1018238\1062963S4K\EMR;\ETB\US\ENQ\1021792\STX\1003450:\24440\DEL\EOT|p^ZN\30349&WtKz(S&M\SO`\SO\181996#\1011887C:^\ETB\147530f\EM\a3jp/\1058108|p\SYN/9?Wn\13780\RSH\ENQ*\168131\1075215\119182gh\2225\1089941T1\133460\77864\1037953=\986510\1004229&1Z[\1043805\1002639\&4U\DC4\998270K%\DEL2\USp&q\1055724o3QhHE:}\ENQhil\1096277fc\f\SYN1U\ACKTK\DC2\173882!4Ch>f\DEL\SYNV\49106QcXO3\t\SYN1\185658\147541ii5;?\ACK\1023746\994599W\63325\DC2\45506yDu\132949\140075\1007168\"\EOTVsg\1088989`\1042945:\38432'\STXE\992832\SYNJ\ETX\64654\DEL\RS\rV)6K\1001241u\n\1061707\ESCWq4k'xZ\CAN\1004671Pp`\78706\DC3s\vb'\1026286\DLE\51253\49630.v\1078713W2u*\1026823\f\rc;=l2.\135778\1067475\66363'AT\1038064\20692mc\ESC\DC3?Y\EM\1043502erF?lU\177756\SYN2\137736ZW\SYNe}\110678i\r8\1045526%\DLE\1060820Wu\ESCwr\SYNZ\984526\DC1\DC4*F\1025876j\4244\NAK\69844\SI&\24155t?\SYN:\996677\EOT\1096939\\d\ESC\rV\1048902\DLEY\SOH\DELHDi#'#\SO3\DLE\1033528\1066728hP'\SI>,#;B-\DEL\ETX\FS\b\1080220\\O\173118\155899\33548\161628r\DC3v\1036063\NAKwY>@P{&\126581muC\30489\DLE\RSW\DC3bzp#\SINO\ng.f\SOH8\1044888\USM3\STX9M#\31452A,S\144295\DLEiK\ACKi5\DC2\1106504\163392\&9\DEL3~\SUB;z\37537H\SOn\74309\1097966\22046h\SOHH\SO\1014941rSW!\1076838\1019303\ENQ,Texo\1103981\\U\60688\1107601ef~\NAKA\CAN\1095090\b1\FSiW\EM:i\1063110\100555\1028434\f@\45876^20\EMn!\1110881\ETB'\t`\"^" } @@ -107,9 +107,9 @@ testObject_CompletePasswordReset_provider_8 = testObject_CompletePasswordReset_provider_9 :: CompletePasswordReset testObject_CompletePasswordReset_provider_9 = CompletePasswordReset - { cpwrKey = Key {asciiKey = unsafeRange (fromRight undefined (validate "8QW8mjnVnIisvrtQDzWV"))}, - cpwrCode = Value {asciiValue = unsafeRange (fromRight undefined (validate "qXaaBJ"))}, - cpwrPassword = + { key = Key {asciiKey = unsafeRange (fromRight undefined (validate "8QW8mjnVnIisvrtQDzWV"))}, + code = Value {asciiValue = unsafeRange (fromRight undefined (validate "qXaaBJ"))}, + password = plainTextPassword6Unsafe "7\CAN\995057\1082858>#\149981T\1113543e\thUr\189434/\186737o%\DC4\SI\8198o6n8\20176c\1043600[C\1057789\&72@t;6t\169068\11814\120655\DC1\EOT\1079958\v\aS\SOH\EMey\ACK:\aii>\1079059u-<\1112894\1083324\SYN[#b$<\r\1056477\1033082\1105819\ETB!eWg\991833d\DLE\CAN\ETX @\SI\185824\&7\b(\40642\&3\NUL\1110157!X\FSe,t\ETX\1095428\&3\128629\1025661p\1000552\184281\184297l\25688V]\1068327v\152194MF\v*\1050101\1065061 \ESCT\SUB-\21105\&0>`{|bal\1060553\ESC\US\GS|\ACK\1028192\DEL\DELV\143705dq'\DEL6mCCjv&\1015677\DC4n9\1022140My[ K0p\\`6r\182750\1080218\DC1$|#\137636H\DC2?0{%`\STX\1005371k!\RSIg\SOH\SYNJ\FS{9b\1059876/4@\1060707ldKAH\ETX'8\180338\178999\1013270O\1075685Dko\23121\&04%/N9B\1003052aW*\1070751\1043722w8\SYN\RSr=\EMnX\1071326]\NUL\GS\1082718\139251\1079728\DC2EfW\t\SYN&G\196\&2\1008326b\1023329\1102771\1047159\&5[f\NAK\100090J/7\26364\t4\SOHS\CAN;7\185137R<;`L\1112382\1022626\&1?yCIiS\153111\GS\FS\EM\ESC\156314LH\140232\\:K\1002577MP}q\139293J\ETX\151699\1052232\1108510\NUL+X\1029314\181545D}-!EF\SOHE|\131183\&6\39841\1062330\21504\SOH<*x\179748\1015132k\DC1\DC3\98575\ETB\EOT|\SI~gr\DEL\2694YyEY)Z\155604&\DC4\997375\1004619\36183\151489\143359\29364\DC3P0R(|\1044843(%Y4\1044821?3\ENQ\v\ACKU\988376\30638Y\f0L\b\986153\STX\997297,\ru['" } @@ -117,17 +117,17 @@ testObject_CompletePasswordReset_provider_9 = testObject_CompletePasswordReset_provider_10 :: CompletePasswordReset testObject_CompletePasswordReset_provider_10 = CompletePasswordReset - { cpwrKey = Key {asciiKey = unsafeRange (fromRight undefined (validate "Myzdj2g7NTl0ppCPXiN1"))}, - cpwrCode = Value {asciiValue = unsafeRange (fromRight undefined (validate "BBwqW3"))}, - cpwrPassword = plainTextPassword6Unsafe "\ESC.\63992\SYN\128619\1086386\&0EI\50894\1058818A\ny\65231\1092012~\CAN;p" + { key = Key {asciiKey = unsafeRange (fromRight undefined (validate "Myzdj2g7NTl0ppCPXiN1"))}, + code = Value {asciiValue = unsafeRange (fromRight undefined (validate "BBwqW3"))}, + password = plainTextPassword6Unsafe "\ESC.\63992\SYN\128619\1086386\&0EI\50894\1058818A\ny\65231\1092012~\CAN;p" } testObject_CompletePasswordReset_provider_11 :: CompletePasswordReset testObject_CompletePasswordReset_provider_11 = CompletePasswordReset - { cpwrKey = Key {asciiKey = unsafeRange (fromRight undefined (validate "nQSYG43lVn8kYS-MPtOO"))}, - cpwrCode = Value {asciiValue = unsafeRange (fromRight undefined (validate "5BuwQHalK"))}, - cpwrPassword = + { key = Key {asciiKey = unsafeRange (fromRight undefined (validate "nQSYG43lVn8kYS-MPtOO"))}, + code = Value {asciiValue = unsafeRange (fromRight undefined (validate "5BuwQHalK"))}, + password = plainTextPassword6Unsafe "\1045282k\1026750)t\NUL\15552jgI\ETBP\SO\188738\147525\1066604G\39626jb\f`\nTq+Ut\92361\27743UBpVU \992919f9\21139\1020059\&1hYp9Ja\147132EBN\DC3t@\1079146i;P\1042445\180008\&8a\1091375T\158952V\138448\SI\18953fx\11087d:\SO\\\1054972?b\NAKKtz\GS\1104407\39067\n\1074206\&3\SOH\1025715\r87\ENQ9@\5471Y\ESC\62699\11493O\1045551\ETB\10550\1037708$Fph\US9\ETBe\fC\20273%>\USP@\STXo\34112h*\1042645\1104430\987562E\43000\11020\32229Ft{A=\38646#k\SYN\185887Fi\99911>&oy\98658\f_\1099272YIL\65827\&2\184583\1063350v3\RS\DC4\27853T\141265S\1048343\NAKK\150089\&1Y\1059308\NULk\DLEy\1067797\162645\92680B\78890 of ," } @@ -135,9 +135,9 @@ testObject_CompletePasswordReset_provider_11 = testObject_CompletePasswordReset_provider_12 :: CompletePasswordReset testObject_CompletePasswordReset_provider_12 = CompletePasswordReset - { cpwrKey = Key {asciiKey = unsafeRange (fromRight undefined (validate "NeuDtdyLCvq11nGkkEal"))}, - cpwrCode = Value {asciiValue = unsafeRange (fromRight undefined (validate "sj64oWB"))}, - cpwrPassword = + { key = Key {asciiKey = unsafeRange (fromRight undefined (validate "NeuDtdyLCvq11nGkkEal"))}, + code = Value {asciiValue = unsafeRange (fromRight undefined (validate "sj64oWB"))}, + password = plainTextPassword6Unsafe "an-<\r\ESCa$\n\SOH\150355@, daTW\1040876\1086641\1008932O\a\173984\1089573\187195E=\1033471\v\142301l\ESC\ACK\ACK\67616g>h(;\983436\ENQN:d\6803R\SYN$<;\18099:@\fWrO\119365\\\SOHE\NULX\SIL&Qc\143803\ACKKx+K\FSF\US\1018415\n:\\\SOH~a\147255\78868\RS\DC3Jr0c\DEL5\1004711\&88\1048447(m\1018537e-cWRQ`N\1091454\127355+i\DEL?\DC1\172339(\1079229\1021542\1023479\1095290\NULzNO\"h\61187q\NAK%\148825|\8495A\171333>\1023153\NUL*\144781\b\1096599\&6\ty\1084884\1106372\&9\991761\&4\54666\993909\&69\188610\78768/\EM\3120\SYNX\160680\1093419e\1101140!(|\EOT\180765C\15108\GSj\73803\t@\rsQ{ZZ-\22170\ETB_\EM&6#\bsD\v\n\td\74406D\37637\&9\72882\1015558\&3\NAKN\1028309Fnk\ENQ&\EOT3Q&\28043Ys\97711H\181981\999099\46018\&5VB\1044294I+\1104448\61690\&7f\12643\133501]\r '\163623\SYNmbE\1015369\n2?HK@\DLE\DC3\DC3\1023424Z(\DC4\SO\DLEk{r6%*\1034286\EOTM=/\STX\1035914&4\1098394\b)TI}\998716[+2\EMV\SOH0h\v\18412@\bQZG\GS_\DEL\999345Cim\DC4)m\1021546\RSP\23785zv\50314\1005770mi\DC1\100847\1042938\USC-zT\SIQY^;f\NUL\ESC\30038N\93068\SOH\DLET\1038908I\DC1\187625n\DC3\CAN\\\r&<\SOH5\71118\1027153X\1092148mF#h/{\DLE!(\16202\&3\ESC\32283\185971[h}I\1071533:\183293R/\1004445\140257#\"\1028937\v\177329\61790_m\138219(\SOH%^\1105873[\1035020RF\CAN\1054790\24076\DC1\FS\NUL\72138\STX\ACKd\ETX>#qn\SYNw=}\1001530\177147&^\NUL$BP%5\3450\179283\DLE\ETB\SYN{y\34999\1114051\NAK:\17208na\133899\1014430c\1106626NDB\160028\15282u\43902Xpr*#\172705\a\SUB\188880\1026535F$\ENQ2\ETBB?Q'asS\ESC\96583\DLE\DLE\1012383e?\f\STXT\1096814Q{\DC3R\CAN\1065288$\1074134j\SI\135241\&3\DEL\1035586\1073529\43493\&9ecd2\ETX\139431@Pvv\123147\157284q\r\1091419\1052105\23426\185829\1098874,[a%\1087411\"RLOU\31476V\1060394K\NAK\EOT\180111S\"Wes\ACKH415\78735-S\SUB\DC4h:d\1036393NZ\t\1043380m\167051i& \1107753`dP4/\DC4Q\ETX\54045B%\186624\&0;Nb1\DC1\EOT9\SO.\1014579\187014q\ESC\1078099f\ETX\64604H\1060225\vY\RS\1045658\DLEC\179470\a\NAKWw\ENQ\1035817[3^3B\154130\"_\nPK\1076894{\ACK\ETXO\DLEr\SIvc=+af\SO\ACK\1101910\167540\STX@\GSQ\1011496s\ETB^c\CANwJY$\1107843s\DC1Gs\1049240\DC4\NAK\171080k\US\ETB|\1065322\EM\1035477tJ(\1075051\1687xc\b\1056830q.\34099\&7\NAKF\1023165\DC3C\a\172318S][\DC1:\ACK\26422qL\1039209\&2\EM\44805\ETX?NG|x\1065136>/Iz\1061649ms\US\SI\1005398\131153\159667\&3\NAK\1048772\997425nd\tv4\DC2\1080172\1101786\v1Iw\1050069\v}?1m^\STX5#V\147028\1063172w\EOT#\1030144\145884\f\DC2\131840\6065\FS8O\NULS\ESC\1033971X8N\142482\1041006\59926.\ETX\163181\ACK\DC2\RS2\GSr\EMV\nK\NUL\DC1\1019014\30036_W\61065\9477\SOH\1094473/\392\20690\159848\181387\EM\vGDR\188046\SOH2G0{\FS\1084240JX)\188982SE\176663B\1089777\US\132402&\SYNg\"\DEL\1902UCP\1054969\1106547\1106033YU\EOTi+,?\147075\1044086\1028895\1110977\1016778\1106548\DC21\186874\1095378L\1030254\997653\998721\SYNc'\ESCp[\STX\EOTN\ETB8^\1021121Bk\b\t[" } @@ -155,9 +155,9 @@ testObject_CompletePasswordReset_provider_13 = testObject_CompletePasswordReset_provider_14 :: CompletePasswordReset testObject_CompletePasswordReset_provider_14 = CompletePasswordReset - { cpwrKey = Key {asciiKey = unsafeRange (fromRight undefined (validate "4hqO6D9=V3BKXLXcLie2"))}, - cpwrCode = Value {asciiValue = unsafeRange (fromRight undefined (validate "emsaYZVuPvQ1U"))}, - cpwrPassword = + { key = Key {asciiKey = unsafeRange (fromRight undefined (validate "4hqO6D9=V3BKXLXcLie2"))}, + code = Value {asciiValue = unsafeRange (fromRight undefined (validate "emsaYZVuPvQ1U"))}, + password = plainTextPassword6Unsafe "\1028432Q~\7949F+9Dc7\1026106jl\SIC?xdB\ENQx\33993\62067\ETX\DEL\GSj/^#NS}fiO\119558At>\GSh0U\62526`\r\aV\US\1112085_v\33980w\ENQ\184054\&8\11831\1032958}e\ETXi\NULRC-- \37583Xd\ENQ\an/,?\SUB\SUB\1066224\42328gQ`\70388\41959\1012806Q\US\ETB\184603&LR\149821>\1012033tR\DELg" } @@ -165,9 +165,9 @@ testObject_CompletePasswordReset_provider_14 = testObject_CompletePasswordReset_provider_15 :: CompletePasswordReset testObject_CompletePasswordReset_provider_15 = CompletePasswordReset - { cpwrKey = Key {asciiKey = unsafeRange (fromRight undefined (validate "bbFHebGp6h_3F4QpSrud"))}, - cpwrCode = Value {asciiValue = unsafeRange (fromRight undefined (validate "K_xVBcX5bLpjvL"))}, - cpwrPassword = + { key = Key {asciiKey = unsafeRange (fromRight undefined (validate "bbFHebGp6h_3F4QpSrud"))}, + code = Value {asciiValue = unsafeRange (fromRight undefined (validate "K_xVBcX5bLpjvL"))}, + password = plainTextPassword6Unsafe "\ETB\26894'\fd3E\120233\1029573\1064918Y\r\1104541H~4aF\16111&&\US\1085044\1086081Kt\2880XoS\r\DLE\NUL\1044509\v\983386q\182823\1075779\148618N=\1062701\1004214R.\\\t6!E\164333\GS_$F\STX\DC4l#!\ETB\DC3+\1078110P_\1037691\GS\1003847~HhsY\1008817\CAN'\996168wy\ESCA\1096877\&2\170187\1060412\SOHO\SUB\ETBc\t\1090646ud\1037884\CAN~\173115\1096337\rB7\1049690o\DLE\1095190fL\996695\ETXi_=\a\SYNLE}<\1106966\aEl\49881\v.6H\CANw\995916ZH\176178\49327\19051o1?\61005\1065006!W\DLEY@!\1058199S`mq\15087\161424\167582\a8\127764~rL\41008\171779\DC3[\989714K\SO\ETB\152791$jRxH\SYNm\1076533\DLE\169669'\EM/xd\52526\95412\&8\ESC\38505\&6bYZ%\139602\20809\35764~\72852SG\1075777`0pL.\185639\&4f`7\DC3\1113337*\v\60813/T\180136C\1111167Z\SUBZ\44799\DC1@\\\1060472\&2\EOT\11121K\1039363||\DC1h]3&\DLEY]\GSk \EOT\SOHU\161853.\DLEk_\133547O\1041592h\1083420{\64532\aw\ETX3K\41041l\1069560\a=\EOT\152591\"\fyH\78163\SOH/L09\149680\DLEvw:\ETBO\1066598%#(Js\169845'9s_&9\32941m\149591$\1021728N\984156WE\DC4=y$=3\1083024\21817<\t\th\1087258\NAKx/\999799V)\STX\183098\1073874BI)\\gk2I]#l\NAKPn$\172450\ETX&\DC1;\GSY\EMO\180851\ETB\1095722d\ESC6\151131}$\175277\NAKajf\1093922v\184717 \ACKa!\v\166519\EOTS\1012345'\153953j\1098235\EOT\FSE\1061729\1052832#5Zg=\172012\4883\66029ZU\36791\22747&C\STXZh,\1088719\7021\1087041\ENQxC\987916\39597=l,\fu\998370\ETX\60675 }&\183212\989435\165094\1040277\135097\"\v\SId\US\EMJ\59927'6WK\13266\ACK>\70807\995567y\r\"\98652,\DC4\SUBd\NULne+\64011,&!9Y\15584T\127281<\1077668d\31074e.#w|?\1034255G\1027753S1\24647\\\1090505\bz3\DC4,\988313<\\\1073727\DC3\1032879\997224%-\64532\EOTC\ESC!2\156292\145116DT \f\SIXja\\R\1014521\SYN`\CANJ\n\45882\1023562\SO\13921ab\NAK d0\SYNX{:\51467\CAN?\187194\&1txQ]\1005159?\176303[)\78300\&1O[Xl#\DLE\38014\50691~g\1043081{\132217_g\ESC!\SOH't\1101558I\1003044\1063761?\137915`Nd\182690`*1rD25c\169907owK\20714(\1055173\&6i&j(U6p\1104351zK\73918mE\11375\vjr:\43447`\1094897w\SOH\SYN^3\DC3<**`j\f " } @@ -195,9 +195,9 @@ testObject_CompletePasswordReset_provider_17 = testObject_CompletePasswordReset_provider_18 :: CompletePasswordReset testObject_CompletePasswordReset_provider_18 = CompletePasswordReset - { cpwrKey = Key {asciiKey = unsafeRange (fromRight undefined (validate "m3ruXwhym9ERHyTAJo1y"))}, - cpwrCode = Value {asciiValue = unsafeRange (fromRight undefined (validate "88xU9QOF1FPXdL6e4"))}, - cpwrPassword = + { key = Key {asciiKey = unsafeRange (fromRight undefined (validate "m3ruXwhym9ERHyTAJo1y"))}, + code = Value {asciiValue = unsafeRange (fromRight undefined (validate "88xU9QOF1FPXdL6e4"))}, + password = plainTextPassword6Unsafe "cW\ac,#\12631\n}\188543\EOT\NUL`v\STX\48639\SYNO^\1061062\1045730\1096180\tUs\EM\SOH[b[uz\DC1\1106362\DC3-\995083\1054859+]\GS90\DC3X\GS\v>8\154400\78507\t!\SYN\24475\&2 \RS\fW?\SO\EM\17276>\\S\ACK@Qt~8`T\1073440\97220a,#\1054560]X\1019169-\1112078]\1005234\SYN}\1112649T\999008\1062688\rH\171818d@9/pab%\52983**pK4q$\984140+e\NAK\USZ\DC3\29392\&3\176130\1073376(\ENQy\\(5$'|\2800!_\154876_\1073420\&2\SYN\996743\187317I\DC4Y\"B\1049376=\1103936\&6\66599v\153333\NUL\137084\119859\147584'\16885GJe\FS\SIPk\NAK\ENQ#\29575\23580\SIa>m.\161669to\SO\1049661_\v\165212\FS\ETB\ESC\trn\1029796\1078206\61317\rM\149956\&2S8\a35\\\ETBo\191128\DC4\58762~?\178576\STX/\nNZSjbWH\r\1098678X\993718\4120/\1046632y}#\63730\ACK.Voi9\50993\f*Y\STX\1001056\43180\DC1\rS\1021396\144641qSj\17576X\149262\1081745\1076445M\1063531\22347\CAN\45875\40887B\NAK)U\"~V\1036888\1007909/S\61542y\SOH<\b\ENQ^\SOY\1013585;\SYN-RKy\ESCO\1033537[;\b\1094937EDjW\997383\182740bKx\128165lZ\DC3J(\1032322\&1mK\DEL\69897z\131148\144121i/RxiQ\1085090}E\23345pA\1065790q\v.\v\ng\20319Gb\46475Kt#\USP@8s0\vg[c\169328\DC3\US}{/\1002448D8\170376\159999\987435\67200\1053165M\1079934\1073683\DC10i\159626\1111106\ESC\"\1019962\SYNg\1025072M\1022474\1059584IsD\b\1086244\70682Z\1015255g\DC2;\SOH\1009422cQ0f\STX]0p<\1065421.j\DC3\r[W^rsM\fU\65479=h\1059093L94\993336oNs\1016719Z;8\30468lw\t;S\GS`V\\f\993287\1001923\49875\1018016\1032042X\ESC\NAK\132703sb\SI\1110714C\ETXi_7\138308\NAK\35645}\12913\100683go\FSVj\vtr\SYN\181280\166083;\137762\161816\EM6\1068253\1058678/\n\71064\fp\1036795O\SUB\45835>S1=\DC4>m=Li]y\1014422\r\US\5961+D\230\54691UWo@\1104594n/\EOT\FSDR\1084131\&4\CAN`-}/\v=<\DC1\1011393\DLE\SYN\1000229oB8\1073774\fT\185994?\DLE5lJ\917988\1051232\993358\&1\\\SYNGx\160450\993275HF\988493\1096467N&\DC3A\1078985\ETB\1085595\71193@\a\SON\ETB7\RS8kT\13512\SOH\128792}!`].7C\ACK\EMa\991996\SOH\ESCR\\Iw/y\1052927\162141;*!\SUB;)\1034215\DC3\GSjQ)\98905\1083130 \aQJf\143466\3112\1088669q\183516D\47434Z\r\1051585\1066298\1011799\DEL\31175\1077158\19157\f}\1074960\CAN{\1026108\ACK\165269\989993\1021383\4839\993646_9\FSYzI=JL0]\45720/W\NAKD\ENQ\143508WJ\CAN\DLE8\EOT2JsPn\1025590\20415\bhB\DC1\1537Xj\ESC\GS%:p\64920@gL\ETB\1087542\145056\1111605Q" } @@ -205,9 +205,9 @@ testObject_CompletePasswordReset_provider_18 = testObject_CompletePasswordReset_provider_19 :: CompletePasswordReset testObject_CompletePasswordReset_provider_19 = CompletePasswordReset - { cpwrKey = Key {asciiKey = unsafeRange (fromRight undefined (validate "nBmwchpz6q_fDPCPZYQe"))}, - cpwrCode = Value {asciiValue = unsafeRange (fromRight undefined (validate "AHGkmRBXJr="))}, - cpwrPassword = + { key = Key {asciiKey = unsafeRange (fromRight undefined (validate "nBmwchpz6q_fDPCPZYQe"))}, + code = Value {asciiValue = unsafeRange (fromRight undefined (validate "AHGkmRBXJr="))}, + password = plainTextPassword6Unsafe "o\58515ZHN\83385\a%S\1039235I\1072272\&0\DC4!\1105051\&0\DC4\FSc|\SYNo\r\141433m\DC4\1017077&\ETBX\GS\101008sXzlOS\1086195nZ\"\DC29\30572S\n\1028791\1110650\SUB1>\155164*K\63527\917991\34537\"\152219\174017GW\165251\917540PPO\1099839\983424\&9c\1001124U{fLy\SOH\FS\STX|\35808\&52\SOHP\n \126255/\42693\188778s^_\1012451MW7M\EOTs\DC2M\RS9\ENQg\1084863\61924@%o\DC2\DC16m&B\95458\190903wL\1066100o\r\1082662y\ETX\tk;>\1108088\1053265A\US9\4469\STX%\44556\SUBghb\1046982\DEL\b%0\1011473\16374'kz\61155\126123\NAK\1040333\&3:<\1028617\12709\1085958X[g77\59354_\ETX\1018780\1031200\&7\STX\GS\163106\60867\n\f\129490\993680iG\181984\58073\168758\44094`i\49314r\65104\GSu\1030407b\1002850\1053366O)\1042687YQ\190781\DEL=fZa)T0j\1070016K/\1104693%v\100085qsY\1017025R\33451\997088\&3a\45926\r\DEL\ESC\1031881\NAK\35199\183615'a\11657B\111310\STX=\RS>n\1055557)d\US\FS.F\1111038M\133759\1021129\&3x\ETX\51747\1102182\11790Z\35206\&3\173723P\RSV3GeGN\v3\28136a^k`\29343\22637\rK\SYN\NAKe(\GSQ%b\1080735u\DLE\ACK\NUL\99272\1095099y{\61538\&9IbP\SI% \CAN^\1064103+f\144228\59518r\18266G\DC2?y\DC3\1073829\RS8\34346}r\45176|y,\b\1026988\145851/\DC1R\1017813\&0W\988979N\NUL\35979q\bc\1091121\NUL\1087940\GS,d\CAN{J8[\1031817\CAN\r\138592\EM|\nz\28160G-{\SI(1\47823\GSl1\18854iL\77903j^\DLE4\ETX\159954\1105693\83316\FSoj\ESC2z\STX\1021083t\17703;K\STX\DEL4Yhr\STX\987287fO6h\158330t\1076871\&3Tpef\SI\ETB\1109588jC\150352eh\10328nf" } @@ -215,9 +215,9 @@ testObject_CompletePasswordReset_provider_19 = testObject_CompletePasswordReset_provider_20 :: CompletePasswordReset testObject_CompletePasswordReset_provider_20 = CompletePasswordReset - { cpwrKey = Key {asciiKey = unsafeRange (fromRight undefined (validate "n7oUiCMAvjokyCwCwIZx"))}, - cpwrCode = Value {asciiValue = unsafeRange (fromRight undefined (validate "padtz-lbyFICM8PEzCj"))}, - cpwrPassword = + { key = Key {asciiKey = unsafeRange (fromRight undefined (validate "n7oUiCMAvjokyCwCwIZx"))}, + code = Value {asciiValue = unsafeRange (fromRight undefined (validate "padtz-lbyFICM8PEzCj"))}, + password = plainTextPassword6Unsafe "n.\30576`Ab}1x?dyrWEI\SO\b|\r n\\\174375\163710yzk\CAN\1032873\13076q\1104973h\1078766\1065080\1073163\1024180\SYNzt\1041454oY\SIv\1109814\999708!\DC4b\r\ETB\139978\1037986\&97|\68831Is\78227\48210\984397\1108736R\1076978y*\ESC \1080452\6350;\1002645*F\ETB|l0\\-\49792/d,76W\SOH\1091954a\52507\ESCkY6\EOTe*6\1068076\1010489\STX\1109890%B\"\DC1X\145857Z\1107907\988601\SOH\r\983601\ETB\1027493's\\g\SI_=\187494\52638\139634oOcZ\EM ZWd\EM\STXe\25610Zz\1055806\1023881Me\25012\DC2N\1061919o\154179BmCD\ESC\146744\165530Wsw<\ETXs\SO\992482\11825,\NAK\97960\ACK\1112588je1m\1080113\&5\CAN@\SI)(\39581y%~d\1022649\&0z1||L{1\EOT\1083342Ja\74536\EOThHi\NAK\1033200\SOH\CAN\ACK\175120\183861\DC34&q\GS>\SOH\184139\SOH\ESCQs\41951a\59763\1069217bv[u\bX\1078841\1048633^\1015710;[\STX\DC3\1001312jYw\1003565\1077047\te3\148232+\7427\\\SUBq\1108026r$(zD)\\7p\"\168984\STX\59311?\8657<\NUL\1035836cP\194909[>\USm2Y\1010432\1106430\21518P\DC1.\1074512\35480\ACK\EM\SOH1npVW\SUB2+\ESC\1059649\33997\GSk\v \993759A)*uk\1030453L0\1078688\1044139\DC2\1029875\DLEn\EM$\1054292?\NUL\vji4Y\DC1\EM\1027716=/S\1024040`P.\ENQ\SI\GS\1090161\50097mww\61962\59664e\994460\1030466\f\83226f\"\CAN{X)\v\4796\SYN\STX\119946\DEL\992301+\39597jv^\169149\SUB%C\"]v5?\185720/M\991044\1010224\1027231\984290+\SUB+\186874VG\SOH2\1003544VM\SI\f2'\1009297\1059762?Lx\986666<,Q\1009359t?\1067784\18910\GS\CAN-\1090445C\2603\1004458\10478XZ\STXo\1019324\by\985769,\46054'\a\21265\DLE\SIH\1003281$J\US\1051584\ETB\r6\ACK\FS_1\45810\1013879\998189\167043\DC2>\1082944<0\47209G,T\1055523\12871\1057078:>4\1005909\1060368\GS\FSED\DC2:\rzSMQw)P\50826s\1051230^-~\95981,v\DEL,\SOH1=/GNsO\129350\&6\GS\16013_4\62900\1097318!\SOH'M\139907+$\29092\154621<~E\96994, U8\ETX\986557#\1092210[\1042274.H\DLE\1098681\ACK\1062248\"\133455?I\1005507e\167230\t\28751\1016604\159825\GS'\160639\&9k\EOTZPj\1084498\1039215O\131535L@\171949\r%2>M<\n\120995\1031232\&9/\985482C\SOHav\142062\ENQ-|\ESC)\b$\"\DC26\16379\CANCT|Ut\131524\149842\96725X\64829\v\28384\DEL'yR\1022028\1056329r\25908o\165079\1077144.\185928\&8\NUL;\NAK5\ENQ\ETB8Y\DC4g\1101865Q\1085552\150701\&7!HO;\br\1026135C\24186\37827\SO\ACK\165967E\r\DC2\DC4l3\1090105\127078\DC4\SYN\bUF\15427\DC3.wO\EOThm\164680L]y&\1024985\&0\308;Nwyw\61385#\r8Om@x\1007233\b\ACKo823U\146708C\SIMN6t\DC28\1047608\SOF\ETXRna\a~\r6\fE\US#\tn\1006471wr'B\rnlolj\1017148\144338\1087477tT\119355\1044444\SYN|4G}\SYNEn\1000211\&0D\DLE\SOjn}`0\994578+\1019070\184767" } diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/EmailUpdate_provider.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/EmailUpdate_provider.hs index 84ce0c6a946..8673f2ba821 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/EmailUpdate_provider.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/EmailUpdate_provider.hs @@ -21,12 +21,12 @@ import Wire.API.Provider (EmailUpdate (..)) import Wire.API.User.Identity (Email (Email, emailDomain, emailLocal)) testObject_EmailUpdate_provider_1 :: EmailUpdate -testObject_EmailUpdate_provider_1 = EmailUpdate {euEmail = Email {emailLocal = "sL\98765", emailDomain = "%"}} +testObject_EmailUpdate_provider_1 = EmailUpdate {email = Email {emailLocal = "sL\98765", emailDomain = "%"}} testObject_EmailUpdate_provider_2 :: EmailUpdate testObject_EmailUpdate_provider_2 = EmailUpdate - { euEmail = + { email = Email { emailLocal = "7\160957>t\21165\ACK\69619n9\b\USskT.\"\1106936\r\DC4`", emailDomain = "^/>1Rp<\EM\1110261\1087553\STX#\a[E\ETX#\30865\162265\3392eJ " @@ -36,7 +36,7 @@ testObject_EmailUpdate_provider_2 = testObject_EmailUpdate_provider_3 :: EmailUpdate testObject_EmailUpdate_provider_3 = EmailUpdate - { euEmail = + { email = Email { emailLocal = "1[Z\68778\r\35821\&3\1087344|u\996796\167850\GS \1071086" @@ -157,7 +157,7 @@ testObject_EmailUpdate_provider_19 = testObject_EmailUpdate_provider_20 :: EmailUpdate testObject_EmailUpdate_provider_20 = EmailUpdate - { euEmail = + { email = Email { emailLocal = "o\SOH\1002138\aLL$\SO\65490\1099895l*p\984607\SUB", emailDomain = "q\30683\DC3\12589\1001477\1015970q\1002402\145416\1056480&^\176848Z" diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/PasswordChange_provider.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/PasswordChange_provider.hs index 605e1e76eaf..092515c8c0d 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/PasswordChange_provider.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/PasswordChange_provider.hs @@ -23,10 +23,10 @@ import Wire.API.Provider (PasswordChange (..)) testObject_PasswordChange_provider_1 :: PasswordChange testObject_PasswordChange_provider_1 = PasswordChange - { cpOldPassword = + { oldPassword = plainTextPassword6Unsafe "\RS\148930<7jc~MQ\SOH\US\7333[\1084132Lz\US\1022735?q'p\1099657\ETBy\DLE\EOT\FS\1107730x\ETB$\1060369\DLE\61681\13692\993364\b9\FSiU\NULz\fb\22561bP\60643f\SO^\\\1008115\NUL\ESC\STXd\DLE>\1040220\1103806\SYNOIc\189228l^l]\1031063JY8J\1036381t\70171AcI\SIi]Bh\989297\ESC\140714R\r\NULz\ACK\1088597' A\DEL\\feuBiG\993059SDoWa\DLE\ACKW'\ESC!\"erY7Y`\\I\4948\"`y)\1045668iN)Z\1012930T5Q\1076971\147595\993658g|)\US\1003237\ETXJ\39701\1106744\NAKY_\a\vJL\1027083\CAN P\ETB\1078145+%.BF\153802Ay9M\98346\1008748\1104393s\25042pI\1005219_\1002925\rM\CAN\39386EZ\58119ZXS\1105928\RS5\DC4b\97371\SOH\1106103\184422b\100457\\X\STX\144554;l\49694xQo\NAK\138070\SOHJ\989399XE0^&\167968\n_1\USS\DEL^\SO?W9~\1099319\DC3=\DC2\1068564@*\155081yLc\ACK9\15796\1059875\RS\98699bV\1105827W\1005933o\1072486\FS\1000032Bmr>\1053735\1030072\157751\1056352m\1072516\142673G\STX'\1013038\&3K\"%Hk]\61616f\178900\RS[\ACK\1112290\DELvq7n\146589}F*m\DC2\ETX\1038640w$R?%\1048405\991130T%\1086216o\DC1\139752G\1070667\SYN|\1085639\111068\1068350B\a\ESC\1063604\1088194T\1019860@\SOH,1\1094852?\DC3\ENQ,)ipt\146004NXe\DELd\1015278\DC2 6\984739\1037131\&14\31204p\f\23571\134629\60442q|\EOTh!\DC4z\GS\NAK\1046271\RS0\120694\ACK\b\DC1\1057519\ENQN\22139P\139372?\",\955a\ETB\f\ESC+\"JpO\39005\1043690\54002\ETB\ENQ\1093734\CAN\1005666\SOH\DLE\DEL\2414I\55278'=I\EOT\62705N \SO{Vtdy\DEL\"\163827\37015hC,\1053062i\NAK!o\SUB\1075233(u&\fz\1049825\ETBA\1045850\175742\RS\US~A\40004:D-\ESC~A:p^\1079564\135140:\151246w\1025133m\61429>\6832:.M\1073891\10252'\CAN\1071280\24496R\1003679P\1024693*\SYNq\GSUX\1072603|\r\US.\1062109\NAK\1109389W~5O\1000925\STX\184929s\1006565\150194\DC1r\SUB\b\1057499ZN\SUB\rf\20741\SOH5\GSJe\66771\1067879b:z\SI!\DLE\ESC\t\NAKd\v@'C/6\DC4h\983790@", - cpNewPassword = + newPassword = plainTextPassword6Unsafe "l\992017jfd]\CANOG\1037448\9679E-FG\DELb\DC3c\168198\179584\r\EM\98126~\tW+\ACK\33446,\1082952M\128295s\1000699M'\DEL\STX\SIz\ESC}\EM\154156\CAN~;k\53216t\ETXx\149224\132305y\96580\ESC\DEL\142174#O\r\bJacD\GS}}M\n\aY\1033126\&01C\EM$E/\NAK-B\175854I\1023972\1070217\6129\1013299\184147\&83$E\1009863\22083\&0\SOn[T\GSB\DLE-\1007136cZ\46079\174945\38508\985022\173232\ESC7\1110907'/2\9477B$SL\NUL^\EM2\NAKG\1093469\&2H\ACK\DLE\DEL\43539\58839XR\1080271h,\78748\174767\1054239\1041868Y?\SOH8DF\EOTCh#;/x\DLE-\EM\bA\DLE\159735\bkX\SO\188157g\94522\172555\NUL:2<\166889\998353\1083925zp\SI#\1022316\48223\NUL\ESC\141660\1089351T\27451\&0bA\7868\v\v$&qMQD\994988\12182}\SOZM\ETX\179973.\ENQ\21913\58375\47428\191199f=j{\47820\1111986\1073477\100913\61587\1073940@\ESC!u\1077743R\7637EJ\1016579\1016763\DLE\1058455\FS_@\1076367V\1005325j1Z\NUL\1004454>t6\1079007\ENQ\1084309$\SO\DC3\98064\137557\47918M\ACK\ETB\172727r\b\1100397)\SOw\ETX3\1010263\DC4\1066921w5>\1035509\96260Ga\USz\1047694n\SUB>\t'\92445\r\148219 \1025075;(4!\1073109,\",\"x\EOTyf \f\aRW'z\133849\1048674\24036\ETXYx%\1080586\42394\1045626n\13335[/'\"2-2jR{=\1012515E;\1026542\SO0+\142703H\987291\24296@\1106752%\SUBNnZVt-k1\DC2\155707bTV\DC1k\1003798a\1071366\DEL(%*h#\1030597\SUBL\STXa" } @@ -34,10 +34,10 @@ testObject_PasswordChange_provider_1 = testObject_PasswordChange_provider_2 :: PasswordChange testObject_PasswordChange_provider_2 = PasswordChange - { cpOldPassword = + { oldPassword = plainTextPassword6Unsafe "J6\1063462\\\ETB\1078893\993390\ru.# ?_\DC4=\1064091E\a\1053958-\150000L\1061533\&3\1048772`'\DC2I\SI\31152,0K\NUL\\G}];\187087\RS\176174d\136667\1076870\t\1047442\48335.\152068\15337{\70067a\EM{9W\1063171\SO}'U\SYNB0a\SOHI\EM:^~\DC1\146030]\ETX\1068275E\ENQ\EOT\SUB\GS\38515-,d\1087008\146851:\1009309\DLE3\nn*4U8\f\f/\164529_Jq<\23032j\163500*e0\152734\DC3\58971v{'\57450^3;\EOT&yY\NUL~\194865\94514ct\33770o}\1015771\1008056?Y/<\SOH\1076816iJ\62386V$\\\CANd\CAN?\DC3n}\1001195\t\1017145\139912\1110640\r\EM&C\FS(A!Ke\DLEV]iB\136999\137089]\173378~\995379\&9\NAK/sY\FS5\165215\142850\&3\1074963\ETBX\DC2\92297\nzeKE\\\v3\128136\r\ETX\n\1110227Mr:M:\n-#'L\142407\121103\&7eo\57512\1043763!L$#", - cpNewPassword = + newPassword = plainTextPassword6Unsafe "\STX5{IYj.N\1097942\1034521]}l~\ETB+\DC2XU\51470pB\121102\25755\ACKH)V\ENQ{\DEL}\ACK\SOH\991933\SO~YZ\1000116`vCT\CANU\3236<\NUL\ETB\1097339\SO\SOHgfBz\NUL\DEL\27119V+q\n\53764 \1025256\FSG\145697\184862~+]A\97342\70080N4r3ly$\EOT\1088639Mv\1002336\1050997$\CAN\DC4\23032\ETX\a\SOi+L\1016399Q4\99029c\1019418\EM>z?'\CANO\SOH\77963l2\SI-nZ\\\NAK\187610\&7'VHQ\ACKf\182917\US\1083627H.1\US*\SI\35903\SYNw\1090044\EOTR(Z\165917\1084964t\1085428\ETXV\184675\b\RSbU>\986822\NUL\DLEZ)X\137883\22578*n\1035455a\RS\SIvZ\CAN\ACKe?eB\998053\991381~\CAN(\ESC\a\1007645;\121445q\1042993\1070820{\SYNk\GSA\DLE@8#sG\1095900O\78803oKfrR*\SI)'\22262L\35087I\1030025;LR\988091\STX\917885\93968b\1033563\986558\&3SJ|\61654E\54642(}\985223J+\\ED\187753\182558\987551\&7*6\ETX9V5mm79s\b<5\146014\ETXe\1070748\\=1|>J \DLE\DC1#\1036249\174789\a\119052\DC4\ENQ\7214A\1057521\991526\ETB\1096433\159048=B\DLE\b\EOT\99076mR7\GS\\_{||o\191444)\1077352SJA5" } @@ -45,10 +45,10 @@ testObject_PasswordChange_provider_2 = testObject_PasswordChange_provider_3 :: PasswordChange testObject_PasswordChange_provider_3 = PasswordChange - { cpOldPassword = + { oldPassword = plainTextPassword6Unsafe "\1090639\STX\132492\SI/\183791\DEL|9\\\b_\1111257E\18560\1026473\37179O-9\SYN1L\11112\153612SYM6`XP\185928x\1091969BP\SIV\1094629\1099550\&3Dt\1051594 \185390\127986\STX\993509\1072672\\P\182591\ACK5\v6\SIW;\178969\&1\nE:[\182420\96819a>\1066339\17724rv\12096OvI'-\1062972\166884\ETX\SO\SOu{\999818\164786\"_\984751~_u\1023831L\RS?\1032751L\97379m\1012949\b\189539H\DC3\3277Zd8\CAN\173661j\STX\59973\STXU\b\1058747\EOT\39158a(\ESC\NAK\"\ETBc_?95\1048328\r\SYNpa\NAK\b\SI!\DLE;\GSI\b@\20755D\1058888 \DLE}f\1025872\989393*\\\DLE\DC4l4sG#{\175474O~3!n\1070630\1046460`X>n\r%\vR%\12500\GS\SO\b \NAKJ\FSe6y:\DEL)T!\163863\19105(p\STX\ETXS\1035778g.v7\EOTU\\\ESC{9\1029424\&7\1096509\182402 \11429`3\v'\1011010\6241H\SUB\67713`\1102842\SI\ENQ\36671XSL\5184\74631i6*H[`bk\187634DB|\1082864tF\STX\1095470\40232\24100W$\DEL\SYN|AjF\SYN\1060698\ETX\1002438\151035s)$.U++'\n\DC3C\1092666.k\ESCgAo?,\1098414\SUB(sBt\994422X\51349C!\1079241<\1003009)5\147358[\25065\RS\993654\988949~(8:\1099034\94463\67647M\NAK\STXFs\\\162758u|~\DC22@D\39863?L\SOH\EOT\CAN\78252_\95345+\b\1047730)f\DC3\147188r\SYN+=8\17990+\131480k\n\1004620kv\ENQ%zD\1087067Q\EOT\DEL<\DC4U\EOT\98368$\CANw<+\125229*\171804/\az[q[\DLE\ACK\132467d\bv\DC1\DC1{Q]\155471\n\rokp\CAN\DLE\180903\EOTNn\147253.!\63250\65540z&|\983968W\164923\1015875\47406\r%B\NUL0\62411\58998\989796jn\EOTg1\1030731U|\1069001.Z\147615-\DLEUdT\SOHP\ENQr:\993057@J\172264r+\22908f\189795\1008819\12565\1059459?!rR\184591\1059540d\1010396\153681\1087402\ETBms\157686SQ\SO\1013566\159622\"S8aV\t\ETX\69642\NUL\1018708\GSj>0!f\1048850\172491d<\1090475c-!+\v\157251\USB\CAN0u\f\1109289@n\US=\EOT&;\FS\1094127\147561Sc1\tkL\f\ETB.V.m\1102645NZ\1025114\171053=\9900w\SI=p)\983196\110627\n*\EOT\4264S\142455c`h\1064905\CAN\DC1}U\16412\RS(.\ETXBQ\RS\SI|2\DC2\t\58697\26979J\1059222\t\n:1\1076824\DC4\20071\DEL\\?AkiJ&\ax^0\t\RS\1008082\145465'\vEB*\n\133263C;EZh*\1096287\v\172007\&27nR\1030319'7\1067756\ETBV\1096588\SIC\25035\NUL\ACKcl\1015672a\DC2\1054753_X3\1087036\&3\174910mvT&\v`r>\1008758_.\28801\DELo*\USR@!g\5064\DELo6'\61374~\11251\1055297Rv\96087", - cpNewPassword = + newPassword = plainTextPassword6Unsafe "\ACKb\65690.z\DELS\RS\1043455|@ou6\SI)^#Nv\173721\nK (\49735\"+\180317r\168250hgU_\NAK>.~\42075\EM\DC3rNA\1003405\1064814O\1080126f\DEL\170710@Mj\DC1\rd6\157492)<\NULZN\STX\EOT]\164074%Ki\ETX;\1074300\&1lkk:Mk\1032789{\1085268Hq\1095137\991423[\1046704\1069727Y;(\DEL<<\NAKGs *\1064528\SYNGz+\r_f\162493\EME\179877\SOHo\GSA%'+v\145346:lQ\183770\120729\1008624\54333~\46645a\18566h\RS\nEX=*~\b\38738\DELk\47265\26012Y,r=\SOH2\12321\&9\FS\f\61703\146118\1101857\41261_\177617~\150584\1101236rA\1057119JA\\~\t\67201\GSrIk%3\179007%\EOT=%\13237\1079931b\FS\1080016`}\SI\167993`@\NAK\1037573\f\179386{\984491b\DC4\191263\SUB`\tV\ETX$\34881\DC2FH\ETX4E\128495\1074641\155862\f SL\176565{A&\FS@\DC3q~p78<\1029510t\1072174&&\1064641W\62128T\148445gn^K\1032060\DEL\1073914TK-\1032280t\69863*B\NAK\ACK}G3W\119556aj\135982\&0\35872\48740O1\EOT[o>\SYN5w\GS\tEd\ESC.}\27602\&1{'\1023415\1007968a|\am\181403\bu\DELo5$07\tK\1101735*\t\bv@F\ACK\ENQrQx\RS\52315\r\f\18064\60859\1043018\42814\1082068\16599p,*\RS\DLE6\SUBH_\994350\SIi\145754\17091\1001085\NULUq\176242\\\1081511[j\1020996PN1\DC15+!\1067420.\34561+7mLuRk\1036698)N)dlu.^\1109734\EOTzU\1019326#3\1055275V/\SUB6^\DLEq\60060\153909j1\n\ENQ\143934\DLEC\1094908\174654w)\SI\1095019\17787\155204\\y0/@_\1036276\\;\1044245U+\":|\1008444L\\" } @@ -56,10 +56,10 @@ testObject_PasswordChange_provider_3 = testObject_PasswordChange_provider_4 :: PasswordChange testObject_PasswordChange_provider_4 = PasswordChange - { cpOldPassword = + { oldPassword = plainTextPassword6Unsafe "\1005314~=N\SI\SOH\a alq\ENQ\ESCj\163982U\133814*f\"\72875\SI\1015050\1072188\52409\177675M@0\\\1060741s\b\131914\&4\NAK{\EOT\125006\ESC7\1042522\n\DC3\ACK\41709\CAN\DEL&\RS\984654\DC2\1039379\GS\NAKbHZNbM,\53068\EOT\SOH\1086193Qw>56\NAKF\"Q6\USp0\ACK_\1071681\22914\GS+\1113265\1033881\&1XL\1057692\r\b,l\1090712UrQ3) \DLE\1020313I{\ENQ\168366\v&\STX\182716k\1077895zs\1099425 \120690G(gf\1060305O\38802\n\1054049\1065585j>|Kg{.V\163868\ENQL\131757[\1096643@;=zg\134436\183794\158027biF\132561\&6ZPA\n\135254\t\1032483\NAK0\CAN\SO\SOHaE\1060005\EOT}Ys )\STX5\172564\SOH\1025776\1058126\1057981Tx#\r\b\DC1Lc5#\1035228Y\1093589/B-Sv\159168\161208\n\1031751S\39534\f\r-\167002Gq:;\168477\&4T\96990\917580,ST\FS\1079935&c\ETB@+\180969\DC1\NULd\167999\143044\CANP\1021550\988126\1020951\1108300z\ACKU\SUB?UV\148371p5\161618D\f\USo\165498#x#_\1054438\991493H\1053912\1101113$m\1108341,$\1028517(\1361\EM\FSr{(\DC2\36604:Hr02Z\CANj\EOT_C\RS\SIt\143715{(-\f\184102\&2q\r\r\155913Z\1042726Ko\t\ENQY\1105826}\a7h\40363\&39\DC1\40241}1P L\nj\GS\123621'\94253Q\1094248%n\144018\"$R'S=W\EOT\nr\v%O_\187746Pz(&v\t8V!\150217O\1087987\1109209G\120191'~q\6433b;\b\33127\&6\6978XNr\ENQ~K\DC1\184383O\STX\43136\186449q,~A\STX\995391f=JwT\f-Z0\DC1\STXJ\135448\SYN)\t\28369\989463oI`'s\aG.ggB\SUB\1089552s\7042Iv\995920f\DC4.NGl\167789\SUB6\ESC\SOfJpG2\ESC\151792J\165772\1060235\RS9\164444@pMICAP\a\STX*_\41597^e(M\EOT\a\GSuYl\1027529\\*\ETB\1000487GSnZO\184505\a\151353Do\185571S,\n\ETX[\1024125\12994%\1048335\158640\b$fm\DELJYdZSTOY\1011389\1000717\22006K-~n\101099Us<\63668\42529r\SOH{\1001552}\1035280\143766-\SI\191007\&0\30696\1067137\1100998y\34996\&3\1012120,d\t{\1060327\1023821H\EOTV.\CANu\1087782A\78628r", - cpNewPassword = + newPassword = plainTextPassword6Unsafe "=:kk\1018981\&8-\\HYms@'?v\ESC\133198\147317\t\1008759.\v\1033547R\DEL\1060763\DC1Z1\95927\CANSmD\143932\1024564\ENQ\FS\"Z\1030825@n?zS\119833\DLE\988733bz\189538\1082413\SYNSv1(\132603\rQ\EM\f\149020'.9\SI^|v`\a\1039850+\DLElBv \RS\23734\35305\1109565\DC2\bJm\1085701\1095232?_rXd\1019687T\137292\STX\147778VK0\134410H?.H3H|\1089668\&5\1020896\RStKw1k\1046876e$A\1046587\66888\1106484w\22514\aRYT\1048339T{|!\1076458\50629;*\1111661\169350\1009115\1100512\&6B^\36743Hbz\DLEK.w\STX]m\1105522\3984`3@\1035182/\113800Y#\1048181{X\74883?^aYz)\STX:$\148676\nd:\"Q\FS1\1083955\DC4}s*}%^CWY\SOH5w<\NULla\65202\1015084\STXa1\1073755L]\GS\ETBV8\SUB\133836\1011042rS\152914\1109488}\SYNl}\1018153p?Yi\1111523\&7v}reh\993180w\DC3\DC1k\US`)\f\181331bSd\184792A6hx\1018142#n<~V-\987055h\143466LT\53862q\f7\SYN\\92\137339\ENQ\r\CANU\1071144%lYedK\vGHs?rN\177663\&9\99852\52785FV\22264\127076\154269`.\DELXv,\1085673\&4\r*\191239\135780\152535\&6/\EOT;V\1045100.Z\DC3\1073857\SYN%\ETBTVv\ACK\5241\&40c\STX\\:_T\49351\&0D=\138839\ESCg\SO2\16967\RS0\1009235b\n\SIe\NUL]=Ir\\[,;\ENQ\1109755E]\b3\1057051\100809c\NULya\1062732\NAK/t\US\r\DELS \1052333QQYH\53161\15320\EOT6\1045701pY-\EOT4\7658L\1039028\155730kB\172820\EM$,8\120808[\1087257DGgn@\ACK\16782+@\169718[\teJf$G/B\8949\\&k)bT<\1074663iE2h`\189858&p2\DC3r4g*\1040011M\SUB\1034202.\14977\25151\994175\1080867\r\156624\&6V\163857?Z\7344(\SOHF(z\1085772\EM@r.\1041715\EMBi_\1023342!I\DLEj\1069951\NULHy?\SYN\1024843R\1061663J4kQ\DC4\SYN`1\SOHNnp\167659\ETB\36188\ACK6p[.q\DLEZBF\\\b\NUL|\f,\989077\161119\150164z1\187508M\DC4!\1041102\DC1\1034211c~\1085907\DC3\1085359V\1024822\SUBJ/#'U4t\119160\1101637\ETXW]\EM\1003131V\FS},\1018388z\28107nOj<%7\SIk^\ETXiZ^*Fz\STX\\g.\np\DLE4o\NAK\DEL\DC1,\1048642\&4L\EOT\DC3]\83046[\DC3y\1111455\RS\ETB0L\US;\\\161083\1038455\165809VOG\97134 R/\1068148\136637J\1008468\SOi\31819Qm9\DC3P\178289\1062875m;\33449\151544\1112165g%\119045\ETX\SOH\9817U\ETB9\63207M\68250\EOT\12530\&3:1\8937s\ETB\t\1073799\160211\1013614\99221Ycje\US\1021337\bC:S\EM\DC3\EM\1080393\&0;Y\1006472unM#\ENQs3(\1012482\ETB\SUB$\1108830\SUB\SO\ESC\1011341\&9xk#\"\1107050o\152443`leDo?\EOT\166427'\178290\1083767KWa\SI\983521\&5N\1062943\ETX*\1069873E\95635\49809B0~\rG\146763Pkj\134528C\994565\1112409\FS\77994\DLE\DLE\1083005G\1079213q\1078280\SO)\SO`\1044446\r,\GS;\141525\13757\USO5\184789\1024674\1052970a\SUB5G\DEL\vN)\1061733\SIi\EOT\1053143`\181217\RS]VL\b\1013194\&0\a\EOT\1039988W\51437c\SO\1065070*av\98257'\170757 ;c\996012.\131792~\DEL\4838\182631\1055951a\135094I\ACK\1052557\f{\1072125\&1\27594Jd\1063195|\8005\SOH\1024659\EM\ESC8\120279\986941,HPp\3786\ETX=\135249\SOHD.\DC4\GSwi\1040647\CAN\SOH;\1021350!|^\DC1\ETX\ACK\1063454~y<8\1011154=|\134143q\f\FSE\149852\bnT\25647I\NAK\STXYB\1111567\1092081Gp)\1057864\STXj\EOTBi\1015288\72231\1105732\vzO\EOT)\1021734IRz\1036141Ty[\SOtj\994518q\ESC\DC1\ENQA\78643`\1033140\SUB\1086534\119199pUM\74032U5\SOE>i\DC4\1026198H\r\f\a\ETX\SYN\EM#\STX0m[\DC4Y\ETX\nY\1041053\1032715\&2xROJP_\1069998\r[\139994o\1038593\1022439-\CAN\FS\1053876\162419\GSI\1114021\1099881\DC2\ENQ=\DC1]\14160\178652ee\NUL3\165586CA$\1096608>,Sc\"\DC24$\98460\US\1104391|\148368vh\EM\b\1110174\SOH\51262EC[7Kh\n\26878\1037105qWk\142931\NULQ7i~gM\RSp\r^\nJy-[\41948\v\1088158!\164120\&4\DC4\41370\1083111\1100437\1027623gln%\r7q2\8168\DC2!\EM\NAK\175295Tl6\1071902\STX\38040+mo`VuL!\n7<*\\\157558>\68039\64688\RS\CAN\37133\ENQ#\DC1zi(3OU\ESC\NAK\ESC%\137946\1049584[8.G\1111459-E\1110194\1084255\1058892\v\1064396\1062440\&9M\99681v\SYNl=\US\15311\1047155&\1053601\ESC\SOH\1047114\1071949\172567$H\n1Y\51322\CANLg\47625\ETX(;\GS\61177lZP|E\ACK-8\GS~\ENQ\v\189891\1107362zv\bQ\USbkv\94908*S\DLEs\1075777B`]\1046292\SO\52998I:\65296D\167913\r\37306\182476P-wN\173628\RS\bD4WD?\63663\SO\1113823\1023204\149429\fI6,6h\b\1004711nP9!G\27578-\DLE.\SYNF[\160877%Q\1097530^\STXH\157909}\v\US:hx{\1038469+\1090842|\1014387M\DEL\\;G\28870\1101783\48530\EM\SO\162503zq\r%\SYNCUS!+%{\127862'w\996607q\1104160^!XSCAa[N'Vm\DC1\DC4~\189916P+w\164548\5708#LI-k\118975V!\121316\1113106md:\SUB\t\FS4\1004433z\1078080Zg:^\NUL\995376Qs\184644o\1095386\SOH\158723\EOT\1021483lPb\nBT@}\2545'&e\NUL\1065941,X0\135225c\tu\CAN|`4\1020041t*wK\DC3\f\25439RD\b\SYNGZ\1006639g0F^n\f\1105456R>f\1100409\1100823\\;`\SUBoh9\ACK\DC3\1071927K\v\11722\"\1060736\DEL\99248\GS\1040422\8236h\194957\23896+T{\52879\1008639\ETB\57964\987068\&6\DC4\998395\&99\SO\1098197\1097876\STXR\1090815\EMQb\165117a|c\150904~\FS\NUL\132829\DC3\15008V\DLE7K\167075\DC16=E\ETX\fTv\1034496<;\rLEGuZY\118839iNm\SYNJ\rI\190474\&2\1095050lI\ENQ\GS\1034351\63865\STXaPo\FS=8DtkQe\SO\147814\&0vQm\153309\1071911x\128401\164053\1008099$o-(t\DC2z\"AQ\1020511e;\SI\70124C\ETBH\29202#\1074721nCh'#\1094035'\1064442\35450Nx5=\37407\177998\94806\49674\\Y\35646Bec\1095406\1051005\DC1r|*\EM\38243}.A~\1079182\1042143\ETB\SI{Pt\1011810\ESCS8\160032\ESC\22627\SI\153862h\998542dZLu A\7299\149281+jc\1513<^\157390\DC4:\1083899\f\1031499]\bl\1036256\128520\38650d\1056973\DC2v\1044284\987395r\ESC#R\1022711Xr\27081\20760R|f\1092090?\1013931+\ACK\1107788M\CAN\1020010;\USJ\DC4\1012811\1028415>\1053853\STXj_)cWt B\18936f\1012599p-\vJ8\51800m7\167922R\NUL\171175\1057562\STXk\1020080(9\DC3%x\34431\DC2}(dMC1\ESC[", - cpNewPassword = + newPassword = plainTextPassword6Unsafe "\131784\138514\157899#Jk\r\1106537K\DC4RP~\ESC\150747\1093719\NUL_\1070253F\EOT*a\RS3we+u\163806\SYN[\183120BlK\n\FSF\DC3\SI\1031201\51899\1091000\1006948y\b;\83374$=\EOT$\100771\tJvs\155623\&2H\1097133<3\49632\18894\&7&L'W\169743\&9\1100463\1016241\DC3\EM1\998556V\DC3Spzv\rZ\98169M\rg\60865d\r}\1017655\6434" } @@ -89,10 +89,10 @@ testObject_PasswordChange_provider_6 = testObject_PasswordChange_provider_7 :: PasswordChange testObject_PasswordChange_provider_7 = PasswordChange - { cpOldPassword = + { oldPassword = plainTextPassword6Unsafe "o\194642\1097637\NAK\1096957q;\40241\78060@G7os\ACK&\NUL\rb\1064652\r!\v\EMh\SIf\1009912\FS\1111085\994910/m\1095852zr\21631\&70p\ESCxcNP;>ah\1038533\1088598?s\DC2\161084+l=\SYNtKk\1112851\NAK<%Wy\DC2\rdO\"wl\r\1073877&P[ x\EOT4\1070910\94261k\110789\EOTO\2408CJ\FSh\CAN,j\FS\1051419\&8\145785\EMDM=?\1044107rN'uaGQD\DC3c\DC1\SYN\50022\SYN\SI\191191\23297_\f\f}(lT\1001335-\1102617\1055091an\ETX\",S#\182773\ETXhx\ETX\"S\29957\133313\44208$Gpk\135573\74317\28585]Dx\SOVr]\1106090\15330\EMt][\190740e#B ;#\RSwWZ`'-K\1031198\1079899\149986'G:I<\ESCgN79G5\1076698\134552\1001620\&4k\178721Z\61166\ENQ\DC2A(@ScQ\1036811\RSS.\1083926?&5\59387\&4N/S\162222\1084995\&74w\171315\176694\31631\132086\f0l\vn\1041562\&22.\995582\162439\178300\DLE\CAN\GS?!\SI\19976usZ8sJD\1016223A]ExUW\18012tdEm\160005{7\b{\ETB<\DEL.\187515\26357\1022998!<\\\ESCGPS%b\1101700\13570\EOT_X6\\a~u.E,\145264\151278B,\1110132\178446!\146205}j\DELw\1094539wAOIN\74851suE\1011582LH\50805\1075175.8g,4\b\994127\158463A\STXO\CANYgM_<\134150`2t\5592/\184130\ESC\1025744\a\EOT@\t\n6\SYN\1051619\153044\US\24861\NAKqOwDI;\158935\STX\142163T\153718\EOT#EZVVq\nj*w\1099335*\SI@[5\1010626\n\DC4\\1\DC4\DEL[\CAN}\NULBUTcW\DLE;-D-\GS[\EOT8o/\26515\b\FSU\DC4}\\\140030~\SOH.%r\24914\33259\ESC=aoY\121055z\135293\180565t:\18518NUy\986819o\v%\1031392\EOT_\1056629\990992Vv\96494\1073204>%E@H\t\171158*\1055587W\131453U#p\ACK:\1001700{?.Dv'\US4VZR\140754\138375\14865\ACK=\1010074\a?\DC3\DC1\1104713F\1094183%\NUL\11085\NUL\119900\50952\1091734\1096788Z\131351\1071405K\STX$H\b\25145\SYN\137614}Uu>\1059256QJ}\1092477c\1005961f?\1098417dP\ESC\1112602eA\f3q\EOT\DC3\1085835\SUBP\DEL$\\\1043723\148046x\EM$J^ I[\ACKgl@k9\14259oq8\60943f%\"J\1057317\73689\1041929t\SO\fi\NUL'tD38k\ESC*z\v\DC4'\38081i2}}K\1000483\NAK ]=\GSzA\SI\STX\GS\65784@5\DEL\32084\RSJ'I\1061395\ENQC\132576k\36936Bde\132392S_]e\22951K\STXh\1080765\&9w\1031828\1079907\"\1075875x]\v\"\1004384\1034557\a\13954X+!S\188785k9\1336\STXL*Z\992108E\988071E\157741\1059002\49383l&M\78548\68781\1059405\&1\1024148\98156\&4JY\vb\1009588\CAN\1012372Xqx\DC4\STX\rW\3001RRPX\GS\RS^m\58278\a\1082402\US\990568QD\1066036\EOTAzaVl\NUL0[[\997199\992592SJ\100209Io K\US\SI?'.\100329Zv\26227\183271\&9?C\\\SUB\1055968\&5x{", - cpNewPassword = + newPassword = plainTextPassword6Unsafe "_90\1017274=\175182\\eIq\EM\29319@\US\ESC\USr\GS{\bq\SYNX{k\998765\1113634#>\v\127239\\L4z^\47811+N\1113429\STX?9C!^\1072965\155787\1051243f\n\189595\DLE\a\ENQ\1019894\50928&\rJw\CANZE\178133jc\ETBb%\50684va\11406<\US*\77953\&9?P\f" } @@ -100,10 +100,10 @@ testObject_PasswordChange_provider_7 = testObject_PasswordChange_provider_8 :: PasswordChange testObject_PasswordChange_provider_8 = PasswordChange - { cpOldPassword = + { oldPassword = plainTextPassword6Unsafe "\180818[@\EOTO\EOTr\t0h\154811\1097619Ls,\RS\177254\1001237\US\53799!\174182i\33534gi\12980Ul\DC2c\"Q!h\1078688\ETB\32168j<\143648\SYN8\120997\&3z\1109784\140076\8229\EML\DC4)L\1086339hE\FSYD v\60832\&3:\b\127281~\t\DC2|\NUL\STX>\1037988\&9\52889\ETB%2TZ\1057438\1019124\34595Ba\36978\&5\n\f\66575M\DEL'.HktRZK\US\b\1045482\SUBQfa:NA.(\az\DEL\131940Jviu\SYNt\141599$5b];W\SUBPM\1063367\1063525\135883,\17207W2L~_\DC2\6631@DJ;|\DELa\ESC.h\1052121\1098974\1033911p\1087765\EM^\t1X<15#N\1026411\1084279\&8G!R\147770\&2t;\ETB\ESC\1064735d~\v\NUL\1102025\DC4B1T\"\1109782}x;!no\r\1106009\RSt\18334uj\EM#r.W'}@b)\STX\162952i\SYN\167204Y\NAK g.xl\63576L\1084858\&5\186390\182838\990328\th\DC14\26177Np\ENQRLe\1082057\&5k\SOH\997985\1062349D;KY\189276A|\ETX&t:7$\ESC\NAKX\176629&\ETB,S\SI\18829\29542K;\CAN\184587,RWVP\RS6C\24675\a\187635\992522\154218\41884\b\STX\ENQX\9568$\SYNK", - cpNewPassword = + newPassword = plainTextPassword6Unsafe "x\1083148\ETX+:\1080028wSH\SOH\62978\1102729N6\182762a.$\992539\120747GK\158987%\136043\DC2S\1037479Ym\1008949\NUL_Fe\GS\n4\990156\39344\1010528\&9\t\ESCEZ\"\aE\SIO]\1045645\1079319mZv\14455\&4Ie\166474iF$\n5\EM\ACK\1075904\1113583F\SOHG|\STX4g\1002980XHN\989865?\1099099\173477\&3\50673\83417\11655\1099379B\ETB1\r\1013634Tn[\EOT$&}'}\141322\&3_m\1077163W\3968Pt\ESC\1071158\&6f\1068159=\183495:\1036808\DLE/p\1004364:\r\1085290\ETB9`\1080065\984968h\1027137kOs7\NUL(t\10489\1068176,G@C\63384\1024509\186856\190455B\1113082\SUB\CANQjW\1008166~U(\1009483\&5\1109177\20348!\1077035E\1005&Mj.(\DC3y\152919\172701\ETX8p)'1ep\n~&{\62654\167895\DC2*7\990132\DEL\185308<\DEL\SI\1098650)j-abs\CAN\GSL\25312\DC3Pl\51906\&2`$bh\SYN_\1086252+>h\59671#\1056101RE\"{n.wh\n\64038\154124c\1069890\GS\170451\1076325N#I\1062645\nX\n3S0+\tr\CAN\39868\t9\1031811`/\1019167\1036273(N\57792\ACKD5\1096310a5\DC2Tf=}\ETB\1108347_yHue0\n\1092905\1099428H\b'\1091583T+:\183409${\1057811\GSE0\RS\1043155ly\SIobfRk\ENQ\RS\145619h`\\\95626\NUL>rV1\ETBfXk=cyaI\EOT\ETX!_\CAN\26741xR\DC4\1038343<%\1073241,`TXaz@^\\^s\180706Y\NUL\1081447\156985\DC2c\EOT&\n\DC3S\44890\NULE@\13815\&0`B\t\1039059N\CAN\32617\167086\999897\34753B\149257\USp[\SYN\186181\ETX\1040852=;\ENQ+$\a#\1020966\ACKc<\1106724\NAK\ACK\CAN#\41741\66650\DC2^\f\1089620!\ENQ\ACKC\SUB+\NAK\1070506f}\SOH>\bz\184367-{\37662z\128698\191437G\ENQ\n\1036769O\1112827\ENQPs}T'q\1049540\1059171+\ESCW9U\ETB1m\ETX\1044364\1110248\1011325\1077049\\\1070234}z^f\v8p\58049u\DC1Dn@7\SO\178338y'\t\CAN\DELX\138703\44901\111212Mz\1060998\&5\\\"\128701>\EOTNZdWO*\177619\DC3NV\1105635\44906vyM\45692\145400z\CAN\63310J\DC4\RS\ESC-FY]`k\DLE\DLE\GS\US4l\DC3(Ot\SOH1\156591\DC1Daok\131703\1053478u\1047598\RS=ES?\1105503v\119021\1077338\1108555\1105842!\EOTICQ\64082\167240\1027279\ETBu?%\1093608v/\47051e\DEL!M\bLA\SOHN\STXWi\1013467\176220*\aU+\SOAiO-(\n\7942m_\1015104khe^:\rQ\bZS?\1043829k\n8eh\984956\ETBU\146314k#]\ESC\32013\58442,\ETX\DC3.3\SI}\30711=8\NAK\1023884o`TI(\992144-\ENQUR?\152908\DLE\1110035\1106113?VYfS\EM\SUB\1095315\33553\1096655\ETXC\RS8j0\tKC\190493[_&\46172\1060818\SOl}:\r\SI8(x\135429?8\98588\&7)R\985918Q\ESC\ACK(z\SOH.\1107353\&2Y\US\SOH\1035764|\DEL|3&\DC3\94271Q'D{\NUL??\ETX7HDW\184522]`f\bPO\ENQx?\33111A\DC2|hP@;We\35075;\1057215R\ACK8\"$!A3.[\ag\997090\1017693.\STXI\1107916\1089611\19348U\983048Y\1008717)G\RSY\1107954\DC3+u/\DC2\DLE$\STXN\DLE\185464(>[\SIH\12867'KOC\DC4P\38328.\65734M\ns\ETXl\NAKj\DC4M\1046104=v\US\FS\1033829=p\157189s\SYN\DC4T\113713e\SIXhO\v0\SYN\159832\SOH>!\161626\n\RS\999549\135814\49229\1051757.\EOT'(,f8NT+J\1006984O\1062064\RS\187616\309D\152878\b\EMg\v^\22870\SYN\1026918\62565\ACKf", - cpNewPassword = + newPassword = plainTextPassword6Unsafe "\47540\188511\&0\STX\SOHF!v\ENQ\11373 l[\SYN\137894\&4R\15581\&7\1083947rK\15414+\n\135750\1065844\SUB\afb'|\RS\"\995385\1090151\DC4\132765/\SOH\153829P\33605B=\72999\a1\1017925F\1051495k\ETXmF\1017174#\177930\148698b\168141ZG$\1112470dbB\SOH\983969\72724\EOT!\996099\&7\SI\1066289{\ETB\1024612\DC1\NAKSr$o\63124\&4<\163973q\1060394\NULXX\DC1;#%fM[dR\EM\1044817N\62150\139272\US\SI\1073067\985245d\RS\GS\DC2EbQ\191179l\1028785r`Tf\DEL\191144\&0\ACKHJ\1016730T6X\DC1cypE\ACKy \DC3\DC2\25565\SI7Wv\SI\1046192Z\vY\"\v\156204\DEL\1106419\995387/\DLE+D?\f;B\163188(\FSyI\1060531Zi\1051115~\993288XN\13032M\DLEPzB\US6\38727gj&L_\1061368\EMj9\1018863V8*Hf`?25\154173Y\SO!dS\1033424O'\1099719`\GS_T\1012344\48568\NAK\1052118\b 'ss\179793Ug\62366\ENQ\rQ:NVc\46684\ETX\147041$\33117K\97385]rNq\1088791\14261\&5g\1108158>i\1060212t@=Io/nm\ENQE{\1051318\v\181086Yk:\SYN9o\NUL\v\16507 [K%J\97955\fM-\1066437rvqm$^b9mkM\1039402\&2;\ETX2\1043146\SUBU\18461]\SOHD\ESCF\DC3<\CANu:\EM\174389\n\DLE\24984\142121yXK\1034045\52191\FSA\62973\&4(K,\168483\SO%gE/B1D\1107948\DC2\161658C\SYN\EOT\DLE\CAN9O5De\29644seu*9\DELk~B\ESC\DLE-\rT?t@\1000006\151230;6\ETB$\1003656\FS\1041307\637\1085577\1005683u\194601{>6\DC1E\48817kO\1071212\DEL60\183739\&9wk\177129\DC3\156315VX\1016207C\141727\"\155769N\153799\CANT\SI\STX\1049621\985530Rl1Qr\21745eC\GS\SYN2z\RSi\161367D6s1y\1095652F&\1040517lTt\ENQ$p\GSRi\1048949-\58685\SIu\21111v\19578P\1077429l:IZ\181939\17566V9e.\DELp\v_6)|q\1034902{\ENQ\29955MXK\1056306ax\1003137_\1006056#0\US\r\CAN\"\DC4`O\1049859\CAN~w|f\EM\126607Oi\1023015\SO\FS?h/('\DC1^\39065i\185517J`a3\ENQ\v\1060183\11345g\DC3\48063X\29116Ya\"6\r \132135Bb\1062624\DC1&\13220\EM\ENQy8anV7y\134882T\1047562\SUBcn\SUBk\168542\US_a\EM?\1106016\1088608\DC3I.Z\1069178\ETX\SIrX )!p\1067306Y\183358\&07\GS\1086052?\169845#m\EOTuZegqUxW{\100361\34246\33073\36773L\EOTg\154155\998821]\ETB\a\1059432\ENQz-\97879\187856j4\ACK\STXM\STX%4\EOT{\59661s" } @@ -122,10 +122,10 @@ testObject_PasswordChange_provider_9 = testObject_PasswordChange_provider_10 :: PasswordChange testObject_PasswordChange_provider_10 = PasswordChange - { cpOldPassword = + { oldPassword = plainTextPassword6Unsafe "1\RS\10044\NULv\987768z\1055172|%\1068184n\150620-g\146786\100842a\132317\EOT%?\97207\1068876AA\"Hmj-\EM\29734\&8\39432,\EOTP\58685>`L\STX:\127298\ACKhOh*\54301md\DC3\STX\144021\1098966LJ+\ACK\"\186180+\1079127\1032187\1090115\SYN9\147876`\63187X9(i\48707\163570\&6\1042913dn~\f>\DC2\1059432\1061679\1009814gq>!\1009228\1047046\63767R&|/\996634fC(D\180586\163947p\\0D$G\23465(J\btdn\1057718u\SYN\NAK:[gvX\50684\NULA\DC3T |@A)\f;\10521R-q?fi\142601\34542#\131181\68251\NULF\1056804\RS\1089058?*\1094737iy \1005023\126576EJ3\153530F\SUB\3963\&2\16235\1015286\SUB\1066520X($}aH\118969!M\1077359\SOH3])\\\ESC\1049797h4sn\FS\10735ztNR\STXxt~:Rb\12611\996694\SI\n\1112987\b\154951C\83302+\\K\1035224\STXs\RSa\47166+d\1073064\&1Z9g\RS)\93030&)\1043446,EIg?K\EOTm\1090815\&9\n\175897\US.u\51778\\\DEL\195063^\DC1|\DC2\SO\SO*LJVVT\1033808WO\USWmOS\1066607\"Z.\SO\1113376C-8\f\DC2miZ\ACK\1084935~C\153854sbIc\"\\-x\10336L\162894\NAK\EOT\1011330\DC4\1065068 \DC1I;\50247;\FS\STX9gU]\151272\154324;\131933v\ESC\n9?QY\SUB\176268\137386Y\78635\1037339Y\DC4\1005665@ll\26187\FS-\v\1059041l\1096164\1084819\SIWrw\ACKU:\135072{\GS\SO\1015883*\f@n.\70686f~\1087845\1045524u0y\SUB\1057096fX\SUB\1018748#e~V\"/[\ESC\CAN\152318\&4\27910_6 q\1092940P<8.MdP\CANV\RS\1046864\991518\NUL\ETXy<\CAN!\US,\RSt`\t\CAN~2E\vs6E\28962\1105957J\vo\1034354O?h7\NULQ>\1091553\&6\"V\138663s.<\"\1088335Myg\"\1103252}>O8\\N\FS\EOTu\DC3\SOF/\RS\GSO\27243?t\177484p$<\1089949VrW+\148070\"Ss\CAN``\v\DC3j@\NAKkeV\bE\164215\11921\FS\NAK1\1061345~aQ\f\RS\SO\1083547~\RS\1064714\GS/t:\DC2\tH\1019658\176743'2\77831\ETX\SO\CAND\SUB\19747ux\DC2\1085285\b@b#\US\17662\NULS>\ENQp\DC1\EM2\NUL\145191\"\"Z\133654\&1, Isn\f\160554\EMR-\58719RsaR\FSu\b\1055113>O\1004908\n\59796\136706\DC2F\1085126y\SOZ\93820\ESC\158354\DC2 \46585\n\1106215J!\STXg\ETX\988927\1065461rba\NUL_\42383\STX\STX\ETB#\aAqacXF1b.$\fFvU\173641\ESCAa:\154419\67985", - cpNewPassword = + newPassword = plainTextPassword6Unsafe "\1903\59455\FS2\DELpfHg\1002321@hB\1104441\136229ae\"@\178717\DC1[;F?\1059559{\r.~Q8q^^\1032632p~\54629A\SO8epx\v\1091069\36029\&9Q#`B>\\\STX\ESC]\62056a\aH\GS\1017283=\133882\DLE\US|K\1089241SU\"`TOG)E\1107458\EM\ENQ\1100349V\DC3\SUB\131700\35766\&11eL\136082.\1077925\f\30081\139237\ETX\1018509\&33\3857\1020021@\\56/RC\9618VomQo\189775\1090226\54508|b5\1008980\t\38541\148813W\1052824u\172429\19279\1097359\&2\SIHs\1009437'\\\bt)A\DC4|\vh\141292\US9K\1006653\1113093wY\SO\1070366\40254\17618\&4u\997723'\1071258Wtl,\1028539\180872c\SYN\169621p5<\989014\SOd\1098426(P\SYN41.!\1051130(\DC4L{m\SUB\1109045dYlO\ENQ\180749l\27773r\1015113tS\DC1d\1103375\RS\150389\\U\137134)\1068287\EOTRc\DC4N\ETB\SYNrzEm\763#q39\1045616lY\CANHr\156951\26672:\877w\135480\DC2\r:CA\29971\110984\1082925\n\DC3VE,od{J@]\21278P\29049\FS\139994\1100241\1102005!\136294\1017333H\23052\&5\\\DC1\148824%\181207\165938-p\bN{Ky(N\52156B\a\990465u\119232\")\14788Q\1031053.\183810J\160516a\18817\EM`c\DLEh3\150349\SI>\59607\58218\987987L7II@C%\170472b>\NAKgl*\EOTzI4Vc\78060\22721+)\ETX,\DC3:\42649\&5\1054588\SO[UL\SYNCQ\41627(\12611\ACK-;O|\120383\SOH\25185;VBv[\fj\n$jq\"\NULuYx\EOT\1042364\&9:F\94542\1103197omPG6\fX$\DC1\ETX\SO\EOT-\137576Yk\147970M`\DC4K0\v?\1041183t\ESCT\1068218\30904Z\ta\1045178\SOH\EM0tf\4343U\NULz \98491~jq\1078216\ETXV\174194=\47181vn\143157oly\DC2i\n~_R$8;fbOK\NULz-?CM*\STX5!\1105218\181223\98689i~\189811!\DC3\134655\DEL+\1100972\1088541>\US\1083023\988420\59101'75K\FSf\CANY\SOzC^b2w-uD\1106649p" } @@ -133,10 +133,10 @@ testObject_PasswordChange_provider_10 = testObject_PasswordChange_provider_11 :: PasswordChange testObject_PasswordChange_provider_11 = PasswordChange - { cpOldPassword = + { oldPassword = plainTextPassword6Unsafe "\1020927\1032547/~G!t3\ETBpT(lfd\987373Uv\US\1047331n/\1037165\v\1000590\&4P\SI\1060450gP\1107120\&3\132634\147692\&0o\57446~\1081825\&4.p\155579xg\169376\1084103yGDY\1068206\EMx^\151320\141047u*R\t21=|\\2\7811\ESC\11201W\147769\STX&\USGu\1097263+#&\ACK]m\159187>\94801\186556\&6W\ESC;w\1017208b\\\ENQqz\\|\95815o`\\\184139\&1\ENQ&@\SUBF\DELC]G[G\164490$z\1112723\1032192\ESC\1044057\EM\1048741\NUL>d\1033451\1015039\1073811\n\166720\180329P&s/!qt\162927@\vP\DC1p\n.n_N\1112206\DLEV~\1101479$h\138762Is\1004025`!\22537$\996552\r\RS\1098882@\16250Rd87\16682\69640\1041864Zo_Ps?\58225\ETB\DEL\25967wU\r [t\174359/\GS.\ETB\178764}UyN\DEL{w\NUL\1036907:u\\\US\SYN\179040K\1072719\6945J>%.\147824'\19885\184555Z\DEL?\4231\STXjg\145989G\DC4\SO\37110\ACK\43793\SIv\134991\NUL\174407ei\\]\n\998741f/a y\1002649F\SIlm\995784\1000687\141212\ESC\RS\US$|\1035150\&1\CAN;6\150884\&6rxN\135999RVa\STX(\GS\ENQ*pSX2-\GS\53557\DC1x\b\".\38402\ETBM\"\1082676\178592\DC4g\r\1100889)\DLEk\190056t\1043965^0\1008489\DC36\US\t\52881m\SUB\DEL;OV\1030445p]-p\DLE\152006D\37776\19566>d\DC34@/\994339\141918c\SI+dol\r{\RS\DC1\1017180\1064450\SUB1>\FSy&#\169442>\DEL?x[~^dAc\f\DLEW\SI1\995822\&0S\ETX_\1047048#9\175054wfVhc\1042539\1020713L#J7GBX(\4705\1048737\989333/W5\SOH\1112863@gv\STX\162785Z\ACKw^\CANk\986491HyU@I#}Xc?\1028091\28123\DC3\DC2)5+\1059942h\DC1\NAK[>\58609\ENQ#\RS\997513\nG\135550\&3\CAN\FS2:M\49436\ENQ\1074694\1023446\1073068\1089664>pne\178174s\SOd\1091829\138029\&1\24380_\1036947PM)\EMGb\986632$z\46384\ETXv'\re\CAN2\12453NA\n\1033330H:\148549y\ETB4\ETBm\132498\185138\DC3\1010645c\at\184247^\b\ETB\1097131*\SUB\1075368Q}\1107305r%\984574gdAS\EMX\ETB\ENQ\NUL\ETB3\NUL\DC1\99185k\fJ.\1031366\48850A\DC2\185849i5V\1044560\996851:)*\tO\DLE", - cpNewPassword = + newPassword = plainTextPassword6Unsafe "P7\8027gJ\1025598\1050728\tb\1046936s\179130\FS*\r\163897~yj\67377qm)Y\EM\1082698k]SS\990645~;\rp\ENQ\SUBm\1109081QAT\SYNe:\1037799\3798\a=nU\DC2n2\97679c\1105464|\SOH\NAK\EOTL\STX\1014848>\n\SON\US\990037\SI\GS`JOJ\991087v\USY\43061\NULp(S\1006785<\1009666\DC2j\ETB\1074651\1111117s\49393\167041J.,OGU\1015263\1026361.\1082540\&71U\1093020\&8/\1053449\1043583T\EOT\GS c=\53746t}RiOL\RSUsY*h\120237_| \1025261\991499\63211\27137s2redy\1033031Vg\6578\EOT\155956\62493bdQ\EM\1060795-\1079855\1078796\EM\ETB\18365\170958\5129\1084739(Qw!\SOHh\1045601N\52593\STXb\43616d1\1081703{\1034023\FSBE+\r\a\1042611I\988095Rbat=\DEL\57734\v\1087456\139092\1002353oA$\ETX\EOT{o|\DC1Y6\SIleK\984319c\DC2\NAK\9960H\SI\97430\&5\988979\&8'\142119\SOH/\12561\bKo6+Iw\179708\18608\v\SYNN\1061814\SILuF\164362J\1037455\&1\1050949\&0\168187\12201/i\SO\990270\996257\&6g\DC2eR;\ACK\159365\1095404\83044\1057125\SOH\42192_=\1021400" } @@ -144,10 +144,10 @@ testObject_PasswordChange_provider_11 = testObject_PasswordChange_provider_12 :: PasswordChange testObject_PasswordChange_provider_12 = PasswordChange - { cpOldPassword = + { oldPassword = plainTextPassword6Unsafe "t\176015z\63099\RS\1019165\72134\1094758\1087142Z\NAKB\1067933+\ETXXj`3.Q\1032039\SUBK\1109183r\1017216\141033\EOT\1016663\52892f=\t\b\CAN\SOH\40431\ETB\a1\187032J4n2eUq\165606\STX\1002769\95144\n\DC1\v'P K\ENQC\49957\&6\995828\abB\\\SYN$E\rCp(\ENQ\997577Z\r\5958\1064586\6052\169035(2\DC3\nwz\EM\1057822`[,\a(\168052\ETBn\1024741\170909\&3\166910-\NAKTp26!\EM%\1067691\983629\1105810X\1084137Ww\160494.S\SUB\RSs5\tS/\188321\STX\179825\14815E\143720\5499::Y%\SI\151589iV\139252BU}]*\GSp'\51146\77903\40692\1032384\EM}\14702k\EOT\1048493a\1024981\&8E\26598\f\1016469\"1uT\US\97604\1086313hC$ND\99182\ENQJ\"S\vCyu\SO\DLE9\137054b\44966\DC3Pe\21040l\44235u\1093696\2097VSM\a\n\1107484\&9\DC4(\a\177489\150593>-\NAK\1030177Mr\1050563\&8\DC3\194810\141213PiK9\EMm\ACKW\SOHvIFX\984936\ac4<\SUBU'\ENQ\SYN\155860x\9048Y>@\1041311\STXp5C\r\163993!z$\1015059\GS\ESC?# UW\1052214\&0&w\ETX\1102267H\190128>-[9z\29338\1008713\SUB@\EOTiA\1113779n1S\136784\tG\DC3\DC4RT*", - cpNewPassword = + newPassword = plainTextPassword6Unsafe "\1029941\182208*\50406\144479mqK=\SYN\NULg\3986a^U !\164592\1000979F\1091010J\137728\43445\ENQTB\152909=N[/5\187278\SYNT\SOH\NULp\1045227\&8\155213q\ETB\v\ESCA!w=x\DC1\RS\29768Z\EM\vpx\US\b(\143914mvW6~'\DC2n&\RS\ETB^]\1092638\b|\1066156d\SOHv-\1092522T\b\ETB\158149x\46579 Mo3)\FS_5\182825Mf\156710VFG\STXOEC\142253(\ESC<1bYVMM7h.:n+\ESCXB~juz{<\GS1\23218\1073013v\1085890Ge\SYN9X\STX\1027702<\ENQx\61722>\ACK^\1108099\1049394\140867P\ETXuh\ESC0\15060?R\SO\CANcT\1025381\1026223C\DC2\"8BY*8\121167XO1\v?z\US9RR\139465\NAKdG\160065\DC4/k\1101568\1097562\46923\ENQk\70387HNx\139984#\997549 \apU\24875\161412E~p\DELe\1024027\32616%(\EOT/\165473Oa\1068906:9'b\b\48968\63083bSw\1089284\DC2pQ\DC4\SO\997853G\143790(A+!\SI\SOH9O\1021380\rWZ\ETBHVe\1038354\SO\SYN>\1084362\SOH}Bcj\1040105\SODC8\180947F\t\1078880yrR\126464|\1002350\CAN\9877e\160489\SYN\fo\n#M\140761\1050789u:j\DC4\"\39095\SOH\1091919I\64643`tpdU\SOH@\ETX5\1015281\169940\&8\1084283C\EMI\70725\EM\DC2M\172398\1098890\&20\17785\ENQzq\v=KLK\1026521\160303\191191\FS\1022904&\1044176\EOT;e\DEL\1092828,59~\DC4\1095506s04[C\74207YbmD\f\40061\\\ETX\EM\153974\169857Z\f~:.\r^?#e\1054794du_I\ETBHy\NAK\DC3C@]Q\167956\65170a\v\1065540<\1097822zRr\vA\1005063\1042686%]\US!\99727.dfV\STXR\54637\1083007CJ3\t\1100221d=\DC4b0\96187\ETB\STXc\NUL\32051B(\RSsx\DLE\FSlYr#@\1048685\145684\1032535\995750\NUL7Py\176787aL?7\SOH'\1032303\1026443\166147;\ENQ\1101976\178862\1064385CP\GSy\NAK2@h4D\74062\98439\98790;\991778+%\142285\1032969V\DLE+Af\ETXr*}v\74561\EOT\b\SYN\DLE\SOH\CAN\NUL\DLElI\1103471Kof\59742\DC4\ESC\185307O\1025693fr/\STXq\62224{\SYN@\1075147p\1092437\DELmvx:fk\1096766\r4\1079176\9458\ETX\t\fP\1068111%c:\\4\403\1072385A\SI\1107936\188641\154662?1\US-\EM5j[([\40806\aQWI1\1012550\1013491H3Xf+A#YF\SUB_lIo\169072\997652\998922X\13580X\1093433\SOH\1032578\989439)P\172195\&0\1014194d\a\RS|\174744$Eu \SOH\ETXF8 a\b\1022530\1066904/]\US{3E9Sf\138114\a_:V\ACK\1111019QWU3\1098773\3051OS XdA[\183160\28570.\31939(b\nL#\1107788[\STX7l*C\1033328\984136\GS1.Z\998716\EOT\46839H\n\1071926\1079240\SOH(l\RS\143037\v\38887>\1090554:-\NULj?%F\1084391I[6v\170273\22502\100077\49274~7G\166097\4519\EM!'\ETX\38398Q?,\GSUu@%(H(I\ETX~>\DC4K\DC3>\72246\EM5\1022086 \1090756O\f\1111314\&2\DC3\25931\994780G9\999039\990590*%\1000152\NAK-\983159\SYN\\\US;\152905JP0$\1106049\37822]\DLE`\1036169:0K\997106hkB\144462\RSH\1102093\33454\RS\989572\1107706:A#]R\SIXFW\"8\STXHW0\986050\45557j\37948\995320\1100585A\1035623}\61155l\49913\1091660\ETXg&?\SO\&H\1054389\1089082\NAKL\98924RG\1101738\&76\5639\1081113@\EOT\SOv:\29442*\DC2xph\136453\"F\n3lu\61648\STXuf\DC1A2M\154097\1091702\ACK\DELtXj\DLE\1096523fT\168155\160774\62409Q\ETX\1073552ah:\1045093ctrC\1008972&:\ENQ1\984019\DEL\72254_,}\1059043Y9`:\DLE\DC3d\1103970\1096003\1102898*Z!\187234\148461\v\52269\&7\63614\SOH'\\TOs!%?\SOH\1093845Z>\DC4\1204t^P\v\a\34585`\147989_\SOE*\1011406\SI\162221<\DC4\USW{\83494[\1054677\&1\1049205duWR\25182\1059779\&9l\FS\a\US\ETB\r\1036646J$Ea\1052569\173473\SUBLpR2\27762A\167459\b\SOUJao\1025597@\17412h`\SO\163155\DC4\1066350E\157076o\1110972dZPjbt\54921\985661k{\1102674\&0|\ETB\50568Q\SOH\152060\&5\rfAj\1062496T\983117U N\31082u\1075887\DC1\157116\DC1IP>\995210'\rz\1046533A\1066921\"\181434\&8\164987|\63500wXC\NUL\1064912?,X\1019667m\US\EOT\96637N\185883_:d\USU\167304A\1106870*'`w|6\1045529\&9+\166106mjC:v\1053515\39282\10936388!Acu\a\ETB6k\SYN>\EM-\22513g\149536S\DEL\RS\1023314\1096302jyZ\1066742\1070063U1G\SYN(\180738\US\1006809\SOH\1114037M\172262\a$CT\CAN;iezO\150819!\1105298t<\1055348\149076oogs\SI\ESCO\a~\DC1\a\DC3\1018432\159829t\15910\37325|\DEL\CAN%\1010165\&9i\156087\&5\144925k\1050355\49336\11211\174004\1051581\DC1K:\RSE\ETX\5991:f\1098856\19403\rN\49047:t\SI\1053824\1038465z\149922V^?D\v\vki\SI\ETB\1001377?u\"4L\1021111&\987357\21606B2H\173390\35107\&5F\34214\GS\DC3\\\1059063\&4" } @@ -166,10 +166,10 @@ testObject_PasswordChange_provider_13 = testObject_PasswordChange_provider_14 :: PasswordChange testObject_PasswordChange_provider_14 = PasswordChange - { cpOldPassword = + { oldPassword = plainTextPassword6Unsafe ")\1036280s\137216'`\59330\STX_\CAN\180010D\t\ENQzJ\1063390\1045233`D^\111264>\132440\NAK\DC3\176932\49323l\SOH\99704\1013404\&8\1098260\DC3&>\43426\30743x\173643.o\158967=6\1633\1098022P1M\162604\"RG\SUB\1038025\FS\STX\CAN:\DC4\ETBu\CANx\1089236\1061187@(E\1002850\&4~\ETX\NUL\51238\&4X\NULH\DC2pll\EOT\DC2\177807\1104201\DLE\17185[K|W\DLE;\144266z,C\USD\983816O\NUL\riV\">=^oX#&L\1049388Kq\25975YW\1033425t\1055427\22674\nPF~\1082938;42%b.;t \1040882\1039127\165132\DC1\1064926PV\26969z_xZ\SOH)Bz\t1f\DLE9/\FS7\1093628,J\33998\72145&Q\NULe=\FSK+\SI\25383\1028788\1022136n\97202\SO\173088\&8p\DLE\ETX\111158|,\STX\1033460\1104436d\1050868o`C\SO\132042\f?Hy&\36586A\46227\141006e\NAK\DC1wJ[\fc\b\1070422l\141230\DC4\64151W\DC4R\1045214t$\136334v\61852~r\1060898f\1071586\&3\SI\1019583\\D\ETB>\164308b\EM\133344w)\1053343_(\1058134[ra5U\SYN\178080\72861fC\141152\&6\1011495\STXy\100396Ii\1109445\f\184085z0\164727~\78749D\rhqu'\DLE\SOH\DC4\145824V\\\SOH+Mu\1041477S;w\141810Z\1041792\EOT\NAK5mo\USZ\1079915\172082\1069321\1090200/\ETB]\aD'\NULx+\STX\ENQI\NUL\DEL8\RS\1055834gcU7\1066759\NUL\7502\RS\995972T-", - cpNewPassword = + newPassword = plainTextPassword6Unsafe "\DC2\t!' czxpt\186414}\1036760Z|\1105851\&3\1098742\&9cE9;qlI\128862\&0d\1041894\1071062\ETB\SUB\13291C(q\CAN\DC4\92178r\992045\n\37621\SOH*\26079\&3xLD\97230\SI/AS\CANX\DC40\NULC\134548\DLE^\1113807P\SYN6U\"2N\STXv%\1078605} \17042\4719\ACKB\v\t\989972s\138208\&5\DLE#\53263\1088280\STX13H\173756#@t)\188467BEV\ACKLCX\SYN]\DC2P\181437\FSN\149514\186718?\22604(\1090926\15413\1065637\EMO\27585\\r\FS\\\SI\1035346\18565\1013435vU\at#\1062175\"\EOT\SOH{pE\12478xJ\DC2g]\ETX\DEL\DC3c\SOH\fPX|\1066931wEAe!\993681R\ACKu\1113614..$\1068793\27316\&9(\SYN\58010c\1002603\RSw!\SOi\1030926>qPl\ACK\STXXmG-\v\120608`\1088763B\FS%gW\ENQ\DC4\n\STX(\1074703\b\DC2N\1109769\&7H\"k\EMty\ETB\187962A\1020329.:\ESCj\re\GS\161991\1034321-*q\ETX\1093441Y%A\46791hf\n\141128\DC3J\157117\SUB}4\EOT\161237\v 8$d%\b\28128n\989856K\DELf\t\NUL|;X\ACK\142667*\CAN\SYN\24303\v\4878\1760Yj\vyyk\1026116'i\1080447?U]\ACKb\ETX\48209&\"\29031\1039525}\63031P\13226%\ESC\t\1047966\1098216\ENQ\ACK\NUL@\ENQ\1106062%D\41968\94208C\NAK~p\SI;\GSz&\SOj\DC1\"7\66276\1081689\EOT\DEL\990793\bdiX@[%}\1072552\1098336\&6K]S\ENQ\1012057T\990893\154290\&24g\USe\STXpS\82979E\FS\ACK\71075\1087888\DELo\29366'\t\SIv\995645\&7,\ETX\SOH!i\1031533\1081283\&43XW\t4\FS7\1101016\1108161\31300?\1083887@\1048301g\DLE\DC3\1067632Mn\GS;\1044539*k\147748\&1\DLEW\1112391\1103992*\vB6\158062\f\68308=P!\1112874\45394|9Qv\DC4q\1063868\1105018\1004357Z\DC4\1097524;9J\160053+\fLa\DC4\1010823\&2\1049908<\1055415\EM\1053244M\ACKDO7NUa\34227\1041181[ \181881\a1\US\vc.\1012405\ACKhi)\162677\35949nG\27679;\132913\1026232f\182327#t\1027272B=\152450`\180605\&4\NUL\1006343*\1075473\b\\*\ESC\177216\CAN;\ao%pAH|\n\EM\tC\143291ZrZ\151170IF\ETBO6=bh\STXzV\1013862P\1064457\\\159157:,U)\58595\DC4\1013245\1075630\GSg\SUByv\110788l\\\v\b^\31887Ii\ENQ[\65195y\1088707\&8a\CAN\t\vDeb\1007440i{t;oR]", - cpNewPassword = + newPassword = plainTextPassword6Unsafe "\152852s\1068988Df{\1109851>\DLEN\1096871:,\1104054 \134810\3245;L\133604uN\989402-\"A9t\1089099f\CAN;q\1046261\36961R<&3\ESC\DEL\72254\NULq\n9e\SUB[d\1062509^\v\CAN\61899U\18913BM)\DC1r\SOHevfz\EOT\118837k\152950\&8zn![nE\40274\a\148239\146181\1034404\DLE\NAK#\1021834\\\7383\f)We\135919\ENQ\1003933\1042129Y\1083464W\184760\1043368\&3\DLE\\\b/\1058055<JXk3\78374\987565\151899\147262\27256\ENQLe\138865V3>\142078\32373\&4\1065316\35039F\\$k1\f\DC2f \v\121169\FS_\1066161b-\6727&\995927'X?Jb,\12990\158842\9204-\ACK/\983518\1100707`\ETX*\9732!\DELf2&/\SO\78519\ENQ\1006374\ESCU\1108463\993917\USJq\155123R\133864\&2Q@\ETXq\30171sM\"\DC2{b\v}i=\118851\DC4p98\DELsa\1110153 NiV\1016779f@\162996\1062077F+Z\154196\DC1\1093124Zd\66026gh^\SOK%\142282I" } @@ -188,10 +188,10 @@ testObject_PasswordChange_provider_15 = testObject_PasswordChange_provider_16 :: PasswordChange testObject_PasswordChange_provider_16 = PasswordChange - { cpOldPassword = + { oldPassword = plainTextPassword6Unsafe "gB[\SOa\136597\&4I_\1070522$\US-E\f\bD\184839l\53618j\145196\1063189e\96537*\1053243g(hJ+E\\\STX\100410/\ENQb.\7738\1113147\\\27214\9423\EMu)-\DEL\FSRh\DC1G>\DLE\ENQ#\162187\94536\v&\DLEd[5\DEL\DEL7U+wZ~e\1065056RT\1015376~\47206\1049409\SUBL~\ESC]\175086KpHWu_\1093704uN=\b\1029782\EM\US\1041680\DC3\DLEd47\1016259\1094650\SYNZOiX\61511M\DLE\DC14\1023510\55250d3h>Jw<\SUB\1105863$*)\173139\&5\t~\36451U\v\1007351\&8nb\DLEXH\137571\DC1Q7kP\186382L<\1078705$+\1081663#\ESC\38858*K\180009%\154955\65738\f2\v~A\1011551\f}\1100334}(%\SUB\997989PA\NUL\1081198o\1064382\SYNV\NULv\159271\ETX\54311\1064618os-\1091683\NULE\STXcl0\137068f\1050864\186833\174746\EM\25158sQ\1071799\60428\5196k^=_l\1066392f;O|\1063397YO\"P\NUL\69230\\\35862\"\ACK\"~\141584X\1038172\ETB$\95964\CAN\27381%UQ\NAKy\1029066\1073585-W\1020228z~\GS\22450\1113567J~\DC4-?:\1110536\rf\1065914\a\187988\1098168^.\26197T!*\1037028~\1073514\SOHF\am\27257\158078\175061\\\SI\147288Vk\99196w\1092949\186929_D\DLEq\1086094r\131393\NAKy2\ETX\ACK{Pq)\1037265\99424\993708t\169393e\NUL\US\988887`\159377\EM\1002749\STXY!\50906\fY\ENQ\1078545ERU\990479>\NUL:ZT\1035772.3\CAN\1096695J\SUBN\ETBZ\153481\a\16088\DC2m\ENQ\ACKDzhd(<\SIF9-N^|\983096;3\993521%\164480|\SOH\1080654\32149L\DELs\72704/G\161452\&6\1001045T<\US\SO\176234\b\132812}\1056421\7504k\19220\NAK[t\DC2U\SOHIX(\1069119E?9*|-/)3U\ETX\ESCo\SO\1099860\SO\RS\1009682E\te#\DC4m;\DLEfx\SIm\1046538\a\97848\187828\&1\137971Kd\CAN\1042040%\ENQ\173735;\1027791:4kcX\37202!>j\153067hT\DC4\163467~\1060082\995785\1005593\190617\1113881\199\DEL(6r\DC3\145739\EM\ENQx\GS9E\SOH,6\1064646\984090\&5Zv\US\70154)dssy(\NULco.#\"\NAKXW\119053gS_\31565O*\142194\"\1067622&Xt\DC2\r{Fi\48778 ]ZZq\994122:\177062:\1052139U\ESC$zN\SYN9\"\10761\&10b}X'`\190793C\1043334}\r\1111369\1021511*\r\SIk\1062958`E?=`\46022\78512l\1068151*j\36518M\1020065\37308;\159311j&\DC4?#\191316\ACKs[iF:\n\16090\991139\1059764v!b\1112922\1068230\SO\985232\141755\1112084j\DC4A\SYNT\NULNY1\1078882\a\136436\1088153blf_n\DC3\GSB\ETB\11380\50340q\991037-B/B\16269j\178019\ACK\1079155rr7x.x~\151350\DLEcIIK l~\vt8z!)/\24279~?yP1BY\ESC\1044'#7\\(p\159717Xx}\150971\145409x\15522X}8\SIw$\1067337Dy\68912SR\7036\54589\1086756R'\EOT\1016478 \1086591>\1072777\&65\DLE+\EOTm\1097089*vMO,4\24600R\1049889W\991833\FS\EM\154481\":H\SYN_K\v1(\23407\&5g\189510=\ESCY\v||]A3\1090464\&8fI\f\1089249d\27681dw:\53053:e\FSX\140812&\26383\58555\1020960\153568\&6\ETX7?Z8\DC3i\10727\32848U\987253'D>\ACK\1099263\167302n\1084348\SUBe\5445\DC4=F\SI\GS,!jSM\1037019_\n", - cpNewPassword = + newPassword = plainTextPassword6Unsafe "s/\DC3\a\1019919;\186152\DC1\ACKL\NAK\SUB\123639\&0\DLE5\988934\1085942\ENQ]y\n\1088660\EOT%#o\181283k'N\5859\164247\1012481.U+D\ACK\US7^\1106302\DC4&\73089\US46zmN\1078548EX\1100831&hV\147473\&2#B,EY\1062234`\DLE\986448\25566\EOT\EOTv\1060131\1011335\6586\8606[H89oS\141447\v(Isb\DLE\1009984\999533Dv>S\ENQ8\NAK\1013739\31809CBi9C\f\ENQ<\1060837\EM\1002394\RS,/g\1021216\&6S$\CAN\CANTc\145792+~\CAN\38440;P\EOTh\SOH\990223\GS3}j {p\1006877\169025\158467D`\1014376mN-\\V\STX\1106691{\SI\ETB \NAK1#6p\994323~\992677\1043440\&6\1059978Q\\8\ENQ\STX\1011902]ynrf~>n&\6380\94374 m_`\1080547D@\DC2k1,>\1098067v\132299\&6?\ACK\1012654\DC1\SOHjL\16576\&6\USld\1008037\189738\&5\7878w\62207$l\f57\NUL\64524\1073108sg\"Mf\ETBuKPsa\190219zLTtY\136016\&2\"R\18939\66650\FSw\b\167281\US\1065135\50725W/\126507\94452}S\164388;X\EMe`\94080\NULZ-\995401\43858\n\\\EOTy\187923f?\1090882!\SI3\n\ETX0\1046274S\39868T\189058\ENQ\SOHB_{&\FS:\FS\CAN\988362\9506k\1054019N\GSWR_>J?,(\1101196r\1035425\1088638\1003569\43364)\997661\1029696q4U{\21915uqQA/\1036564\1028269 ]4L\100553\29035\25204m\ETX\179784b\64823\1106448\GS\151115\DC4F\1004969G0@6\1077837\DLE\137744BV\1081634l\1081851C\1065998Q*<\SUB4\ENQ\99901\DC1dh\1085582\1100640V\128022\FS\1012025oZ6>\24971I\1046586\&2@I^\DC4B\ETB\ACKmD.\137741`sB\19558\183636L2\DC32;\GS1L;\DEL\141722p/\bCj\47458G\27338SXe\97073Z\ENQf\43154\&2_\6385\SYNr\DC4/C1R\DC2" } @@ -199,10 +199,10 @@ testObject_PasswordChange_provider_16 = testObject_PasswordChange_provider_17 :: PasswordChange testObject_PasswordChange_provider_17 = PasswordChange - { cpOldPassword = + { oldPassword = plainTextPassword6Unsafe "I{A\1081115\1040244WH\t^\1024680\STX\DEL]~D\n9:\NAK\ESCy\1040393$%7?\1048769>bm\DC26V\1065346\16705\ESCQMle,\1015761\21766\1105355\NUL\1020694\GS\v@K\1043881aC\1094072GI\37368\1075187\1079031@W\1038319\1001363\997424\157615\EMa}\SOH\12756\1081169RP\1087906\SImNi\98040.6\14300\35116\STXe2S:X\\y\1027289R1\163603}\1012190\1110662\119901d\146377Xi_\1058064z \185806\47296\28402f#\ACK\b\1018085\fDK>\1092488AV=6\b\DLE\GSi\DC1\SYN\1108215=W$M\1102069\ESC \DC4u\990358Q\FS\78744u)\1056471Qf\US\SOH-\STX,\DELnCr\\[\25698\CAN\ENQ-G\SO7\9176m\RSs5\CAN\NAK\NAK\1081901`-fY\1028198\ETBL\63765\ETBX2[X$B\FS\ESC|\n\SOc\1093611X\NAKW\1010429q\1046880^`CD\DC3SMJ\STX/wR\NAKmB(\EM-\1034880xI\DC4A\1078737\1103535\1083873yw\fn\1057985E\1101283cP1\189927\141738\1011422j\1037710_\NULb>&^\EOT\58470<\r\b\rr#hu.LY,\tS}\ETX=Jz\1113866\78095B[\f(yR\997282\SUB3\140630\DELl\1016964\SYNIa^\50526*\988502\&3z\11825%<\ESCx\48956=H&u=\FSs5_X/\1021976Q\1059092dJ\172609ghu\44563\ESCE>3\1072325\189630Wls=)'NG\1094331r\SYN\DC1%}8%&\154657\&8:\ETBKQ@?>k\1027270\NULb\9895+Xmu\1011506\n\33550-\f\49393\51542\DEL6\1055009\CANw70*;Q\1072772}y#\ACK}\ENQu+2\163564\171133\vTF\v.Pq\DC2`M\174005\96741\&1\SO\njL^sg7\1081135C*\1102887o\1088885{y\52998\ETX|\1023709\EMF\135291vxdQ\137699:\SYN]e\DC3^\SOrv\SUBf[5\NUL6x1E\1005855\1048944\1080103\v\993780\v\DC1\SO\988187\"p\35477k]^/=+\1067771\n\1074075\SUB}A\DEL_8\RS62\ESC\DC2Bk\29783C~S\EM-`\n\186446\EM\NAK]J!p\SUB!Y\SI8m(cS,\176277<\168390\1057601\1082774'\1092313z\989733\ETBwe\1013727\aa\n\59433Fb>A\1088804|\SYN-\STXXz&/'~(cy)hIF\181057\DLE-/XyR\147207\1035531\99846\ENQr[\r\1052642Q\1054366u/r\995938\NUL\ETX\r\tTj\190394\155541d\1046953\DELm\vb'<\1059546\45701@v\53022T5dlF\f\157714gRJ\1037469\995950\1090231\US\62219j\bF\\\v\f]}4[\1091004\&1J5\1101864fM\1002697P}\1109954]xd\44742rn\USi\127844zuK2\64008qwmc\57449\SYN\SUB\r55w5q|\DEL\1004339\DC4\1000580\NAK\\;\97824(d\STX\1069352\126106#\SIeP\1014578pc\b\1006213\78367C\119203\b\DC4#C\183272M_\DC4 EY \140657\STXg\US\rq.\99689._\44617E\ENQ\STX\21293\994346.\1010642\165378s 7p?I\\\1016448NG\1016271\vH.\1011097\&4Hz\DC3a\1112965\1099391LS\956\NULnx\ESCK]\v\1014996\ESC\1001785\DC1<\1059607M)\1103444M\52771o\DLE\FS)6\52537\78102YfQ@F\140229W\NAK+\158031\f_b\999514_p\1026159N\vF\RS\"f0\FS\DEL?#v{\1062480\GS\ETX_p\STX[\170629Qb\37443\&5\1079682b\b\1113122O\987041\r\30653z\GS\1034134I`\ENQ\1074991\ENQ4\NUL|\GS\rt-\FSY\ETXea\164217'\ETX|\25860qY\137837\EOT9Gyz$ME\1012376HF8\1101936\DC4\1040797\&4\DC3d\38807w\EM\1087666PY6$aKV\RSkHNh\ENQ7\b\154234;I-J\1010947rSDa\51431C\157687\SUB\US\SOHV%\ETXB\DC2N\DELGq#Q\173949>\1049166\ETB&\SUB\1027480\&6c{:\NUL\1026276{\tq3\96886\1014266n\DC2C\993425\17816nLR<2bXS\ESCe[l\1097388\fjjZ\1004264w,a\143819\r\SYNL\1049703K\EOT\FS\v(x\141566\1002452\49875l{\986046cp\\\GS>DA*\186399\189082v1`[I\1087573f\160956\&8j\SO\144181n\60434\EOT7jx \v\DC4\SOH-\"\1051346+`\STXF{y56\186936T\17962D\111297^C:F%5B\1113608\183649eU" } @@ -210,10 +210,10 @@ testObject_PasswordChange_provider_17 = testObject_PasswordChange_provider_18 :: PasswordChange testObject_PasswordChange_provider_18 = PasswordChange - { cpOldPassword = + { oldPassword = plainTextPassword6Unsafe "\ENQ>$;GNS\NAKq\178874\58968$-\68366|\151635\70868GG\1069152+N\994629igAv\68290\n\1040872\DC2Tl\ETX\CAN\173661\ETX\161735N\42419v\149562\98179\&9$v$R/\69765U,\a\21766\CAN\ETB\1040043-O\DC1HY\fK\1067449aS6V\NAK\1040221\996914\850D\54816Ke\ACKj!|!\ETBo]Xg)X8P=\ETX\ENQ\RS.b\"xp\1105843\&3i?kTDu\1098220T'.\1071583x%0\DC1+GA$A\45313\a\ETB\ESCa\1028493\1096329+\1019183\1111460\SO\n\SOH\ESC\65042\155997\STX(]\1046910GL\DC2a\151097F\a\168528\fdB\ETB'\165547+\vTf\992507I\1045958\&4r\175158%\RS\999749Xq_*g\994465q\RS\SYN.\1013841 \SYNzQ\NAK\986554:\181318(d0i\1025168Z\1057887\nn\988266sa\61001\SYNx\DEL\170759A\1027650?LZ\CANO\1039286\57543\&8\RS\EOT\992522M:unvs\ACKco/\1103889\61376:$\1017208O0l:\4771j\1071859\NULB\DC4\165947e|\1104789\119138`BCH\92363\&42\59532\999574%Y6\1036574\b|\119002n\1008926\NAK\FSb\EOTso`\DELy7H\1144\SI0\12299B`!\n\EOT#L\51662\1103006|\ESCa\1038787\DLE\r\1067701\&0Y\135747#NKj\1106283\42365\SO,9\ETXh\DLEw\128979R\"(\EOTV\r\14540\&1\989621\DC1yq-e\f\1035089r1YU2\1087695\171952\DC2\SO\1105513\1062941[\1019605_Za\52679\DC2\ENQ\v\1046141\\#\1076425\a\FS\16658b5C&>dt~y)\66452\ETXg\141548@\DC3\182735\ETB*$\DLE\1313UnKs:vVS\1095798m\997335\15618X5f)}@{ha\DC2\f\1041518\ETB-\1054867\t@\STX,\1099907\990571\STXD\1087623\SOH Cm\1004594sDY#YL\1090422;F\156423\v\GS n\a\v\157412c6+,\1004205\EOTH\1063061\33351\vf\1065194-ZS\ACKB\SIFd\buy)\128544\1074733i\1092468/\SOvZw`JB>\RSu}\1107475\1036872\35763%\185556n5\CAN\60703js\1039874\1078173\135796uvW\"\28047h\1043723P\DLE\1097958S-<\187968\34464\186710/wb(\26583\&3\n*kt+\180850\SUB\1021642\1068226x\983171@\DC3\SI\US\\0\NULRA?\SO\RS\189447LuW:Xh1\SOHT\DLE\94916 VOG\DEL\RSO\189514k\3015\1025016;l`g?q_ \1011679\92993\984171~\ny\US\1045482\52577N\1029913\EOT\SIA/j\STX\1084693\DEL\176033\136608m\GS#z(\127161jW[\1038238\1073630\a\1060787\&6\nnn\145137\188550\DC1\1068174\989085t(l;\1017830Sm`tO\r\57362\NUL\1101579|`x\1071012t\153686\EM\163617/\DC2yuB\1072146s_\183212UrcO\99677\1081043\n\41654b\1797\GS^\132600\142485}Q\1109755\DC3G!\1035773\&9L\195083y\2453*\SIU\vk?T\1064435;\f\\Q\RSk\1085726\172950\188191|\6976\1114033Z\155291\tl\NULb%WA\49679r}u2\1059498I\DC3V'i0\158983/Icz\74116\1054934\DLE5L2K.\ESCKLr\DC4\1046820\1052056\STX\\\SYN+\DC4G>\132569>N%R\DEL\vR\\L\1082431*D\SI4u7\DC3AW\STXG\144748e2%y\bw\US\SUBZ4x,\ESC\67889\f\47421\DC2r\1004074r]%ws\DC4]y0\1014309I\993296n\1010689.l\NAKLAv\EOTJ3z@d\27165\42869\t" } @@ -221,10 +221,10 @@ testObject_PasswordChange_provider_18 = testObject_PasswordChange_provider_19 :: PasswordChange testObject_PasswordChange_provider_19 = PasswordChange - { cpOldPassword = + { oldPassword = plainTextPassword6Unsafe ";\93029\64850k{\EM\ETB\183122'\ACK`{2\16834\ETB\DC17\b\aQ}P%O!_^d Tf\STX\177895sQDd\DC1?}\b\NAK\64801!7T\180836L\ENQ\30743\STX\DC3\GS\a\US\1011186\DC2\DEL1EEV(x'\DC1\SUB\1061407\t\GS\ri\1100649\&4*\1060200Fs<3\FS>}Y:\DC2)8+4+\STX\985320\1012240\134405\vl\NUL$\v]rZ~Dy\1045002MF\CANlw\995758x\1076847-I*bE\1065762A\189306\&5\50057c:R^f\\G)\44960\&9\DC4$|\STX\"y\1020665\39604AW =\20322\1091813\&1\1108618'\1051166x\39102\&6U_\997336\ENQ\50873<\1066165*\ENQ\1029616z\186193U\DC1:4a\148141\32437@\135977\177323\&5p\1110836\NAK$[\US\74077.\987765\&7\NUL_\988982\&8\ETX\r\bg+'R\1027482\1029411~E\rP\1034583\r\181175\46544S\\&.^\60125L\1104199L\a\144365G:Wiws\NAKQc\r\164901\b\141361;\999696|Q\23549\&4\1036417\72875y\29622\f_&fGgH[\1029620u\1052069\23938$\ACK\STX}M2y\99985Z&\189182\f\1110805nzK&\1066016w\n\NUL!-U\SOH\ESC7\ETX6\1026958so$\991139\t\138455\DC1A\27842M1\DC3\SO3.Q[Uy\1006799e\1005623\fl\146202\171029W\1104958C\SIk\71104p@$+\ENQr5\1029753\nB(X)Y\62054>\149953%'\180534H\187026\135153s\11937A2MqW/\18450$#I]\137728\&8sv\49908\ESC\1061880t\1103799sB\988567\&5\"\a\128637{t\23482oJA($\RS;\1067956:\SO\98842\128224\v\141160c\992280\"\1037303\95310oQ>\STXyD\186030\1035343\186166g@&\EOT\95865{x0R6\989091tn\12077x\1106050d}\1016609m\DC4bHo{\f\rM\184517\t\137817\147706<\NAK\179286;dz\EOTC9.\CAN\15836V\SUB;\992386\RS\44724Ho\DC2\93805/\1100285\141534\RS\t\1016167c\STX\1023078\1034365\1046848DavSJ\SOH\STXk\NAK.\FS{Z4\1035470\&0j\1013919{\161435\59533{\148113\EMIW\143598\147178_[", - cpNewPassword = + newPassword = plainTextPassword6Unsafe "4)N`WV1t\171789cC\1064787\SUBi\r\181549K.\1026553\EOTpO\USm\172246\&4JS\119270\NUL)bL>\ENQDBd!\SYNc@\SI,Y\30028`M\47712M\SO\8923{\1025087\ETXk.\30014\EOT\1066825`\120441Zu\169464;>\1079442\CAN\1106555\1111972\ETB\51402%\1109382,Zp+\rM~Q\r)Hv#l\168927\FSDHS\174628\999635j\987945\163692eWG\156827\\7\RS\1052535\&9\\\t\DC1t\1112332\1073530`\143677N\1010456h&\188126\1030547b\6757\1027169\1067336\183902[U\136396\991560>\CAN%\nO\78186\24509\b\1052137\&3Za.u\160812T\US\1033241\CAN6VR>P\188486\1062205\1040066!n(\1023327sWSekN@\24878t\985533V\145005\1095963\r+\1017241B*K\ACK\1074664]Ani&\tsuX/a|,,\74249^\129600\SOHty\ESCf\146951\NAK\150050\DC3E\fS\1032730\SOH\3856\SUB:7=\bgux(Q}s\20372]\DLE\r\44488(\1014999\148549\&2E`yqv;=\DC1\985264#{\EOT=l4PE5\181488D\1035492\138684:_a.{\"F[\n#~\1063106\&50K>\bTp\US\DC4K\1084112/zT\186543\991672\&7\150007\1111071X)\DC1\\,\22596%\SUB1\SIA\STX\RS\10664l\135150\1044470:e\SYN\179418a\17938v\34834\ENQj\NAK[\1095674f\177286W\159061\19064\180331\\]\162954&\EOT,6\GS\DLE\v&g\1039892&36\120707\1051886[IO\1066559\ESC\DC4sS\1010996_a><\f\1020047(.Y}%7z\DC2Q\NUL\CAN\1050803v\1028497\US\DC3J\EM\DC1dEh'Em\133130\999811\SIH\FS\120427E\v\1050653,{\190522iQ\1097210\165473k\FS\1112852\&3}6#\1003388 \94215\1112185\n{\vY\ETB\70801\1019457\v|~W{\1035159\8185\1045959'\DLEO!\SO[\DLEUk\23328)\1101657*\1069854B7#\988898`\992584$C\r\SI\1055353\1075772i\121086\1096003e{N\a\US\SYN\7098\1049584\DC1\SYN\164973\1005568^\US\1074252\1056920\FS\180867^6\SYNWPe\nx\1022949:^\SUB[\EOT~u\26460\&7\RS \44431\DC2\23328O\ENQ}zi\1081683d d\166200t\996444\fk\172000r0\1044826\50464*\994866\&1)$j*<\51631\1008420v|F~\1020301\NAKm#^l\EOT\148762\139353\US\GSW\15496^j\DC3\1080990\aA\\.=3J\995313>\95982}.u\STX\989998:sk\ESC\1107636E\ACKBR2o)\STX\7667S(V\"\n\50026dvp\997353f\DC1\DC3\2034\ACK~KH4K\92412'\58542h\1050852k\1045053i&\a~\20933W\1033711{\1058407mp%\1091729H\1011114i\DLEdZ\1104024W\NAKYb%\bXwgAa\1084701/\1060643\ACK\DC4W+h\1089169S~\EOTQzZ~\SO\1094174E\1061848\t*\100572v\STX#\\K\RS\1045046\111171\EM\149568O'\DC2!4]\DC2\163000\ACK\ESC:\59217\NAK>Y|\31158\t\149865\NULuv\1087835\aV\tb\STX7\1095030~#\184376\165077\41742\1035571\US\DLE\13715\v\1079101\NUL\EOT\1064658\136028\ESC`\1005448V?\1069622{x\SO)\DC24n*\997306nsI L\DC2\CANvo\EM\ap_P\tJ-Pk#ui\1049155\159822b[\1067444Yd\180222\35890\42013V|\49216q\1097565\r\CAN(yW?#+E\SO?Y\29463\63850\DC3\DLE3Q$\a'1\1110820%\r\153831@W\26659-\DC4\52370v\DC1\1013997a\r\SUB\NUL\1009250Jz\983893n\986832\133570\5867\163028O\t\ENQ\999543\&8\DLE\38142A\\$\5442\n)\1058130t\178355\166333CE\163128rpj \DC4O|}\72274\150000&1\1012087)\98960\138897\133873\53513", - cpNewPassword = + newPassword = plainTextPassword6Unsafe "\GSATD~\GS\EMK$\1042815h\993958PO\rPp6}vL}Q\SIO?\SO\SYN2!%\140960\98456\14965IQ\SYN\DC3T\DEL\EMb\\n.\EM\v6G)j\NAKo*G\vn\DC1q\DLE4\1057182\190279\FSG\a\1078359\CAN\STX5\US\r\SO&JH\v\v\GS\SOy\FSZ\1087012*\1054369C36Z\100291I\1006927d\167128\136845X\NAK}\vX\13655\ETBE@\1047002}S\DC1\44983:nS\1033701y\1032307\&6\a1\RSF\151742;\78820|\NAK0\1046714\ACK-\DC3'\1052372\t\DC1J\1031338\t\60374\ACK\1100306&\EOT\USfx\1078008\998032ev\t\17415^p\ESC\41380=1de]\988835zK\ETXt\168935\EM_\133793\SI\128297A\GS" } diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/PasswordReset_provider.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/PasswordReset_provider.hs index afccd106599..a652aed54af 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/PasswordReset_provider.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/PasswordReset_provider.hs @@ -23,7 +23,7 @@ import Wire.API.User.Identity (Email (Email, emailDomain, emailLocal)) testObject_PasswordReset_provider_1 :: PasswordReset testObject_PasswordReset_provider_1 = PasswordReset - { nprEmail = + { email = Email { emailLocal = "\1086444\r\1014286bW\1044115\989541\1013077\r\ETX\SOH\ESCj\150487", emailDomain = "sC.\DC2PW" @@ -33,7 +33,7 @@ testObject_PasswordReset_provider_1 = testObject_PasswordReset_provider_2 :: PasswordReset testObject_PasswordReset_provider_2 = PasswordReset - { nprEmail = + { email = Email { emailLocal = "mh\DC1\1112540\a\1111919#\63011e\994580m\122892\189689\161506D]", emailDomain = "\GSJ-0\123200DU~\7828\1089171\NAKF$" @@ -43,7 +43,7 @@ testObject_PasswordReset_provider_2 = testObject_PasswordReset_provider_3 :: PasswordReset testObject_PasswordReset_provider_3 = PasswordReset - { nprEmail = + { email = Email { emailLocal = "-BP\CAN\1007058F\19503\1100657]W\1039512d\138837\1077790\ACK\GS\138454Dy\ESCx\CAN\158675uOU\987404\CAN\1075830\ACK", @@ -53,12 +53,12 @@ testObject_PasswordReset_provider_3 = testObject_PasswordReset_provider_4 :: PasswordReset testObject_PasswordReset_provider_4 = - PasswordReset {nprEmail = Email {emailLocal = "\ETX!\DC4]$Zp", emailDomain = "R\STX\DLEQ"}} + PasswordReset {email = Email {emailLocal = "\ETX!\DC4]$Zp", emailDomain = "R\STX\DLEQ"}} testObject_PasswordReset_provider_5 :: PasswordReset testObject_PasswordReset_provider_5 = PasswordReset - { nprEmail = + { email = Email { emailLocal = "\1008001Mm\145584\FS9` \146161\994039\DLE\150684\ETX\44961]\1047951\27506\&2\SI\ETB\45081", emailDomain = "B\989792{\n\1049497O\EOT,P" @@ -68,7 +68,7 @@ testObject_PasswordReset_provider_5 = testObject_PasswordReset_provider_6 :: PasswordReset testObject_PasswordReset_provider_6 = PasswordReset - { nprEmail = + { email = Email { emailLocal = "\5297\1059611\152727\ETXLv \1037185\&9", emailDomain = @@ -79,7 +79,7 @@ testObject_PasswordReset_provider_6 = testObject_PasswordReset_provider_7 :: PasswordReset testObject_PasswordReset_provider_7 = PasswordReset - { nprEmail = + { email = Email { emailLocal = "\SOH\ETXrra\SOH4|]c&4%#Al\DC2*U\STX\82983m9\SOH\985551UQ\41944\1046828", emailDomain = "1G*\155832f\CANV\996525\15378\98283lR\51561" @@ -88,12 +88,12 @@ testObject_PasswordReset_provider_7 = testObject_PasswordReset_provider_8 :: PasswordReset testObject_PasswordReset_provider_8 = - PasswordReset {nprEmail = Email {emailLocal = "6\1063459C\37237(|\NUL\RS\133203", emailDomain = "\35140\EM\39282"}} + PasswordReset {email = Email {emailLocal = "6\1063459C\37237(|\NUL\RS\133203", emailDomain = "\35140\EM\39282"}} testObject_PasswordReset_provider_9 :: PasswordReset testObject_PasswordReset_provider_9 = PasswordReset - { nprEmail = + { email = Email { emailLocal = "ui0^p\1017396\ETX\994732\DELu<8\"YgWb\bx[\RS},W\v\1043359\32800\SYN", emailDomain = "\b*\1030521\&0>*N`\134311\DC3 t" @@ -102,12 +102,12 @@ testObject_PasswordReset_provider_9 = testObject_PasswordReset_provider_10 :: PasswordReset testObject_PasswordReset_provider_10 = - PasswordReset {nprEmail = Email {emailLocal = "", emailDomain = "$y0=|\GS\1042508E\1079919!tN:"}} + PasswordReset {email = Email {emailLocal = "", emailDomain = "$y0=|\GS\1042508E\1079919!tN:"}} testObject_PasswordReset_provider_11 :: PasswordReset testObject_PasswordReset_provider_11 = PasswordReset - { nprEmail = + { email = Email { emailLocal = "\57466\DLE\SOH\97075\40644K!z|\135037\&0\9622,1,\1083909\&4\\\38025Q", emailDomain = ">Xi\1078572\SOH\DC1:\1037092\180278\166228\SUB[\CAN.+uOgWp" @@ -117,7 +117,7 @@ testObject_PasswordReset_provider_11 = testObject_PasswordReset_provider_12 :: PasswordReset testObject_PasswordReset_provider_12 = PasswordReset - { nprEmail = + { email = Email { emailLocal = "\1068401\168354\128598>", emailDomain = @@ -128,7 +128,7 @@ testObject_PasswordReset_provider_12 = testObject_PasswordReset_provider_13 :: PasswordReset testObject_PasswordReset_provider_13 = PasswordReset - { nprEmail = + { email = Email { emailLocal = "\994700\&5\ACK\132331!\1085699\nVb\1027357nU&\1037025u\169968", emailDomain = "+I\176471q\1064856\SYN\1069753#A\163779\DLE}.\SOHu\1015059" @@ -136,12 +136,12 @@ testObject_PasswordReset_provider_13 = } testObject_PasswordReset_provider_14 :: PasswordReset -testObject_PasswordReset_provider_14 = PasswordReset {nprEmail = Email {emailLocal = "v", emailDomain = "\1090313"}} +testObject_PasswordReset_provider_14 = PasswordReset {email = Email {emailLocal = "v", emailDomain = "\1090313"}} testObject_PasswordReset_provider_15 :: PasswordReset testObject_PasswordReset_provider_15 = PasswordReset - { nprEmail = + { email = Email { emailLocal = "+\150753~\1073496VFc\RS\1102900R\a\ESC4J_\1087106I\f\1043823Dj\DC1\EOT\62142q", emailDomain = "\1020153\138280n\1062475Gh?\vPXOO\v\1092723\DC2" @@ -151,7 +151,7 @@ testObject_PasswordReset_provider_15 = testObject_PasswordReset_provider_16 :: PasswordReset testObject_PasswordReset_provider_16 = PasswordReset - { nprEmail = + { email = Email { emailLocal = "]\1111436Dn\b\NAK\n\17695\167052\ENQ\1024236\&2\r\1069249\1002489\1038720", emailDomain = "%L(\EM\1109782\STXk\EOTo\170961B\18655O*/+", emailDomain = "\48353"} } testObject_PasswordReset_provider_18 :: PasswordReset testObject_PasswordReset_provider_18 = PasswordReset - { nprEmail = + { email = Email { emailLocal = "\FS\1022850\1012117^3\68431*(\1037814\99655", emailDomain = @@ -179,7 +179,7 @@ testObject_PasswordReset_provider_18 = testObject_PasswordReset_provider_19 :: PasswordReset testObject_PasswordReset_provider_19 = PasswordReset - { nprEmail = + { email = Email { emailLocal = "x|\58643\1101318J8\1007195|%\142798'9\1089195\172026\1085440F\1098543xyP\1054659 4,", emailDomain = "!]w6:\SOHd4t(\1103884\1052833$\SOHrl9\9929\120677t8" @@ -189,7 +189,7 @@ testObject_PasswordReset_provider_19 = testObject_PasswordReset_provider_20 :: PasswordReset testObject_PasswordReset_provider_20 = PasswordReset - { nprEmail = + { email = Email { emailLocal = "\39795\&2\SYN)=Xd\155177}o", emailDomain = "4\SUB\188588\1054317g\NUL\1092307\984568Q`\\\SOU\1017696" diff --git a/services/background-worker/src/Wire/BackgroundWorker.hs b/services/background-worker/src/Wire/BackgroundWorker.hs index f6aec92223b..117b135aa6b 100644 --- a/services/background-worker/src/Wire/BackgroundWorker.hs +++ b/services/background-worker/src/Wire/BackgroundWorker.hs @@ -64,7 +64,7 @@ run opts = do -- Close the channel. `extended` will then close the connection, flushing messages to the server. Log.info l $ Log.msg $ Log.val "Closing RabbitMQ channel" Q.closeChannel chan - let server = defaultServer (cs $ opts.backgroundWorker._epHost) opts.backgroundWorker._epPort env.logger env.metrics + let server = defaultServer (cs $ opts.backgroundWorker._host) opts.backgroundWorker._port env.logger env.metrics settings <- newSettings server -- Additional cleanup when shutting down via signals. runSettingsWithCleanup cleanup settings (servantApp env) Nothing diff --git a/services/background-worker/src/Wire/Defederation.hs b/services/background-worker/src/Wire/Defederation.hs index 6f1efbb09bc..e8da0e9366b 100644 --- a/services/background-worker/src/Wire/Defederation.hs +++ b/services/background-worker/src/Wire/Defederation.hs @@ -19,6 +19,7 @@ import Network.HTTP.Types import Servant.Client (BaseUrl (..), ClientEnv, Scheme (Http), mkClientEnv) import System.Logger.Class qualified as Log import Util.Options +import Util.Options qualified as O import Wire.API.Federation.BackendNotifications import Wire.API.Routes.FederationDomainConfig qualified as Fed import Wire.BackgroundWorker.Env @@ -99,8 +100,8 @@ req env dom = defaultRequest { method = methodDelete, secure = False, - host = galley env ^. epHost . to encodeUtf8, - port = galley env ^. epPort . to fromIntegral, + host = galley env ^. O.host . to encodeUtf8, + port = galley env ^. O.port . to fromIntegral, path = "/i/federation/" <> toByteString' dom, requestHeaders = ("Accept", "application/json") : requestHeaders defaultRequest, responseTimeout = defederationTimeout env diff --git a/services/background-worker/test/Test/Wire/Util.hs b/services/background-worker/test/Test/Wire/Util.hs index 51e8ce51b38..d80121fdc69 100644 --- a/services/background-worker/test/Test/Wire/Util.hs +++ b/services/background-worker/test/Test/Wire/Util.hs @@ -6,7 +6,7 @@ import Control.Concurrent.Chan import Imports import Network.HTTP.Client import System.Logger.Class qualified as Logger -import Util.Options +import Util.Options (Endpoint (..)) import Wire.API.Routes.FederationDomainConfig import Wire.BackgroundWorker.Env hiding (federatorInternal, galley) import Wire.BackgroundWorker.Env qualified as E diff --git a/services/brig/src/Brig/API/Federation.hs b/services/brig/src/Brig/API/Federation.hs index ece2d3c737e..c8da1a5e702 100644 --- a/services/brig/src/Brig/API/Federation.hs +++ b/services/brig/src/Brig/API/Federation.hs @@ -102,17 +102,17 @@ getFederationStatus _ request = do Just AllowAll -> pure $ NonConnectedBackends mempty _ -> do fedDomains <- fromList . fmap (.domain) . (.remotes) <$> getFederationRemotes - pure $ NonConnectedBackends (request.dsDomains \\ fedDomains) + pure $ NonConnectedBackends (request.domains \\ fedDomains) sendConnectionAction :: Domain -> NewConnectionRequest -> Handler r NewConnectionResponse sendConnectionAction originDomain NewConnectionRequest {..} = do - active <- lift $ wrapClient $ Data.isActivated ncrTo + active <- lift $ wrapClient $ Data.isActivated to if active then do - self <- qualifyLocal ncrTo - let other = toRemoteUnsafe originDomain ncrFrom + self <- qualifyLocal to + let other = toRemoteUnsafe originDomain from mconnection <- lift . wrapClient $ Data.lookupConnection self (tUntagged other) - maction <- lift $ performRemoteAction self other mconnection ncrAction + maction <- lift $ performRemoteAction self other mconnection action pure $ NewConnectionResponseOk maction else pure NewConnectionResponseUserNotActivated @@ -166,8 +166,8 @@ fedClaimKeyPackages :: Domain -> ClaimKeyPackageRequest -> Handler r (Maybe KeyP fedClaimKeyPackages domain ckpr = isMLSEnabled >>= \case True -> do - ltarget <- qualifyLocal (ckprTarget ckpr) - let rusr = toRemoteUnsafe domain (ckprClaimant ckpr) + ltarget <- qualifyLocal ckpr.target + let rusr = toRemoteUnsafe domain ckpr.claimant lift . fmap hush . runExceptT $ claimLocalKeyPackages (tUntagged rusr) Nothing ltarget False -> pure Nothing @@ -220,12 +220,12 @@ getUserClients _ (GetUserClients uids) = API.lookupLocalPubClientsBulk uids !>> getMLSClients :: Domain -> MLSClientsRequest -> Handler r (Set ClientInfo) getMLSClients _domain mcr = do - Internal.getMLSClients (mcrUserId mcr) (mcrSignatureScheme mcr) + Internal.getMLSClients mcr.userId mcr.signatureScheme onUserDeleted :: Domain -> UserDeletedConnectionsNotification -> (Handler r) EmptyResponse onUserDeleted origDomain udcn = lift $ do - let deletedUser = toRemoteUnsafe origDomain (udcnUser udcn) - connections = udcnConnections udcn + let deletedUser = toRemoteUnsafe origDomain udcn.user + connections = udcn.connections event = pure . UserEvent $ UserDeleted (tUntagged deletedUser) acceptedLocals <- map csv2From diff --git a/services/brig/src/Brig/API/MLS/KeyPackages.hs b/services/brig/src/Brig/API/MLS/KeyPackages.hs index 1b99d97975b..bc297e2c196 100644 --- a/services/brig/src/Brig/API/MLS/KeyPackages.hs +++ b/services/brig/src/Brig/API/MLS/KeyPackages.hs @@ -107,8 +107,8 @@ claimRemoteKeyPackages lusr target = do $ runBrigFederatorClient (tDomain target) $ fedClient @'Brig @"claim-key-packages" $ ClaimKeyPackageRequest - { ckprClaimant = tUnqualified lusr, - ckprTarget = tUnqualified target + { claimant = tUnqualified lusr, + target = tUnqualified target } -- validate and set up mappings for all claimed key packages diff --git a/services/brig/src/Brig/App.hs b/services/brig/src/Brig/App.hs index b5bc4eeed1f..1131a971830 100644 --- a/services/brig/src/Brig/App.hs +++ b/services/brig/src/Brig/App.hs @@ -300,16 +300,15 @@ newEnv o = do where emailConn _ (Opt.EmailAWS aws) = pure (Just aws, Nothing) emailConn lgr (Opt.EmailSMTP s) = do - let host = Opt.smtpEndpoint s ^. epHost - port = Just $ fromInteger $ toInteger $ Opt.smtpEndpoint s ^. epPort + let h = Opt.smtpEndpoint s ^. host + p = Just $ fromInteger $ toInteger $ Opt.smtpEndpoint s ^. port smtpCredentials <- case Opt.smtpCredentials s of - Just (Opt.EmailSMTPCredentials u p) -> do - pass <- initCredentials p - pure $ Just (SMTP.Username u, SMTP.Password pass) + Just (Opt.EmailSMTPCredentials u p') -> do + Just . (SMTP.Username u,) . SMTP.Password <$> initCredentials p' _ -> pure Nothing - smtp <- SMTP.initSMTP lgr host port smtpCredentials (Opt.smtpConnType s) + smtp <- SMTP.initSMTP lgr h p smtpCredentials (Opt.smtpConnType s) pure (Nothing, Just smtp) - mkEndpoint service = RPC.host (encodeUtf8 (service ^. epHost)) . RPC.port (service ^. epPort) $ RPC.empty + mkEndpoint service = RPC.host (encodeUtf8 (service ^. host)) . RPC.port (service ^. port) $ RPC.empty mkIndexEnv :: Opts -> Logger -> Manager -> Metrics -> Endpoint -> IndexEnv mkIndexEnv o lgr mgr mtr galleyEndpoint = @@ -425,21 +424,21 @@ initCassandra :: Opts -> Logger -> IO Cas.ClientState initCassandra o g = do c <- maybe - (Cas.initialContactsPlain (Opt.cassandra o ^. casEndpoint . epHost)) + (Cas.initialContactsPlain (Opt.cassandra o ^. endpoint . host)) (Cas.initialContactsDisco "cassandra_brig" . unpack) (Opt.discoUrl o) p <- Cas.init $ Cas.setLogger (Cas.mkLogger (Log.clone (Just "cassandra.brig") g)) . Cas.setContacts (NE.head c) (NE.tail c) - . Cas.setPortNumber (fromIntegral (Opt.cassandra o ^. casEndpoint . epPort)) - . Cas.setKeyspace (Keyspace (Opt.cassandra o ^. casKeyspace)) + . Cas.setPortNumber (fromIntegral (Opt.cassandra o ^. endpoint . port)) + . Cas.setKeyspace (Keyspace (Opt.cassandra o ^. keyspace)) . Cas.setMaxConnections 4 . Cas.setPoolStripes 4 . Cas.setSendTimeout 3 . Cas.setResponseTimeout 10 . Cas.setProtocolVersion Cas.V4 - . Cas.setPolicy (Cas.dcFilterPolicyIfConfigured g (Opt.cassandra o ^. casFilterNodesByDatacentre)) + . Cas.setPolicy (Cas.dcFilterPolicyIfConfigured g (Opt.cassandra o ^. filterNodesByDatacentre)) $ Cas.defSettings runClient p $ versionCheck schemaVersion pure p diff --git a/services/brig/src/Brig/Provider/API.hs b/services/brig/src/Brig/Provider/API.hs index 9c5cccfce1d..d30876aa078 100644 --- a/services/brig/src/Brig/Provider/API.hs +++ b/services/brig/src/Brig/Provider/API.hs @@ -549,11 +549,11 @@ updateAccountPasswordH (pid ::: req) = do updateAccountPassword :: ProviderId -> Public.PasswordChange -> (Handler r) () updateAccountPassword pid upd = do pass <- wrapClientE (DB.lookupPassword pid) >>= maybeBadCredentials - unless (verifyPassword (cpOldPassword upd) pass) $ + unless (verifyPassword (oldPassword upd) pass) $ throwStd (errorToWai @'E.BadCredentials) - when (verifyPassword (cpNewPassword upd) pass) $ + when (verifyPassword (newPassword upd) pass) $ throwStd newPasswordMustDiffer - wrapClientE $ DB.updateAccountPassword pid (cpNewPassword upd) + wrapClientE $ DB.updateAccountPassword pid (newPassword upd) addServiceH :: Member GalleyProvider r => ProviderId ::: JsonRequest Public.NewService -> (Handler r) Response addServiceH (pid ::: req) = do diff --git a/services/brig/src/Brig/Run.hs b/services/brig/src/Brig/Run.hs index 305a43911cc..f5ecdff2ae2 100644 --- a/services/brig/src/Brig/Run.hs +++ b/services/brig/src/Brig/Run.hs @@ -110,8 +110,8 @@ run o = do Async.cancel authMetrics closeEnv e where - endpoint = brig o - server e = defaultServer (unpack $ endpoint ^. epHost) (endpoint ^. epPort) (e ^. applog) (e ^. metrics) + endpoint' = brig o + server e = defaultServer (unpack $ endpoint' ^. host) (endpoint' ^. port) (e ^. applog) (e ^. metrics) mkApp :: Opts -> IO (Wai.Application, Env) mkApp o = do diff --git a/services/brig/src/Brig/User/Search/Index.hs b/services/brig/src/Brig/User/Search/Index.hs index ea06246298a..812842aef82 100644 --- a/services/brig/src/Brig/User/Search/Index.hs +++ b/services/brig/src/Brig/User/Search/Index.hs @@ -49,17 +49,19 @@ module Brig.User.Search.Index ) where -import Bilge (MonadHttp, expect2xx, header, lbytes) -import Bilge qualified as RPC +import Bilge (expect2xx, header, lbytes, paths) +import Bilge.IO (MonadHttp) +import Bilge.IO qualified as RPC import Bilge.RPC (RPCException (RPCException)) -import Bilge.Request (paths) +import Bilge.Request qualified as RPC (empty, host, method, port) import Bilge.Response (responseJsonThrow) import Bilge.Retry (rpcHandlers) import Brig.Data.Instances () import Brig.Index.Types (CreateIndexSettings (..)) import Brig.Types.Search (SearchVisibilityInbound, defaultSearchVisibilityInbound, searchVisibilityInboundFromFeatureStatus) import Brig.User.Search.Index.Types as Types -import Cassandra qualified as C +import Cassandra.CQL qualified as C +import Cassandra.Exec qualified as C import Cassandra.Util import Control.Lens hiding ((#), (.=)) import Control.Monad.Catch (MonadCatch, MonadMask, MonadThrow, throwM, try) @@ -85,13 +87,13 @@ import Data.Text.Lens hiding (text) import Data.UUID qualified as UUID import Database.Bloodhound qualified as ES import Imports hiding (log, searchable) -import Network.HTTP.Client hiding (path) +import Network.HTTP.Client hiding (host, path, port) import Network.HTTP.Types (StdMethod (POST), hContentType, statusCode) import SAML2.WebSSO.Types qualified as SAML import System.Logger qualified as Log import System.Logger.Class (Logger, MonadLogger (..), field, info, msg, val, (+++), (~~)) import URI.ByteString (URI, serializeURIRef) -import Util.Options (Endpoint, epHost, epPort) +import Util.Options (Endpoint, host, port) import Wire.API.Routes.Internal.Galley.TeamFeatureNoConfigMulti qualified as Multi import Wire.API.Team.Feature (SearchVisibilityInboundConfig, featureNameBS) import Wire.API.User @@ -933,7 +935,7 @@ getTeamSearchVisibilityInboundMulti tids = do Left x -> throwM $ RPCException nm rq x Right x -> pure x where - mkEndpoint service = RPC.host (encodeUtf8 (service ^. epHost)) . RPC.port (service ^. epPort) $ RPC.empty + mkEndpoint service = RPC.host (encodeUtf8 (service ^. host)) . RPC.port (service ^. port) $ RPC.empty x3 :: RetryPolicy x3 = limitRetries 3 <> exponentialBackoff 100000 diff --git a/services/brig/test/integration/API/Federation.hs b/services/brig/test/integration/API/Federation.hs index 0a539e44555..d69cc968046 100644 --- a/services/brig/test/integration/API/Federation.hs +++ b/services/brig/test/integration/API/Federation.hs @@ -134,7 +134,7 @@ testFulltextSearchMultipleUsers opts brig = do update'' :: UserUpdate <- liftIO $ generate arbitrary let update' = update'' {uupName = Just (Name (fromHandle handle))} update = RequestBodyLBS . encode $ update' - put (brig . path "/self" . contentJson . zUser (userId identityThief) . zConn "c" . body update) !!! const 200 === statusCode + put (brig . path "/self" . contentJson . zUser identityThief.userId . zConn "c" . body update) !!! const 200 === statusCode refreshIndex brig @@ -272,9 +272,9 @@ testGetUsersByIdsSuccess :: Brig -> FedClient 'Brig -> Http () testGetUsersByIdsSuccess brig fedBrigClient = do user1 <- randomUser brig user2 <- randomUser brig - let uid1 = userId user1 + let uid1 = user1.userId quid1 = userQualifiedId user1 - uid2 = userId user2 + uid2 = user2.userId quid2 = userQualifiedId user2 profiles <- runFedClient @"get-users-by-ids" fedBrigClient (Domain "example.com") [uid1, uid2] liftIO $ do @@ -287,7 +287,7 @@ testGetUsersByIdsPartial brig fedBrigClient = do absentUserId :: UserId <- Id <$> lift UUIDv4.nextRandom profiles <- runFedClient @"get-users-by-ids" fedBrigClient (Domain "example.com") $ - [userId presentUser, absentUserId] + [presentUser.userId, absentUserId] liftIO $ assertEqual "should return the present user and skip the absent ones" [userQualifiedId presentUser] (profileQualifiedId <$> profiles) @@ -302,7 +302,7 @@ testGetUsersByIdsNoneFound fedBrigClient = do testClaimPrekeySuccess :: Brig -> FedClient 'Brig -> Http () testClaimPrekeySuccess brig fedBrigClient = do user <- randomUser brig - let uid = userId user + let uid = user.userId let new = defNewClient PermanentClientType [head somePrekeys] (head someLastPrekeys) c <- responseJsonError =<< addClient brig uid new mkey <- runFedClient @"claim-prekey" fedBrigClient (Domain "example.com") (uid, clientId c) @@ -351,7 +351,7 @@ addTestClients brig uid idxs = testGetUserClients :: Brig -> FedClient 'Brig -> Http () testGetUserClients brig fedBrigClient = do - uid1 <- userId <$> randomUser brig + uid1 <- (.userId) <$> randomUser brig clients :: [Client] <- addTestClients brig uid1 [0, 1, 2] UserMap userClients <- runFedClient @"get-user-clients" fedBrigClient (Domain "example.com") (GetUserClients [uid1]) liftIO $ @@ -372,10 +372,10 @@ testGetUserClientsNotFound fedBrigClient = do testRemoteUserGetsDeleted :: Opt.Opts -> Brig -> Cannon -> FedClient 'Brig -> Http () testRemoteUserGetsDeleted opts brig cannon fedBrigClient = do - connectedUser <- userId <$> randomUser brig - pendingUser <- userId <$> randomUser brig - blockedUser <- userId <$> randomUser brig - unconnectedUser <- userId <$> randomUser brig + connectedUser <- (.userId) <$> randomUser brig + pendingUser <- (.userId) <$> randomUser brig + blockedUser <- (.userId) <$> randomUser brig + unconnectedUser <- (.userId) <$> randomUser brig remoteUser <- fakeRemoteUser sendConnectionAction brig opts connectedUser remoteUser (Just FedBrig.RemoteConnect) Accepted diff --git a/services/brig/test/integration/API/Internal/Util.hs b/services/brig/test/integration/API/Internal/Util.hs index 4837e7a1019..ab6824f4d76 100644 --- a/services/brig/test/integration/API/Internal/Util.hs +++ b/services/brig/test/integration/API/Internal/Util.hs @@ -30,7 +30,7 @@ module API.Internal.Util where import API.Team.Util (createPopulatedBindingTeamWithNamesAndHandles) -import Bilge +import Bilge hiding (host, port) import Control.Lens (view, (^.)) import Control.Monad.Catch (MonadCatch, MonadThrow, throwM) import Data.ByteString.Base16 qualified as B16 @@ -46,7 +46,7 @@ import Servant.API.ContentTypes (NoContent) import Servant.Client qualified as Client import System.Random (randomIO) import Util -import Util.Options (Endpoint, epHost, epPort) +import Util.Options (Endpoint, host, port) import Wire.API.Connection import Wire.API.Push.V2.Token qualified as PushToken import Wire.API.Routes.Internal.Brig as IAPI @@ -146,5 +146,5 @@ deleteAccountConferenceCallingConfigClient brigep mgr uid = runHereClientM brige runHereClientM :: (HasCallStack, MonadIO m) => Endpoint -> Manager -> Client.ClientM a -> m (Either Client.ClientError a) runHereClientM brigep mgr action = do let env = Client.mkClientEnv mgr baseurl - baseurl = Client.BaseUrl Client.Http (cs $ brigep ^. epHost) (fromIntegral $ brigep ^. epPort) "" + baseurl = Client.BaseUrl Client.Http (cs $ brigep ^. host) (fromIntegral $ brigep ^. port) "" liftIO $ Client.runClientM action env diff --git a/services/brig/test/integration/API/Provider.hs b/services/brig/test/integration/API/Provider.hs index 815bf4025aa..2025bd45e86 100644 --- a/services/brig/test/integration/API/Provider.hs +++ b/services/brig/test/integration/API/Provider.hs @@ -1545,7 +1545,7 @@ testRegisterProvider db' brig = do getProviderActivationCodeInternal brig email Http () testHandleLogin brig = do - usr <- userId <$> randomUser brig + usr <- (.userId) <$> randomUser brig hdl <- randomHandle let update = RequestBodyLBS . encode $ HandleUpdate hdl put (brig . path "/self/handle" . contentJson . zUser usr . zConn "c" . Http.body update) @@ -703,7 +703,7 @@ testLimitRetries conf brig = do testRegularUserLegalHoldLogin :: Brig -> Http () testRegularUserLegalHoldLogin brig = do -- Create a regular user - uid <- userId <$> randomUser brig + uid <- (.userId) <$> randomUser brig -- fail if user is not a team user legalHoldLogin brig (LegalHoldLogin uid (Just defPassword) Nothing) PersistentCookie !!! do const 403 === statusCode @@ -788,7 +788,7 @@ testLegalHoldLogout brig galley = do testEmailSsoLogin :: Brig -> Http () testEmailSsoLogin brig = do -- Create a user - uid <- userId <$> randomUser brig + uid <- (.userId) <$> randomUser brig now <- liftIO getCurrentTime -- Login and do some checks _rs <- @@ -803,7 +803,7 @@ testEmailSsoLogin brig = do testSuspendedSsoLogin :: Brig -> Http () testSuspendedSsoLogin brig = do -- Create a user and immediately suspend them - uid <- userId <$> randomUser brig + uid <- (.userId) <$> randomUser brig setStatus brig uid Suspended -- Try to login and see if we fail ssoLogin brig (SsoLogin uid Nothing) PersistentCookie !!! do @@ -833,7 +833,7 @@ testInvalidCookie z b = do const 403 === statusCode const (Just "Invalid user token") =~= responseBody -- Expired - user <- userId <$> randomUser b + user <- (.userId) <$> randomUser b let f = set (ZAuth.userTTL (Proxy @u)) 0 t <- toByteString' <$> runZAuth z (ZAuth.localSettings f (ZAuth.newUserToken @u user Nothing)) liftIO $ threadDelay 1000000 @@ -845,7 +845,7 @@ testInvalidCookie z b = do testInvalidToken :: ZAuth.Env -> Brig -> Http () testInvalidToken z b = do - user <- userId <$> randomUser b + user <- (.userId) <$> randomUser b t <- toByteString' <$> runZAuth z (ZAuth.newUserToken @ZAuth.User user Nothing) -- Syntactically invalid @@ -1421,7 +1421,7 @@ testLogout b = do testReauthentication :: Brig -> Http () testReauthentication b = do - u <- userId <$> randomUser b + u <- (.userId) <$> randomUser b let js = Http.body . RequestBodyLBS . encode $ object ["foo" .= ("bar" :: Text)] get (b . paths ["/i/users", toByteString' u, "reauthenticate"] . contentJson . js) !!! do const 403 === statusCode diff --git a/services/brig/test/integration/API/User/Connection.hs b/services/brig/test/integration/API/User/Connection.hs index 85260c9d002..972d4ddeda0 100644 --- a/services/brig/test/integration/API/User/Connection.hs +++ b/services/brig/test/integration/API/User/Connection.hs @@ -44,7 +44,7 @@ import Util import Wire.API.Connection import Wire.API.Conversation import Wire.API.Federation.API.Brig -import Wire.API.Federation.API.Galley (GetConversationsRequest (..), GetConversationsResponse (gcresConvs), RemoteConvMembers (rcmOthers), RemoteConversation (rcnvMembers)) +import Wire.API.Federation.API.Galley (GetConversationsRequest (..), GetConversationsResponse (convs), RemoteConvMembers (others), RemoteConversation (members)) import Wire.API.Federation.Component import Wire.API.Routes.Internal.Brig.Connection import Wire.API.Routes.MultiTablePaging @@ -113,7 +113,7 @@ tests cl _at opts p b _c g fedBrigClient fedGalleyClient db = testCreateConnectionInvalidUser :: Brig -> Http () testCreateConnectionInvalidUser brig = do - uid1 <- userId <$> randomUser brig + uid1 <- (.userId) <$> randomUser brig -- user does not exist uid2 <- Id <$> liftIO UUID.nextRandom postConnection brig uid1 uid2 !!! do @@ -142,14 +142,14 @@ testCreateConnectionInvalidUserQualified brig = do testCreateManualConnections :: Brig -> Http () testCreateManualConnections brig = do - uid1 <- userId <$> randomUser brig - uid2 <- userId <$> randomUser brig + uid1 <- (.userId) <$> randomUser brig + uid2 <- (.userId) <$> randomUser brig postConnection brig uid1 uid2 !!! const 201 === statusCode assertConnections brig uid1 [ConnectionStatus uid1 uid2 Sent] assertConnections brig uid2 [ConnectionStatus uid2 uid1 Pending] -- Test that no connections to anonymous users can be created, -- as well as that anonymous users cannot create connections. - uid3 <- userId <$> createAnonUser "foo3" brig + uid3 <- (.userId) <$> createAnonUser "foo3" brig postConnection brig uid1 uid3 !!! const 400 === statusCode postConnection brig uid3 uid1 !!! const 403 === statusCode @@ -168,8 +168,8 @@ testCreateManualConnectionsQualified brig = do testCreateMutualConnections :: Brig -> Galley -> Http () testCreateMutualConnections brig galley = do - uid1 <- userId <$> randomUser brig - uid2 <- userId <$> randomUser brig + uid1 <- (.userId) <$> randomUser brig + uid2 <- (.userId) <$> randomUser brig postConnection brig uid1 uid2 !!! const 201 === statusCode assertConnections brig uid1 [ConnectionStatus uid1 uid2 Sent] assertConnections brig uid2 [ConnectionStatus uid2 uid1 Pending] @@ -210,8 +210,8 @@ testCreateMutualConnectionsQualified brig galley = do testAcceptConnection :: Brig -> Http () testAcceptConnection brig = do - uid1 <- userId <$> randomUser brig - uid2 <- userId <$> randomUser brig + uid1 <- (.userId) <$> randomUser brig + uid2 <- (.userId) <$> randomUser brig -- Initiate a new connection (A -> B) postConnection brig uid1 uid2 !!! const 201 === statusCode -- B accepts @@ -219,7 +219,7 @@ testAcceptConnection brig = do assertConnections brig uid1 [ConnectionStatus uid1 uid2 Accepted] assertConnections brig uid2 [ConnectionStatus uid2 uid1 Accepted] -- Mutual connection request with a user C - uid3 <- userId <$> randomUser brig + uid3 <- (.userId) <$> randomUser brig postConnection brig uid1 uid3 !!! const 201 === statusCode postConnection brig uid3 uid1 !!! const 200 === statusCode assertConnections brig uid1 [ConnectionStatus uid1 uid3 Accepted] @@ -238,8 +238,8 @@ testAcceptConnectionQualified brig = do testIgnoreConnection :: Brig -> Http () testIgnoreConnection brig = do - uid1 <- userId <$> randomUser brig - uid2 <- userId <$> randomUser brig + uid1 <- (.userId) <$> randomUser brig + uid2 <- (.userId) <$> randomUser brig -- Initiate a new connection (A -> B) postConnection brig uid1 uid2 !!! const 201 === statusCode -- B ignores A @@ -267,8 +267,8 @@ testIgnoreConnectionQualified brig = do testCancelConnection :: Brig -> Http () testCancelConnection brig = do - uid1 <- userId <$> randomUser brig - uid2 <- userId <$> randomUser brig + uid1 <- (.userId) <$> randomUser brig + uid2 <- (.userId) <$> randomUser brig -- Initiate a new connection (A -> B) postConnection brig uid1 uid2 !!! const 201 === statusCode -- A cancels the request @@ -296,8 +296,8 @@ testCancelConnectionQualified brig = do testCancelConnection2 :: Brig -> Galley -> Http () testCancelConnection2 brig galley = do - uid1 <- userId <$> randomUser brig - uid2 <- userId <$> randomUser brig + uid1 <- (.userId) <$> randomUser brig + uid2 <- (.userId) <$> randomUser brig -- Initiate a new connection (A -> B) postConnection brig uid1 uid2 !!! const 201 === statusCode -- A cancels the request @@ -373,8 +373,8 @@ testBlockConnection :: Brig -> Http () testBlockConnection brig = do u1 <- randomUser brig u2 <- randomUser brig - let uid1 = userId u1 - let uid2 = userId u2 + let uid1 = u1.userId + let uid2 = u2.userId -- Initiate a new connection (A -> B) postConnection brig uid1 uid2 !!! const 201 === statusCode -- Even connected users cannot see each other's email @@ -418,8 +418,8 @@ testBlockConnectionQualified :: Brig -> Http () testBlockConnectionQualified brig = do u1 <- randomUser brig u2 <- randomUser brig - let uid1 = userId u1 - uid2 = userId u2 + let uid1 = u1.userId + uid2 = u2.userId quid1 = userQualifiedId u1 quid2 = userQualifiedId u2 -- Initiate a new connection (A -> B) @@ -465,8 +465,8 @@ testBlockAndResendConnection :: Brig -> Galley -> Http () testBlockAndResendConnection brig galley = do u1 <- randomUser brig u2 <- randomUser brig - let uid1 = userId u1 - let uid2 = userId u2 + let uid1 = u1.userId + let uid2 = u2.userId -- Initiate a new connection (A -> B) postConnection brig uid1 uid2 !!! const 201 === statusCode -- B blocks A @@ -516,8 +516,8 @@ testBlockAndResendConnectionQualified brig galley = do testUnblockPendingConnection :: Brig -> Http () testUnblockPendingConnection brig = do - u1 <- userId <$> randomUser brig - u2 <- userId <$> randomUser brig + u1 <- (.userId) <$> randomUser brig + u2 <- (.userId) <$> randomUser brig postConnection brig u1 u2 !!! const 201 === statusCode putConnection brig u1 u2 Blocked !!! const 200 === statusCode assertConnections brig u1 [ConnectionStatus u1 u2 Blocked] @@ -539,8 +539,8 @@ testUnblockPendingConnectionQualified brig = do testAcceptWhileBlocked :: Brig -> Http () testAcceptWhileBlocked brig = do - u1 <- userId <$> randomUser brig - u2 <- userId <$> randomUser brig + u1 <- (.userId) <$> randomUser brig + u2 <- (.userId) <$> randomUser brig postConnection brig u1 u2 !!! const 201 === statusCode putConnection brig u1 u2 Blocked !!! const 200 === statusCode assertConnections brig u1 [ConnectionStatus u1 u2 Blocked] @@ -576,8 +576,8 @@ testUpdateConnectionNoopQualified brig = do testBadUpdateConnection :: Brig -> Http () testBadUpdateConnection brig = do - uid1 <- userId <$> randomUser brig - uid2 <- userId <$> randomUser brig + uid1 <- (.userId) <$> randomUser brig + uid2 <- (.userId) <$> randomUser brig postConnection brig uid1 uid2 !!! const 201 === statusCode assertBadUpdate uid1 uid2 Pending assertBadUpdate uid1 uid2 Ignored @@ -606,9 +606,9 @@ testBadUpdateConnectionQualified brig = do testLocalConnectionsPaging :: Brig -> Http () testLocalConnectionsPaging b = do - u <- userId <$> randomUser b + u <- (.userId) <$> randomUser b replicateM_ total $ do - u2 <- userId <$> randomUser b + u2 <- (.userId) <$> randomUser b postConnection b u u2 !!! const 201 === statusCode foldM_ (next u 2) (0, Nothing) [2, 2, 1, 0] foldM_ (next u total) (0, Nothing) [total, 0] @@ -672,21 +672,21 @@ testAllConnectionsPaging b db = do testConnectionLimit :: Brig -> ConnectionLimit -> Http () testConnectionLimit brig (ConnectionLimit l) = do - uid1 <- userId <$> randomUser brig + uid1 <- (.userId) <$> randomUser brig (uid2 : _) <- replicateM (fromIntegral l) (newConn uid1) - uidX <- userId <$> randomUser brig + uidX <- (.userId) <$> randomUser brig postConnection brig uid1 uidX !!! assertLimited -- blocked connections do not count towards the limit putConnection brig uid1 uid2 Blocked !!! const 200 === statusCode postConnection brig uid1 uidX !!! const 201 === statusCode -- the next send/accept hits the limit again - uidY <- userId <$> randomUser brig + uidY <- (.userId) <$> randomUser brig postConnection brig uid1 uidY !!! assertLimited -- (re-)sending an already accepted connection does not affect the limit postConnection brig uid1 uidX !!! const 200 === statusCode where newConn from = do - to <- userId <$> randomUser brig + to <- (.userId) <$> randomUser brig postConnection brig from to !!! const 201 === statusCode pure to assertLimited = do @@ -737,7 +737,7 @@ testConnectOK brig galley fedBrigClient = do testConnectWithAnon :: Brig -> FedClient 'Brig -> Http () testConnectWithAnon brig fedBrigClient = do fromUser <- randomId - toUser <- userId <$> createAnonUser "anon1234" brig + toUser <- (.userId) <$> createAnonUser "anon1234" brig res <- runFedClient @"send-connection-action" fedBrigClient (Domain "far-away.example.com") $ NewConnectionRequest fromUser toUser RemoteConnect @@ -746,7 +746,7 @@ testConnectWithAnon brig fedBrigClient = do testConnectFromAnon :: Brig -> Http () testConnectFromAnon brig = do - anonUser <- userId <$> createAnonUser "anon1234" brig + anonUser <- (.userId) <$> createAnonUser "anon1234" brig remoteUser <- fakeRemoteUser postConnectionQualified brig anonUser remoteUser !!! const 403 === statusCode @@ -790,13 +790,13 @@ testConnectMutualRemoteActionThenLocalAction opts brig fedBrigClient fedGalleyCl let request = GetConversationsRequest - { gcrUserId = qUnqualified quid2, - gcrConvIds = [qUnqualified convId] + { userId = qUnqualified quid2, + convIds = [qUnqualified convId] } res <- runFedClient @"get-conversations" fedGalleyClient (qDomain quid2) request liftIO $ - fmap (fmap omQualifiedId . rcmOthers . rcnvMembers) (gcresConvs res) @?= [[]] + fmap (fmap omQualifiedId . others . members) res.convs @?= [[]] -- The mock response has 'RemoteConnect' as action, because the remote backend -- cannot be sure if the local backend was previously in Ignored state or not diff --git a/services/brig/test/integration/Main.hs b/services/brig/test/integration/Main.hs index aafb086f845..dcdef16cd5a 100644 --- a/services/brig/test/integration/Main.hs +++ b/services/brig/test/integration/Main.hs @@ -36,7 +36,8 @@ import API.TeamUserSearch qualified as TeamUserSearch import API.User qualified as User import API.UserPendingActivation qualified as UserPendingActivation import API.Version qualified -import Bilge hiding (header) +import Bilge hiding (header, host, port) +import Bilge qualified import Brig.API (sitemap) import Brig.AWS qualified as AWS import Brig.CanonicalInterpreter @@ -131,9 +132,9 @@ runTests iConf brigOpts otherArgs = do Opts.TurnSourceFiles files -> files Opts.TurnSourceDNS _ -> error "The integration tests can only be run when TurnServers are sourced from files" localDomain = brigOpts ^. Opts.optionSettings . Opts.federationDomain - casHost = (\v -> Opts.cassandra v ^. casEndpoint . epHost) brigOpts - casPort = (\v -> Opts.cassandra v ^. casEndpoint . epPort) brigOpts - casKey = (\v -> Opts.cassandra v ^. casKeyspace) brigOpts + casHost = (\v -> Opts.cassandra v ^. endpoint . host) brigOpts + casPort = (\v -> Opts.cassandra v ^. endpoint . port) brigOpts + casKey = (\v -> Opts.cassandra v ^. keyspace) brigOpts awsOpts = Opts.aws brigOpts lg <- Logger.new Logger.defSettings -- TODO: use mkLogger'? db <- defInitCassandra casKey casHost casPort lg @@ -193,9 +194,9 @@ runTests iConf brigOpts otherArgs = do federationEnd2End ] where - mkRequest (Endpoint h p) = host (encodeUtf8 h) . port p + mkRequest (Endpoint h p) = Bilge.host (encodeUtf8 h) . Bilge.port p - mkVersionedRequest endpoint = maybeAddPrefix . mkRequest endpoint + mkVersionedRequest ep = maybeAddPrefix . mkRequest ep maybeAddPrefix :: Request -> Request maybeAddPrefix r = case pathSegments $ getUri r of diff --git a/services/brig/test/integration/Util.hs b/services/brig/test/integration/Util.hs index d9a5bf5e976..3c7ee83324a 100644 --- a/services/brig/test/integration/Util.hs +++ b/services/brig/test/integration/Util.hs @@ -22,7 +22,7 @@ module Util where -import Bilge +import Bilge hiding (host, port) import Bilge.Assert import Brig.AWS.Types import Brig.App (applog, fsWatcher, sftEnv, turnEnv) @@ -176,14 +176,14 @@ runFedClient :: FedClient comp -> Domain -> Servant.Client Http api -runFedClient (FedClient mgr endpoint) domain = +runFedClient (FedClient mgr ep) domain = Servant.hoistClient (Proxy @api) (servantClientMToHttp domain) $ Servant.clientIn (Proxy @api) (Proxy @Servant.ClientM) where servantClientMToHttp :: Domain -> Servant.ClientM a -> Http a servantClientMToHttp originDomain action = liftIO $ do - let brigHost = Text.unpack $ endpoint ^. epHost - brigPort = fromInteger . toInteger $ endpoint ^. epPort + let brigHost = Text.unpack $ ep ^. host + brigPort = fromInteger . toInteger $ ep ^. port baseUrl = Servant.BaseUrl Servant.Http brigHost brigPort "/federation" clientEnv = Servant.ClientEnv mgr baseUrl Nothing (makeClientRequest originDomain) eitherRes <- Servant.runClientM action clientEnv diff --git a/services/cargohold/src/CargoHold/API/Federation.hs b/services/cargohold/src/CargoHold/API/Federation.hs index 934aedca3f4..f5cbf4b3f62 100644 --- a/services/cargohold/src/CargoHold/API/Federation.hs +++ b/services/cargohold/src/CargoHold/API/Federation.hs @@ -45,13 +45,13 @@ federationSitemap = checkAsset :: F.GetAsset -> Handler Bool checkAsset ga = fmap isJust . runMaybeT $ - checkMetadata Nothing (F.gaKey ga) (F.gaToken ga) + checkMetadata Nothing (F.key ga) (F.token ga) streamAsset :: Domain -> F.GetAsset -> Handler AssetSource streamAsset _ ga = do available <- checkAsset ga unless available (throwE assetNotFound) - AssetSource <$> S3.downloadV3 (F.gaKey ga) + AssetSource <$> S3.downloadV3 (F.key ga) getAsset :: Domain -> F.GetAsset -> Handler F.GetAssetResponse getAsset _ = fmap F.GetAssetResponse . checkAsset diff --git a/services/cargohold/src/CargoHold/API/V3.hs b/services/cargohold/src/CargoHold/API/V3.hs index 8491f39db24..d96d772d5ce 100644 --- a/services/cargohold/src/CargoHold/API/V3.hs +++ b/services/cargohold/src/CargoHold/API/V3.hs @@ -69,8 +69,8 @@ upload own bdy = do let cl = fromIntegral $ hdrLength hdrs when (cl <= 0) $ throwE invalidLength - maxTotalBytes <- view (settings . setMaxTotalBytes) - when (cl > maxTotalBytes) $ + maxBytes <- view (CargoHold.App.settings . maxTotalBytes) + when (cl > maxBytes) $ throwE assetTooLarge ast <- liftIO $ Id <$> nextRandom tok <- if sets ^. V3.setAssetPublic then pure Nothing else Just <$> randToken @@ -172,7 +172,7 @@ metadataHeaders = cl <- contentLength hdrs pure (ct, cl) -assetHeaders :: Parser AssetHeaders +assetHeaders :: Parser CargoHold.Types.V3.AssetHeaders assetHeaders = eol *> boundary @@ -180,7 +180,7 @@ assetHeaders = <* eol where go hdrs = - AssetHeaders + CargoHold.Types.V3.AssetHeaders <$> contentType hdrs <*> contentLength hdrs diff --git a/services/cargohold/src/CargoHold/AWS.hs b/services/cargohold/src/CargoHold/AWS.hs index 39301e7fee1..4593fa6d7d3 100644 --- a/services/cargohold/src/CargoHold/AWS.hs +++ b/services/cargohold/src/CargoHold/AWS.hs @@ -44,7 +44,7 @@ import Amazonka (AWSRequest, AWSResponse) import qualified Amazonka as AWS import qualified Amazonka.S3 as S3 import CargoHold.CloudFront -import CargoHold.Options +import CargoHold.Options hiding (cloudFront, s3Bucket) import Conduit import Control.Lens hiding ((.=)) import Control.Monad.Catch @@ -116,7 +116,7 @@ mkEnv lgr s3End s3AddrStyle s3Download bucket cfOpts mgr = do cf <- mkCfEnv cfOpts pure (Env g bucket e s3Download cf) where - mkCfEnv (Just o) = Just <$> initCloudFront (o ^. cfPrivateKey) (o ^. cfKeyPairId) 300 (o ^. cfDomain) + mkCfEnv (Just o) = Just <$> initCloudFront (o ^. privateKey) (o ^. keyPairId) 300 (o ^. domain) mkCfEnv Nothing = pure Nothing mkAwsEnv g s3 = do baseEnv <- @@ -172,7 +172,7 @@ exec :: (Text -> r) -> m (AWSResponse r) exec env request = do - let req = request (_s3Bucket env) + let req = request env._s3Bucket resp <- execute env (sendCatch (env ^. amazonkaEnv) req) case resp of Left err -> do @@ -191,7 +191,7 @@ execStream :: (Text -> r) -> ResourceT IO (AWSResponse r) execStream env request = do - let req = request (_s3Bucket env) + let req = request env._s3Bucket resp <- sendCatch (env ^. amazonkaEnv) req case resp of Left err -> do @@ -210,7 +210,7 @@ execCatch :: (Text -> r) -> m (Maybe (AWSResponse r)) execCatch env request = do - let req = request (_s3Bucket env) + let req = request env._s3Bucket resp <- execute env (retrying retry5x (const canRetry) (const (sendCatch (env ^. amazonkaEnv) req))) case resp of Left err -> do diff --git a/services/cargohold/src/CargoHold/App.hs b/services/cargohold/src/CargoHold/App.hs index de2a6777a08..b8d4b9c6e8d 100644 --- a/services/cargohold/src/CargoHold/App.hs +++ b/services/cargohold/src/CargoHold/App.hs @@ -53,7 +53,8 @@ import Bilge (Manager, MonadHttp, RequestId (..), newManager, withResponse) import qualified Bilge import Bilge.RPC (HasRequestId (..)) import qualified CargoHold.AWS as AWS -import CargoHold.Options as Opt +import CargoHold.Options (AWSOpts, Opts, S3Compatibility (..)) +import qualified CargoHold.Options as Opt import Control.Error (ExceptT, exceptT) import Control.Exception (throw) import Control.Lens (Lens', makeLenses, non, view, (?~), (^.)) @@ -93,18 +94,18 @@ data Env = Env makeLenses ''Env settings :: Lens' Env Opt.Settings -settings = options . optSettings +settings = options . Opt.settings newEnv :: Opts -> IO Env newEnv o = do met <- Metrics.metrics - lgr <- Log.mkLogger (o ^. optLogLevel) (o ^. optLogNetStrings) (o ^. optLogFormat) + lgr <- Log.mkLogger (o ^. Opt.logLevel) (o ^. Opt.logNetStrings) (o ^. Opt.logFormat) checkOpts o lgr - mgr <- initHttpManager (o ^. optAws . awsS3Compatibility) + mgr <- initHttpManager (o ^. Opt.aws . Opt.s3Compatibility) h2mgr <- initHttp2Manager - ama <- initAws (o ^. optAws) lgr mgr + ama <- initAws (o ^. Opt.aws) lgr mgr multiIngressAWS <- initMultiIngressAWS lgr mgr - let loc = toLocalUnsafe (o ^. optSettings . Opt.setFederationDomain) () + let loc = toLocalUnsafe (o ^. Opt.settings . Opt.federationDomain) () pure $ Env ama met lgr mgr h2mgr def o loc multiIngressAWS where initMultiIngressAWS :: Logger -> Manager -> IO (Map String AWS.Env) @@ -114,10 +115,10 @@ newEnv o = do ( \(k, v) -> initAws (patchS3DownloadEndpoint v) lgr mgr >>= \v' -> pure (k, v') ) - (Map.assocs (o ^. optAws . Opt.optMultiIngress . non Map.empty)) + (Map.assocs (o ^. Opt.aws . Opt.multiIngress . non Map.empty)) patchS3DownloadEndpoint :: AWSEndpoint -> AWSOpts - patchS3DownloadEndpoint endpoint = (o ^. optAws) & awsS3DownloadEndpoint ?~ endpoint + patchS3DownloadEndpoint e = (o ^. Opt.aws) & Opt.s3DownloadEndpoint ?~ e -- | Validate (some) options (`Opts`) -- @@ -134,19 +135,19 @@ checkOpts opts lgr = do error errorMsg where multiIngressConfigured :: Bool - multiIngressConfigured = (not . null) (opts ^. (optAws . Opt.optMultiIngress . non Map.empty)) + multiIngressConfigured = (not . null) (opts ^. (Opt.aws . Opt.multiIngress . non Map.empty)) cloudFrontConfigured :: Bool - cloudFrontConfigured = isJust (opts ^. (optAws . Opt.awsCloudFront)) + cloudFrontConfigured = isJust (opts ^. (Opt.aws . Opt.cloudFront)) singleAwsDownloadEndpointConfigured :: Bool - singleAwsDownloadEndpointConfigured = isJust (opts ^. (optAws . Opt.awsS3DownloadEndpoint)) + singleAwsDownloadEndpointConfigured = isJust (opts ^. (Opt.aws . Opt.s3DownloadEndpoint)) initAws :: AWSOpts -> Logger -> Manager -> IO AWS.Env -initAws o l = AWS.mkEnv l (o ^. awsS3Endpoint) addrStyle downloadEndpoint (o ^. awsS3Bucket) (o ^. awsCloudFront) +initAws o l = AWS.mkEnv l (o ^. Opt.s3Endpoint) addrStyle downloadEndpoint (o ^. Opt.s3Bucket) (o ^. Opt.cloudFront) where - downloadEndpoint = fromMaybe (o ^. awsS3Endpoint) (o ^. awsS3DownloadEndpoint) - addrStyle = maybe S3AddressingStylePath unwrapS3AddressingStyle (o ^. awsS3AddressingStyle) + downloadEndpoint = fromMaybe (o ^. Opt.s3Endpoint) (o ^. Opt.s3DownloadEndpoint) + addrStyle = maybe S3AddressingStylePath Opt.unwrapS3AddressingStyle (o ^. Opt.s3AddressingStyle) initHttpManager :: Maybe S3Compatibility -> IO Manager initHttpManager s3Compat = diff --git a/services/cargohold/src/CargoHold/Federation.hs b/services/cargohold/src/CargoHold/Federation.hs index 5517e0dce0f..d1d57d0a5bf 100644 --- a/services/cargohold/src/CargoHold/Federation.hs +++ b/services/cargohold/src/CargoHold/Federation.hs @@ -56,12 +56,12 @@ downloadRemoteAsset :: downloadRemoteAsset usr rkey tok = do let ga = GetAsset - { gaKey = tUnqualified rkey, - gaUser = tUnqualified usr, - gaToken = tok + { key = tUnqualified rkey, + user = tUnqualified usr, + token = tok } exists <- - fmap gaAvailable . executeFederated rkey $ + fmap available . executeFederated rkey $ fedClient @'Cargohold @"get-asset" ga if exists then @@ -77,7 +77,7 @@ mkFederatorClientEnv :: Remote x -> Handler FederatorClientEnv mkFederatorClientEnv remote = do loc <- view localUnit endpoint <- - view (options . optFederator) + view (options . federator) >>= maybe (throwE federationNotConfigured) pure mgr <- view http2Manager pure diff --git a/services/cargohold/src/CargoHold/Options.hs b/services/cargohold/src/CargoHold/Options.hs index 9741c3b9e85..4f99c8300ad 100644 --- a/services/cargohold/src/CargoHold/Options.hs +++ b/services/cargohold/src/CargoHold/Options.hs @@ -35,11 +35,11 @@ import Wire.API.Routes.Version -- | AWS CloudFront settings. data CloudFrontOpts = CloudFrontOpts { -- | Domain - _cfDomain :: CF.Domain, + _domain :: CF.Domain, -- | Keypair ID - _cfKeyPairId :: CF.KeyPairId, + _keyPairId :: CF.KeyPairId, -- | Path to private key - _cfPrivateKey :: FilePath + _privateKey :: FilePath } deriving (Show, Generic) @@ -62,7 +62,7 @@ instance FromJSON OptS3AddressingStyle where other -> fail $ "invalid S3AddressingStyle: " <> show other data AWSOpts = AWSOpts - { _awsS3Endpoint :: !AWSEndpoint, + { _s3Endpoint :: !AWSEndpoint, -- | S3 can either by addressed in path style, i.e. -- https:////, or vhost style, i.e. -- https://./. AWS's S3 offering has @@ -88,18 +88,18 @@ data AWSOpts = AWSOpts -- -- When this option is unspecified, we default to path style addressing to -- ensure smooth transition for older deployments. - _awsS3AddressingStyle :: !(Maybe OptS3AddressingStyle), + _s3AddressingStyle :: !(Maybe OptS3AddressingStyle), -- | S3 endpoint for generating download links. Useful if Cargohold is configured to use -- an S3 replacement running inside the internal network (in which case internally we -- would use one hostname for S3, and when generating an asset link for a client app, we -- would use another hostname). - _awsS3DownloadEndpoint :: !(Maybe AWSEndpoint), + _s3DownloadEndpoint :: !(Maybe AWSEndpoint), -- | S3 bucket name - _awsS3Bucket :: !Text, + _s3Bucket :: !Text, -- | Enable this option for compatibility with specific S3 backends. - _awsS3Compatibility :: !(Maybe S3Compatibility), + _s3Compatibility :: !(Maybe S3Compatibility), -- | AWS CloudFront options - _awsCloudFront :: !(Maybe CloudFrontOpts), + _cloudFront :: !(Maybe CloudFrontOpts), -- | @Z-Host@ header to s3 download endpoint `Map` -- -- This logic is: If the @Z-Host@ header is provided and found in this map, @@ -107,7 +107,7 @@ data AWSOpts = AWSOpts -- otherwise, `_awsS3DownloadEndpoint` is used. This option is only useful -- in the context of multi-ingress setups where one backend / deployment is -- reachable under several domains. - _optMultiIngress :: !(Maybe (Map String AWSEndpoint)) + _multiIngress :: !(Maybe (Map String AWSEndpoint)) } deriving (Show, Generic) @@ -128,9 +128,9 @@ makeLenses ''AWSOpts data Settings = Settings { -- | Maximum allowed size for uploads, in bytes - _setMaxTotalBytes :: !Int, + _maxTotalBytes :: !Int, -- | TTL for download links, in seconds - _setDownloadLinkTTL :: !Word, + _downloadLinkTTL :: !Word, -- | FederationDomain is required, even when not wanting to federate with other backends -- (in that case the 'allowedDomains' can be set to empty in Federator) -- Federation domain is used to qualify local IDs and handles, @@ -141,8 +141,8 @@ data Settings = Settings -- Remember to keep it the same in all services. -- This is referred to as the 'backend domain' in the public documentation; See -- https://docs.wire.com/how-to/install/configure-federation.html#choose-a-backend-domain-name - _setFederationDomain :: !Domain, - _setDisabledAPIVersions :: !(Maybe (Set Version)) + _federationDomain :: !Domain, + _disabledAPIVersions :: !(Maybe (Set Version)) } deriving (Show, Generic) @@ -154,19 +154,19 @@ makeLenses ''Settings -- modify the behavior. data Opts = Opts { -- | Hostname and port to bind to - _optCargohold :: !Endpoint, - _optAws :: !AWSOpts, - _optSettings :: !Settings, + _cargohold :: !Endpoint, + _aws :: !AWSOpts, + _settings :: !Settings, -- | Federator endpoint - _optFederator :: Maybe Endpoint, + _federator :: Maybe Endpoint, -- Logging -- | Log level (Debug, Info, etc) - _optLogLevel :: !Level, + _logLevel :: !Level, -- | Use netstrings encoding: -- - _optLogNetStrings :: !(Maybe (Last Bool)), - _optLogFormat :: !(Maybe (Last LogFormat)) --- ^ Log format + _logNetStrings :: !(Maybe (Last Bool)), + _logFormat :: !(Maybe (Last LogFormat)) --- ^ Log format } deriving (Show, Generic) diff --git a/services/cargohold/src/CargoHold/Run.hs b/services/cargohold/src/CargoHold/Run.hs index ae393ced1ca..556cabf3679 100644 --- a/services/cargohold/src/CargoHold/Run.hs +++ b/services/cargohold/src/CargoHold/Run.hs @@ -27,8 +27,8 @@ import qualified Amazonka as AWS import CargoHold.API.Federation import CargoHold.API.Public import CargoHold.AWS (amazonkaEnv) -import CargoHold.App -import CargoHold.Options +import CargoHold.App hiding (settings) +import CargoHold.Options hiding (aws) import Control.Exception (bracket) import Control.Lens (set, (^.)) import Control.Monad.Codensity @@ -65,8 +65,8 @@ run o = lowerCodensity $ do s <- Server.newSettings $ defaultServer - (unpack $ o ^. optCargohold . epHost) - (o ^. optCargohold . epPort) + (unpack $ o ^. cargohold . host) + (o ^. cargohold . port) (e ^. appLogger) (e ^. metrics) runSettingsWithShutdown s app Nothing @@ -78,7 +78,7 @@ mkApp o = Codensity $ \k -> where middleware :: Env -> Wai.Middleware middleware e = - versionMiddleware (fold (o ^. optSettings . setDisabledAPIVersions)) + versionMiddleware (fold (o ^. settings . disabledAPIVersions)) . servantPrometheusMiddleware (Proxy @CombinedAPI) . GZip.gzip GZip.def . catchErrors (e ^. appLogger) [Right $ e ^. metrics] @@ -87,7 +87,7 @@ mkApp o = Codensity $ \k -> let e = set requestId (maybe def RequestId (lookupRequestId r)) e0 in Servant.serveWithContext (Proxy @CombinedAPI) - ((o ^. optSettings . setFederationDomain) :. Servant.EmptyContext) + ((o ^. settings . federationDomain) :. Servant.EmptyContext) ( hoistServerWithDomain @FederationAPI (toServantHandler e) federationSitemap :<|> hoistServerWithDomain @ServantAPI (toServantHandler e) servantSitemap :<|> hoistServerWithDomain @InternalAPI (toServantHandler e) internalSitemap diff --git a/services/cargohold/src/CargoHold/S3.hs b/services/cargohold/src/CargoHold/S3.hs index 44ccb280ed0..72695f0f477 100644 --- a/services/cargohold/src/CargoHold/S3.hs +++ b/services/cargohold/src/CargoHold/S3.hs @@ -43,7 +43,7 @@ import CargoHold.API.Error import CargoHold.AWS (amazonkaEnvWithDownloadEndpoint) import qualified CargoHold.AWS as AWS import CargoHold.App hiding (Env, Handler) -import CargoHold.Options +import CargoHold.Options (downloadLinkTTL) import qualified CargoHold.Types.V3 as V3 import qualified Codec.MIME.Parse as MIME import qualified Codec.MIME.Type as MIME @@ -218,7 +218,7 @@ signedURL path mbHost = do e <- awsEnvForHost let b = view AWS.s3Bucket e now <- liftIO getCurrentTime - ttl <- view (settings . setDownloadLinkTTL) + ttl <- view (settings . downloadLinkTTL) let req = newGetObject (BucketName b) (ObjectKey . Text.decodeLatin1 $ toByteString' path) signed <- presignURL (amazonkaEnvWithDownloadEndpoint e) now (Seconds (fromIntegral ttl)) req diff --git a/services/cargohold/test/integration/API.hs b/services/cargohold/test/integration/API.hs index 88f733e763e..781cbe125e1 100644 --- a/services/cargohold/test/integration/API.hs +++ b/services/cargohold/test/integration/API.hs @@ -23,7 +23,7 @@ import API.Util import Bilge hiding (body) import Bilge.Assert import CargoHold.API.Error -import CargoHold.Options (awsS3DownloadEndpoint, optAws) +import CargoHold.Options (aws, s3DownloadEndpoint) import CargoHold.Types import qualified CargoHold.Types.V3 as V3 import qualified Codec.MIME.Type as MIME @@ -228,7 +228,7 @@ testDownloadURLOverride = do -- This is a .example domain, it shouldn't resolve. But it is also not -- supposed to be used by cargohold to make connections. let downloadEndpoint = "external-s3-url.example" - withSettingsOverrides (optAws . awsS3DownloadEndpoint ?~ AWSEndpoint downloadEndpoint True 443) $ do + withSettingsOverrides (aws . s3DownloadEndpoint ?~ AWSEndpoint downloadEndpoint True 443) $ do uid <- liftIO $ Id <$> nextRandom -- Upload, should work, shouldn't try to use the S3DownloadEndpoint diff --git a/services/cargohold/test/integration/API/Federation.hs b/services/cargohold/test/integration/API/Federation.hs index 6e25283ea02..29c2d63992b 100644 --- a/services/cargohold/test/integration/API/Federation.hs +++ b/services/cargohold/test/integration/API/Federation.hs @@ -77,13 +77,13 @@ testGetAssetAvailable isPublicAsset = do let key = view assetKey ast let ga = GetAsset - { gaUser = uid, - gaToken = tok, - gaKey = qUnqualified key + { user = uid, + token = tok, + key = qUnqualified key } ok <- withFederationClient $ - gaAvailable <$> runFederationClient (unsafeFedClientIn @'Cargohold @"get-asset" ga) + available <$> runFederationClient (unsafeFedClientIn @'Cargohold @"get-asset" ga) -- check that asset is available liftIO $ ok @?= True @@ -97,13 +97,13 @@ testGetAssetNotAvailable = do let key = AssetKeyV3 assetId AssetPersistent let ga = GetAsset - { gaUser = uid, - gaToken = Just token, - gaKey = key + { user = uid, + token = Just token, + key = key } ok <- withFederationClient $ - gaAvailable <$> runFederationClient (unsafeFedClientIn @'Cargohold @"get-asset" ga) + available <$> runFederationClient (unsafeFedClientIn @'Cargohold @"get-asset" ga) -- check that asset is not available liftIO $ ok @?= False @@ -124,13 +124,13 @@ testGetAssetWrongToken = do let key = view assetKey ast let ga = GetAsset - { gaUser = uid, - gaToken = Just tok, - gaKey = qUnqualified key + { user = uid, + token = Just tok, + key = qUnqualified key } ok <- withFederationClient $ - gaAvailable <$> runFederationClient (unsafeFedClientIn @'Cargohold @"get-asset" ga) + available <$> runFederationClient (unsafeFedClientIn @'Cargohold @"get-asset" ga) -- check that asset is not available liftIO $ ok @?= False @@ -156,9 +156,9 @@ testLargeAsset = do let key = view assetKey ast let ga = GetAsset - { gaUser = uid, - gaToken = tok, - gaKey = qUnqualified key + { user = uid, + token = tok, + key = qUnqualified key } chunks <- withFederationClient $ do source <- getAssetSource <$> runFederationClient (unsafeFedClientIn @'Cargohold @"stream-asset" ga) @@ -188,9 +188,9 @@ testStreamAsset = do let key = view assetKey ast let ga = GetAsset - { gaUser = uid, - gaToken = tok, - gaKey = qUnqualified key + { user = uid, + token = tok, + key = qUnqualified key } respBody <- withFederationClient $ do source <- getAssetSource <$> runFederationClient (unsafeFedClientIn @'Cargohold @"stream-asset" ga) @@ -206,9 +206,9 @@ testStreamAssetNotAvailable = do let key = AssetKeyV3 assetId AssetPersistent let ga = GetAsset - { gaUser = uid, - gaToken = Just token, - gaKey = key + { user = uid, + token = Just token, + key = key } err <- withFederationError $ do runFederationClient (unsafeFedClientIn @'Cargohold @"stream-asset" ga) @@ -232,9 +232,9 @@ testStreamAssetWrongToken = do let key = view assetKey ast let ga = GetAsset - { gaUser = uid, - gaToken = Just tok, - gaKey = qUnqualified key + { user = uid, + token = Just tok, + key = qUnqualified key } err <- withFederationError $ do runFederationClient (unsafeFedClientIn @'Cargohold @"stream-asset" ga) diff --git a/services/cargohold/test/integration/API/Util.hs b/services/cargohold/test/integration/API/Util.hs index 3c1994a8af8..4f0b2c1c746 100644 --- a/services/cargohold/test/integration/API/Util.hs +++ b/services/cargohold/test/integration/API/Util.hs @@ -17,7 +17,7 @@ module API.Util where -import Bilge hiding (body) +import Bilge hiding (body, host, port) import CargoHold.Options import CargoHold.Run import qualified Codec.MIME.Parse as MIME @@ -64,11 +64,11 @@ uploadRaw :: Lazy.ByteString -> TestM (Response (Maybe Lazy.ByteString)) uploadRaw c usr bs = do - cargohold <- viewUnversionedCargohold + cargohold' <- viewUnversionedCargohold post $ apiVersion "v1" . c - . cargohold + . cargohold' . method POST . zUser usr . zConn "conn" @@ -177,7 +177,7 @@ deleteToken uid key = do . paths ["assets", toByteString' key, "token"] viewFederationDomain :: TestM Domain -viewFederationDomain = view (tsOpts . optSettings . setFederationDomain) +viewFederationDomain = view (tsOpts . settings . federationDomain) -------------------------------------------------------------------------------- -- Mocking utilities @@ -192,7 +192,7 @@ withSettingsOverrides f action = do liftIO $ runTestM (ts & tsEndpoint %~ setLocalEndpoint p) action setLocalEndpoint :: Word16 -> Endpoint -> Endpoint -setLocalEndpoint p = (epPort .~ p) . (epHost .~ "127.0.0.1") +setLocalEndpoint p = (port .~ p) . (host .~ "127.0.0.1") withMockFederator :: (FederatedRequest -> IO (HTTP.MediaType, LByteString)) -> @@ -201,5 +201,5 @@ withMockFederator :: withMockFederator respond action = do withTempMockFederator [] respond $ \p -> withSettingsOverrides - (optFederator . _Just %~ setLocalEndpoint (fromIntegral p)) + (federator . _Just %~ setLocalEndpoint (fromIntegral p)) action diff --git a/services/cargohold/test/integration/App.hs b/services/cargohold/test/integration/App.hs index f277a71d3c9..016de02496b 100644 --- a/services/cargohold/test/integration/App.hs +++ b/services/cargohold/test/integration/App.hs @@ -29,8 +29,8 @@ testMultiIngressCloudFrontFails = do ts <- ask let opts = view tsOpts ts - & (Opts.optAws . Opts.awsCloudFront) ?~ cloudFrontOptions - & (Opts.optAws . Opts.optMultiIngress) ?~ multiIngressMap + & (Opts.aws . Opts.cloudFront) ?~ cloudFrontOptions + & (Opts.aws . Opts.multiIngress) ?~ multiIngressMap msg <- liftIO $ catch @@ -44,9 +44,9 @@ testMultiIngressCloudFrontFails = do cloudFrontOptions :: CloudFrontOpts cloudFrontOptions = CloudFrontOpts - { _cfDomain = Domain (T.pack "example.com"), - _cfKeyPairId = KeyPairId (T.pack "anyId"), - _cfPrivateKey = "any/path" + { _domain = Domain (T.pack "example.com"), + _keyPairId = KeyPairId (T.pack "anyId"), + _privateKey = "any/path" } multiIngressMap :: Map String AWSEndpoint @@ -63,8 +63,8 @@ testMultiIngressS3DownloadEndpointFails = do ts <- ask let opts = view tsOpts ts - & (Opts.optAws . Opts.awsS3DownloadEndpoint) ?~ toAWSEndpoint "http://fake-s3:4570" - & (Opts.optAws . Opts.optMultiIngress) ?~ multiIngressMap + & (Opts.aws . Opts.s3DownloadEndpoint) ?~ toAWSEndpoint "http://fake-s3:4570" + & (Opts.aws . Opts.multiIngress) ?~ multiIngressMap msg <- liftIO $ catch diff --git a/services/cargohold/test/integration/TestSetup.hs b/services/cargohold/test/integration/TestSetup.hs index 759c760a698..03cc3ccd330 100644 --- a/services/cargohold/test/integration/TestSetup.hs +++ b/services/cargohold/test/integration/TestSetup.hs @@ -38,7 +38,7 @@ module TestSetup where import Bilge hiding (body, responseBody) -import CargoHold.Options +import CargoHold.Options hiding (domain) import Control.Exception (catch) import Control.Lens import Control.Monad.Codensity @@ -58,7 +58,7 @@ import qualified Network.Wai.Utilities.Error as Wai import Servant.Client.Streaming import Test.Tasty import Test.Tasty.HUnit -import Util.Options +import Util.Options (Endpoint (..)) import Util.Options.Common import Util.Test import Web.HttpApiData @@ -151,10 +151,10 @@ createTestSetup optsPath configPath = do tlsManagerSettings { managerResponseTimeout = responseTimeoutMicro 300000000 } - let localEndpoint p = Endpoint {_epHost = "127.0.0.1", _epPort = p} + let localEndpoint p = Endpoint {_host = "127.0.0.1", _port = p} iConf <- handleParseError =<< decodeFileEither configPath opts <- decodeFileThrow optsPath - endpoint <- optOrEnv cargohold iConf (localEndpoint . read) "CARGOHOLD_WEB_PORT" + endpoint <- optOrEnv @IntegrationConfig (.cargohold) iConf (localEndpoint . read) "CARGOHOLD_WEB_PORT" pure $ TestSetup { _tsManager = m, @@ -166,7 +166,7 @@ runFederationClient :: ClientM a -> ReaderT TestSetup (ExceptT ClientError (Code runFederationClient action = do man <- view tsManager Endpoint cHost cPort <- view tsEndpoint - domain <- view (tsOpts . optSettings . setFederationDomain) + domain <- view (tsOpts . settings . federationDomain) let base = BaseUrl Http (T.unpack cHost) (fromIntegral cPort) "/federation" let env = (mkClientEnv man base) diff --git a/services/federator/default.nix b/services/federator/default.nix index 5ed00b42be0..a6a88ed1d37 100644 --- a/services/federator/default.nix +++ b/services/federator/default.nix @@ -140,7 +140,6 @@ mkDerivation { imports kan-extensions lens - mtl optparse-applicative polysemy QuickCheck diff --git a/services/federator/federator.cabal b/services/federator/federator.cabal index 9b6dc292c8a..e3e28a30089 100644 --- a/services/federator/federator.cabal +++ b/services/federator/federator.cabal @@ -291,7 +291,6 @@ executable federator-integration , imports , kan-extensions , lens - , mtl , optparse-applicative , polysemy , QuickCheck diff --git a/services/federator/src/Federator/Run.hs b/services/federator/src/Federator/Run.hs index cd2f82f9ba2..e3072294ec6 100644 --- a/services/federator/src/Federator/Run.hs +++ b/services/federator/src/Federator/Run.hs @@ -74,18 +74,18 @@ run opts = do void $ waitAnyCancel [updateFedDomainsThread, internalServerThread, externalServerThread] where endpointInternal = federatorInternal opts - portInternal = fromIntegral $ endpointInternal ^. epPort + portInternal = fromIntegral $ endpointInternal ^. port endpointExternal = federatorExternal opts - portExternal = fromIntegral $ endpointExternal ^. epPort + portExternal = fromIntegral $ endpointExternal ^. port mkResolvConf :: RunSettings -> DNS.ResolvConf -> DNS.ResolvConf mkResolvConf settings conf = case (dnsHost settings, dnsPort settings) of - (Just host, Nothing) -> - conf {DNS.resolvInfo = DNS.RCHostName host} - (Just host, Just port) -> - conf {DNS.resolvInfo = DNS.RCHostPort host (fromIntegral port)} + (Just h, Nothing) -> + conf {DNS.resolvInfo = DNS.RCHostName h} + (Just h, Just p) -> + conf {DNS.resolvInfo = DNS.RCHostPort h (fromIntegral p)} (_, _) -> conf ------------------------------------------------------------------------------- @@ -99,8 +99,8 @@ newEnv o _dnsResolver _applog _domainConfigs = do _service Brig = Opt.brig o _service Galley = Opt.galley o _service Cargohold = Opt.cargohold o - _externalPort = o.federatorExternal._epPort - _internalPort = o.federatorInternal._epPort + _externalPort = o.federatorExternal._port + _internalPort = o.federatorInternal._port _httpManager <- initHttpManager sslContext <- mkTLSSettingsOrThrow _runSettings _http2Manager <- newIORef =<< mkHttp2Manager sslContext diff --git a/services/federator/test/integration/Test/Federator/IngressSpec.hs b/services/federator/test/integration/Test/Federator/IngressSpec.hs index fb24eac5796..c5c13ea41af 100644 --- a/services/federator/test/integration/Test/Federator/IngressSpec.hs +++ b/services/federator/test/integration/Test/Federator/IngressSpec.hs @@ -144,8 +144,8 @@ inwardBrigCallViaIngressWithSettings :: Sem r StreamingResponse inwardBrigCallViaIngressWithSettings sslCtx requestPath payload = do - Endpoint ingressHost ingressPort <- cfgNginxIngress . view teTstOpts <$> input - originDomain <- cfgOriginDomain . view teTstOpts <$> input + Endpoint ingressHost ingressPort <- nginxIngress . view teTstOpts <$> input + originDomain <- originDomain . view teTstOpts <$> input let target = SrvTarget (cs ingressHost) ingressPort headers = [(originDomainHeaderName, Text.encodeUtf8 originDomain)] mgr <- liftToCodensity . liftIO $ http2ManagerWithSSLCtx sslCtx diff --git a/services/federator/test/integration/Test/Federator/InwardSpec.hs b/services/federator/test/integration/Test/Federator/InwardSpec.hs index 066e9a50583..ae267dd67e8 100644 --- a/services/federator/test/integration/Test/Federator/InwardSpec.hs +++ b/services/federator/test/integration/Test/Federator/InwardSpec.hs @@ -31,7 +31,7 @@ import Data.ByteString.Lazy qualified as LBS import Data.Handle import Data.LegalHold (UserLegalHoldStatus (UserLegalHoldNoConsent)) import Data.Text.Encoding -import Federator.Options +import Federator.Options hiding (federatorExternal) import Imports import Network.HTTP.Types qualified as HTTP import Network.Wai.Utilities.Error qualified as E @@ -126,7 +126,7 @@ spec env = -- and "IngressSpec". it "rejectRequestsWithoutClientCertInward" $ runTestFederator env $ do - originDomain <- cfgOriginDomain <$> view teTstOpts + originDomain <- originDomain <$> view teTstOpts hdl <- randomHandle inwardCallWithHeaders "federation/brig/get-user-by-handle" @@ -145,7 +145,7 @@ inwardCallWithHeaders :: LBS.ByteString -> m (Response (Maybe LByteString)) inwardCallWithHeaders requestPath hh payload = do - Endpoint fedHost fedPort <- cfgFederatorExternal <$> view teTstOpts + Endpoint fedHost fedPort <- federatorExternal <$> view teTstOpts post ( host (encodeUtf8 fedHost) . port fedPort @@ -160,7 +160,7 @@ inwardCall :: LBS.ByteString -> m (Response (Maybe LByteString)) inwardCall requestPath payload = do - originDomain :: Text <- cfgOriginDomain <$> view teTstOpts + originDomain :: Text <- originDomain <$> view teTstOpts inwardCallWithOriginDomain (toByteString' originDomain) requestPath payload inwardCallWithOriginDomain :: @@ -170,7 +170,7 @@ inwardCallWithOriginDomain :: LBS.ByteString -> m (Response (Maybe LByteString)) inwardCallWithOriginDomain originDomain requestPath payload = do - Endpoint fedHost fedPort <- cfgFederatorExternal <$> view teTstOpts + Endpoint fedHost fedPort <- federatorExternal <$> view teTstOpts clientCertFilename <- clientCertificate . optSettings . view teOpts <$> ask clientCert <- liftIO $ BS.readFile clientCertFilename post diff --git a/services/federator/test/integration/Test/Federator/JSON.hs b/services/federator/test/integration/Test/Federator/JSON.hs index d585fd3f9d9..e69be554afb 100644 --- a/services/federator/test/integration/Test/Federator/JSON.hs +++ b/services/federator/test/integration/Test/Federator/JSON.hs @@ -26,4 +26,4 @@ deriveJSONOptions :: Options deriveJSONOptions = defaultOptions {fieldLabelModifier = labelmod} labelmod :: String -> String -labelmod = (ix 0 %~ toLower) . dropWhile (not . isUpper) +labelmod = (ix 0 %~ toLower) diff --git a/services/federator/test/integration/Test/Federator/Util.hs b/services/federator/test/integration/Test/Federator/Util.hs index 883e93bc7b0..6d8a61f0093 100644 --- a/services/federator/test/integration/Test/Federator/Util.hs +++ b/services/federator/test/integration/Test/Federator/Util.hs @@ -30,8 +30,7 @@ import Bilge.Assert import Control.Exception import Control.Lens hiding ((.=)) import Control.Monad.Catch -import Control.Monad.Except -import Crypto.Random.Types (MonadRandom, getRandomBytes) +import Crypto.Random.Types import Data.Aeson import Data.Aeson.TH import Data.Aeson.Types qualified as Aeson @@ -54,7 +53,8 @@ import Polysemy.Error import System.Random import Test.Federator.JSON import Test.Tasty.HUnit -import Util.Options +import Util.Options (Endpoint) +import Util.Options qualified as O import Wire.API.User import Wire.API.User.Auth @@ -104,11 +104,11 @@ data TestEnv = TestEnv type Select = TestEnv -> (Request -> Request) data IntegrationConfig = IntegrationConfig - { cfgBrig :: Endpoint, - cfgCargohold :: Endpoint, - cfgFederatorExternal :: Endpoint, - cfgNginxIngress :: Endpoint, - cfgOriginDomain :: Text + { brig :: Endpoint, + cargohold :: Endpoint, + federatorExternal :: Endpoint, + nginxIngress :: Endpoint, + originDomain :: Text } deriving (Show, Generic) @@ -152,8 +152,8 @@ mkEnv :: HasCallStack => IntegrationConfig -> Opts -> IO TestEnv mkEnv _teTstOpts _teOpts = do let managerSettings = mkManagerSettings (Network.Connection.TLSSettingsSimple True False False) Nothing _teMgr :: Manager <- newManager managerSettings - let _teBrig = endpointToReq (cfgBrig _teTstOpts) - _teCargohold = endpointToReq (cfgCargohold _teTstOpts) + let _teBrig = endpointToReq _teTstOpts.brig + _teCargohold = endpointToReq _teTstOpts.cargohold -- _teTLSSettings <- mkTLSSettingsOrThrow (optSettings _teOpts) _teSSLContext <- mkTLSSettingsOrThrow (optSettings _teOpts) let _teSettings = optSettings _teOpts @@ -163,7 +163,7 @@ destroyEnv :: HasCallStack => TestEnv -> IO () destroyEnv _ = pure () endpointToReq :: Endpoint -> (Bilge.Request -> Bilge.Request) -endpointToReq ep = Bilge.host (ep ^. epHost . to cs) . Bilge.port (ep ^. epPort) +endpointToReq ep = Bilge.host (ep ^. O.host . to cs) . Bilge.port (ep ^. O.port) -- All the code below is copied from brig-integration tests -- FUTUREWORK: This should live in another package and shared by all the integration tests diff --git a/services/federator/test/unit/Test/Federator/Client.hs b/services/federator/test/unit/Test/Federator/Client.hs index afe72d009e5..d5db3ae77f6 100644 --- a/services/federator/test/unit/Test/Federator/Client.hs +++ b/services/federator/test/unit/Test/Federator/Client.hs @@ -45,7 +45,7 @@ import Servant.Types.SourceT import Test.QuickCheck (arbitrary, generate) import Test.Tasty import Test.Tasty.HUnit -import Util.Options +import Util.Options (Endpoint (Endpoint)) import Wire.API.Federation.API import Wire.API.Federation.Client import Wire.API.Federation.Error diff --git a/services/galley/src/Galley/API/Action.hs b/services/galley/src/Galley/API/Action.hs index 9e1ff71130f..811e78decdf 100644 --- a/services/galley/src/Galley/API/Action.hs +++ b/services/galley/src/Galley/API/Action.hs @@ -356,7 +356,7 @@ performAction :: ConversationAction tag -> Sem r (BotsAndMembers, ConversationAction tag) performAction tag origUser lconv action = do - let lcnv = fmap convId lconv + let lcnv = fmap (.convId) lconv conv = tUnqualified lconv case tag of SConversationJoinTag -> do @@ -436,7 +436,7 @@ performConversationJoin qusr lconv (ConversationJoin invited role) = do checkLHPolicyConflictsRemote (FutureWork (ulRemotes newMembers)) checkRemoteBackendsConnected lusr - addMembersToLocalConversation (fmap convId lconv) newMembers role + addMembersToLocalConversation (fmap (.convId) lconv) newMembers role where checkRemoteBackendsConnected :: Local UserId -> @@ -464,9 +464,9 @@ performConversationJoin qusr lconv (ConversationJoin invited role) = do Sem r () checkLocals lusr (Just tid) newUsers = do tms <- - Map.fromList . map (view userId &&& id) + Map.fromList . map (view Wire.API.Team.Member.userId &&& Imports.id) <$> E.selectTeamMembers tid newUsers - let userMembershipMap = map (id &&& flip Map.lookup tms) newUsers + let userMembershipMap = map (Imports.id &&& flip Map.lookup tms) newUsers ensureAccessRole (convAccessRoles conv) userMembershipMap ensureConnectedOrSameTeam lusr newUsers checkLocals lusr Nothing newUsers = do @@ -568,7 +568,7 @@ performConversationAccessData qusr lconv action = do pure (mempty, action) where - lcnv = fmap convId lconv + lcnv = fmap (.convId) lconv conv = tUnqualified lconv maybeRemoveBots :: BotsAndMembers -> Sem r BotsAndMembers @@ -673,7 +673,7 @@ updateLocalConversationUnchecked :: Sem r LocalConversationUpdate updateLocalConversationUnchecked lconv qusr con action = do let tag = sing @tag - lcnv = fmap convId lconv + lcnv = fmap (.convId) lconv conv = tUnqualified lconv -- retrieve member @@ -777,7 +777,7 @@ notifyConversationAction :: Sem r LocalConversationUpdate notifyConversationAction tag quid notifyOrigDomain con lconv targets action = do now <- input - let lcnv = fmap convId lconv + let lcnv = fmap (.convId) lconv e = conversationActionToEvent tag now quid (tUntagged lcnv) Nothing action let mkUpdate uids = @@ -990,11 +990,11 @@ notifyTypingIndicator conv qusr mcon ts = do let (remoteMemsOrig, remoteMemsOther) = List.partition ((origDomain ==) . tDomain . rmId) (Data.convRemoteMembers conv) tdu users = TypingDataUpdated - { tudTime = now, - tudOrigUserId = qusr, - tudConvId = Data.convId conv, - tudUsersInConv = users, - tudTypingStatus = ts + { time = now, + origUserId = qusr, + convId = Data.convId conv, + usersInConv = users, + typingStatus = ts } void $ E.runFederatedConcurrentlyEither (fmap rmId remoteMemsOther) $ \rmems -> do diff --git a/services/galley/src/Galley/API/Federation.hs b/services/galley/src/Galley/API/Federation.hs index f939de7357e..99b5f72a771 100644 --- a/services/galley/src/Galley/API/Federation.hs +++ b/services/galley/src/Galley/API/Federation.hs @@ -92,7 +92,6 @@ import Wire.API.Error.Galley import Wire.API.Event.Conversation import Wire.API.Federation.API import Wire.API.Federation.API.Common (EmptyResponse (..)) -import Wire.API.Federation.API.Galley import Wire.API.Federation.API.Galley qualified as F import Wire.API.Federation.Error import Wire.API.FederationUpdate (fetch) @@ -145,16 +144,16 @@ onClientRemoved :: Member TinyLog r ) => Domain -> - ClientRemovedRequest -> + F.ClientRemovedRequest -> Sem r EmptyResponse onClientRemoved domain req = do - let qusr = Qualified (F.crrUser req) domain + let qusr = Qualified req.user domain whenM isMLSEnabled $ do - for_ (F.crrConvs req) $ \convId -> do + for_ req.convs $ \convId -> do mConv <- E.getConversation convId for mConv $ \conv -> do lconv <- qualifyLocal conv - removeClient lconv qusr (F.crrClient req) + removeClient lconv qusr (F.client req) pure EmptyResponse onConversationCreated :: @@ -171,11 +170,11 @@ onConversationCreated :: onConversationCreated domain rc = do let qrc = fmap (toRemoteUnsafe domain) rc loc <- qualifyLocal () - let (localUserIds, _) = partitionQualified loc (map omQualifiedId (toList (F.ccNonCreatorMembers rc))) + let (localUserIds, _) = partitionQualified loc (map omQualifiedId (toList (F.nonCreatorMembers rc))) addedUserIds <- addLocalUsersToRemoteConv - (F.ccCnvId qrc) + (F.cnvId qrc) (tUntagged (F.ccRemoteOrigUserId qrc)) localUserIds @@ -187,17 +186,17 @@ onConversationCreated domain rc = do (const True) . omQualifiedId ) - (F.ccNonCreatorMembers rc) + (F.nonCreatorMembers rc) -- Make sure to notify only about local users connected to the adder - let qrcConnected = qrc {F.ccNonCreatorMembers = connectedMembers} + let qrcConnected = qrc {F.nonCreatorMembers = connectedMembers} for_ (fromConversationCreated loc qrcConnected) $ \(mem, c) -> do let event = Event - (tUntagged (F.ccCnvId qrcConnected)) + (tUntagged (F.cnvId qrcConnected)) Nothing (tUntagged (F.ccRemoteOrigUserId qrcConnected)) - (F.ccTime qrcConnected) + qrcConnected.time (EdConversation c) pushConversationEvent Nothing event (qualifyAs loc [qUnqualified . Public.memId $ mem]) [] pure EmptyResponse @@ -252,8 +251,8 @@ leaveConversation :: F.LeaveConversationRequest -> Sem r F.LeaveConversationResponse leaveConversation requestingDomain lc = do - let leaver = Qualified (F.lcLeaver lc) requestingDomain - lcnv <- qualifyLocal (F.lcConvId lc) + let leaver = Qualified lc.leaver requestingDomain + lcnv <- qualifyLocal lc.convId res <- runError @@ -319,19 +318,19 @@ onMessageSent :: Sem r EmptyResponse onMessageSent domain rmUnqualified = do let rm = fmap (toRemoteUnsafe domain) rmUnqualified - convId = tUntagged $ F.rmConversation rm + convId = tUntagged rm.conversation msgMetadata = MessageMetadata - { mmNativePush = F.rmPush rm, - mmTransient = F.rmTransient rm, - mmNativePriority = F.rmPriority rm, - mmData = F.rmData rm + { mmNativePush = F.push rm, + mmTransient = F.transient rm, + mmNativePriority = F.priority rm, + mmData = F._data rm } - recipientMap = userClientMap $ F.rmRecipients rm + recipientMap = userClientMap rm.recipients msgs = toMapOf (itraversed <.> itraversed) recipientMap (members, allMembers) <- first Set.fromList - <$> E.selectRemoteMembers (Map.keys recipientMap) (F.rmConversation rm) + <$> E.selectRemoteMembers (Map.keys recipientMap) rm.conversation unless allMembers $ P.warn $ Log.field "conversation" (toByteString' (qUnqualified convId)) @@ -345,9 +344,9 @@ onMessageSent domain rmUnqualified = do void $ sendLocalMessages loc - (F.rmTime rm) - (F.rmSender rm) - (F.rmSenderClient rm) + rm.time + rm.sender + rm.senderClient Nothing (Just convId) mempty @@ -374,9 +373,9 @@ sendMessage :: F.ProteusMessageSendRequest -> Sem r F.MessageSendResponse sendMessage originDomain msr = do - let sender = Qualified (F.pmsrSender msr) originDomain - msg <- either throwErr pure (fromProto (fromBase64ByteString (F.pmsrRawMessage msr))) - lcnv <- qualifyLocal (F.pmsrConvId msr) + let sender = Qualified msr.sender originDomain + msg <- either throwErr pure (fromProto (fromBase64ByteString msr.rawMessage)) + lcnv <- qualifyLocal msr.convId F.MessageSendResponse <$> postQualifiedOtrMessage User sender Nothing lcnv msg where throwErr = throw . InvalidPayload . LT.pack @@ -398,9 +397,9 @@ onUserDeleted :: F.UserDeletedConversationsNotification -> Sem r EmptyResponse onUserDeleted origDomain udcn = do - let deletedUser = toRemoteUnsafe origDomain (F.udcvUser udcn) + let deletedUser = toRemoteUnsafe origDomain udcn.user untaggedDeletedUser = tUntagged deletedUser - convIds = F.udcvConversations udcn + convIds = F.conversations udcn E.spawnMany $ fromRange convIds <&> \c -> do @@ -461,13 +460,13 @@ updateConversation :: ) => Domain -> F.ConversationUpdateRequest -> - Sem r ConversationUpdateResponse + Sem r F.ConversationUpdateResponse updateConversation origDomain updateRequest = do loc <- qualifyLocal () - let rusr = toRemoteUnsafe origDomain (F.curUser updateRequest) - lcnv = qualifyAs loc (F.curConvId updateRequest) + let rusr = toRemoteUnsafe origDomain updateRequest.user + lcnv = qualifyAs loc updateRequest.convId - mkResponse $ case F.curAction updateRequest of + mkResponse $ case F.action updateRequest of SomeConversationAction tag action -> case tag of SConversationJoinTag -> mapToGalleyError @(HasConversationActionGalleyErrors 'ConversationJoinTag) @@ -514,11 +513,11 @@ updateConversation origDomain updateRequest = do $ updateLocalConversation @'ConversationAccessDataTag lcnv (tUntagged rusr) Nothing action where mkResponse = - fmap (either F.ConversationUpdateResponseError id) + fmap (either F.ConversationUpdateResponseError Imports.id) . runError @GalleyError . fmap (fromRight F.ConversationUpdateResponseNoChanges) . runError @NoChanges - . fmap (either F.ConversationUpdateResponseNonFederatingBackends id) + . fmap (either F.ConversationUpdateResponseNonFederatingBackends Imports.id) . runError @NonFederatingBackends . fmap (either F.ConversationUpdateResponseUnreachableBackends id) . runError @UnreachableBackends @@ -536,16 +535,16 @@ handleMLSMessageErrors :: ': r ) ) => - Sem r1 MLSMessageResponse -> - Sem r MLSMessageResponse + Sem r1 F.MLSMessageResponse -> + Sem r F.MLSMessageResponse handleMLSMessageErrors = - fmap (either (F.MLSMessageResponseProtocolError . unTagged) id) + fmap (either (F.MLSMessageResponseProtocolError . unTagged) Imports.id) . runError @MLSProtocolError - . fmap (either F.MLSMessageResponseError id) + . fmap (either F.MLSMessageResponseError Imports.id) . runError - . fmap (either (F.MLSMessageResponseProposalFailure . pfInner) id) + . fmap (either (F.MLSMessageResponseProposalFailure . pfInner) Imports.id) . runError - . fmap (either F.MLSMessageResponseNonFederatingBackends id) + . fmap (either F.MLSMessageResponseNonFederatingBackends Imports.id) . runError . fmap (either (F.MLSMessageResponseUnreachableBackends . Set.fromList . (.backends)) id) . runError @UnreachableBackends @@ -576,11 +575,11 @@ sendMLSCommitBundle :: sendMLSCommitBundle remoteDomain msr = handleMLSMessageErrors $ do assertMLSEnabled loc <- qualifyLocal () - let sender = toRemoteUnsafe remoteDomain (F.mmsrSender msr) - bundle <- either (throw . mlsProtocolError) pure $ deserializeCommitBundle (fromBase64ByteString (F.mmsrRawMessage msr)) + let sender = toRemoteUnsafe remoteDomain msr.sender + bundle <- either (throw . mlsProtocolError) pure $ deserializeCommitBundle (fromBase64ByteString msr.rawMessage) let msg = rmValue (cbCommitMsg bundle) qcnv <- E.getConversationIdByGroupId (msgGroupId msg) >>= noteS @'ConvNotFound - when (Conv (qUnqualified qcnv) /= F.mmsrConvOrSubId msr) $ throwS @'MLSGroupConversationMismatch + when (Conv (qUnqualified qcnv) /= F.convOrSubId msr) $ throwS @'MLSGroupConversationMismatch uncurry F.MLSMessageResponseUpdates . (,mempty) . map lcuUpdate <$> postMLSCommitBundle loc (tUntagged sender) Nothing qcnv Nothing bundle @@ -609,12 +608,12 @@ sendMLSMessage :: sendMLSMessage remoteDomain msr = handleMLSMessageErrors $ do assertMLSEnabled loc <- qualifyLocal () - let sender = toRemoteUnsafe remoteDomain (F.mmsrSender msr) - raw <- either (throw . mlsProtocolError) pure $ decodeMLS' (fromBase64ByteString (F.mmsrRawMessage msr)) + let sender = toRemoteUnsafe remoteDomain msr.sender + raw <- either (throw . mlsProtocolError) pure $ decodeMLS' (fromBase64ByteString msr.rawMessage) case rmValue raw of SomeMessage _ msg -> do qcnv <- E.getConversationIdByGroupId (msgGroupId msg) >>= noteS @'ConvNotFound - when (Conv (qUnqualified qcnv) /= F.mmsrConvOrSubId msr) $ throwS @'MLSGroupConversationMismatch + when (Conv (qUnqualified qcnv) /= F.convOrSubId msr) $ throwS @'MLSGroupConversationMismatch uncurry F.MLSMessageResponseUpdates . first (map lcuUpdate) <$> postMLSMessage loc (tUntagged sender) Nothing qcnv Nothing raw @@ -626,7 +625,7 @@ class ToGalleyRuntimeError (effs :: EffectRow) r where Sem r a instance ToGalleyRuntimeError '[] r where - mapToGalleyError = id + mapToGalleyError = Imports.id instance forall (err :: GalleyError) effs r. @@ -652,8 +651,8 @@ mlsSendWelcome :: Domain -> F.MLSWelcomeRequest -> Sem r F.MLSWelcomeResponse -mlsSendWelcome _origDomain (fromBase64ByteString . F.unMLSWelcomeRequest -> rawWelcome) = - fmap (either (const MLSWelcomeMLSNotEnabled) (const MLSWelcomeSent)) +mlsSendWelcome _origDomain (fromBase64ByteString . F.mlsWelcomeRequest -> rawWelcome) = + fmap (either (const F.MLSWelcomeMLSNotEnabled) (const F.MLSWelcomeSent)) . runError @(Tagged 'MLSNotEnabled ()) $ do assertMLSEnabled @@ -685,13 +684,13 @@ onMLSMessageSent :: F.RemoteMLSMessage -> Sem r F.RemoteMLSMessageResponse onMLSMessageSent domain rmm = - fmap (either (const RemoteMLSMessageMLSNotEnabled) (const RemoteMLSMessageOk)) + fmap (either (const F.RemoteMLSMessageMLSNotEnabled) (const F.RemoteMLSMessageOk)) . runError @(Tagged 'MLSNotEnabled ()) $ do assertMLSEnabled loc <- qualifyLocal () - let rcnv = toRemoteUnsafe domain (F.rmmConversation rmm) - let users = Set.fromList (map fst (F.rmmRecipients rmm)) + let rcnv = toRemoteUnsafe domain rmm.conversation + let users = Set.fromList (map fst rmm.recipients) (members, allMembers) <- first Set.fromList <$> E.selectRemoteMembers (toList users) rcnv @@ -704,14 +703,14 @@ onMLSMessageSent domain rmm = \ users not in the conversation" :: ByteString ) - let recipients = filter (\(u, _) -> Set.member u members) (F.rmmRecipients rmm) + let recipients = filter (\(u, _) -> Set.member u members) rmm.recipients -- FUTUREWORK: support local bots let e = - Event (tUntagged rcnv) Nothing (F.rmmSender rmm) (F.rmmTime rmm) $ - EdMLSMessage (fromBase64ByteString (F.rmmMessage rmm)) + Event (tUntagged rcnv) Nothing rmm.sender rmm.time $ + EdMLSMessage (fromBase64ByteString rmm.message) runMessagePush loc (Just (tUntagged rcnv)) $ - newMessagePush mempty Nothing (F.rmmMetadata rmm) recipients e + newMessagePush mempty Nothing rmm.metadata recipients e queryGroupInfo :: ( Member ConversationStore r, @@ -728,8 +727,8 @@ queryGroupInfo origDomain req = . mapToGalleyError @MLSGroupInfoStaticErrors $ do assertMLSEnabled - lconvId <- qualifyLocal . ggireqConv $ req - let sender = toRemoteUnsafe origDomain . ggireqSender $ req + lconvId <- qualifyLocal req.conv + let sender = toRemoteUnsafe origDomain req.sender state <- getGroupInfoFromLocalConv (tUntagged sender) lconvId pure . Base64ByteString @@ -746,27 +745,27 @@ updateTypingIndicator :: Domain -> F.TypingDataUpdateRequest -> Sem r F.TypingDataUpdateResponse -updateTypingIndicator origDomain TypingDataUpdateRequest {..} = do - let qusr = Qualified tdurUserId origDomain - lcnv <- qualifyLocal tdurConvId +updateTypingIndicator origDomain F.TypingDataUpdateRequest {..} = do + let qusr = Qualified userId origDomain + lcnv <- qualifyLocal convId ret <- runError . mapToRuntimeError @'ConvNotFound ConvNotFound $ do (conv, _) <- getConversationAndMemberWithError @'ConvNotFound qusr lcnv - notifyTypingIndicator conv qusr Nothing tdurTypingStatus + notifyTypingIndicator conv qusr Nothing typingStatus - pure (either TypingDataUpdateError TypingDataUpdateSuccess ret) + pure (either F.TypingDataUpdateError F.TypingDataUpdateSuccess ret) onTypingIndicatorUpdated :: ( Member GundeckAccess r ) => Domain -> - TypingDataUpdated -> + F.TypingDataUpdated -> Sem r EmptyResponse -onTypingIndicatorUpdated origDomain TypingDataUpdated {..} = do - let qcnv = Qualified tudConvId origDomain - pushTypingIndicatorEvents tudOrigUserId tudTime tudUsersInConv Nothing qcnv tudTypingStatus +onTypingIndicatorUpdated origDomain F.TypingDataUpdated {..} = do + let qcnv = Qualified convId origDomain + pushTypingIndicatorEvents origUserId time usersInConv Nothing qcnv typingStatus pure EmptyResponse -- Since we already have the origin domain where the defederation event started, diff --git a/services/galley/src/Galley/API/Internal.hs b/services/galley/src/Galley/API/Internal.hs index a21cf229c40..7f1565036fe 100644 --- a/services/galley/src/Galley/API/Internal.hs +++ b/services/galley/src/Galley/API/Internal.hs @@ -78,7 +78,7 @@ import Galley.Effects.ProposalStore import Galley.Effects.TeamStore import Galley.Intra.Push qualified as Intra import Galley.Monad -import Galley.Options +import Galley.Options hiding (brig) import Galley.Queue qualified as Q import Galley.Types.Bot (AddBot, RemoveBot) import Galley.Types.Bot.Service @@ -124,7 +124,7 @@ import Wire.Sem.Paging.Cassandra internalAPI :: API InternalAPI GalleyEffects internalAPI = - hoistAPI @InternalAPIBase id $ + hoistAPI @InternalAPIBase Imports.id $ mkNamedAPI @"status" (pure ()) <@> mkNamedAPI @"delete-user" (callsFed (exposeAnnotations rmUser)) <@> mkNamedAPI @"connect" (callsFed (exposeAnnotations Create.createConnectConversation)) @@ -140,7 +140,7 @@ federationAPI = mkNamedAPI @"get-federation-status" (const getFederationStatus) legalholdWhitelistedTeamsAPI :: API ILegalholdWhitelistedTeamsAPI GalleyEffects -legalholdWhitelistedTeamsAPI = mkAPI $ \tid -> hoistAPIHandler id (base tid) +legalholdWhitelistedTeamsAPI = mkAPI $ \tid -> hoistAPIHandler Imports.id (base tid) where base :: TeamId -> API ILegalholdWhitelistedTeamsAPIBase GalleyEffects base tid = @@ -149,13 +149,13 @@ legalholdWhitelistedTeamsAPI = mkAPI $ \tid -> hoistAPIHandler id (base tid) <@> mkNamedAPI @"get-team-legalhold-whitelisted" (LegalHoldStore.isTeamLegalholdWhitelisted tid) iTeamsAPI :: API ITeamsAPI GalleyEffects -iTeamsAPI = mkAPI $ \tid -> hoistAPIHandler id (base tid) +iTeamsAPI = mkAPI $ \tid -> hoistAPIHandler Imports.id (base tid) where hoistAPISegment :: (ServerT (seg :> inner) (Sem r) ~ ServerT inner (Sem r)) => API inner r -> API (seg :> inner) r - hoistAPISegment = hoistAPI id + hoistAPISegment = hoistAPI Imports.id base :: TeamId -> API ITeamsAPIBase GalleyEffects base tid = @@ -413,7 +413,7 @@ rmUser lusr conn = do for_ (maybeList1 (catMaybes pp)) - push + Galley.Effects.GundeckAccess.push -- FUTUREWORK: This could be optimized to reduce the number of RPCs -- made. When a team is deleted the burst of RPCs created here could @@ -571,7 +571,7 @@ deleteFederationDomainRemoteUserFromLocalConversations (fromRange -> maxPage) do getPaginatedData page env <- input let lCnvMap = foldr insertIntoMap mempty remoteUsers - localDomain = env ^. Galley.App.options . optSettings . setFederationDomain + localDomain = env ^. Galley.App.options . Galley.Options.settings . federationDomain for_ (Map.toList lCnvMap) $ \(cnvId, rUsers) -> do let mapAllErrors :: Text -> diff --git a/services/galley/src/Galley/API/LegalHold/Conflicts.hs b/services/galley/src/Galley/API/LegalHold/Conflicts.hs index 68b7920f856..a6d098b459b 100644 --- a/services/galley/src/Galley/API/LegalHold/Conflicts.hs +++ b/services/galley/src/Galley/API/LegalHold/Conflicts.hs @@ -84,7 +84,7 @@ guardLegalholdPolicyConflicts LegalholdPlusFederationNotImplemented _otherClient guardLegalholdPolicyConflicts UnprotectedBot _otherClients = pure () guardLegalholdPolicyConflicts (ProtectedUser self) otherClients = do opts <- input - case view (optSettings . setFeatureFlags . flagLegalHold) opts of + case view (settings . featureFlags . flagLegalHold) opts of FeatureLegalHoldDisabledPermanently -> case FutureWork @'LegalholdPlusFederationNotImplemented () of FutureWork () -> pure () -- FUTUREWORK: if federation is enabled, we still need to run the guard! FeatureLegalHoldDisabledByDefault -> guardLegalholdPolicyConflictsUid self otherClients diff --git a/services/galley/src/Galley/API/MLS/GroupInfo.hs b/services/galley/src/Galley/API/MLS/GroupInfo.hs index 58772657b25..73d74ffe589 100644 --- a/services/galley/src/Galley/API/MLS/GroupInfo.hs +++ b/services/galley/src/Galley/API/MLS/GroupInfo.hs @@ -87,8 +87,8 @@ getGroupInfoFromRemoteConv :: getGroupInfoFromRemoteConv lusr rcnv = do let getRequest = GetGroupInfoRequest - { ggireqSender = tUnqualified lusr, - ggireqConv = tUnqualified rcnv + { sender = tUnqualified lusr, + conv = tUnqualified rcnv } response <- E.runFederated rcnv (fedClient @'Galley @"query-group-info" getRequest) case response of diff --git a/services/galley/src/Galley/API/MLS/Message.hs b/services/galley/src/Galley/API/MLS/Message.hs index c8509d199e6..643048311c0 100644 --- a/services/galley/src/Galley/API/MLS/Message.hs +++ b/services/galley/src/Galley/API/MLS/Message.hs @@ -338,9 +338,9 @@ postMLSCommitBundleToRemoteConv loc qusr con bundle rcnv = do runFederated rcnv $ fedClient @'Galley @"send-mls-commit-bundle" $ MLSMessageSendRequest - { mmsrConvOrSubId = Conv $ tUnqualified rcnv, - mmsrSender = tUnqualified lusr, - mmsrRawMessage = Base64ByteString (serializeCommitBundle bundle) + { convOrSubId = Conv $ tUnqualified rcnv, + sender = tUnqualified lusr, + rawMessage = Base64ByteString (serializeCommitBundle bundle) } case resp of MLSMessageResponseError e -> rethrowErrors @MLSBundleStaticErrors e @@ -523,9 +523,9 @@ postMLSMessageToRemoteConv loc qusr _senderClient con smsg rcnv = do runFederated rcnv $ fedClient @'Galley @"send-mls-message" $ MLSMessageSendRequest - { mmsrConvOrSubId = Conv $ tUnqualified rcnv, - mmsrSender = tUnqualified lusr, - mmsrRawMessage = Base64ByteString (rmRaw smsg) + { convOrSubId = Conv $ tUnqualified rcnv, + sender = tUnqualified lusr, + rawMessage = Base64ByteString (rmRaw smsg) } case resp of MLSMessageResponseError e -> rethrowErrors @MLSMessageStaticErrors e @@ -728,7 +728,7 @@ processExternalCommit qusr mSenderClient lconv mlsMeta cm epoch action updatePat -- increment epoch number setConversationEpoch (Data.convId (tUnqualified lconv)) (succ epoch) -- fetch local conversation with new epoch - lc <- qualifyAs lconv <$> getLocalConvForUser qusr (convId <$> lconv) + lc <- qualifyAs lconv <$> getLocalConvForUser qusr ((.convId) <$> lconv) -- fetch backend remove proposals of the previous epoch kpRefs <- getPendingBackendRemoveProposals (cnvmlsGroupId mlsMeta) epoch -- requeue backend remove proposals for the current epoch @@ -929,10 +929,10 @@ applyProposalRef conv mlsMeta groupId epoch _suite (Ref ref) = do p <- getProposal groupId epoch ref >>= noteS @'MLSProposalNotFound checkEpoch epoch mlsMeta checkGroup groupId mlsMeta - applyProposal (convId conv) groupId (rmValue p) + applyProposal conv.convId groupId (rmValue p) applyProposalRef conv _mlsMeta groupId _epoch suite (Inline p) = do checkProposalCipherSuite suite p - applyProposal (convId conv) groupId p + applyProposal conv.convId groupId p applyProposal :: forall r. @@ -1021,11 +1021,11 @@ processProposal qusr conv mlsMeta msg prop = do foldQualified loc ( fmap isJust - . getLocalMember (convId conv) + . getLocalMember conv.convId . tUnqualified ) ( fmap isJust - . getRemoteMember (convId conv) + . getRemoteMember conv.convId ) qusr unless isMember' $ throwS @'ConvNotFound @@ -1273,8 +1273,8 @@ getRemoteMLSClients rusr ss = do runFederated rusr $ fedClient @'Brig @"get-mls-clients" $ MLSClientsRequest - { mcrUserId = tUnqualified rusr, - mcrSignatureScheme = ss + { userId = tUnqualified rusr, + signatureScheme = ss } -- | Check if the epoch number matches that of a conversation @@ -1321,7 +1321,7 @@ class HandleMLSProposalFailure eff r where handleMLSProposalFailure :: Sem (eff ': r) a -> Sem r a instance HandleMLSProposalFailures '[] r where - handleMLSProposalFailures = id + handleMLSProposalFailures = Imports.id instance ( HandleMLSProposalFailures effs r, diff --git a/services/galley/src/Galley/API/MLS/Propagate.hs b/services/galley/src/Galley/API/MLS/Propagate.hs index c95e4c7dca6..d40758fa735 100644 --- a/services/galley/src/Galley/API/MLS/Propagate.hs +++ b/services/galley/src/Galley/API/MLS/Propagate.hs @@ -87,12 +87,12 @@ propagateMessage qusr lconv cm con raw = do $ \(tUnqualified -> rs) -> fedClient @'Galley @"on-mls-message-sent" $ RemoteMLSMessage - { rmmTime = now, - rmmSender = qusr, - rmmMetadata = mm, - rmmConversation = tUnqualified lcnv, - rmmRecipients = rs >>= remoteMemberMLSClients, - rmmMessage = Base64ByteString raw + { time = now, + sender = qusr, + metadata = mm, + conversation = tUnqualified lcnv, + recipients = rs >>= remoteMemberMLSClients, + message = Base64ByteString raw } where localMemberMLSClients :: Local x -> LocalMember -> [(UserId, ClientId)] diff --git a/services/galley/src/Galley/API/Mapping.hs b/services/galley/src/Galley/API/Mapping.hs index 074cab6f2f9..ec6f0993e12 100644 --- a/services/galley/src/Galley/API/Mapping.hs +++ b/services/galley/src/Galley/API/Mapping.hs @@ -29,7 +29,6 @@ import Data.Id (UserId, idToText) import Data.Qualified import Galley.API.Error import Galley.Data.Conversation qualified as Data -import Galley.Data.Types (convId) import Galley.Types.Conversations.Members import Imports import Polysemy @@ -76,7 +75,7 @@ conversationViewWithCachedOthers remoteOthers localOthers conv luid = do val "User " +++ idToText (tUnqualified luid) +++ val " is not a member of conv " - +++ idToText (convId conv) + +++ idToText (Data.convId conv) throw BadMemberState -- | View for a given user of a stored conversation. @@ -89,7 +88,7 @@ conversationViewMaybe luid remoteOthers localOthers conv = do let others = filter (\oth -> tUntagged luid /= omQualifiedId oth) localOthers <> remoteOthers pure $ Conversation - (tUntagged . qualifyAs luid . convId $ conv) + (tUntagged . qualifyAs luid . Data.convId $ conv) (Data.convMetadata conv) (ConvMembers self others) (Data.convProtocol conv) @@ -101,8 +100,8 @@ remoteConversationView :: Remote RemoteConversation -> Conversation remoteConversationView uid status (tUntagged -> Qualified rconv rDomain) = - let mems = rcnvMembers rconv - others = rcmOthers mems + let mems = rconv.members + others = mems.others self = localMemberToSelf uid @@ -110,13 +109,13 @@ remoteConversationView uid status (tUntagged -> Qualified rconv rDomain) = { lmId = tUnqualified uid, lmService = Nothing, lmStatus = status, - lmConvRoleName = rcmSelfRole mems + lmConvRoleName = mems.selfRole } in Conversation - (Qualified (rcnvId rconv) rDomain) - (rcnvMetadata rconv) + (Qualified rconv.id rDomain) + rconv.metadata (ConvMembers self others) - (rcnvProtocol rconv) + rconv.protocol -- | Convert a local conversation to a structure to be returned to a remote -- backend. @@ -130,20 +129,20 @@ conversationToRemote :: conversationToRemote localDomain ruid conv = do let (selfs, rothers) = partition ((== ruid) . rmId) (Data.convRemoteMembers conv) lothers = Data.convLocalMembers conv - selfRole <- rmConvRoleName <$> listToMaybe selfs - let others = + selfRole' <- rmConvRoleName <$> listToMaybe selfs + let others' = map (localMemberToOther localDomain) lothers <> map remoteMemberToOther rothers pure $ RemoteConversation - { rcnvId = Data.convId conv, - rcnvMetadata = Data.convMetadata conv, - rcnvMembers = + { id = Data.convId conv, + metadata = Data.convMetadata conv, + members = RemoteConvMembers - { rcmSelfRole = selfRole, - rcmOthers = others + { selfRole = selfRole', + others = others' }, - rcnvProtocol = Data.convProtocol conv + protocol = Data.convProtocol conv } -- | Convert a local conversation member (as stored in the DB) to a publicly diff --git a/services/galley/src/Galley/API/Message.hs b/services/galley/src/Galley/API/Message.hs index 5b210ee8347..9302001017f 100644 --- a/services/galley/src/Galley/API/Message.hs +++ b/services/galley/src/Galley/API/Message.hs @@ -148,7 +148,7 @@ mkMessageSendingStatus time mismatch = } clientMismatchStrategyApply :: ClientMismatchStrategy -> QualifiedRecipientSet -> QualifiedRecipientSet -clientMismatchStrategyApply MismatchReportAll = id +clientMismatchStrategyApply MismatchReportAll = Imports.id clientMismatchStrategyApply MismatchIgnoreAll = const mempty clientMismatchStrategyApply (MismatchReportOnly users) = Set.filter (\(d, u, _) -> Set.member (Qualified u d) users) @@ -190,7 +190,7 @@ checkMessageClients :: ClientMismatchStrategy -> (Bool, Map (Domain, UserId, ClientId) ByteString, QualifiedMismatch) checkMessageClients sender participantMap recipientMap mismatchStrat = - let participants = setOf ((itraversed <. folded) . withIndex . to (\((d, u), c) -> (d, u, c))) participantMap + let participants = setOf ((itraversed <. folded) . withIndex . Control.Lens.to (\((d, u), c) -> (d, u, c))) participantMap expected = Set.delete sender participants expectedUsers :: Set (Domain, UserId) = Map.keysSet participantMap @@ -242,12 +242,12 @@ postRemoteOtrMessage :: postRemoteOtrMessage sender conv rawMsg = do let msr = ProteusMessageSendRequest - { pmsrConvId = tUnqualified conv, - pmsrSender = qUnqualified sender, - pmsrRawMessage = Base64ByteString rawMsg + { convId = tUnqualified conv, + sender = qUnqualified sender, + rawMessage = Base64ByteString rawMsg } rpc = fedClient @'Galley @"send-message" msr - msResponse <$> runFederated conv rpc + (.response) <$> runFederated conv rpc postBroadcast :: ( Member BrigAccess r, @@ -287,7 +287,7 @@ postBroadcast lusr con msg = runError $ do -- is used and length `report_missing` < limit since we cannot fetch larger teams than -- that. tMembers <- - fmap (view userId) <$> case qualifiedNewOtrClientMismatchStrategy msg of + fmap (view Wire.API.Team.Member.userId) <$> case qualifiedNewOtrClientMismatchStrategy msg of -- Note: remote ids are not in a local team MismatchReportOnly qus -> maybeFetchLimitedTeamMemberList @@ -411,7 +411,7 @@ postQualifiedOtrMessage senderType sender mconn lcnv msg = Set.fromList $ map (tUntagged . qualifyAs lcnv) localMemberIds <> map (tUntagged . rmId) (convRemoteMembers conv) - isInternal <- view (optSettings . setIntraListing) <$> input + isInternal <- view (settings . intraListing) <$> input -- check if the sender is part of the conversation unless (Set.member sender members) $ @@ -653,15 +653,15 @@ sendRemoteMessages domain now sender senderClient lcnv metadata messages = (hand (Map.assocs messages) rm = RemoteMessage - { rmTime = now, - rmData = mmData metadata, - rmSender = sender, - rmSenderClient = senderClient, - rmConversation = tUnqualified lcnv, - rmPriority = mmNativePriority metadata, - rmPush = mmNativePush metadata, - rmTransient = mmTransient metadata, - rmRecipients = UserClientMap rcpts + { time = now, + _data = mmData metadata, + sender = sender, + senderClient = senderClient, + conversation = tUnqualified lcnv, + priority = mmNativePriority metadata, + push = mmNativePush metadata, + transient = mmTransient metadata, + recipients = UserClientMap rcpts } let rpc = void $ fedQueueClient @'Galley @"on-message-sent" rm enqueueNotification domain Q.Persistent rpc @@ -716,7 +716,7 @@ class Unqualify a b where unqualify :: Domain -> a -> b instance Unqualify a a where - unqualify _ = id + unqualify _ = Imports.id instance Unqualify MessageSendingStatus ClientMismatch where unqualify domain status = diff --git a/services/galley/src/Galley/API/Query.hs b/services/galley/src/Galley/API/Query.hs index 16635d55b37..02b9e3ad885 100644 --- a/services/galley/src/Galley/API/Query.hs +++ b/services/galley/src/Galley/API/Query.hs @@ -249,7 +249,7 @@ getRemoteConversationsWithFailures lusr convs = do lusr ( Map.findWithDefault defMemberStatus - (fmap rcnvId rconv) + ((.id) <$> rconv) statusMap ) rconv @@ -277,7 +277,7 @@ getRemoteConversationsWithFailures lusr convs = do Logger.msg ("Error occurred while fetching remote conversations" :: ByteString) . Logger.field "error" (show e) pure . Left $ failedGetConversationRemotely (sequenceA rcids) e - handleFailure (Right c) = pure . Right . traverse gcresConvs $ c + handleFailure (Right c) = pure . Right . traverse (.convs) $ c getConversationRoles :: ( Member ConversationStore r, @@ -690,7 +690,7 @@ getConversationGuestLinksFeatureStatus :: Maybe TeamId -> Sem r (WithStatus GuestLinksConfig) getConversationGuestLinksFeatureStatus mbTid = do - defaultStatus :: WithStatus GuestLinksConfig <- input <&> view (optSettings . setFeatureFlags . flagConversationGuestLinks . unDefaults) + defaultStatus :: WithStatus GuestLinksConfig <- input <&> view (settings . featureFlags . flagConversationGuestLinks . unDefaults) case mbTid of Nothing -> pure defaultStatus Just tid -> do diff --git a/services/galley/src/Galley/API/Teams.hs b/services/galley/src/Galley/API/Teams.hs index 53f1a9ad815..921990a56fd 100644 --- a/services/galley/src/Galley/API/Teams.hs +++ b/services/galley/src/Galley/API/Teams.hs @@ -290,11 +290,11 @@ updateTeamStatus tid (TeamStatusUpdate newStatus cur) = do oldStatus <- fmap tdStatus $ E.getTeam tid >>= noteS @'TeamNotFound valid <- validateTransition (oldStatus, newStatus) when valid $ do - journal newStatus cur + runJournal newStatus cur E.setTeamStatus tid newStatus where - journal Suspended _ = Journal.teamSuspend tid - journal Active c = do + runJournal Suspended _ = Journal.teamSuspend tid + runJournal Active c = do teamCreationTime <- E.getTeamCreationTime tid -- When teams are created, they are activated immediately. In this situation, Brig will -- most likely report team size as 0 due to ES taking some time to index the team creator. @@ -305,7 +305,7 @@ updateTeamStatus tid (TeamStatusUpdate newStatus cur) = do then 1 else possiblyStaleSize Journal.teamActivate tid size c teamCreationTime - journal _ _ = throwS @'InvalidTeamStatusUpdate + runJournal _ _ = throwS @'InvalidTeamStatusUpdate validateTransition :: Member (ErrorS 'InvalidTeamStatusUpdate) r => (TeamStatus, TeamStatus) -> Sem r Bool validateTransition = \case (PendingActive, Active) -> pure True @@ -437,10 +437,10 @@ uncheckedDeleteTeam lusr zcon tid = do where pushDeleteEvents :: [TeamMember] -> Event -> [Push] -> Sem r () pushDeleteEvents membs e ue = do - o <- inputs (view optSettings) + o <- inputs (view settings) let r = list1 (userRecipient (tUnqualified lusr)) (membersToRecipients (Just (tUnqualified lusr)) membs) -- To avoid DoS on gundeck, send team deletion events in chunks - let chunkSize = fromMaybe defConcurrentDeletionEvents (o ^. setConcurrentDeletionEvents) + let chunkSize = fromMaybe defConcurrentDeletionEvents (o ^. concurrentDeletionEvents) let chunks = List.chunksOf chunkSize (toList r) forM_ chunks $ \case [] -> pure () @@ -1216,7 +1216,7 @@ ensureNotTooLarge :: ensureNotTooLarge tid = do o <- input (TeamSize size) <- E.getSize tid - unless (size < fromIntegral (o ^. optSettings . setMaxTeamSize)) $ + unless (size < fromIntegral (o ^. settings . maxTeamSize)) $ throwS @'TooManyTeamMembers pure $ TeamSize size diff --git a/services/galley/src/Galley/API/Teams/Features/Get.hs b/services/galley/src/Galley/API/Teams/Features/Get.hs index 9ba9d1e2159..0fae9d94deb 100644 --- a/services/galley/src/Galley/API/Teams/Features/Get.hs +++ b/services/galley/src/Galley/API/Teams/Features/Get.hs @@ -356,7 +356,7 @@ genericGetConfigForUser uid = do instance GetFeatureConfig SSOConfig where getConfigForServer = do status <- - inputs (view (optSettings . setFeatureFlags . flagSSO)) <&> \case + inputs (view (settings . featureFlags . flagSSO)) <&> \case FeatureSSOEnabledByDefault -> FeatureStatusEnabled FeatureSSODisabledByDefault -> FeatureStatusDisabled pure $ setStatus status defFeatureStatus @@ -366,14 +366,14 @@ instance GetFeatureConfig SSOConfig where instance GetFeatureConfig SearchVisibilityAvailableConfig where getConfigForServer = do status <- - inputs (view (optSettings . setFeatureFlags . flagTeamSearchVisibility)) <&> \case + inputs (view (settings . featureFlags . flagTeamSearchVisibility)) <&> \case FeatureTeamSearchVisibilityAvailableByDefault -> FeatureStatusEnabled FeatureTeamSearchVisibilityUnavailableByDefault -> FeatureStatusDisabled pure $ setStatus status defFeatureStatus instance GetFeatureConfig ValidateSAMLEmailsConfig where getConfigForServer = - inputs (view (optSettings . setFeatureFlags . flagsTeamFeatureValidateSAMLEmailsStatus . unDefaults . unImplicitLockStatus)) + inputs (view (settings . featureFlags . flagsTeamFeatureValidateSAMLEmailsStatus . unDefaults . unImplicitLockStatus)) instance GetFeatureConfig DigitalSignaturesConfig @@ -405,15 +405,15 @@ instance GetFeatureConfig LegalholdConfig where instance GetFeatureConfig FileSharingConfig where getConfigForServer = - input <&> view (optSettings . setFeatureFlags . flagFileSharing . unDefaults) + input <&> view (settings . featureFlags . flagFileSharing . unDefaults) instance GetFeatureConfig AppLockConfig where getConfigForServer = - input <&> view (optSettings . setFeatureFlags . flagAppLockDefaults . unDefaults . unImplicitLockStatus) + input <&> view (settings . featureFlags . flagAppLockDefaults . unDefaults . unImplicitLockStatus) instance GetFeatureConfig ClassifiedDomainsConfig where getConfigForServer = - input <&> view (optSettings . setFeatureFlags . flagClassifiedDomains . unImplicitLockStatus) + input <&> view (settings . featureFlags . flagClassifiedDomains . unImplicitLockStatus) instance GetFeatureConfig ConferenceCallingConfig where type @@ -428,7 +428,7 @@ instance GetFeatureConfig ConferenceCallingConfig where ) getConfigForServer = - input <&> view (optSettings . setFeatureFlags . flagConferenceCalling . unDefaults . unImplicitLockStatus) + input <&> view (settings . featureFlags . flagConferenceCalling . unDefaults . unImplicitLockStatus) getConfigForUser uid = do wsnl <- getAccountConferenceCallingConfigClient uid @@ -436,27 +436,27 @@ instance GetFeatureConfig ConferenceCallingConfig where instance GetFeatureConfig SelfDeletingMessagesConfig where getConfigForServer = - input <&> view (optSettings . setFeatureFlags . flagSelfDeletingMessages . unDefaults) + input <&> view (settings . featureFlags . flagSelfDeletingMessages . unDefaults) instance GetFeatureConfig GuestLinksConfig where getConfigForServer = - input <&> view (optSettings . setFeatureFlags . flagConversationGuestLinks . unDefaults) + input <&> view (settings . featureFlags . flagConversationGuestLinks . unDefaults) instance GetFeatureConfig SndFactorPasswordChallengeConfig where getConfigForServer = - input <&> view (optSettings . setFeatureFlags . flagTeamFeatureSndFactorPasswordChallengeStatus . unDefaults) + input <&> view (settings . featureFlags . flagTeamFeatureSndFactorPasswordChallengeStatus . unDefaults) instance GetFeatureConfig SearchVisibilityInboundConfig where getConfigForServer = - input <&> view (optSettings . setFeatureFlags . flagTeamFeatureSearchVisibilityInbound . unDefaults . unImplicitLockStatus) + input <&> view (settings . featureFlags . flagTeamFeatureSearchVisibilityInbound . unDefaults . unImplicitLockStatus) instance GetFeatureConfig MLSConfig where getConfigForServer = - input <&> view (optSettings . setFeatureFlags . flagMLS . unDefaults . unImplicitLockStatus) + input <&> view (settings . featureFlags . flagMLS . unDefaults . unImplicitLockStatus) instance GetFeatureConfig ExposeInvitationURLsToTeamAdminConfig where getConfigForTeam tid = do - allowList <- input <&> view (optSettings . setExposeInvitationURLsTeamAllowlist . to (fromMaybe [])) + allowList <- input <&> view (settings . exposeInvitationURLsTeamAllowlist . to (fromMaybe [])) mbOldStatus <- TeamFeatures.getFeatureConfig FeatureSingletonExposeInvitationURLsToTeamAdminConfig tid <&> fmap wssStatus let teamAllowed = tid `elem` allowList pure $ computeConfigForTeam teamAllowed (fromMaybe FeatureStatusDisabled mbOldStatus) @@ -477,11 +477,11 @@ instance GetFeatureConfig ExposeInvitationURLsToTeamAdminConfig where instance GetFeatureConfig OutlookCalIntegrationConfig where getConfigForServer = - input <&> view (optSettings . setFeatureFlags . flagOutlookCalIntegration . unDefaults) + input <&> view (settings . featureFlags . flagOutlookCalIntegration . unDefaults) instance GetFeatureConfig MlsE2EIdConfig where getConfigForServer = - input <&> view (optSettings . setFeatureFlags . flagMlsE2EId . unDefaults) + input <&> view (settings . featureFlags . flagMlsE2EId . unDefaults) -- -- | If second factor auth is enabled, make sure that end-points that don't support it, but should, are blocked completely. (This is a workaround until we have 2FA for those end-points as well.) -- -- diff --git a/services/galley/src/Galley/API/Update.hs b/services/galley/src/Galley/API/Update.hs index c16c805172c..eb3253d10a3 100644 --- a/services/galley/src/Galley/API/Update.hs +++ b/services/galley/src/Galley/API/Update.hs @@ -366,9 +366,9 @@ updateRemoteConversation :: updateRemoteConversation rcnv lusr conn action = getUpdateResult $ do let updateRequest = ConversationUpdateRequest - { curUser = tUnqualified lusr, - curConvId = tUnqualified rcnv, - curAction = SomeConversationAction (sing @tag) action + { user = tUnqualified lusr, + convId = tUnqualified rcnv, + action = SomeConversationAction (sing @tag) action } response <- E.runFederated rcnv (fedClient @'Galley @"update-conversation" updateRequest) convUpdate <- case response of @@ -751,7 +751,7 @@ joinConversation :: Access -> Sem r (UpdateResult Event) joinConversation lusr zcon conv access = do - let lcnv = qualifyAs lusr (convId conv) + let lcnv = qualifyAs lusr conv.convId ensureConversationAccess (tUnqualified lusr) conv access ensureGroupConversation conv -- FUTUREWORK: remote users? @@ -1110,7 +1110,7 @@ removeMemberFromRemoteConv cnv lusr victim | tUntagged lusr == victim = do let lc = LeaveConversationRequest (tUnqualified cnv) (qUnqualified victim) let rpc = fedClient @'Galley @"leave-conversation" lc - (either handleError handleSuccess . void . leaveResponse =<<) $ + (either handleError handleSuccess . void . (.response) =<<) $ E.runFederated cnv rpc | otherwise = throwS @('ActionDenied 'RemoveConversationMember) where @@ -1421,14 +1421,14 @@ memberTyping lusr zcon qcnv ts = do unless isMemberRemoteConv $ throwS @'ConvNotFound let rpc = TypingDataUpdateRequest - { tdurTypingStatus = ts, - tdurUserId = tUnqualified lusr, - tdurConvId = tUnqualified rcnv + { typingStatus = ts, + userId = tUnqualified lusr, + convId = tUnqualified rcnv } res <- E.runFederated rcnv (fedClient @'Galley @"update-typing-indicator" rpc) case res of TypingDataUpdateSuccess (TypingDataUpdated {..}) -> do - pushTypingIndicatorEvents tudOrigUserId tudTime tudUsersInConv (Just zcon) qcnv tudTypingStatus + pushTypingIndicatorEvents origUserId time usersInConv (Just zcon) qcnv typingStatus TypingDataUpdateError _ -> pure () ) qcnv diff --git a/services/galley/src/Galley/API/Util.hs b/services/galley/src/Galley/API/Util.hs index 7dfa122432f..9fd9d441d86 100644 --- a/services/galley/src/Galley/API/Util.hs +++ b/services/galley/src/Galley/API/Util.hs @@ -68,7 +68,7 @@ import Polysemy.Error import Polysemy.Input import Polysemy.TinyLog qualified as P import Wire.API.Connection -import Wire.API.Conversation hiding (Member) +import Wire.API.Conversation hiding (Member, cnvAccess, cnvAccessRoles, cnvName, cnvType) import Wire.API.Conversation qualified as Public import Wire.API.Conversation.Action import Wire.API.Conversation.Protocol @@ -83,6 +83,7 @@ import Wire.API.Password (verifyPassword) import Wire.API.Routes.Public.Galley.Conversation import Wire.API.Routes.Public.Util import Wire.API.Team.Member +import Wire.API.Team.Member qualified as Mem import Wire.API.Team.Role import Wire.API.User (VerificationAction) import Wire.API.User qualified as User @@ -128,7 +129,7 @@ ensureConnectedOrSameTeam (tUnqualified -> u) uids = do uTeams <- getUserTeams u -- We collect all the relevant uids from same teams as the origin user sameTeamUids <- forM uTeams $ \team -> - fmap (view userId) <$> selectTeamMembers team uids + fmap (view Mem.userId) <$> selectTeamMembers team uids -- Do not check connections for users that are on the same team ensureConnectedToLocals u (uids \\ join sameTeamUids) @@ -488,8 +489,8 @@ nonTeamMembers cm tm = filter (not . isMemberOfTeam . lmId) cm uid -> isTeamMember uid tm membersToRecipients :: Maybe UserId -> [TeamMember] -> [Recipient] -membersToRecipients Nothing = map (userRecipient . view userId) -membersToRecipients (Just u) = map userRecipient . filter (/= u) . map (view userId) +membersToRecipients Nothing = map (userRecipient . view Mem.userId) +membersToRecipients (Just u) = map userRecipient . filter (/= u) . map (view Mem.userId) getSelfMemberFromLocals :: (Foldable t, Member (ErrorS 'ConvNotFound) r) => @@ -572,7 +573,7 @@ canDeleteMember :: TeamMember -> TeamMember -> Bool canDeleteMember deleter deletee | getRole deletee == RoleOwner = getRole deleter == RoleOwner -- owners can only be deleted by another owner - && (deleter ^. userId /= deletee ^. userId) -- owner cannot delete itself + && (deleter ^. Mem.userId /= deletee ^. Mem.userId) -- owner cannot delete itself | otherwise = True where @@ -674,19 +675,19 @@ toConversationCreated :: ConversationCreated ConvId toConversationCreated now Data.Conversation {convMetadata = ConversationMetadata {..}, ..} = do ConversationCreated - { ccTime = now, - ccOrigUserId = cnvmCreator, - ccCnvId = convId, - ccCnvType = cnvmType, - ccCnvAccess = cnvmAccess, - ccCnvAccessRoles = cnvmAccessRoles, - ccCnvName = cnvmName, + { time = now, + origUserId = cnvmCreator, + cnvId = convId, + cnvType = cnvmType, + cnvAccess = cnvmAccess, + cnvAccessRoles = cnvmAccessRoles, + cnvName = cnvmName, -- non-creator members are a function of the remote backend and will be -- overridden when fanning out the notification to remote backends. - ccNonCreatorMembers = Set.empty, - ccMessageTimer = cnvmMessageTimer, - ccReceiptMode = cnvmReceiptMode, - ccProtocol = convProtocol + nonCreatorMembers = Set.empty, + messageTimer = cnvmMessageTimer, + receiptMode = cnvmReceiptMode, + protocol = convProtocol } -- | The function converts a 'ConversationCreated' value to a @@ -699,7 +700,7 @@ fromConversationCreated :: ConversationCreated (Remote ConvId) -> [(Public.Member, Public.Conversation)] fromConversationCreated loc rc@ConversationCreated {..} = - let membersView = fmap (second Set.toList) . setHoles $ ccNonCreatorMembers + let membersView = fmap (second Set.toList) . setHoles $ nonCreatorMembers creatorOther = OtherMember (tUntagged (ccRemoteOrigUserId rc)) @@ -712,7 +713,7 @@ fromConversationCreated loc rc@ConversationCreated {..} = membersView where inDomain :: OtherMember -> Bool - inDomain = (== tDomain loc) . qDomain . omQualifiedId + inDomain = (== tDomain loc) . qDomain . Public.omQualifiedId setHoles :: Ord a => Set a -> [(a, Set a)] setHoles s = foldMap (\x -> [(x, Set.delete x s)]) s -- Currently this function creates a Member with default conversation attributes @@ -720,33 +721,33 @@ fromConversationCreated loc rc@ConversationCreated {..} = toMember :: OtherMember -> Public.Member toMember m = Public.Member - { memId = omQualifiedId m, - memService = omService m, + { memId = Public.omQualifiedId m, + memService = Public.omService m, memOtrMutedStatus = Nothing, memOtrMutedRef = Nothing, memOtrArchived = False, memOtrArchivedRef = Nothing, memHidden = False, memHiddenRef = Nothing, - memConvRoleName = omConvRoleName m + memConvRoleName = Public.omConvRoleName m } conv :: Public.Member -> [OtherMember] -> Public.Conversation conv this others = Public.Conversation - (tUntagged ccCnvId) + (tUntagged cnvId) ConversationMetadata - { cnvmType = ccCnvType, + { cnvmType = cnvType, -- FUTUREWORK: Document this is the same domain as the conversation -- domain - cnvmCreator = ccOrigUserId, - cnvmAccess = ccCnvAccess, - cnvmAccessRoles = ccCnvAccessRoles, - cnvmName = ccCnvName, + cnvmCreator = origUserId, + cnvmAccess = cnvAccess, + cnvmAccessRoles = cnvAccessRoles, + cnvmName = cnvName, -- FUTUREWORK: Document this is the same domain as the conversation -- domain. cnvmTeam = Nothing, - cnvmMessageTimer = ccMessageTimer, - cnvmReceiptMode = ccReceiptMode + cnvmMessageTimer = messageTimer, + cnvmReceiptMode = receiptMode } (ConvMembers this others) ProtocolProteus @@ -791,7 +792,7 @@ registerRemoteConversationMemberships now lc = deleteOnUnreachable $ do \rrms -> fedClient @'Galley @"on-conversation-created" ( rc - { ccNonCreatorMembers = + { nonCreatorMembers = toMembers (tUnqualified rrms) } ) @@ -905,7 +906,7 @@ anyLegalholdActivated :: Sem r Bool anyLegalholdActivated uids = do opts <- input - case view (optSettings . setFeatureFlags . flagLegalHold) opts of + case view (settings . featureFlags . flagLegalHold) opts of FeatureLegalHoldDisabledPermanently -> pure False FeatureLegalHoldDisabledByDefault -> check FeatureLegalHoldWhitelistTeamsAndImplicitConsent -> check @@ -924,7 +925,7 @@ allLegalholdConsentGiven :: Sem r Bool allLegalholdConsentGiven uids = do opts <- input - case view (optSettings . setFeatureFlags . flagLegalHold) opts of + case view (settings . featureFlags . flagLegalHold) opts of FeatureLegalHoldDisabledPermanently -> pure False FeatureLegalHoldDisabledByDefault -> do flip allM (chunksOf 32 uids) $ \uidsPage -> do @@ -969,7 +970,7 @@ ensureMemberLimit :: Sem r () ensureMemberLimit old new = do o <- input - let maxSize = fromIntegral (o ^. optSettings . setMaxConvSize) + let maxSize = fromIntegral (o ^. settings . maxConvSize) when (length old + length new > maxSize) $ throwS @'TooManyMembers diff --git a/services/galley/src/Galley/App.hs b/services/galley/src/Galley/App.hs index f90daa29f29..55c1dfab8df 100644 --- a/services/galley/src/Galley/App.hs +++ b/services/galley/src/Galley/App.hs @@ -44,7 +44,7 @@ module Galley.App ) where -import Bilge hiding (Request, header, options, statusCode, statusMessage) +import Bilge hiding (Request, header, host, options, port, statusCode, statusMessage) import Cassandra hiding (Set) import Cassandra qualified as C import Cassandra.Settings qualified as C @@ -81,13 +81,14 @@ import Galley.Intra.BackendNotificationQueue import Galley.Intra.Effects import Galley.Intra.Federator import Galley.Keys -import Galley.Options +import Galley.Options hiding (brig, endpoint, federator) +import Galley.Options qualified as O import Galley.Queue import Galley.Queue qualified as Q import Galley.Types.Teams qualified as Teams import HTTP2.Client.Manager (Http2Manager, http2ManagerWithSSLCtx) import Imports hiding (forkIO) -import Network.AMQP.Extended +import Network.AMQP.Extended (mkRabbitMqChannelMVar) import Network.HTTP.Client (responseTimeoutMicro) import Network.HTTP.Client.OpenSSL import Network.Wai.Utilities.JSONResponse @@ -101,7 +102,7 @@ import Polysemy.TinyLog qualified as P import Servant qualified import Ssl.Util import System.Logger qualified as Log -import System.Logger.Class +import System.Logger.Class (Logger) import System.Logger.Extended qualified as Logger import UnliftIO.Exception qualified as UnliftIO import Util.Options @@ -129,13 +130,13 @@ type GalleyEffects = Append GalleyEffects1 GalleyEffects0 -- Define some invariants for the options used validateOptions :: Opts -> IO () validateOptions o = do - let settings = view optSettings o + let settings' = view settings o optFanoutLimit = fromIntegral . fromRange $ currentFanoutLimit o - when (settings ^. setMaxConvSize > fromIntegral optFanoutLimit) $ + when (settings' ^. maxConvSize > fromIntegral optFanoutLimit) $ error "setMaxConvSize cannot be > setTruncationLimit" - when (settings ^. setMaxTeamSize < optFanoutLimit) $ + when (settings' ^. maxTeamSize < optFanoutLimit) $ error "setMaxTeamSize cannot be < setTruncationLimit" - case (o ^. optFederator, o ^. optRabbitmq) of + case (o ^. O.federator, o ^. rabbitmq) of (Nothing, Just _) -> error "RabbitMQ config is specified and federator is not, please specify both or none" (Just _, Nothing) -> error "Federator is specified and RabbitMQ config is not, please specify both or none" _ -> pure () @@ -146,32 +147,32 @@ createEnv m o l = do mgr <- initHttpManager o h2mgr <- initHttp2Manager validateOptions o - Env def m o l mgr h2mgr (o ^. optFederator) (o ^. optBrig) cass + Env def m o l mgr h2mgr (o ^. O.federator) (o ^. O.brig) cass <$> Q.new 16000 <*> initExtEnv - <*> maybe (pure Nothing) (fmap Just . Aws.mkEnv l mgr) (o ^. optJournal) - <*> loadAllMLSKeys (fold (o ^. optSettings . setMlsPrivateKeyPaths)) - <*> traverse (mkRabbitMqChannelMVar l) (o ^. optRabbitmq) + <*> maybe (pure Nothing) (fmap Just . Aws.mkEnv l mgr) (o ^. journal) + <*> loadAllMLSKeys (fold (o ^. settings . mlsPrivateKeyPaths)) + <*> traverse (mkRabbitMqChannelMVar l) (o ^. rabbitmq) initCassandra :: Opts -> Logger -> IO ClientState initCassandra o l = do c <- maybe - (C.initialContactsPlain (o ^. optCassandra . casEndpoint . epHost)) + (C.initialContactsPlain (o ^. cassandra . endpoint . host)) (C.initialContactsDisco "cassandra_galley" . unpack) - (o ^. optDiscoUrl) + (o ^. discoUrl) C.init . C.setLogger (C.mkLogger (Logger.clone (Just "cassandra.galley") l)) . C.setContacts (NE.head c) (NE.tail c) - . C.setPortNumber (fromIntegral $ o ^. optCassandra . casEndpoint . epPort) - . C.setKeyspace (Keyspace $ o ^. optCassandra . casKeyspace) + . C.setPortNumber (fromIntegral $ o ^. cassandra . endpoint . port) + . C.setKeyspace (Keyspace $ o ^. cassandra . keyspace) . C.setMaxConnections 4 . C.setMaxStreams 128 . C.setPoolStripes 4 . C.setSendTimeout 3 . C.setResponseTimeout 10 . C.setProtocolVersion C.V4 - . C.setPolicy (C.dcFilterPolicyIfConfigured l (o ^. optCassandra . casFilterNodesByDatacentre)) + . C.setPolicy (C.dcFilterPolicyIfConfigured l (o ^. cassandra . filterNodesByDatacentre)) $ C.defSettings initHttpManager :: Opts -> IO Manager @@ -186,8 +187,8 @@ initHttpManager o = do newManager (opensslManagerSettings (pure ctx)) { managerResponseTimeout = responseTimeoutMicro 10000000, - managerConnCount = o ^. optSettings . setHttpPoolSize, - managerIdleConnectionCount = 3 * (o ^. optSettings . setHttpPoolSize) + managerConnCount = o ^. settings . httpPoolSize, + managerIdleConnectionCount = 3 * (o ^. settings . httpPoolSize) } initHttp2Manager :: IO Http2Manager @@ -246,7 +247,7 @@ evalGalley e = . runInputSem (embed getCurrentTime) -- FUTUREWORK: could we take the time only once instead? . interpretWaiRoutes . runInputConst (e ^. options) - . runInputConst (toLocalUnsafe (e ^. options . optSettings . setFederationDomain) ()) + . runInputConst (toLocalUnsafe (e ^. options . settings . federationDomain) ()) . interpretInternalTeamListToCassandra . interpretTeamListToCassandra . interpretLegacyConversationListToCassandra @@ -276,4 +277,4 @@ evalGalley e = . interpretSparAccess . interpretBrigAccess where - lh = view (options . optSettings . setFeatureFlags . Teams.flagLegalHold) e + lh = view (options . settings . featureFlags . Teams.flagLegalHold) e diff --git a/services/galley/src/Galley/Aws.hs b/services/galley/src/Galley/Aws.hs index 176f8dc38db..07a84b42fca 100644 --- a/services/galley/src/Galley/Aws.hs +++ b/services/galley/src/Galley/Aws.hs @@ -57,7 +57,7 @@ import Network.TLS qualified as TLS import Proto.TeamEvents qualified as E import System.Logger qualified as Logger import System.Logger.Class -import Util.Options +import Util.Options hiding (endpoint) newtype QueueUrl = QueueUrl Text deriving (Show) @@ -102,14 +102,14 @@ mkEnv :: Logger -> Manager -> JournalOpts -> IO Env mkEnv lgr mgr opts = do let g = Logger.clone (Just "aws.galley") lgr e <- mkAwsEnv g - q <- getQueueUrl e (opts ^. awsQueueName) + q <- getQueueUrl e (opts ^. queueName) pure (Env e g q) where sqs e = AWS.setEndpoint (e ^. awsSecure) (e ^. awsHost) (e ^. awsPort) SQS.defaultService mkAwsEnv g = do baseEnv <- AWS.newEnv AWS.discover - <&> AWS.configureService (sqs (opts ^. awsEndpoint)) + <&> AWS.configureService (sqs (opts ^. endpoint)) pure $ baseEnv { AWS.logger = awsLogger g, diff --git a/services/galley/src/Galley/Cassandra/Client.hs b/services/galley/src/Galley/Cassandra/Client.hs index cb30b340185..419feef79e6 100644 --- a/services/galley/src/Galley/Cassandra/Client.hs +++ b/services/galley/src/Galley/Cassandra/Client.hs @@ -69,4 +69,4 @@ interpretClientStoreToCassandra = interpret $ \case CreateClient uid cid -> embedClient $ updateClient True uid cid DeleteClient uid cid -> embedClient $ updateClient False uid cid DeleteClients uid -> embedClient $ eraseClients uid - UseIntraClientListing -> embedApp . view $ options . optSettings . setIntraListing + UseIntraClientListing -> embedApp . view $ options . settings . intraListing diff --git a/services/galley/src/Galley/Cassandra/Code.hs b/services/galley/src/Galley/Cassandra/Code.hs index 784e8d1089a..9206425afe3 100644 --- a/services/galley/src/Galley/Cassandra/Code.hs +++ b/services/galley/src/Galley/Cassandra/Code.hs @@ -49,7 +49,7 @@ interpretCodeStoreToCassandra = interpret $ \case MakeKey cid -> Code.mkKey cid GenerateCode cid s t -> Code.generate cid s t GetConversationCodeURI -> - view (options . optSettings . setConversationCodeURI) <$> input + view (options . settings . conversationCodeURI) <$> input -- | Insert a conversation code insertCode :: Code -> Maybe Password -> Client () diff --git a/services/galley/src/Galley/Cassandra/Team.hs b/services/galley/src/Galley/Cassandra/Team.hs index bbea1852b86..06560c01baf 100644 --- a/services/galley/src/Galley/Cassandra/Team.hs +++ b/services/galley/src/Galley/Cassandra/Team.hs @@ -99,7 +99,7 @@ interpretTeamStoreToCassandra lh = interpret $ \case SetTeamStatus tid st -> embedClient $ updateTeamStatus tid st FanoutLimit -> embedApp $ currentFanoutLimit <$> view options GetLegalHoldFlag -> - view (options . optSettings . setFeatureFlags . flagLegalHold) <$> input + view (options . settings . featureFlags . flagLegalHold) <$> input EnqueueTeamEvent e -> do menv <- inputs (view aEnv) for_ menv $ \env -> diff --git a/services/galley/src/Galley/Env.hs b/services/galley/src/Galley/Env.hs index 2dbf0b40d33..32e45f2aa73 100644 --- a/services/galley/src/Galley/Env.hs +++ b/services/galley/src/Galley/Env.hs @@ -29,6 +29,7 @@ import Data.Misc (Fingerprint, Rsa) import Data.Range import Galley.Aws qualified as Aws import Galley.Options +import Galley.Options qualified as O import Galley.Queue qualified as Q import HTTP2.Client.Manager (Http2Manager) import Imports @@ -104,6 +105,6 @@ reqIdMsg = ("request" .=) . unRequestId currentFanoutLimit :: Opts -> Range 1 HardTruncationLimit Int32 currentFanoutLimit o = do - let optFanoutLimit = fromIntegral . fromRange $ fromMaybe defFanoutLimit (o ^. (optSettings . setMaxFanoutSize)) - let maxTeamSize = fromIntegral (o ^. (optSettings . setMaxTeamSize)) - unsafeRange (min maxTeamSize optFanoutLimit) + let optFanoutLimit = fromIntegral . fromRange $ fromMaybe defFanoutLimit (o ^. (O.settings . maxFanoutSize)) + let maxSize = fromIntegral (o ^. (O.settings . maxTeamSize)) + unsafeRange (min maxSize optFanoutLimit) diff --git a/services/galley/src/Galley/Intra/BackendNotificationQueue.hs b/services/galley/src/Galley/Intra/BackendNotificationQueue.hs index 57e4628484c..fb2e02605fc 100644 --- a/services/galley/src/Galley/Intra/BackendNotificationQueue.hs +++ b/services/galley/src/Galley/Intra/BackendNotificationQueue.hs @@ -33,7 +33,7 @@ interpretBackendNotificationQueueAccess = interpret $ \case enqueueNotification :: Domain -> Q.DeliveryMode -> FedQueueClient c () -> App (Either FederationError ()) enqueueNotification remoteDomain deliveryMode action = do mChanVar <- view rabbitmqChannel - ownDomain <- view (options . optSettings . setFederationDomain) + ownDomain <- view (options . settings . federationDomain) case mChanVar of Nothing -> pure (Left FederationNotConfigured) Just chanVar -> do diff --git a/services/galley/src/Galley/Intra/Federator.hs b/services/galley/src/Galley/Intra/Federator.hs index b8e12474e42..e0ac966dcba 100644 --- a/services/galley/src/Galley/Intra/Federator.hs +++ b/services/galley/src/Galley/Intra/Federator.hs @@ -23,6 +23,7 @@ import Data.Bifunctor import Data.Qualified import Galley.Effects.FederatorAccess (FederatorAccess (..)) import Galley.Env +import Galley.Env qualified as E import Galley.Monad import Galley.Options import Imports @@ -48,15 +49,15 @@ interpretFederatorAccess = interpret $ \case RunFederatedConcurrentlyBucketsEither rs f -> embedApp $ runFederatedConcurrentlyBucketsEither rs f - IsFederationConfigured -> embedApp $ isJust <$> view federator + IsFederationConfigured -> embedApp $ isJust <$> view E.federator runFederatedEither :: Remote x -> FederatorClient c a -> App (Either FederationError a) runFederatedEither (tDomain -> remoteDomain) rpc = do - ownDomain <- view (options . optSettings . setFederationDomain) - mfedEndpoint <- view federator + ownDomain <- view (options . settings . federationDomain) + mfedEndpoint <- view E.federator mgr <- view http2Manager case mfedEndpoint of Nothing -> pure (Left FederationNotConfigured) diff --git a/services/galley/src/Galley/Intra/Push/Internal.hs b/services/galley/src/Galley/Intra/Push/Internal.hs index 0f6deec5619..272a4593493 100644 --- a/services/galley/src/Galley/Intra/Push/Internal.hs +++ b/services/galley/src/Galley/Intra/Push/Internal.hs @@ -191,7 +191,7 @@ newConversationEventPush e users = pushSlowly :: Foldable f => f Push -> App () pushSlowly ps = do - mmillis <- view (options . optSettings . setDeleteConvThrottleMillis) + mmillis <- view (options . settings . deleteConvThrottleMillis) let delay = 1000 * fromMaybe defDeleteConvThrottleMillis mmillis forM_ ps $ \p -> do push [p] diff --git a/services/galley/src/Galley/Intra/User.hs b/services/galley/src/Galley/Intra/User.hs index 1cf0ea992ef..a1b0b8cd6b4 100644 --- a/services/galley/src/Galley/Intra/User.hs +++ b/services/galley/src/Galley/Intra/User.hs @@ -35,7 +35,7 @@ module Galley.Intra.User ) where -import Bilge hiding (getHeader, options, statusCode) +import Bilge hiding (getHeader, host, options, port, statusCode) import Bilge.RPC import Brig.Types.Intra qualified as Brig import Control.Error hiding (bool, isRight) @@ -253,7 +253,7 @@ runHereClientM action = do mgr <- view manager brigep <- view brig let env = Client.mkClientEnv mgr baseurl - baseurl = Client.BaseUrl Client.Http (cs $ brigep ^. epHost) (fromIntegral $ brigep ^. epPort) "" + baseurl = Client.BaseUrl Client.Http (cs $ brigep ^. host) (fromIntegral $ brigep ^. port) "" liftIO $ Client.runClientM action env handleServantResp :: diff --git a/services/galley/src/Galley/Intra/Util.hs b/services/galley/src/Galley/Intra/Util.hs index d59fad9afd8..0ebff1f349f 100644 --- a/services/galley/src/Galley/Intra/Util.hs +++ b/services/galley/src/Galley/Intra/Util.hs @@ -22,7 +22,8 @@ module Galley.Intra.Util ) where -import Bilge hiding (getHeader, options, statusCode) +import Bilge hiding (getHeader, host, options, port, statusCode) +import Bilge qualified as B import Bilge.RPC import Bilge.Retry import Control.Lens (view, (^.)) @@ -32,7 +33,7 @@ import Data.ByteString.Lazy qualified as LB import Data.Misc (portNumber) import Data.Text.Encoding (encodeUtf8) import Data.Text.Lazy qualified as LT -import Galley.Env +import Galley.Env hiding (brig) import Galley.Monad import Galley.Options import Imports hiding (log) @@ -51,14 +52,14 @@ componentName Gundeck = "gundeck" componentRequest :: IntraComponent -> Opts -> Request -> Request componentRequest Brig o = - host (encodeUtf8 (o ^. optBrig . epHost)) - . port (portNumber (fromIntegral (o ^. optBrig . epPort))) + B.host (encodeUtf8 (o ^. brig . host)) + . B.port (portNumber (fromIntegral (o ^. brig . port))) componentRequest Spar o = - host (encodeUtf8 (o ^. optSpar . epHost)) - . port (portNumber (fromIntegral (o ^. optSpar . epPort))) + B.host (encodeUtf8 (o ^. spar . host)) + . B.port (portNumber (fromIntegral (o ^. spar . port))) componentRequest Gundeck o = - host (encodeUtf8 $ o ^. optGundeck . epHost) - . port (portNumber $ fromIntegral (o ^. optGundeck . epPort)) + B.host (encodeUtf8 $ o ^. gundeck . host) + . B.port (portNumber $ fromIntegral (o ^. gundeck . port)) . method POST . path "/i/push/v2" . expect2xx diff --git a/services/galley/src/Galley/Options.hs b/services/galley/src/Galley/Options.hs index 584282051b7..ab34df7f996 100644 --- a/services/galley/src/Galley/Options.hs +++ b/services/galley/src/Galley/Options.hs @@ -19,39 +19,39 @@ module Galley.Options ( Settings, - setHttpPoolSize, - setMaxTeamSize, - setMaxFanoutSize, - setExposeInvitationURLsTeamAllowlist, - setMaxConvSize, - setIntraListing, - setDisabledAPIVersions, - setConversationCodeURI, - setConcurrentDeletionEvents, - setDeleteConvThrottleMillis, - setFederationDomain, - setMlsPrivateKeyPaths, - setFeatureFlags, + httpPoolSize, + maxTeamSize, + maxFanoutSize, + exposeInvitationURLsTeamAllowlist, + maxConvSize, + intraListing, + disabledAPIVersions, + conversationCodeURI, + concurrentDeletionEvents, + deleteConvThrottleMillis, + federationDomain, + mlsPrivateKeyPaths, + featureFlags, defConcurrentDeletionEvents, defDeleteConvThrottleMillis, defFanoutLimit, JournalOpts (JournalOpts), - awsQueueName, - awsEndpoint, + queueName, + endpoint, Opts, - optGalley, - optCassandra, - optBrig, - optGundeck, - optSpar, - optFederator, - optRabbitmq, - optDiscoUrl, - optSettings, - optJournal, - optLogLevel, - optLogNetStrings, - optLogFormat, + galley, + cassandra, + brig, + gundeck, + spar, + federator, + rabbitmq, + discoUrl, + settings, + journal, + logLevel, + logNetStrings, + logFormat, ) where @@ -66,35 +66,35 @@ import Galley.Types.Teams import Imports import Network.AMQP.Extended import System.Logger.Extended (Level, LogFormat) -import Util.Options +import Util.Options hiding (endpoint) import Util.Options.Common import Wire.API.Routes.Version import Wire.API.Team.Member data Settings = Settings { -- | Number of connections for the HTTP client pool - _setHttpPoolSize :: !Int, + _httpPoolSize :: !Int, -- | Max number of members in a team. NOTE: This must be in sync with Brig - _setMaxTeamSize :: !Word32, + _maxTeamSize :: !Word32, -- | Max number of team members users to fanout events to. For teams larger than -- this value, team events and user updates will no longer be sent to team users. -- This defaults to setMaxTeamSize and cannot be > HardTruncationLimit. Useful -- to tune mainly for testing purposes. - _setMaxFanoutSize :: !(Maybe (Range 1 HardTruncationLimit Int32)), + _maxFanoutSize :: !(Maybe (Range 1 HardTruncationLimit Int32)), -- | List of teams for which the invitation URL can be added to the list of all -- invitations retrievable by team admins. See also: -- 'ExposeInvitationURLsToTeamAdminConfig'. - _setExposeInvitationURLsTeamAllowlist :: !(Maybe [TeamId]), + _exposeInvitationURLsTeamAllowlist :: !(Maybe [TeamId]), -- | Max number of members in a conversation. NOTE: This must be in sync with Brig - _setMaxConvSize :: !Word16, + _maxConvSize :: !Word16, -- | Whether to call Brig for device listing - _setIntraListing :: !Bool, + _intraListing :: !Bool, -- | URI prefix for conversations with access mode @code@ - _setConversationCodeURI :: !HttpsUrl, + _conversationCodeURI :: !HttpsUrl, -- | Throttling: limits to concurrent deletion events - _setConcurrentDeletionEvents :: !(Maybe Int), + _concurrentDeletionEvents :: !(Maybe Int), -- | Throttling: delay between sending events upon team deletion - _setDeleteConvThrottleMillis :: !(Maybe Int), + _deleteConvThrottleMillis :: !(Maybe Int), -- | FederationDomain is required, even when not wanting to federate with other backends -- (in that case the 'allowedDomains' can be set to empty in Federator) -- Federation domain is used to qualify local IDs and handles, @@ -107,16 +107,16 @@ data Settings = Settings -- allowedDomains: -- - wire.com -- - example.com - _setFederationDomain :: !Domain, + _federationDomain :: !Domain, -- | When true, galley will assume data in `billing_team_member` table is -- consistent and use it for billing. -- When false, billing information for large teams is not guaranteed to have all -- the owners. -- Defaults to false. - _setMlsPrivateKeyPaths :: !(Maybe MLSPrivateKeyPaths), + _mlsPrivateKeyPaths :: !(Maybe MLSPrivateKeyPaths), -- | FUTUREWORK: 'setFeatureFlags' should be renamed to 'setFeatureConfigs' in all types. - _setFeatureFlags :: !FeatureFlags, - _setDisabledAPIVersions :: Maybe (Set Version) + _featureFlags :: !FeatureFlags, + _disabledAPIVersions :: Maybe (Set Version) } deriving (Show, Generic) @@ -135,9 +135,9 @@ defFanoutLimit = unsafeRange hardTruncationLimit data JournalOpts = JournalOpts { -- | SQS queue name to send team events - _awsQueueName :: !Text, + _queueName :: !Text, -- | AWS endpoint - _awsEndpoint :: !AWSEndpoint + _endpoint :: !AWSEndpoint } deriving (Show, Generic) @@ -147,34 +147,34 @@ makeLenses ''JournalOpts data Opts = Opts { -- | Host and port to bind to - _optGalley :: !Endpoint, + _galley :: !Endpoint, -- | Cassandra settings - _optCassandra :: !CassandraOpts, + _cassandra :: !CassandraOpts, -- | Brig endpoint - _optBrig :: !Endpoint, + _brig :: !Endpoint, -- | Gundeck endpoint - _optGundeck :: !Endpoint, + _gundeck :: !Endpoint, -- | Spar endpoint - _optSpar :: !Endpoint, + _spar :: !Endpoint, -- | Federator endpoint - _optFederator :: !(Maybe Endpoint), + _federator :: !(Maybe Endpoint), -- | RabbitMQ settings, required when federation is enabled. - _optRabbitmq :: !(Maybe RabbitMqOpts), + _rabbitmq :: !(Maybe RabbitMqOpts), -- | Disco URL - _optDiscoUrl :: !(Maybe Text), + _discoUrl :: !(Maybe Text), -- | Other settings - _optSettings :: !Settings, + _settings :: !Settings, -- | Journaling options ('Nothing' -- disables journaling) -- Logging - _optJournal :: !(Maybe JournalOpts), + _journal :: !(Maybe JournalOpts), -- | Log level (Debug, Info, etc) - _optLogLevel :: !Level, + _logLevel :: !Level, -- | Use netstrings encoding -- - _optLogNetStrings :: !(Maybe (Last Bool)), + _logNetStrings :: !(Maybe (Last Bool)), -- | What log format to use - _optLogFormat :: !(Maybe (Last LogFormat)) + _logFormat :: !(Maybe (Last LogFormat)) } deriveFromJSON toOptionFieldName ''Opts diff --git a/services/galley/src/Galley/Run.hs b/services/galley/src/Galley/Run.hs index 88c92783ba5..bd2ad81994a 100644 --- a/services/galley/src/Galley/Run.hs +++ b/services/galley/src/Galley/Run.hs @@ -69,12 +69,12 @@ import Wire.API.Routes.Version.Wai run :: Opts -> IO () run opts = lowerCodensity $ do (app, env) <- mkApp opts - settings <- + settings' <- lift $ newSettings $ defaultServer - (unpack $ opts ^. optGalley . epHost) - (portNumber $ fromIntegral $ opts ^. optGalley . epPort) + (unpack $ opts ^. galley . host) + (portNumber $ fromIntegral $ opts ^. galley . port) (env ^. App.applog) (env ^. monitor) @@ -83,17 +83,17 @@ run opts = lowerCodensity $ do void $ Codensity $ Async.withAsync $ runApp env deleteLoop void $ Codensity $ Async.withAsync $ runApp env refreshMetrics - lift $ finally (runSettingsWithShutdown settings app Nothing) (closeApp env) + lift $ finally (runSettingsWithShutdown settings' app Nothing) (closeApp env) mkApp :: Opts -> Codensity IO (Application, Env) mkApp opts = do - logger <- lift $ mkLogger (opts ^. optLogLevel) (opts ^. optLogNetStrings) (opts ^. optLogFormat) + logger <- lift $ mkLogger (opts ^. logLevel) (opts ^. logNetStrings) (opts ^. logFormat) metrics <- lift $ M.metrics env <- lift $ App.createEnv metrics opts logger lift $ runClient (env ^. cstate) $ versionCheck schemaVersion let middlewares = - versionMiddleware (opts ^. optSettings . setDisabledAPIVersions . traverse) + versionMiddleware (opts ^. settings . disabledAPIVersions . traverse) . servantPlusWAIPrometheusMiddleware API.sitemap (Proxy @CombinedAPI) . GZip.gunzip . GZip.gzip GZip.def @@ -111,7 +111,7 @@ mkApp opts = let e = reqId .~ lookupReqId r $ e0 in Servant.serveWithContext (Proxy @CombinedAPI) - ( view (options . optSettings . setFederationDomain) e + ( view (options . settings . federationDomain) e :. customFormatters :. Servant.EmptyContext ) diff --git a/services/galley/src/Galley/Validation.hs b/services/galley/src/Galley/Validation.hs index f87db6df4bf..964963e4e65 100644 --- a/services/galley/src/Galley/Validation.hs +++ b/services/galley/src/Galley/Validation.hs @@ -62,7 +62,7 @@ checkedConvSize :: Sem r (ConvSizeChecked f a) checkedConvSize o x = do let minV :: Integer = 0 - limit = o ^. optSettings . setMaxConvSize - 1 + limit = o ^. settings . maxConvSize - 1 if length x <= fromIntegral limit then pure (ConvSizeChecked x) else throwErr (errorMsg minV limit "") diff --git a/services/galley/test/integration/API.hs b/services/galley/test/integration/API.hs index c753e81a5fc..24038e03605 100644 --- a/services/galley/test/integration/API.hs +++ b/services/galley/test/integration/API.hs @@ -69,9 +69,10 @@ import Data.Time.Clock (getCurrentTime) import Federator.Discovery (DiscoveryFailure (..)) import Federator.MockServer import Galley.API.Mapping -import Galley.Options (optFederator, optRabbitmq) +import Galley.Options (federator, rabbitmq) import Galley.Types.Conversations.Members -import Imports +import Imports hiding (id) +import Imports qualified as I import Network.HTTP.Types.Status qualified as HTTP import Network.Wai.Utilities.Error import Test.QuickCheck (arbitrary, generate) @@ -84,6 +85,7 @@ import TestSetup import Util.Options (Endpoint (Endpoint)) import Wire.API.Connection import Wire.API.Conversation +import Wire.API.Conversation qualified as C import Wire.API.Conversation.Action import Wire.API.Conversation.Code hiding (Value) import Wire.API.Conversation.Protocol @@ -93,10 +95,8 @@ import Wire.API.Error.Galley import Wire.API.Event.Conversation import Wire.API.Federation.API import Wire.API.Federation.API.Brig -import Wire.API.Federation.API.Brig qualified as F import Wire.API.Federation.API.Common import Wire.API.Federation.API.Galley -import Wire.API.Federation.API.Galley qualified as F import Wire.API.Internal.Notification import Wire.API.Message import Wire.API.Message qualified as Message @@ -515,33 +515,32 @@ postConvWithRemoteUsersOk rbs = do -- assertions on the conversation.create event triggering federation request let fedReqsCreated = filter (\r -> frRPC r == "on-conversation-created") federatedRequests fedReqCreatedBodies <- for fedReqsCreated $ assertRight . parseFedRequest - forM_ fedReqCreatedBodies $ \fedReqCreatedBody -> liftIO $ do - F.ccOrigUserId fedReqCreatedBody @?= alice - F.ccCnvId fedReqCreatedBody @?= cid - F.ccCnvType fedReqCreatedBody @?= RegularConv - F.ccCnvAccess fedReqCreatedBody @?= [InviteAccess] - F.ccCnvAccessRoles fedReqCreatedBody + forM_ fedReqCreatedBodies $ \(fedReqCreatedBody :: ConversationCreated ConvId) -> liftIO $ do + fedReqCreatedBody.origUserId @?= alice + fedReqCreatedBody.cnvId @?= cid + fedReqCreatedBody.cnvType @?= RegularConv + fedReqCreatedBody.cnvAccess @?= [InviteAccess] + fedReqCreatedBody.cnvAccessRoles @?= Set.fromList [TeamMemberAccessRole, NonTeamMemberAccessRole, ServiceAccessRole] - F.ccCnvName fedReqCreatedBody @?= Just convName + fedReqCreatedBody.cnvName @?= Just convName assertBool "Notifying an incorrect set of conversation members" $ - minimalShouldBePresentSet `Set.isSubsetOf` F.ccNonCreatorMembers fedReqCreatedBody - F.ccMessageTimer fedReqCreatedBody @?= Nothing - F.ccReceiptMode fedReqCreatedBody @?= Nothing + minimalShouldBePresentSet `Set.isSubsetOf` fedReqCreatedBody.nonCreatorMembers + fedReqCreatedBody.messageTimer @?= Nothing + fedReqCreatedBody.receiptMode @?= Nothing -- assertions on the conversation.member-join event triggering federation request let fedReqsAdd = filter (\r -> frRPC r == "on-conversation-updated") federatedRequests fedReqAddBodies <- for fedReqsAdd $ assertRight . parseFedRequest - forM_ fedReqAddBodies $ \fedReqAddBody -> liftIO $ do - F.cuOrigUserId fedReqAddBody @?= qAlice - F.cuConvId fedReqAddBody @?= cid + forM_ fedReqAddBodies $ \(fedReqAddBody :: ConversationUpdate) -> liftIO $ do + fedReqAddBody.cuOrigUserId @?= qAlice + fedReqAddBody.cuConvId @?= cid -- This remote backend must already have their users in the conversation, -- otherwise they should not be receiving the conversation update message assertBool "The list of already present users should be non-empty" . not . null - . F.cuAlreadyPresentUsers - $ fedReqAddBody - case F.cuAction fedReqAddBody of + $ fedReqAddBody.cuAlreadyPresentUsers + case fedReqAddBody.cuAction of SomeConversationAction SConversationJoinTag _action -> pure () _ -> assertFailure @() "Unexpected update action" where @@ -576,13 +575,13 @@ postCryptoMessageVerifyMsgSentAndRejectIfMissingClient = do let t = 5 # Second -- Missing eve let m1 = [(bob, bc, "ciphertext1")] - postOtrMessage id alice ac conv m1 !!! do + postOtrMessage I.id alice ac conv m1 !!! do const 412 === statusCode assertMismatch [(eve, Set.singleton ec)] [] [] -- Complete WS.bracketR2 c bob eve $ \(wsB, wsE) -> do let m2 = [(bob, bc, toBase64Text "ciphertext2"), (eve, ec, toBase64Text "ciphertext2")] - postOtrMessage id alice ac conv m2 !!! do + postOtrMessage I.id alice ac conv m2 !!! do const 201 === statusCode assertMismatch [] [] [] void . liftIO $ WS.assertMatch t wsB (wsAssertOtr qconv qalice ac bc (toBase64Text "ciphertext2")) @@ -590,7 +589,7 @@ postCryptoMessageVerifyMsgSentAndRejectIfMissingClient = do -- Redundant self WS.bracketR3 c alice bob eve $ \(wsA, wsB, wsE) -> do let m3 = [(alice, ac, toBase64Text "ciphertext3"), (bob, bc, toBase64Text "ciphertext3"), (eve, ec, toBase64Text "ciphertext3")] - postOtrMessage id alice ac conv m3 !!! do + postOtrMessage I.id alice ac conv m3 !!! do const 201 === statusCode assertMismatch [] [(alice, Set.singleton ac)] [] void . liftIO $ WS.assertMatch t wsB (wsAssertOtr qconv qalice ac bc (toBase64Text "ciphertext3")) @@ -604,7 +603,7 @@ postCryptoMessageVerifyMsgSentAndRejectIfMissingClient = do WS.assertMatch_ (5 # WS.Second) wsE $ wsAssertClientRemoved ec let m4 = [(bob, bc, toBase64Text "ciphertext4"), (eve, ec, toBase64Text "ciphertext4")] - postOtrMessage id alice ac conv m4 !!! do + postOtrMessage I.id alice ac conv m4 !!! do const 201 === statusCode assertMismatch [] [] [(eve, Set.singleton ec)] void . liftIO $ WS.assertMatch t wsB (wsAssertOtr qconv qalice ac bc (toBase64Text "ciphertext4")) @@ -613,7 +612,7 @@ postCryptoMessageVerifyMsgSentAndRejectIfMissingClient = do -- Deleted eve & redundant self WS.bracketR3 c alice bob eve $ \(wsA, wsB, wsE) -> do let m5 = [(bob, bc, toBase64Text "ciphertext5"), (eve, ec, toBase64Text "ciphertext5"), (alice, ac, toBase64Text "ciphertext5")] - postOtrMessage id alice ac conv m5 !!! do + postOtrMessage I.id alice ac conv m5 !!! do const 201 === statusCode assertMismatch [] [(alice, Set.singleton ac)] [(eve, Set.singleton ec)] void . liftIO $ WS.assertMatch t wsB (wsAssertOtr qconv qalice ac bc (toBase64Text "ciphertext5")) @@ -622,7 +621,7 @@ postCryptoMessageVerifyMsgSentAndRejectIfMissingClient = do assertNoMsg wsE (wsAssertOtr qconv qalice ac ec (toBase64Text "ciphertext5")) -- Missing Bob, deleted eve & redundant self let m6 = [(eve, ec, toBase64Text "ciphertext6"), (alice, ac, toBase64Text "ciphertext6")] - postOtrMessage id alice ac conv m6 !!! do + postOtrMessage I.id alice ac conv m6 !!! do const 412 === statusCode assertMismatch [(bob, Set.singleton bc)] @@ -636,7 +635,7 @@ postCryptoMessageVerifyMsgSentAndRejectIfMissingClient = do -- The second client listens only for his own messages WS.bracketR (c . queryItem "client" (toByteString' bc2)) bob $ \wsB2 -> do let m7 = [(bob, bc, cipher), (bob, bc2, cipher)] - postOtrMessage id alice ac conv m7 !!! do + postOtrMessage I.id alice ac conv m7 !!! do const 201 === statusCode assertMismatch [] [] [] -- Bob's first client gets both messages @@ -661,7 +660,7 @@ postCryptoMessageVerifyRejectMissingClientAndRepondMissingPrekeysJson = do -- Missing eve let m = [(bob, bc, toBase64Text "hello bob")] r1 <- - postOtrMessage id alice ac conv m do let msgToAllIncludingChad = [(bob, bc, toBase64Text "ciphertext2"), (eve, ec, toBase64Text "ciphertext2"), (chad, cc, toBase64Text "ciphertext2")] - postOtrMessage id alice ac conversationWithAllButChad msgToAllIncludingChad !!! const 201 === statusCode + postOtrMessage I.id alice ac conversationWithAllButChad msgToAllIncludingChad !!! const 201 === statusCode let checkBobGetsMsg = void . liftIO $ WS.assertMatch (5 # Second) wsBob (wsAssertOtr qconv qalice ac bc (toBase64Text "ciphertext2")) let checkEveGetsMsg = void . liftIO $ WS.assertMatch (5 # Second) wsEve (wsAssertOtr qconv qalice ac ec (toBase64Text "ciphertext2")) let checkChadDoesNotGetMsg = assertNoMsg wsChad (wsAssertOtr qconv qalice ac ac (toBase64Text "ciphertext2")) @@ -763,12 +762,12 @@ postMessageRejectIfMissingClients = do let msgMissingClients = mkMsg "hello!" <$> drop 1 allReceivers let checkSendToAllClientShouldBeSuccessful = - postOtrMessage id sender senderClient conv msgToAllClients !!! do + postOtrMessage I.id sender senderClient conv msgToAllClients !!! do const 201 === statusCode assertMismatch [] [] [] let checkSendWitMissingClientsShouldFail = - postOtrMessage id sender senderClient conv msgMissingClients !!! do + postOtrMessage I.id sender senderClient conv msgMissingClients !!! do const 412 === statusCode assertMismatch [(receiver1, Set.singleton receiverClient1)] [] [] @@ -795,7 +794,7 @@ postCryptoMessageVerifyCorrectResponseIfIgnoreAndReportMissingQueryParam = do let msgMissingChadAndEve = [(bob, bc, toBase64Text "hello bob")] let m' = otrRecipients [(bob, bc, toBase64Text "hello bob")] -- These three are equivalent (i.e. report all missing clients) - postOtrMessage id alice ac conv msgMissingChadAndEve + postOtrMessage I.id alice ac conv msgMissingChadAndEve !!! const 412 === statusCode postOtrMessage (queryItem "ignore_missing" "false") alice ac conv msgMissingChadAndEve !!! const 412 === statusCode @@ -816,10 +815,10 @@ postCryptoMessageVerifyCorrectResponseIfIgnoreAndReportMissingQueryParam = do postOtrMessage' (Just [bob]) (queryItem "report_missing" (listToByteString [eve, chad])) alice ac conv msgMissingChadAndEve !!! const 201 === statusCode -- Set it only in the body of the message - postOtrMessage' (Just [bob]) id alice ac conv msgMissingChadAndEve + postOtrMessage' (Just [bob]) I.id alice ac conv msgMissingChadAndEve !!! const 201 === statusCode -- Let's make sure that protobuf works too, when specified in the body only - postProtoOtrMessage' (Just [bob]) id alice ac conv m' + postProtoOtrMessage' (Just [bob]) I.id alice ac conv m' !!! const 201 === statusCode reportEveAndChad <- -- send message with no clients @@ -956,12 +955,12 @@ postMessageQualifiedLocalOwningBackendRedundantAndDeletedClients = do -- FUTUREWORK: Mock federator and ensure that a message to Dee is sent let brigMock = do guardRPC "get-user-clients" - getUserClients <- getRequestBody + getUserClients <- getRequestBody @GetUserClients let lookupClients uid | uid == deeRemoteUnqualified = Just (uid, Set.fromList [PubClient deeClient Nothing]) | uid == nonMemberRemoteUnqualified = Just (uid, Set.fromList [PubClient nonMemberRemoteClient Nothing]) | otherwise = Nothing - mockReply $ UserMap . Map.fromList . mapMaybe lookupClients $ F.gucUsers getUserClients + mockReply $ UserMap . Map.fromList $ mapMaybe lookupClients getUserClients.users galleyMock = "on-message-sent" ~> EmptyResponse (resp2, _requests) <- postProteusMessageQualifiedWithMockFederator aliceUnqualified aliceClient convId message "data" Message.MismatchReportAll (brigMock <|> galleyMock) @@ -1274,7 +1273,7 @@ postMessageQualifiedRemoteOwningBackendSuccess = do Message.mssFailedToConfirmClients = mempty } message = [(bobOwningDomain, bobClient, "text-for-bob"), (deeRemote, deeClient, "text-for-dee")] - mock = "send-message" ~> F.MessageSendResponse (Right mss) + mock = "send-message" ~> MessageSendResponse (Right mss) (resp2, _requests) <- postProteusMessageQualifiedWithMockFederator aliceUnqualified aliceClient convId message "data" Message.MismatchReportAll mock @@ -1705,8 +1704,8 @@ testAccessUpdateGuestRemoved = do compareLists ( map ( \fr -> do - cu <- eitherDecode (frBody fr) - pure (F.cuOrigUserId cu, F.cuAction cu) + cu <- eitherDecode @ConversationUpdate (frBody fr) + pure (cu.cuOrigUserId, cu.cuAction) ) ( filter ( \fr -> @@ -1792,8 +1791,8 @@ testAccessUpdateGuestRemovedRemotesUnavailable = do compareLists ( map ( \fr -> do - cu <- eitherDecode (frBody fr) - pure (F.cuOrigUserId cu, F.cuAction cu) + cu <- eitherDecode @ConversationUpdate (frBody fr) + pure (cu.cuOrigUserId, cu.cuAction) ) ( filter ( \fr -> @@ -1963,8 +1962,8 @@ getConvsOk2 = do liftIO . forM_ [(cnv1, c1), (cnv2, c2)] $ \(expected, actual) -> do assertEqual "name mismatch" - (Just $ cnvName expected) - (cnvName <$> actual) + (Just $ C.cnvName expected) + (C.cnvName <$> actual) assertEqual "self member mismatch" (Just . cmSelf $ cnvMembers expected) @@ -2074,12 +2073,12 @@ paginateConvListIds = do replicateM_ 25 $ do conv <- randomId let cu = - F.ConversationUpdate - { F.cuTime = now, - F.cuOrigUserId = qChad, - F.cuConvId = conv, - F.cuAlreadyPresentUsers = [], - F.cuAction = SomeConversationAction (sing @'ConversationJoinTag) (ConversationJoin (pure qAlice) roleNameWireMember) + ConversationUpdate + { cuTime = now, + cuOrigUserId = qChad, + cuConvId = conv, + cuAlreadyPresentUsers = [], + cuAction = SomeConversationAction (sing @'ConversationJoinTag) (ConversationJoin (pure qAlice) roleNameWireMember) } void $ runFedClient @"on-conversation-updated" fedGalleyClient chadDomain cu @@ -2090,12 +2089,12 @@ paginateConvListIds = do replicateM_ 31 $ do conv <- randomId let cu = - F.ConversationUpdate - { F.cuTime = now, - F.cuOrigUserId = qDee, - F.cuConvId = conv, - F.cuAlreadyPresentUsers = [], - F.cuAction = SomeConversationAction (sing @'ConversationJoinTag) (ConversationJoin (pure qAlice) roleNameWireMember) + ConversationUpdate + { cuTime = now, + cuOrigUserId = qDee, + cuConvId = conv, + cuAlreadyPresentUsers = [], + cuAction = SomeConversationAction (sing @'ConversationJoinTag) (ConversationJoin (pure qAlice) roleNameWireMember) } void $ runFedClient @"on-conversation-updated" fedGalleyClient deeDomain cu @@ -2135,12 +2134,12 @@ paginateConvListIdsPageEndingAtLocalsAndDomain = do replicateM_ 16 $ do conv <- randomId let cu = - F.ConversationUpdate - { F.cuTime = now, - F.cuOrigUserId = qChad, - F.cuConvId = conv, - F.cuAlreadyPresentUsers = [], - F.cuAction = SomeConversationAction (sing @'ConversationJoinTag) (ConversationJoin (pure qAlice) roleNameWireMember) + ConversationUpdate + { cuTime = now, + cuOrigUserId = qChad, + cuConvId = conv, + cuAlreadyPresentUsers = [], + cuAction = SomeConversationAction (sing @'ConversationJoinTag) (ConversationJoin (pure qAlice) roleNameWireMember) } void $ runFedClient @"on-conversation-updated" fedGalleyClient chadDomain cu @@ -2153,12 +2152,12 @@ paginateConvListIdsPageEndingAtLocalsAndDomain = do replicateM_ 16 $ do conv <- randomId let cu = - F.ConversationUpdate - { F.cuTime = now, - F.cuOrigUserId = qDee, - F.cuConvId = conv, - F.cuAlreadyPresentUsers = [], - F.cuAction = SomeConversationAction (sing @'ConversationJoinTag) (ConversationJoin (pure qAlice) roleNameWireMember) + ConversationUpdate + { cuTime = now, + cuOrigUserId = qDee, + cuConvId = conv, + cuAlreadyPresentUsers = [], + cuAction = SomeConversationAction (sing @'ConversationJoinTag) (ConversationJoin (pure qAlice) roleNameWireMember) } void $ runFedClient @"on-conversation-updated" fedGalleyClient deeDomain cu @@ -2355,8 +2354,8 @@ postConvQualifiedFederationNotEnabled = do connectWithRemoteUser alice bob let federatorNotConfigured o = o - & optFederator .~ Nothing - & optRabbitmq .~ Nothing + & federator .~ Nothing + & rabbitmq .~ Nothing withSettingsOverrides federatorNotConfigured $ do g <- viewGalley unreachable :: UnreachableBackends <- @@ -2436,10 +2435,10 @@ putConvAcceptOk = do putConvAccept bob (qUnqualified qcnv) !!! const 200 === statusCode getConvQualified alice qcnv !!! do const 200 === statusCode - const (Just One2OneConv) === fmap cnvType . responseJsonUnsafe + const (Just One2OneConv) === fmap C.cnvType . responseJsonUnsafe getConvQualified bob qcnv !!! do const 200 === statusCode - const (Just One2OneConv) === fmap cnvType . responseJsonUnsafe + const (Just One2OneConv) === fmap C.cnvType . responseJsonUnsafe putConvAcceptRetry :: TestM () putConvAcceptRetry = do @@ -2476,45 +2475,45 @@ postRepeatConnectConvCancel = do rsp1 <- postConnectConv alice bob "A" "a" Nothing getConvQualified bob qconvId liftIO $ do - ConnectConv @=? cnvType cnvX - Just "B" @=? cnvName cnvX - privateAccess @=? cnvAccess cnvX + ConnectConv @=? C.cnvType cnvX + Just "B" @=? C.cnvName cnvX + privateAccess @=? C.cnvAccess cnvX -- Alice accepts, finally turning it into a 1-1 putConvAccept alice convId !!! const 200 === statusCode cnv4 <- responseJsonUnsafeWithMsg "conversation" <$> getConvQualified alice qconvId liftIO $ do - One2OneConv @=? cnvType cnv4 - Just "B" @=? cnvName cnv4 - privateAccess @=? cnvAccess cnv4 + One2OneConv @=? C.cnvType cnv4 + Just "B" @=? C.cnvName cnv4 + privateAccess @=? C.cnvAccess cnv4 where cancel u c = do g <- viewGalley @@ -2734,8 +2733,8 @@ testGetQualifiedLocalConv = do convId <- decodeQualifiedConvId <$> postConv alice [] (Just "gossip") [] Nothing Nothing conv :: Conversation <- fmap responseJsonUnsafe $ getConvQualified alice convId mockedFederatedGalleyResponse @@ -3337,7 +3336,7 @@ leaveRemoteConvQualifiedOk = do (resp, fedRequests) <- withTempMockFederator' mockResponses $ deleteMemberQualified alice qAlice qconv - let leaveRequest = + let leaveRequest :: LeaveConversationRequest = fromJust . decode . frBody . Imports.head $ fedRequests liftIO $ do @@ -3345,8 +3344,8 @@ leaveRemoteConvQualifiedOk = do case responseJsonEither resp of Left err -> assertFailure err Right e -> assertLeaveEvent qconv qAlice [qAlice] e - F.lcConvId leaveRequest @?= conv - F.lcLeaver leaveRequest @?= alice + leaveRequest.convId @?= conv + leaveRequest.leaver @?= alice -- Alice tries to leave a non-existent remote conversation leaveNonExistentRemoteConv :: TestM () @@ -3358,20 +3357,20 @@ leaveNonExistentRemoteConv = do let mockResponses = do guardComponent Galley mockReply $ - F.LeaveConversationResponse (Left F.RemoveFromConversationErrorNotFound) + LeaveConversationResponse (Left RemoveFromConversationErrorNotFound) (resp, fedRequests) <- withTempMockFederator' mockResponses $ responseJsonError =<< deleteMemberQualified (qUnqualified alice) alice conv do let e = List1.head (WS.unpackPayload n) @@ -3546,9 +3545,9 @@ putQualifiedConvRenameWithRemotesUnavailable = do frTargetDomain req @?= remoteDomain frComponent req @?= Galley frRPC req @?= "on-conversation-updated" - Right cu <- pure . eitherDecode . frBody $ req - F.cuConvId cu @?= qUnqualified qconv - F.cuAction cu @?= SomeConversationAction (sing @'ConversationRenameTag) (ConversationRename "gossip++") + Right cu <- pure . eitherDecode @ConversationUpdate . frBody $ req + cu.cuConvId @?= qUnqualified qconv + cu.cuAction @?= SomeConversationAction (sing @'ConversationRenameTag) (ConversationRename "gossip++") void . liftIO . WS.assertMatch (5 # Second) wsB $ \n -> do let e = List1.head (WS.unpackPayload n) @@ -3801,7 +3800,7 @@ putRemoteConvMemberOk update = do fedGalleyClient <- view tsFedGalleyClient now <- liftIO getCurrentTime let cu = - F.ConversationUpdate + ConversationUpdate { cuTime = now, cuOrigUserId = qbob, cuConvId = qUnqualified qconv, @@ -3946,7 +3945,7 @@ putRemoteReceiptModeOk = do fedGalleyClient <- view tsFedGalleyClient now <- liftIO getCurrentTime let cuAddAlice = - F.ConversationUpdate + ConversationUpdate { cuTime = now, cuOrigUserId = qbob, cuConvId = qUnqualified qconv, @@ -3961,7 +3960,7 @@ putRemoteReceiptModeOk = do let adam = qUnqualified qadam connectWithRemoteUser adam qbob let cuAddAdam = - F.ConversationUpdate + ConversationUpdate { cuTime = now, cuOrigUserId = qbob, cuConvId = qUnqualified qconv, @@ -3974,7 +3973,7 @@ putRemoteReceiptModeOk = do let newReceiptMode = ReceiptMode 42 let action = ConversationReceiptModeUpdate newReceiptMode let responseConvUpdate = - F.ConversationUpdate + ConversationUpdate { cuTime = now, cuOrigUserId = qalice, cuConvId = qUnqualified qconv, @@ -3995,11 +3994,11 @@ putRemoteReceiptModeOk = do liftIO $ assertEqual "Unexcepected receipt mode in event" newReceiptMode receiptModeEvent cFedReq <- assertOne $ filter (\r -> frTargetDomain r == remoteDomain && frRPC r == "update-conversation") federatedRequests - cFedReqBody <- assertRight $ parseFedRequest cFedReq + cFedReqBody :: ConversationUpdateRequest <- assertRight $ parseFedRequest cFedReq liftIO $ do - curUser cFedReqBody @?= alice - curConvId cFedReqBody @?= qUnqualified qconv - curAction cFedReqBody @?= SomeConversationAction (sing @'ConversationReceiptModeUpdateTag) action + cFedReqBody.user @?= alice + cFedReqBody.convId @?= qUnqualified qconv + cFedReqBody.action @?= SomeConversationAction (sing @'ConversationReceiptModeUpdateTag) action WS.assertMatch_ (5 # Second) wsAdam $ \n -> do liftIO $ wsAssertConvReceiptModeUpdate qconv qalice newReceiptMode n @@ -4031,9 +4030,9 @@ putReceiptModeWithRemotesOk = do frTargetDomain req @?= remoteDomain frComponent req @?= Galley frRPC req @?= "on-conversation-updated" - Right cu <- pure . eitherDecode . frBody $ req - F.cuConvId cu @?= qUnqualified qconv - F.cuAction cu + Right cu <- pure . eitherDecode @ConversationUpdate . frBody $ req + cu.cuConvId @?= qUnqualified qconv + cu.cuAction @?= SomeConversationAction (sing @'ConversationReceiptModeUpdateTag) (ConversationReceiptModeUpdate (ReceiptMode 43)) void . liftIO . WS.assertMatch (5 # Second) wsB $ \n -> do @@ -4073,9 +4072,9 @@ putReceiptModeWithRemotesUnavailable = do frTargetDomain req @?= remoteDomain frComponent req @?= Galley frRPC req @?= "on-conversation-updated" - Right cu <- pure . eitherDecode . frBody $ req - F.cuConvId cu @?= qUnqualified qconv - F.cuAction cu + Right cu <- pure . eitherDecode @ConversationUpdate . frBody $ req + cu.cuConvId @?= qUnqualified qconv + cu.cuAction @?= SomeConversationAction (sing @'ConversationReceiptModeUpdateTag) (ConversationReceiptModeUpdate (ReceiptMode 43)) void . liftIO . WS.assertMatch (5 # Second) wsB $ \n -> do @@ -4272,18 +4271,18 @@ removeUser = do now <- liftIO getCurrentTime fedGalleyClient <- view tsFedGalleyClient let nc cid creator quids = - F.ConversationCreated - { F.ccTime = now, - F.ccOrigUserId = qUnqualified creator, - F.ccCnvId = cid, - F.ccCnvType = RegularConv, - F.ccCnvAccess = [], - F.ccCnvAccessRoles = Set.fromList [], - F.ccCnvName = Just "gossip4", - F.ccNonCreatorMembers = Set.fromList $ createOtherMember <$> quids, - F.ccMessageTimer = Nothing, - F.ccReceiptMode = Nothing, - F.ccProtocol = ProtocolProteus + ConversationCreated + { time = now, + origUserId = qUnqualified creator, + cnvId = cid, + cnvType = RegularConv, + cnvAccess = [], + cnvAccessRoles = Set.fromList [], + cnvName = Just "gossip4", + nonCreatorMembers = Set.fromList $ createOtherMember <$> quids, + messageTimer = Nothing, + receiptMode = Nothing, + protocol = ProtocolProteus } void $ runFedClient @"on-conversation-created" fedGalleyClient bDomain $ nc convB1 bart [alice, alexDel] void $ runFedClient @"on-conversation-created" fedGalleyClient bDomain $ nc convB2 bart [alexDel] @@ -4299,7 +4298,7 @@ removeUser = do throw (DiscoveryFailureSrvNotAvailable "dDomain"), do guard (d `elem` [bDomain, cDomain]) - "leave-conversation" ~> F.LeaveConversationResponse (Right mempty) + "leave-conversation" ~> LeaveConversationResponse (Right mempty) ] (_, fedRequests) <- withTempMockFederator' handler $ @@ -4400,12 +4399,12 @@ testOne2OneConversationRequest shouldBeLocal actor desired = do fedGalleyClient <- view tsFedGalleyClient GetConversationsResponse convs <- runFedClient @"get-conversations" fedGalleyClient (tDomain bob) $ - F.GetConversationsRequest - { F.gcrUserId = tUnqualified bob, - F.gcrConvIds = [qUnqualified convId] + GetConversationsRequest + { userId = tUnqualified bob, + convIds = [qUnqualified convId] } pure - . fmap (map omQualifiedId . rcmOthers . rcnvMembers) + . fmap (map omQualifiedId . (.members.others)) . listToMaybe $ convs liftIO $ case desired of @@ -4417,7 +4416,7 @@ testOne2OneConversationRequest shouldBeLocal actor desired = do found <- do let rconv = mkProteusConv (qUnqualified convId) (tUnqualified bob) roleNameWireAdmin [] (resp, _) <- - withTempMockFederator' (mockReply (F.GetConversationsResponse [rconv])) $ + withTempMockFederator' (mockReply (GetConversationsResponse [rconv])) $ getConvQualified (tUnqualified alice) convId pure $ statusCode resp == 200 liftIO $ found @?= ((actor, desired) == (LocalActor, Included)) diff --git a/services/galley/test/integration/API/Federation.hs b/services/galley/test/integration/API/Federation.hs index c0d83cae44c..73930b4bd59 100644 --- a/services/galley/test/integration/API/Federation.hs +++ b/services/galley/test/integration/API/Federation.hs @@ -50,6 +50,7 @@ import Test.Tasty.HUnit import TestHelpers import TestSetup import Wire.API.Conversation +import Wire.API.Conversation qualified as Conv import Wire.API.Conversation.Action import Wire.API.Conversation.Role import Wire.API.Event.Conversation @@ -149,21 +150,21 @@ getConversationsAllFound = do (qUnqualified aliceQ) (map qUnqualified [cnv1Id, cnvQualifiedId cnv2]) - let c2 = find ((== qUnqualified (cnvQualifiedId cnv2)) . rcnvId) convs + let c2 = find ((== qUnqualified (cnvQualifiedId cnv2)) . (.id)) convs liftIO $ do assertEqual "name mismatch" - (Just $ cnvName cnv2) - (cnvmName . rcnvMetadata <$> c2) + (Just $ Conv.cnvName cnv2) + ((.metadata.cnvmName) <$> c2) assertEqual "self member role mismatch" (Just . memConvRoleName . cmSelf $ cnvMembers cnv2) - (rcmSelfRole . rcnvMembers <$> c2) + ((.members.selfRole) <$> c2) assertEqual "other members mismatch" (Just (sort [bob, qUnqualified carlQ])) - (fmap (sort . map (qUnqualified . omQualifiedId) . rcmOthers . rcnvMembers) c2) + (fmap (sort . map (qUnqualified . omQualifiedId) . (.members.others)) c2) -- @SF.Federation @TSFI.RESTfulAPI @S2 -- @@ -761,9 +762,9 @@ leaveConversationSuccess = do . json leaveRequest ) ) [(alice, msg aliceC1), (alice, msg aliceC2), (eve, msg eveC)] rm = FedGalley.RemoteMessage - { FedGalley.rmTime = now, - FedGalley.rmData = Nothing, - FedGalley.rmSender = qbob, - FedGalley.rmSenderClient = fromc, - FedGalley.rmConversation = conv, - FedGalley.rmPriority = Nothing, - FedGalley.rmTransient = False, - FedGalley.rmPush = False, - FedGalley.rmRecipients = rcpts + { FedGalley.time = now, + FedGalley._data = Nothing, + FedGalley.sender = qbob, + FedGalley.senderClient = fromc, + FedGalley.conversation = conv, + FedGalley.priority = Nothing, + FedGalley.transient = False, + FedGalley.push = False, + FedGalley.recipients = rcpts } -- send message to alice and check reception @@ -950,9 +951,9 @@ sendMessage = do msg = mkQualifiedOtrPayload bobClient rcpts "" MismatchReportAll msr = FedGalley.ProteusMessageSendRequest - { FedGalley.pmsrConvId = convId, - FedGalley.pmsrSender = bobId, - FedGalley.pmsrRawMessage = Base64ByteString (Protolens.encodeMessage msg) + { FedGalley.convId = convId, + FedGalley.sender = bobId, + FedGalley.rawMessage = Base64ByteString (Protolens.encodeMessage msg) } let mock = do guardComponent Brig @@ -1058,8 +1059,8 @@ onUserDeleted = do (resp, rpcCalls) <- withTempMockFederator' (mockReply EmptyResponse) $ do let udcn = FedGalley.UserDeletedConversationsNotification - { FedGalley.udcvUser = tUnqualified bob, - FedGalley.udcvConversations = + { FedGalley.user = tUnqualified bob, + FedGalley.conversations = unsafeRange [ qUnqualified ooConvId, qUnqualified groupConvId, @@ -1152,9 +1153,9 @@ updateConversationByRemoteAdmin = do -- bob updates the conversation let cnvUpdateRequest = ConversationUpdateRequest - { curUser = qUnqualified qbob, - curConvId = qUnqualified cnv, - curAction = action + { user = qUnqualified qbob, + convId = qUnqualified cnv, + action = action } resp <- do fedGalleyClient <- view tsFedGalleyClient diff --git a/services/galley/test/integration/API/MLS/Mocks.hs b/services/galley/test/integration/API/MLS/Mocks.hs index db80027d402..1b58cd9df51 100644 --- a/services/galley/test/integration/API/MLS/Mocks.hs +++ b/services/galley/test/integration/API/MLS/Mocks.hs @@ -88,7 +88,7 @@ claimKeyPackagesMock kpb = "claim-key-packages" ~> kpb queryGroupStateMock :: ByteString -> Qualified UserId -> Mock LByteString queryGroupStateMock gs qusr = do guardRPC "query-group-info" - uid <- ggireqSender <$> getRequestBody + uid <- (\(a :: GetGroupInfoRequest) -> a.sender) <$> getRequestBody mockReply $ if uid == qUnqualified qusr then GetGroupInfoResponseState (Base64ByteString gs) diff --git a/services/galley/test/integration/API/MLS/Util.hs b/services/galley/test/integration/API/MLS/Util.hs index a34b8bf714c..edebdaf86e1 100644 --- a/services/galley/test/integration/API/MLS/Util.hs +++ b/services/galley/test/integration/API/MLS/Util.hs @@ -83,9 +83,9 @@ import Wire.API.User.Client.Prekey cid2Str :: ClientIdentity -> String cid2Str cid = - show (ciUser cid) + show cid.ciUser <> ":" - <> T.unpack (client . ciClient $ cid) + <> T.unpack cid.ciClient.client <> "@" <> T.unpack (domainText (ciDomain cid)) @@ -94,10 +94,10 @@ mapRemoteKeyPackageRef :: (Request -> Request) -> KeyPackageBundle -> m () -mapRemoteKeyPackageRef brig bundle = +mapRemoteKeyPackageRef brigCall bundle = void $ put - ( brig + ( brigCall . paths ["i", "mls", "key-package-refs"] . json bundle ) @@ -113,9 +113,9 @@ postMessage :: ByteString -> m ResponseLBS postMessage sender msg = do - galley <- viewGalley + galleyCall <- viewGalley post - ( galley + ( galleyCall . paths ["mls", "messages"] . zUser (ciUser sender) . zClient (ciClient sender) @@ -134,9 +134,9 @@ postCommitBundle :: ByteString -> m ResponseLBS postCommitBundle sender bundle = do - galley <- viewGalley + galleyCall <- viewGalley post - ( galley + ( galleyCall . paths ["mls", "commit-bundles"] . zUser (ciUser sender) . zClient (ciClient sender) @@ -156,9 +156,9 @@ postWelcome :: ByteString -> m ResponseLBS postWelcome uid welcome = do - galley <- view tsUnversionedGalley + galleyCall <- view tsUnversionedGalley post - ( galley + ( galleyCall . paths ["v2", "mls", "welcome"] . zUser uid . zConn "conn" @@ -190,7 +190,7 @@ mkAppAckProposalMessage gid epoch ref mrs priv pub = do saveRemovalKey :: FilePath -> TestM () saveRemovalKey fp = do - keys <- fromJust <$> view (tsGConf . optSettings . setMlsPrivateKeyPaths) + keys <- fromJust <$> view (tsGConf . settings . mlsPrivateKeyPaths) keysByPurpose <- liftIO $ loadAllMLSKeys keys let (_, pub) = fromJust (mlsKeyPair_ed25519 (keysByPurpose RemovalPurpose)) liftIO $ BS.writeFile fp (BA.convert pub) @@ -293,10 +293,10 @@ createLocalMLSClient (tUntagged -> qusr) = do -- set public key pkey <- mlscli qcid ["public-key"] Nothing - brig <- viewBrig + brigCall <- viewBrig let update = defUpdateClient {updateClientMLSPublicKeys = Map.singleton Ed25519 pkey} put - ( brig + ( brigCall . paths ["clients", toByteString' . ciClient $ qcid] . zUser (ciUser qcid) . json update @@ -325,9 +325,9 @@ uploadNewKeyPackage qcid = do (kp, _) <- generateKeyPackage qcid -- upload key package - brig <- viewBrig + brigCall <- viewBrig post - ( brig + ( brigCall . paths ["mls", "key-packages", "self", toByteString' . ciClient $ qcid] . zUser (ciUser qcid) . json (KeyPackageUpload [kp]) @@ -480,10 +480,10 @@ keyPackageFile qcid ref = claimLocalKeyPackages :: HasCallStack => ClientIdentity -> Local UserId -> MLSTest KeyPackageBundle claimLocalKeyPackages qcid lusr = do - brig <- viewBrig + brigCall <- viewBrig responseJsonError =<< post - ( brig + ( brigCall . paths ["mls", "key-packages", "claim", toByteString' (tDomain lusr), toByteString' (tUnqualified lusr)] . zUser (ciUser qcid) ) @@ -503,7 +503,7 @@ getUserClients qusr = do -- | Generate one key package for each client of a remote user claimRemoteKeyPackages :: HasCallStack => Remote UserId -> MLSTest KeyPackageBundle claimRemoteKeyPackages (tUntagged -> qusr) = do - brig <- viewBrig + brigCall <- viewBrig clients <- getUserClients qusr bundle <- fmap (KeyPackageBundle . Set.fromList) $ for clients $ \cid -> do @@ -515,7 +515,7 @@ claimRemoteKeyPackages (tUntagged -> qusr) = do kpbeRef = ref, kpbeKeyPackage = KeyPackageData (rmRaw kp) } - mapRemoteKeyPackageRef brig bundle + mapRemoteKeyPackageRef brigCall bundle pure bundle -- | Claim key package for a local user, or generate and map key packages for remote ones. @@ -997,9 +997,9 @@ getGroupInfo :: Qualified ConvId -> m ResponseLBS getGroupInfo sender qcnv = do - galley <- viewGalley + galleyCall <- viewGalley get - ( galley + ( galleyCall . paths [ "conversations", toByteString' (qDomain qcnv), @@ -1025,4 +1025,4 @@ getSelfConv u = do withMLSDisabled :: HasSettingsOverrides m => m a -> m a withMLSDisabled = withSettingsOverrides noMLS where - noMLS = Opts.optSettings . Opts.setMlsPrivateKeyPaths .~ Nothing + noMLS = Opts.settings . Opts.mlsPrivateKeyPaths .~ Nothing diff --git a/services/galley/test/integration/API/Teams.hs b/services/galley/test/integration/API/Teams.hs index a5a6f11816a..8b217f515f0 100644 --- a/services/galley/test/integration/API/Teams.hs +++ b/services/galley/test/integration/API/Teams.hs @@ -59,7 +59,7 @@ import Data.UUID.V1 qualified as UUID import Data.Vector qualified as V import GHC.TypeLits (KnownSymbol) import Galley.Env qualified as Galley -import Galley.Options (optSettings, setFeatureFlags, setMaxConvSize, setMaxFanoutSize) +import Galley.Options (featureFlags, maxConvSize, maxFanoutSize, settings) import Galley.Types.Conversations.Roles import Galley.Types.Teams import Imports @@ -415,7 +415,7 @@ testEnableSSOPerTeam = do liftIO $ do assertEqual "bad status" status403 status assertEqual "bad label" "not-implemented" label - featureSSO <- view (tsGConf . optSettings . setFeatureFlags . flagSSO) + featureSSO <- view (tsGConf . settings . featureFlags . flagSSO) case featureSSO of FeatureSSOEnabledByDefault -> check "Teams should start with SSO enabled" Public.FeatureStatusEnabled FeatureSSODisabledByDefault -> check "Teams should start with SSO disabled" Public.FeatureStatusDisabled @@ -1732,8 +1732,8 @@ postCryptoBroadcastMessageFilteredTooLargeTeam bcast = do WS.bracketR (c . queryItem "client" (toByteString' ac)) alice $ \wsA1 -> do -- We change also max conv size due to the invariants that galley forces us to keep let newOpts = - ((optSettings . setMaxFanoutSize) ?~ unsafeRange 4) - . (optSettings . setMaxConvSize .~ 4) + ((settings . maxFanoutSize) ?~ unsafeRange 4) + . (settings . maxConvSize .~ 4) withSettingsOverrides newOpts $ do -- Untargeted, Alice's team is too large Util.postBroadcast (q alice) ac bcast {bMessage = msg} !!! do diff --git a/services/galley/test/integration/API/Teams/Feature.hs b/services/galley/test/integration/API/Teams/Feature.hs index 73408aca64c..5bb48172366 100644 --- a/services/galley/test/integration/API/Teams/Feature.hs +++ b/services/galley/test/integration/API/Teams/Feature.hs @@ -41,7 +41,7 @@ import Data.Schema (ToSchema) import Data.Set qualified as Set import Data.Timeout (TimeoutUnit (Second), (#)) import GHC.TypeLits (KnownSymbol) -import Galley.Options (optSettings, setExposeInvitationURLsTeamAllowlist, setFeatureFlags) +import Galley.Options (exposeInvitationURLsTeamAllowlist, featureFlags, settings) import Galley.Types.Teams import Imports import Network.Wai.Utilities (label) @@ -284,7 +284,7 @@ testSSO setSSOFeature = do assertFlagForbidden $ getTeamFeatureFlag @SSOConfig nonMember tid - featureSSO <- view (tsGConf . optSettings . setFeatureFlags . flagSSO) + featureSSO <- view (tsGConf . settings . featureFlags . flagSSO) case featureSSO of FeatureSSODisabledByDefault -> do -- Test default @@ -331,7 +331,7 @@ testLegalHold setLegalHoldInternal = do assertFlagForbidden $ getTeamFeatureFlag @LegalholdConfig nonMember tid -- FUTUREWORK: run two galleys, like below for custom search visibility. - featureLegalHold <- view (tsGConf . optSettings . setFeatureFlags . flagLegalHold) + featureLegalHold <- view (tsGConf . settings . featureFlags . flagLegalHold) case featureLegalHold of FeatureLegalHoldDisabledByDefault -> do -- Test default @@ -483,7 +483,7 @@ testClassifiedDomainsDisabled = do let classifiedDomainsDisabled opts = opts & over - (optSettings . setFeatureFlags . flagClassifiedDomains) + (settings . featureFlags . flagClassifiedDomains) (\(ImplicitLockStatus s) -> ImplicitLockStatus (s & setStatus FeatureStatusDisabled & setConfig (ClassifiedDomainsConfig []))) withSettingsOverrides classifiedDomainsDisabled $ do getClassifiedDomains member tid expected @@ -841,8 +841,8 @@ testSelfDeletingMessages = do defLockStatus :: LockStatus <- view ( tsGConf - . optSettings - . setFeatureFlags + . settings + . featureFlags . flagSelfDeletingMessages . unDefaults . to wsLockStatus @@ -996,8 +996,8 @@ testAllFeatures = do defLockStatus :: LockStatus <- view ( tsGConf - . optSettings - . setFeatureFlags + . settings + . featureFlags . flagSelfDeletingMessages . unDefaults . to wsLockStatus @@ -1283,7 +1283,7 @@ testExposeInvitationURLsToTeamAdminTeamIdInAllowList = do tid <- createBindingTeamInternal "foo" owner assertTeamActivate "create team" tid void $ - withSettingsOverrides (\opts -> opts & optSettings . setExposeInvitationURLsTeamAllowlist ?~ [tid]) $ do + withSettingsOverrides (\opts -> opts & settings . exposeInvitationURLsTeamAllowlist ?~ [tid]) $ do g <- viewGalley assertExposeInvitationURLsToTeamAdminConfigStatus owner tid FeatureStatusDisabled LockStatusUnlocked let enabled = WithStatusNoLock FeatureStatusEnabled ExposeInvitationURLsToTeamAdminConfig FeatureTTLUnlimited @@ -1298,7 +1298,7 @@ testExposeInvitationURLsToTeamAdminEmptyAllowList = do tid <- createBindingTeamInternal "foo" owner assertTeamActivate "create team" tid void $ - withSettingsOverrides (\opts -> opts & optSettings . setExposeInvitationURLsTeamAllowlist .~ Nothing) $ do + withSettingsOverrides (\opts -> opts & settings . exposeInvitationURLsTeamAllowlist .~ Nothing) $ do g <- viewGalley assertExposeInvitationURLsToTeamAdminConfigStatus owner tid FeatureStatusDisabled LockStatusLocked let enabled = WithStatusNoLock FeatureStatusEnabled ExposeInvitationURLsToTeamAdminConfig FeatureTTLUnlimited @@ -1310,7 +1310,7 @@ testExposeInvitationURLsToTeamAdminEmptyAllowList = do -- | Ensure that the server config takes precedence over a saved team config. -- -- In other words: When a team id is no longer in the --- `setExposeInvitationURLsTeamAllowlist` the +-- `exposeInvitationURLsTeamAllowlist` the -- `ExposeInvitationURLsToTeamAdminConfig` is always disabled (even tough it -- might have been enabled before). testExposeInvitationURLsToTeamAdminServerConfigTakesPrecedence :: TestM () @@ -1319,7 +1319,7 @@ testExposeInvitationURLsToTeamAdminServerConfigTakesPrecedence = do tid <- createBindingTeamInternal "foo" owner assertTeamActivate "create team" tid void $ - withSettingsOverrides (\opts -> opts & optSettings . setExposeInvitationURLsTeamAllowlist ?~ [tid]) $ do + withSettingsOverrides (\opts -> opts & settings . exposeInvitationURLsTeamAllowlist ?~ [tid]) $ do g <- viewGalley assertExposeInvitationURLsToTeamAdminConfigStatus owner tid FeatureStatusDisabled LockStatusUnlocked let enabled = WithStatusNoLock FeatureStatusEnabled ExposeInvitationURLsToTeamAdminConfig FeatureTTLUnlimited @@ -1328,7 +1328,7 @@ testExposeInvitationURLsToTeamAdminServerConfigTakesPrecedence = do const 200 === statusCode assertExposeInvitationURLsToTeamAdminConfigStatus owner tid FeatureStatusEnabled LockStatusUnlocked void $ - withSettingsOverrides (\opts -> opts & optSettings . setExposeInvitationURLsTeamAllowlist .~ Nothing) $ do + withSettingsOverrides (\opts -> opts & settings . exposeInvitationURLsTeamAllowlist .~ Nothing) $ do g <- viewGalley assertExposeInvitationURLsToTeamAdminConfigStatus owner tid FeatureStatusDisabled LockStatusLocked let enabled = WithStatusNoLock FeatureStatusEnabled ExposeInvitationURLsToTeamAdminConfig FeatureTTLUnlimited diff --git a/services/galley/test/integration/API/Teams/LegalHold.hs b/services/galley/test/integration/API/Teams/LegalHold.hs index 9f37a4a35bc..d9efba2945c 100644 --- a/services/galley/test/integration/API/Teams/LegalHold.hs +++ b/services/galley/test/integration/API/Teams/LegalHold.hs @@ -50,7 +50,7 @@ import Galley.Cassandra.Client (lookupClients) import Galley.Cassandra.LegalHold import Galley.Cassandra.LegalHold qualified as LegalHoldData import Galley.Env qualified as Galley -import Galley.Options (optSettings, setFeatureFlags) +import Galley.Options (featureFlags, settings) import Galley.Types.Clients qualified as Clients import Galley.Types.Teams import Imports @@ -83,7 +83,7 @@ import Wire.API.User.Client qualified as Client onlyIfLhWhitelisted :: TestM () -> TestM () onlyIfLhWhitelisted action = do - featureLegalHold <- view (tsGConf . optSettings . setFeatureFlags . flagLegalHold) + featureLegalHold <- view (tsGConf . settings . featureFlags . flagLegalHold) case featureLegalHold of FeatureLegalHoldDisabledPermanently -> liftIO $ hPutStrLn stderr errmsg diff --git a/services/galley/test/integration/API/Teams/LegalHold/Util.hs b/services/galley/test/integration/API/Teams/LegalHold/Util.hs index 1a31e38d5ee..835f2100709 100644 --- a/services/galley/test/integration/API/Teams/LegalHold/Util.hs +++ b/services/galley/test/integration/API/Teams/LegalHold/Util.hs @@ -584,8 +584,8 @@ assertMatchChan c match = go [] getLHWhitelistedTeam :: HasCallStack => TeamId -> TestM ResponseLBS getLHWhitelistedTeam tid = do - galley <- viewGalley - getLHWhitelistedTeam' galley tid + galleyCall <- viewGalley + getLHWhitelistedTeam' galleyCall tid getLHWhitelistedTeam' :: (HasCallStack, MonadHttp m) => GalleyR -> TeamId -> m ResponseLBS getLHWhitelistedTeam' g tid = do @@ -596,8 +596,8 @@ getLHWhitelistedTeam' g tid = do putLHWhitelistTeam :: HasCallStack => TeamId -> TestM ResponseLBS putLHWhitelistTeam tid = do - galley <- viewGalley - putLHWhitelistTeam' galley tid + galleyCall <- viewGalley + putLHWhitelistTeam' galleyCall tid putLHWhitelistTeam' :: (HasCallStack, MonadHttp m) => GalleyR -> TeamId -> m ResponseLBS putLHWhitelistTeam' g tid = do @@ -608,8 +608,8 @@ putLHWhitelistTeam' g tid = do _deleteLHWhitelistTeam :: HasCallStack => TeamId -> TestM ResponseLBS _deleteLHWhitelistTeam tid = do - galley <- viewGalley - deleteLHWhitelistTeam' galley tid + galleyCall <- viewGalley + deleteLHWhitelistTeam' galleyCall tid deleteLHWhitelistTeam' :: (HasCallStack, MonadHttp m) => GalleyR -> TeamId -> m ResponseLBS deleteLHWhitelistTeam' g tid = do @@ -642,7 +642,7 @@ instance IsTest LHTest where run :: OptionSet -> LHTest -> (Progress -> IO ()) -> IO Result run _ (LHTest expectedFlag setupAction testAction) _ = do setup <- setupAction - let featureLegalHold = setup ^. tsGConf . optSettings . setFeatureFlags . flagLegalHold + let featureLegalHold = setup ^. tsGConf . settings . featureFlags . flagLegalHold if featureLegalHold == expectedFlag then do hunitResult <- try $ void . flip runReaderT setup . runTestM $ testAction diff --git a/services/galley/test/integration/API/Util.hs b/services/galley/test/integration/API/Util.hs index 87276bd4358..b126c0aca72 100644 --- a/services/galley/test/integration/API/Util.hs +++ b/services/galley/test/integration/API/Util.hs @@ -25,8 +25,6 @@ import API.SQS qualified as SQS import Bilge hiding (timeout) import Bilge.Assert import Bilge.TestSession -import Brig.Types.Connection -import Brig.Types.Intra import Control.Applicative import Control.Concurrent.Async import Control.Exception (throw) @@ -107,6 +105,7 @@ import Util.Options import Web.Cookie import Wire.API.Connection import Wire.API.Conversation +import Wire.API.Conversation qualified as Conv import Wire.API.Conversation.Action import Wire.API.Conversation.Code hiding (Value) import Wire.API.Conversation.Protocol @@ -193,12 +192,12 @@ symmPermissions p = let s = Set.fromList p in fromJust (newPermissions s s) createBindingTeam :: HasCallStack => TestM (UserId, TeamId) createBindingTeam = do - first userId <$> createBindingTeam' + first Wire.API.User.userId <$> createBindingTeam' createBindingTeam' :: HasCallStack => TestM (User, TeamId) createBindingTeam' = do owner <- randomTeamCreator' - teams <- getTeams (userId owner) [] + teams <- getTeams owner.userId [] let [team] = view teamListTeams teams let tid = view teamId team SQS.assertTeamActivate "create team" tid @@ -367,7 +366,7 @@ getTeamMembersPaginated usr tid n mPs = do . paths ["teams", toByteString' tid, "members"] . zUser usr . queryItem "maxResults" (C.pack $ show n) - . maybe id (queryItem "pagingState" . cs) mPs + . maybe Imports.id (queryItem "pagingState" . cs) mPs ) Maybe Role -> UserId -> TeamId -> TestM addUserToTeamWithRole role inviter tid = do (inv, rsp2) <- addUserToTeamWithRole' role inviter tid let invitee :: User = responseJsonUnsafe rsp2 - inviteeId = userId invitee + inviteeId = invitee.userId let invmeta = Just (inviter, inCreatedAt inv) mem <- getTeamMember inviter tid inviteeId liftIO $ assertEqual "Member has no/wrong invitation metadata" invmeta (mem ^. Team.invitation) @@ -484,8 +483,7 @@ addUserToTeamWithRole' role inviter tid = do addUserToTeamWithSSO :: HasCallStack => Bool -> TeamId -> TestM TeamMember addUserToTeamWithSSO hasEmail tid = do let ssoid = UserSSOId mkSimpleSampleUref - user <- responseJsonError =<< postSSOUser "SSO User" hasEmail ssoid tid - let uid = userId user + uid <- fmap (\(u :: User) -> u.userId) $ responseJsonError =<< postSSOUser "SSO User" hasEmail ssoid tid getTeamMember uid tid uid makeOwner :: HasCallStack => UserId -> TeamMember -> TeamId -> TestM () @@ -726,7 +724,7 @@ postConvQualified u c n = do g . path "/conversations" . zUser u - . maybe id zClient c + . maybe Imports.id zClient c . zConn "conn" . zType "access" . json n @@ -933,7 +931,7 @@ data Broadcast = Broadcast } instance Default Broadcast where - def = Broadcast BroadcastLegacyQueryParams BroadcastJSON mempty "ZXhhbXBsZQ==" mempty id + def = Broadcast BroadcastLegacyQueryParams BroadcastJSON mempty "ZXhhbXBsZQ==" mempty Imports.id postBroadcast :: (MonadIO m, MonadHttp m, HasGalley m) => @@ -945,8 +943,8 @@ postBroadcast lu c b = do let u = qUnqualified lu g <- viewGalley let (bodyReport, queryReport) = case bAPI b of - BroadcastLegacyQueryParams -> (Nothing, maybe id mkOtrReportMissing (bReport b)) - _ -> (bReport b, id) + BroadcastLegacyQueryParams -> (Nothing, maybe Imports.id mkOtrReportMissing (bReport b)) + _ -> (bReport b, Imports.id) let bdy = case (bAPI b, bType b) of (BroadcastQualified, BroadcastJSON) -> error "JSON not supported for the qualified broadcast API" (BroadcastQualified, BroadcastProto) -> @@ -998,7 +996,7 @@ mkOtrMessage (usr, clt, m) = (fn usr, HashMap.singleton (fn clt) m) fn = fromJust . fromByteString . toByteString' postProtoOtrMessage :: UserId -> ClientId -> ConvId -> OtrRecipients -> TestM ResponseLBS -postProtoOtrMessage = postProtoOtrMessage' Nothing id +postProtoOtrMessage = postProtoOtrMessage' Nothing Imports.id postProtoOtrMessage' :: Maybe [UserId] -> (Request -> Request) -> UserId -> ClientId -> ConvId -> OtrRecipients -> TestM ResponseLBS postProtoOtrMessage' reportMissing modif u d c rec = do @@ -1583,17 +1581,17 @@ registerRemoteConv convId originUser name othMembers = do void $ runFedClient @"on-conversation-created" fedGalleyClient (qDomain convId) $ ConversationCreated - { ccTime = now, - ccOrigUserId = originUser, - ccCnvId = qUnqualified convId, - ccCnvType = RegularConv, - ccCnvAccess = [], - ccCnvAccessRoles = Set.fromList [TeamMemberAccessRole, NonTeamMemberAccessRole], - ccCnvName = name, - ccNonCreatorMembers = othMembers, - ccMessageTimer = Nothing, - ccReceiptMode = Nothing, - ccProtocol = ProtocolProteus + { time = now, + origUserId = originUser, + cnvId = qUnqualified convId, + cnvType = RegularConv, + cnvAccess = [], + cnvAccessRoles = Set.fromList [TeamMemberAccessRole, NonTeamMemberAccessRole], + cnvName = name, + nonCreatorMembers = othMembers, + messageTimer = Nothing, + receiptMode = Nothing, + protocol = ProtocolProteus } getFeatureStatusMulti :: forall cfg. KnownSymbol (FeatureSymbol cfg) => Multi.TeamFeatureNoConfigMultiRequest -> TestM ResponseLBS @@ -1629,15 +1627,15 @@ assertNotConvMember u c = assertConvEquals :: (HasCallStack, MonadIO m) => Conversation -> Conversation -> m () assertConvEquals c1 c2 = liftIO $ do - assertEqual "id" (cnvQualifiedId c1) (cnvQualifiedId c2) - assertEqual "type" (cnvType c1) (cnvType c2) - assertEqual "creator" (cnvCreator c1) (cnvCreator c2) + assertEqual "id" c1.cnvQualifiedId c2.cnvQualifiedId + assertEqual "type" (Conv.cnvType c1) (Conv.cnvType c2) + assertEqual "creator" (Conv.cnvCreator c1) (Conv.cnvCreator c2) assertEqual "access" (accessSet c1) (accessSet c2) - assertEqual "name" (cnvName c1) (cnvName c2) + assertEqual "name" (Conv.cnvName c1) (Conv.cnvName c2) assertEqual "self member" (selfMember c1) (selfMember c2) assertEqual "other members" (otherMembers c1) (otherMembers c2) where - accessSet = Set.fromList . toList . cnvAccess + accessSet = Set.fromList . toList . Conv.cnvAccess selfMember = cmSelf . cnvMembers otherMembers = Set.fromList . cmOthers . cnvMembers @@ -1670,9 +1668,9 @@ assertConvWithRole r t c s us n mt role = do let _self = cmSelf (cnvMembers cnv) let others = cmOthers (cnvMembers cnv) liftIO $ do - assertEqual "id" cId (qUnqualified (cnvQualifiedId cnv)) - assertEqual "name" n (cnvName cnv) - assertEqual "type" t (cnvType cnv) + assertEqual "id" cId (qUnqualified cnv.cnvQualifiedId) + assertEqual "name" n (Conv.cnvName cnv) + assertEqual "type" t (Conv.cnvType cnv) assertEqual "creator" c (cnvCreator cnv) assertEqual "message_timer" mt (cnvMessageTimer cnv) assertEqual "self" s (memId _self) @@ -1683,9 +1681,9 @@ assertConvWithRole r t c s us n mt role = do assertBool "otr archived not false" (not (memOtrArchived _self)) assertBool "otr archived ref not empty" (isNothing (memOtrArchivedRef _self)) case t of - SelfConv -> assertEqual "access" privateAccess (cnvAccess cnv) - ConnectConv -> assertEqual "access" privateAccess (cnvAccess cnv) - One2OneConv -> assertEqual "access" privateAccess (cnvAccess cnv) + SelfConv -> assertEqual "access" privateAccess (Conv.cnvAccess cnv) + ConnectConv -> assertEqual "access" privateAccess (Conv.cnvAccess cnv) + One2OneConv -> assertEqual "access" privateAccess (Conv.cnvAccess cnv) _ -> pure () pure (cnvQualifiedId cnv) @@ -2026,7 +2024,7 @@ connectUsersUnchecked :: UserId -> List1 UserId -> TestM (List1 (Response (Maybe Lazy.ByteString), Response (Maybe Lazy.ByteString))) -connectUsersUnchecked = connectUsersWith id +connectUsersUnchecked = connectUsersWith Imports.id connectUsersWith :: (Request -> Request) -> @@ -2199,7 +2197,7 @@ ephemeralUser = do let p = object ["name" .= name] r <- post (b . path "/register" . json p) UserId -> LastPrekey -> TestM ClientId randomClient uid lk = randomClientWithCaps uid lk Nothing @@ -2339,11 +2337,11 @@ fromBS bs = convRange :: Maybe (Either [ConvId] ConvId) -> Maybe Int32 -> Request -> Request convRange range size = - maybe id (queryItem "size" . C.pack . show) size + maybe Imports.id (queryItem "size" . C.pack . show) size . case range of Just (Left l) -> queryItem "ids" (C.intercalate "," $ map toByteString' l) Just (Right c) -> queryItem "start" (toByteString' c) - Nothing -> id + Nothing -> Imports.id privateAccess :: [Access] privateAccess = [PrivateAccess] @@ -2391,7 +2389,7 @@ assertMismatchWithMessage mmsg missing redundant deleted = do userClients = UserClients . Map.fromList formatMessage :: String -> String - formatMessage = maybe id (\msg -> ((msg <> "\n") <>)) mmsg + formatMessage = maybe Imports.id (\msg -> ((msg <> "\n") <>)) mmsg assertMismatch :: HasCallStack => @@ -2707,7 +2705,7 @@ withTempMockFederator' resp action = do [("Content-Type", "application/json")] mock $ \mockPort -> do - withSettingsOverrides (\opts -> opts & Opts.optFederator ?~ Endpoint "127.0.0.1" (fromIntegral mockPort)) action + withSettingsOverrides (\opts -> opts & Opts.federator ?~ Endpoint "127.0.0.1" (fromIntegral mockPort)) action -- Starts a servant Application in Network.Wai.Test session and runs the -- FederatedRequest against it. diff --git a/services/galley/test/integration/API/Util/TeamFeature.hs b/services/galley/test/integration/API/Util/TeamFeature.hs index e2d04068bb7..cb98a9aa9c4 100644 --- a/services/galley/test/integration/API/Util/TeamFeature.hs +++ b/services/galley/test/integration/API/Util/TeamFeature.hs @@ -33,7 +33,7 @@ import Data.ByteString.Conversion (toByteString') import Data.Id (ConvId, TeamId, UserId) import Data.Schema import GHC.TypeLits (KnownSymbol) -import Galley.Options (optSettings, setFeatureFlags) +import Galley.Options (featureFlags, settings) import Galley.Types.Teams import Imports import TestSetup @@ -41,7 +41,7 @@ import Wire.API.Team.Feature qualified as Public withCustomSearchFeature :: FeatureTeamSearchVisibilityAvailability -> TestM () -> TestM () withCustomSearchFeature flag action = do - Util.withSettingsOverrides (\opts -> opts & optSettings . setFeatureFlags . flagTeamSearchVisibility .~ flag) action + Util.withSettingsOverrides (\opts -> opts & settings . featureFlags . flagTeamSearchVisibility .~ flag) action getTeamSearchVisibilityAvailable :: HasCallStack => (Request -> Request) -> UserId -> TeamId -> MonadHttp m => m ResponseLBS getTeamSearchVisibilityAvailable = getTeamFeatureFlagWithGalley @Public.SearchVisibilityAvailableConfig diff --git a/services/galley/test/integration/Federation.hs b/services/galley/test/integration/Federation.hs index 6e3d853f7d1..2971b59ecc8 100644 --- a/services/galley/test/integration/Federation.hs +++ b/services/galley/test/integration/Federation.hs @@ -58,7 +58,7 @@ isConvMemberLTests :: TestM () isConvMemberLTests = do s <- ask let opts = s ^. tsGConf - localDomain = opts ^. optSettings . setFederationDomain + localDomain = opts ^. settings . federationDomain remoteDomain = Domain "far-away.example.com" convId = Id $ fromJust $ UUID.fromString "8cc34301-6949-46c5-bb93-00a72268e2f5" convLocalMembers = [LocalMember userId defMemberStatus Nothing roleNameWireMember] @@ -96,8 +96,8 @@ updateFedDomainsTestNoop' = do let interval = (maxBound :: Int) `div` 2 -- Very large values so that we don't have to worry about automatic updates remoteDomain = Domain "far-away.example.com" remoteDomain2 = Domain "far-away-two.example.com" - liftIO $ assertBool "remoteDomain is different to local domain" $ remoteDomain /= opts ^. optSettings . setFederationDomain - liftIO $ assertBool "remoteDomain2 is different to local domain" $ remoteDomain2 /= opts ^. optSettings . setFederationDomain + liftIO $ assertBool "remoteDomain is different to local domain" $ remoteDomain /= opts ^. settings . federationDomain + liftIO $ assertBool "remoteDomain2 is different to local domain" $ remoteDomain2 /= opts ^. settings . federationDomain -- Setup a conversation for a known remote domain. -- Include that domain in the old and new lists so -- if the function is acting up we know it will be @@ -115,8 +115,8 @@ updateFedDomainsTestAddRemote' = do let interval = (maxBound :: Int) `div` 2 -- Very large values so that we don't have to worry about automatic updates remoteDomain = Domain "far-away.example.com" remoteDomain2 = Domain "far-away-two.example.com" - liftIO $ assertBool "remoteDomain is different to local domain" $ remoteDomain /= opts ^. optSettings . setFederationDomain - liftIO $ assertBool "remoteDomain2 is different to local domain" $ remoteDomain2 /= opts ^. optSettings . setFederationDomain + liftIO $ assertBool "remoteDomain is different to local domain" $ remoteDomain /= opts ^. settings . federationDomain + liftIO $ assertBool "remoteDomain2 is different to local domain" $ remoteDomain2 /= opts ^. settings . federationDomain -- Adding a new federation domain, this too should be a no-op updateFedDomainsAddRemote env remoteDomain remoteDomain2 interval @@ -132,8 +132,8 @@ updateFedDomainsTestRemoveRemoteFromLocal' = do let interval = (maxBound :: Int) `div` 2 -- Very large values so that we don't have to worry about automatic updates remoteDomain = Domain "far-away.example.com" remoteDomain2 = Domain "far-away-two.example.com" - liftIO $ assertBool "remoteDomain is different to local domain" $ remoteDomain /= opts ^. optSettings . setFederationDomain - liftIO $ assertBool "remoteDomain2 is different to local domain" $ remoteDomain2 /= opts ^. optSettings . setFederationDomain + liftIO $ assertBool "remoteDomain is different to local domain" $ remoteDomain /= opts ^. settings . federationDomain + liftIO $ assertBool "remoteDomain2 is different to local domain" $ remoteDomain2 /= opts ^. settings . federationDomain -- Remove a remote domain from local conversations updateFedDomainRemoveRemoteFromLocal env remoteDomain remoteDomain2 interval @@ -149,8 +149,8 @@ updateFedDomainsTestRemoveLocalFromRemote' = do let interval = (maxBound :: Int) `div` 2 -- Very large values so that we don't have to worry about automatic updates remoteDomain = Domain "far-away.example.com" remoteDomain2 = Domain "far-away-two.example.com" - liftIO $ assertBool "remoteDomain is different to local domain" $ remoteDomain /= opts ^. optSettings . setFederationDomain - liftIO $ assertBool "remoteDomain2 is different to local domain" $ remoteDomain2 /= opts ^. optSettings . setFederationDomain + liftIO $ assertBool "remoteDomain is different to local domain" $ remoteDomain /= opts ^. settings . federationDomain + liftIO $ assertBool "remoteDomain2 is different to local domain" $ remoteDomain2 /= opts ^. settings . federationDomain -- Remove a local domain from remote conversations updateFedDomainRemoveLocalFromRemote env remoteDomain interval @@ -312,7 +312,7 @@ updateFedDomainsAddRemote :: Env -> Domain -> Domain -> Int -> TestM () updateFedDomainsAddRemote env remoteDomain remoteDomain2 interval = do s <- ask let opts = s ^. tsGConf - localDomain = opts ^. optSettings . setFederationDomain + localDomain = opts ^. settings . federationDomain old = FederationDomainConfigs AllowDynamic [FederationDomainConfig remoteDomain FullSearch] interval new = old {remotes = FederationDomainConfig remoteDomain2 FullSearch : remotes old} -- Just check against the domains, as the search @@ -350,7 +350,7 @@ updateFedDomainsTestNoop :: Env -> Domain -> Int -> TestM () updateFedDomainsTestNoop env remoteDomain interval = do s <- ask let opts = s ^. tsGConf - localDomain = opts ^. optSettings . setFederationDomain + localDomain = opts ^. settings . federationDomain old = FederationDomainConfigs AllowDynamic [FederationDomainConfig remoteDomain FullSearch] interval new = old qalice <- randomQualifiedUser diff --git a/services/galley/test/integration/Main.hs b/services/galley/test/integration/Main.hs index 7c211f068a3..6d465089cbe 100644 --- a/services/galley/test/integration/Main.hs +++ b/services/galley/test/integration/Main.hs @@ -22,7 +22,8 @@ where import API qualified import API.SQS qualified as SQS -import Bilge hiding (body, header) +import Bilge hiding (body, header, host, port) +import Bilge qualified import Cassandra.Util import Control.Lens import Data.ByteString.Char8 qualified as BS @@ -37,7 +38,8 @@ import Data.Yaml (decodeFileEither) import Federation import Galley.API (sitemap) import Galley.Aws qualified as Aws -import Galley.Options +import Galley.Options hiding (endpoint) +import Galley.Options qualified as O import Imports hiding (local) import Network.HTTP.Client (responseTimeoutMicro) import Network.HTTP.Client.TLS (tlsManagerSettings) @@ -107,34 +109,34 @@ main = withOpenSSL $ runTests go ] getOpts gFile iFile = do m <- newManager tlsManagerSettings {managerResponseTimeout = responseTimeoutMicro 300000000} - let local p = Endpoint {_epHost = "127.0.0.1", _epPort = p} + let local p = Endpoint {_host = "127.0.0.1", _port = p} gConf <- handleParseError =<< decodeFileEither gFile iConf <- handleParseError =<< decodeFileEither iFile -- FUTUREWORK: we don't support process env setup any more, so both gconf and iConf -- must be 'Just'. the following code could be simplified a lot, but this should -- probably happen after (or at least while) unifying the integration test suites into -- a single library. - galleyEndpoint <- optOrEnv galley iConf (local . read) "GALLEY_WEB_PORT" + galleyEndpoint <- optOrEnv (.galley) iConf (local . read) "GALLEY_WEB_PORT" let g = mkRequest galleyEndpoint - b <- mkRequest <$> optOrEnv brig iConf (local . read) "BRIG_WEB_PORT" - c <- mkRequest <$> optOrEnv cannon iConf (local . read) "CANNON_WEB_PORT" + b <- mkRequest <$> optOrEnv (.brig) iConf (local . read) "BRIG_WEB_PORT" + c <- mkRequest <$> optOrEnv (.cannon) iConf (local . read) "CANNON_WEB_PORT" -- unset this env variable in galley's config to disable testing SQS team events - q <- join <$> optOrEnvSafe queueName gConf (Just . pack) "GALLEY_SQS_TEAM_EVENTS" - e <- join <$> optOrEnvSafe endpoint gConf (fromByteString . BS.pack) "GALLEY_SQS_ENDPOINT" + q <- join <$> optOrEnvSafe queueName' gConf (Just . pack) "GALLEY_SQS_TEAM_EVENTS" + e <- join <$> optOrEnvSafe endpoint' gConf (fromByteString . BS.pack) "GALLEY_SQS_ENDPOINT" convMaxSize <- optOrEnv maxSize gConf read "CONV_MAX_SIZE" awsEnv <- initAwsEnv e q -- Initialize cassandra - let ch = fromJust gConf ^. optCassandra . casEndpoint . epHost - let cp = fromJust gConf ^. optCassandra . casEndpoint . epPort - let ck = fromJust gConf ^. optCassandra . casKeyspace + let ch = fromJust gConf ^. cassandra . endpoint . host + let cp = fromJust gConf ^. cassandra . endpoint . port + let ck = fromJust gConf ^. cassandra . keyspace lg <- Logger.new Logger.defSettings db <- defInitCassandra ck ch cp lg teamEventWatcher <- sequence $ SQS.watchSQSQueue <$> ((^. Aws.awsEnv) <$> awsEnv) <*> q pure $ TestSetup (fromJust gConf) (fromJust iConf) m g b c awsEnv convMaxSize db (FedClient m galleyEndpoint) teamEventWatcher - queueName = fmap (view awsQueueName) . view optJournal - endpoint = fmap (view awsEndpoint) . view optJournal - maxSize = view (optSettings . setMaxConvSize) + queueName' = fmap (view queueName) . view journal + endpoint' = fmap (view O.endpoint) . view journal + maxSize = view (settings . maxConvSize) initAwsEnv (Just e) (Just q) = Just <$> SQS.mkAWSEnv (JournalOpts q e) initAwsEnv _ _ = pure Nothing releaseOpts _ = pure () - mkRequest (Endpoint h p) = host (encodeUtf8 h) . port p + mkRequest (Endpoint h p) = Bilge.host (encodeUtf8 h) . Bilge.port p diff --git a/services/galley/test/integration/TestHelpers.hs b/services/galley/test/integration/TestHelpers.hs index cad9342ec46..fdfbb8c309a 100644 --- a/services/galley/test/integration/TestHelpers.hs +++ b/services/galley/test/integration/TestHelpers.hs @@ -24,7 +24,7 @@ import Control.Monad.Catch (MonadMask) import Control.Retry import Data.Domain (Domain) import Data.Qualified -import Galley.Options (optSettings, setFederationDomain) +import Galley.Options (federationDomain, settings) import Imports import Test.Tasty (TestName, TestTree) import Test.Tasty.HUnit (Assertion, testCase) @@ -39,7 +39,7 @@ test s n h = testCase n runTest void . flip runReaderT setup . runTestM $ h viewFederationDomain :: TestM Domain -viewFederationDomain = view (tsGConf . optSettings . setFederationDomain) +viewFederationDomain = view (tsGConf . settings . federationDomain) qualifyLocal :: a -> TestM (Local a) qualifyLocal x = do diff --git a/services/galley/test/integration/TestSetup.hs b/services/galley/test/integration/TestSetup.hs index f3869492956..70ff6fc5356 100644 --- a/services/galley/test/integration/TestSetup.hs +++ b/services/galley/test/integration/TestSetup.hs @@ -142,15 +142,15 @@ runFedClient :: FedClient comp -> Domain -> Servant.Client m api -runFedClient (FedClient mgr endpoint) domain = +runFedClient (FedClient mgr ep) domain = Servant.hoistClient (Proxy @api) (servantClientMToHttp domain) $ Servant.clientIn (Proxy @api) (Proxy @Servant.ClientM) where servantClientMToHttp :: Domain -> Servant.ClientM a -> m a servantClientMToHttp originDomain action = liftIO $ do - let host = Text.unpack $ endpoint ^. epHost - port = fromInteger . toInteger $ endpoint ^. epPort - baseUrl = Servant.BaseUrl Servant.Http host port "/federation" + let h = Text.unpack $ ep ^. host + p = fromInteger . toInteger $ ep ^. port + baseUrl = Servant.BaseUrl Servant.Http h p "/federation" clientEnv = Servant.ClientEnv mgr baseUrl Nothing (makeClientRequest originDomain) eitherRes <- Servant.runClientM action clientEnv case eitherRes of diff --git a/services/galley/test/unit/Test/Galley/Mapping.hs b/services/galley/test/unit/Test/Galley/Mapping.hs index fa296cc6b72..c18bb63f903 100644 --- a/services/galley/test/unit/Test/Galley/Mapping.hs +++ b/services/galley/test/unit/Test/Galley/Mapping.hs @@ -83,19 +83,19 @@ tests = testProperty "self user role in remote conversation view is correct" $ \(ConvWithRemoteUser c ruid) dom -> qDomain (tUntagged ruid) /= dom ==> - fmap (rcmSelfRole . rcnvMembers) (conversationToRemote dom ruid c) + fmap (selfRole . members) (conversationToRemote dom ruid c) == Just roleNameWireMember, testProperty "remote conversation view metadata is correct" $ \(ConvWithRemoteUser c ruid) dom -> qDomain (tUntagged ruid) /= dom ==> - fmap rcnvMetadata (conversationToRemote dom ruid c) + fmap (.metadata) (conversationToRemote dom ruid c) == Just (Data.convMetadata c), testProperty "remote conversation view does not contain self" $ \(ConvWithRemoteUser c ruid) dom -> case conversationToRemote dom ruid c of Nothing -> False Just rcnv -> tUntagged ruid - `notElem` map omQualifiedId (rcmOthers (rcnvMembers rcnv)) + `notElem` map omQualifiedId rcnv.members.others ] cnvUids :: Conversation -> [Qualified UserId] diff --git a/services/gundeck/src/Gundeck/Aws.hs b/services/gundeck/src/Gundeck/Aws.hs index be9caa56973..ab8dd27c69c 100644 --- a/services/gundeck/src/Gundeck/Aws.hs +++ b/services/gundeck/src/Gundeck/Aws.hs @@ -24,6 +24,8 @@ module Gundeck.Aws mkEnv, Amazon, execute, + Gundeck.Aws.region, + Gundeck.Aws.account, -- * Errors Error (..), @@ -79,7 +81,8 @@ import Data.Text.Lazy qualified as LT import Gundeck.Aws.Arn import Gundeck.Aws.Sns import Gundeck.Instances () -import Gundeck.Options +import Gundeck.Options (Opts) +import Gundeck.Options qualified as O import Gundeck.Types.Push hiding (token) import Gundeck.Types.Push qualified as Push import Imports @@ -152,10 +155,10 @@ mkEnv lgr opts mgr = do e <- mkAwsEnv g - (mkEndpoint SQS.defaultService (opts ^. optAws . awsSqsEndpoint)) - (mkEndpoint SNS.defaultService (opts ^. optAws . awsSnsEndpoint)) - q <- getQueueUrl e (opts ^. optAws . awsQueueName) - pure (Env e g q (opts ^. optAws . awsRegion) (opts ^. optAws . awsAccount)) + (mkEndpoint SQS.defaultService (opts ^. O.aws . O.sqsEndpoint)) + (mkEndpoint SNS.defaultService (opts ^. O.aws . O.snsEndpoint)) + q <- getQueueUrl e (opts ^. O.aws . O.queueName) + pure (Env e g q (opts ^. O.aws . O.region) (opts ^. O.aws . O.account)) where mkEndpoint svc e = AWS.setEndpoint (e ^. awsSecure) (e ^. awsHost) (e ^. awsPort) svc mkAwsEnv g sqs sns = do @@ -166,7 +169,7 @@ mkEnv lgr opts mgr = do pure $ baseEnv { AWS.logger = awsLogger g, - AWS.region = opts ^. optAws . awsRegion, + AWS.region = opts ^. O.aws . O.region, AWS.retryCheck = retryCheck, AWS.manager = mgr } @@ -291,7 +294,7 @@ createEndpoint :: UserId -> Push.Transport -> ArnEnv -> AppName -> Push.Token -> createEndpoint u tr arnEnv app token = do env <- ask let top = mkAppTopic arnEnv tr app - let arn = mkSnsArn (env ^. region) (env ^. account) top + let arn = mkSnsArn env._region env._account top let tkn = Push.tokenText token let req = SNS.newCreatePlatformEndpoint (toText arn) tkn diff --git a/services/gundeck/src/Gundeck/Env.hs b/services/gundeck/src/Gundeck/Env.hs index bc2ee1d2676..f6e205e74e5 100644 --- a/services/gundeck/src/Gundeck/Env.hs +++ b/services/gundeck/src/Gundeck/Env.hs @@ -19,7 +19,7 @@ module Gundeck.Env where -import Bilge +import Bilge hiding (host, port) import Cassandra (ClientState, Keyspace (..)) import Cassandra qualified as C import Cassandra.Settings qualified as C @@ -36,7 +36,8 @@ import Data.Time.Clock import Data.Time.Clock.POSIX import Database.Redis qualified as Redis import Gundeck.Aws qualified as Aws -import Gundeck.Options as Opt +import Gundeck.Options as Opt hiding (host, port) +import Gundeck.Options qualified as O import Gundeck.Redis qualified as Redis import Gundeck.Redis.HedisExtensions qualified as Redis import Gundeck.ThreadBudget @@ -68,23 +69,23 @@ schemaVersion = 7 createEnv :: Metrics -> Opts -> IO ([Async ()], Env) createEnv m o = do - l <- Logger.mkLogger (o ^. optLogLevel) (o ^. optLogNetStrings) (o ^. optLogFormat) + l <- Logger.mkLogger (o ^. logLevel) (o ^. logNetStrings) (o ^. logFormat) c <- maybe - (C.initialContactsPlain (o ^. optCassandra . casEndpoint . epHost)) + (C.initialContactsPlain (o ^. cassandra . endpoint . host)) (C.initialContactsDisco "cassandra_gundeck" . unpack) - (o ^. optDiscoUrl) + (o ^. discoUrl) n <- newManager tlsManagerSettings - { managerConnCount = o ^. optSettings . setHttpPoolSize, - managerIdleConnectionCount = 3 * (o ^. optSettings . setHttpPoolSize), + { managerConnCount = o ^. settings . httpPoolSize, + managerIdleConnectionCount = 3 * (o ^. settings . httpPoolSize), managerResponseTimeout = responseTimeoutMicro 5000000 } - (rThread, r) <- createRedisPool l (o ^. optRedis) "main-redis" + (rThread, r) <- createRedisPool l (o ^. redis) "main-redis" - (rAdditionalThreads, rAdditional) <- case o ^. optRedisAdditionalWrite of + (rAdditionalThreads, rAdditional) <- case o ^. redisAdditionalWrite of Nothing -> pure ([], Nothing) Just additionalRedis -> do (rAddThread, rAdd) <- createRedisPool l additionalRedis "additional-write-redis" @@ -94,15 +95,15 @@ createEnv m o = do C.init $ C.setLogger (C.mkLogger (Logger.clone (Just "cassandra.gundeck") l)) . C.setContacts (NE.head c) (NE.tail c) - . C.setPortNumber (fromIntegral $ o ^. optCassandra . casEndpoint . epPort) - . C.setKeyspace (Keyspace (o ^. optCassandra . casKeyspace)) + . C.setPortNumber (fromIntegral $ o ^. cassandra . endpoint . port) + . C.setKeyspace (Keyspace (o ^. cassandra . keyspace)) . C.setMaxConnections 4 . C.setMaxStreams 128 . C.setPoolStripes 4 . C.setSendTimeout 3 . C.setResponseTimeout 10 . C.setProtocolVersion C.V4 - . C.setPolicy (C.dcFilterPolicyIfConfigured l (o ^. optCassandra . casFilterNodesByDatacentre)) + . C.setPolicy (C.dcFilterPolicyIfConfigured l (o ^. cassandra . filterNodesByDatacentre)) $ C.defSettings a <- Aws.mkEnv l o n io <- @@ -110,7 +111,7 @@ createEnv m o = do defaultUpdateSettings { updateAction = Ms . round . (* 1000) <$> getPOSIXTime } - mtbs <- mkThreadBudgetState `mapM` (o ^. optSettings . setMaxConcurrentNativePushes) + mtbs <- mkThreadBudgetState `mapM` (o ^. settings . maxConcurrentNativePushes) pure $! (rThread : rAdditionalThreads,) $! Env def m o l n p r rAdditional a io mtbs reqIdMsg :: RequestId -> Logger.Msg -> Logger.Msg @@ -118,21 +119,21 @@ reqIdMsg = ("request" Logger..=) . unRequestId {-# INLINE reqIdMsg #-} createRedisPool :: Logger.Logger -> RedisEndpoint -> ByteString -> IO (Async (), Redis.RobustConnection) -createRedisPool l endpoint identifier = do +createRedisPool l ep identifier = do let redisConnInfo = Redis.defaultConnectInfo - { Redis.connectHost = unpack $ endpoint ^. rHost, - Redis.connectPort = Redis.PortNumber (fromIntegral $ endpoint ^. rPort), + { Redis.connectHost = unpack $ ep ^. O.host, + Redis.connectPort = Redis.PortNumber (fromIntegral $ ep ^. O.port), Redis.connectTimeout = Just (secondsToNominalDiffTime 5), Redis.connectMaxConnections = 100 } Log.info l $ Log.msg (Log.val $ "starting connection to " <> identifier <> "...") - . Log.field "connectionMode" (show $ endpoint ^. rConnectionMode) + . Log.field "connectionMode" (show $ ep ^. O.connectionMode) . Log.field "connInfo" (show redisConnInfo) let connectWithRetry = Redis.connectRobust l (capDelay 1000000 (exponentialBackoff 50000)) - r <- case endpoint ^. rConnectionMode of + r <- case ep ^. O.connectionMode of Master -> connectWithRetry $ Redis.checkedConnect redisConnInfo Cluster -> connectWithRetry $ Redis.checkedConnectCluster redisConnInfo Log.info l $ Log.msg (Log.val $ "Established connection to " <> identifier <> ".") diff --git a/services/gundeck/src/Gundeck/Notification.hs b/services/gundeck/src/Gundeck/Notification.hs index 92136f7bec2..5f41a7ba5cf 100644 --- a/services/gundeck/src/Gundeck/Notification.hs +++ b/services/gundeck/src/Gundeck/Notification.hs @@ -33,11 +33,11 @@ import Data.Time.Clock.POSIX import Data.UUID qualified as UUID import Gundeck.Monad import Gundeck.Notification.Data qualified as Data -import Gundeck.Options +import Gundeck.Options hiding (host, port) import Imports hiding (getLast) import System.Logger.Class import System.Logger.Class qualified as Log -import Util.Options +import Util.Options hiding (host, port) import Wire.API.Internal.Notification data PaginateResult = PaginateResult @@ -64,7 +64,7 @@ paginate uid since mclt size = do updateActivity :: UserId -> ClientId -> Gundeck () updateActivity uid clt = do r <- do - Endpoint h p <- view $ options . optBrig + Endpoint h p <- view $ options . brig post ( host (toByteString' h) . port p diff --git a/services/gundeck/src/Gundeck/Notification/Data.hs b/services/gundeck/src/Gundeck/Notification/Data.hs index f8bbe165b78..d680e68f2c4 100644 --- a/services/gundeck/src/Gundeck/Notification/Data.hs +++ b/services/gundeck/src/Gundeck/Notification/Data.hs @@ -37,7 +37,7 @@ import Data.Range (Range, fromRange) import Data.Sequence (Seq, ViewL ((:<))) import Data.Sequence qualified as Seq import Gundeck.Env -import Gundeck.Options (NotificationTTL (..), optSettings, setInternalPageSize, setMaxPayloadLoadSize) +import Gundeck.Options (NotificationTTL (..), internalPageSize, maxPayloadLoadSize, settings) import Gundeck.Push.Native.Serialise () import Imports hiding (cs) import UnliftIO (pooledForConcurrentlyN_) @@ -119,7 +119,7 @@ fetchId u n c = runMaybeT $ do fetchLast :: (MonadReader Env m, MonadClient m) => UserId -> Maybe ClientId -> m (Maybe QueuedNotification) fetchLast u c = do - pageSize <- fromMaybe 100 <$> asks (^. options . optSettings . setInternalPageSize) + pageSize <- fromMaybe 100 <$> asks (^. options . settings . internalPageSize) go (Page True [] (firstPage pageSize)) where go page = case result page of @@ -219,12 +219,12 @@ mkResultPage size more ns = fetch :: (MonadReader Env m, MonadClient m, MonadUnliftIO m) => UserId -> Maybe ClientId -> Maybe NotificationId -> Range 100 10000 Int32 -> m ResultPage fetch u c Nothing (fromIntegral . fromRange -> size) = do - pageSize <- fromMaybe 100 <$> asks (^. options . optSettings . setInternalPageSize) + pageSize <- fromMaybe 100 <$> asks (^. options . settings . internalPageSize) let page1 = retry x1 $ paginate cqlStart (paramsP LocalQuorum (Identity u) pageSize) -- We always need to look for one more than requested in order to correctly -- report whether there are more results. - maxPayloadLoadSize <- fromMaybe (5 * 1024 * 1024) <$> asks (^. options . optSettings . setMaxPayloadLoadSize) - (ns, more) <- collect c Seq.empty True (size + 1) maxPayloadLoadSize page1 + maxPayloadSize <- fromMaybe (5 * 1024 * 1024) <$> asks (^. options . settings . maxPayloadLoadSize) + (ns, more) <- collect c Seq.empty True (size + 1) maxPayloadSize page1 -- Drop the extra element at the end if present pure $! mkResultPage size more ns where @@ -235,7 +235,7 @@ fetch u c Nothing (fromIntegral . fromRange -> size) = do \WHERE user = ? \ \ORDER BY id ASC" fetch u c (Just since) (fromIntegral . fromRange -> size) = do - pageSize <- fromMaybe 100 <$> asks (^. options . optSettings . setInternalPageSize) + pageSize <- fromMaybe 100 <$> asks (^. options . settings . internalPageSize) let page1 = retry x1 $ paginate cqlSince (paramsP LocalQuorum (u, TimeUuid (toUUID since)) pageSize) @@ -243,8 +243,8 @@ fetch u c (Just since) (fromIntegral . fromRange -> size) = do -- notification corresponding to the `since` argument itself. The second is -- to get an accurate `hasMore`, just like in the case above. - maxPayloadLoadSize <- fromMaybe (5 * 1024 * 1024) <$> asks (^. options . optSettings . setMaxPayloadLoadSize) - (ns, more) <- collect c Seq.empty True (size + 2) maxPayloadLoadSize page1 + maxPayloadSize <- fromMaybe (5 * 1024 * 1024) <$> asks (^. options . settings . maxPayloadLoadSize) + (ns, more) <- collect c Seq.empty True (size + 2) maxPayloadSize page1 -- Remove notification corresponding to the `since` argument, and record if it is found. let (ns', sinceFound) = case Seq.viewl ns of x :< xs | since == x ^. queuedNotificationId -> (xs, True) diff --git a/services/gundeck/src/Gundeck/Options.hs b/services/gundeck/src/Gundeck/Options.hs index ec90c651c56..ac484ec8331 100644 --- a/services/gundeck/src/Gundeck/Options.hs +++ b/services/gundeck/src/Gundeck/Options.hs @@ -36,15 +36,15 @@ newtype NotificationTTL = NotificationTTL data AWSOpts = AWSOpts { -- | AWS account - _awsAccount :: !Account, + _account :: !Account, -- | AWS region name - _awsRegion :: !Region, + _region :: !Region, -- | Environment name to scope ARNs to - _awsArnEnv :: !ArnEnv, + _arnEnv :: !ArnEnv, -- | SQS queue name - _awsQueueName :: !Text, - _awsSqsEndpoint :: !AWSEndpoint, - _awsSnsEndpoint :: !AWSEndpoint + _queueName :: !Text, + _sqsEndpoint :: !AWSEndpoint, + _snsEndpoint :: !AWSEndpoint } deriving (Show, Generic) @@ -54,18 +54,18 @@ makeLenses ''AWSOpts data Settings = Settings { -- | Number of connections to keep open in the http-client pool - _setHttpPoolSize :: !Int, + _httpPoolSize :: !Int, -- | TTL (seconds) of stored notifications - _setNotificationTTL :: !NotificationTTL, + _notificationTTL :: !NotificationTTL, -- | Use this option to group push notifications and send them in bulk to Cannon, instead -- of in individual requests - _setBulkPush :: !Bool, + _bulkPush :: !Bool, -- | Maximum number of concurrent threads calling SNS. - _setMaxConcurrentNativePushes :: !(Maybe MaxConcurrentNativePushes), + _maxConcurrentNativePushes :: !(Maybe MaxConcurrentNativePushes), -- | Maximum number of parallel requests to SNS and cassandra -- during native push processing (per incoming push request) -- defaults to unbounded, if unset. - _setPerNativePushConcurrency :: !(Maybe Int), + _perNativePushConcurrency :: !(Maybe Int), -- | The amount of time in milliseconds to wait after reading from an SQS queue -- returns no message, before asking for messages from SQS again. -- defaults to 'defSqsThrottleMillis'. @@ -74,25 +74,25 @@ data Settings = Settings -- ensures that there is only one request every 20 seconds. -- However, that parameter is not honoured when using fake-sqs -- (where throttling can thus make sense) - _setSqsThrottleMillis :: !(Maybe Int), - _setDisabledAPIVersions :: !(Maybe (Set Version)), + _sqsThrottleMillis :: !(Maybe Int), + _disabledAPIVersions :: !(Maybe (Set Version)), -- | Maximum number of bytes loaded into memory when fetching (referenced) payloads. -- Gundeck will return a truncated page if the whole page's payload sizes would exceed this limit in total. -- Inlined payloads can cause greater payload sizes to be loaded into memory regardless of this setting. - _setMaxPayloadLoadSize :: Maybe Int32, + _maxPayloadLoadSize :: Maybe Int32, -- | Cassandra page size for fetching notifications. Does not directly -- effect the page size request in the client API. A lower number will -- reduce the amount by which setMaxPayloadLoadSize is exceeded when loading -- notifications from the database if notifications have inlined payloads. - _setInternalPageSize :: Maybe Int32 + _internalPageSize :: Maybe Int32 } deriving (Show, Generic) data MaxConcurrentNativePushes = MaxConcurrentNativePushes { -- | more than this number of threads will not be allowed - _limitHard :: !(Maybe Int), + _hard :: !(Maybe Int), -- | more than this number of threads will be warned about - _limitSoft :: !(Maybe Int) + _soft :: !(Maybe Int) } deriving (Show, Generic) @@ -108,9 +108,9 @@ data RedisConnectionMode deriveJSON defaultOptions {constructorTagModifier = map toLower} ''RedisConnectionMode data RedisEndpoint = RedisEndpoint - { _rHost :: !Text, - _rPort :: !Word16, - _rConnectionMode :: !RedisConnectionMode + { _host :: !Text, + _port :: !Word16, + _connectionMode :: !RedisConnectionMode } deriving (Show, Generic) @@ -124,22 +124,22 @@ deriveFromJSON toOptionFieldName ''Settings data Opts = Opts { -- | Hostname and port to bind to - _optGundeck :: !Endpoint, - _optBrig :: !Endpoint, - _optCassandra :: !CassandraOpts, - _optRedis :: !RedisEndpoint, - _optRedisAdditionalWrite :: !(Maybe RedisEndpoint), - _optAws :: !AWSOpts, - _optDiscoUrl :: !(Maybe Text), - _optSettings :: !Settings, + _gundeck :: !Endpoint, + _brig :: !Endpoint, + _cassandra :: !CassandraOpts, + _redis :: !RedisEndpoint, + _redisAdditionalWrite :: !(Maybe RedisEndpoint), + _aws :: !AWSOpts, + _discoUrl :: !(Maybe Text), + _settings :: !Settings, -- Logging -- | Log level (Debug, Info, etc) - _optLogLevel :: !Level, + _logLevel :: !Level, -- | Use netstrings encoding: -- - _optLogNetStrings :: !(Maybe (Last Bool)), - _optLogFormat :: !(Maybe (Last LogFormat)) + _logNetStrings :: !(Maybe (Last Bool)), + _logFormat :: !(Maybe (Last LogFormat)) } deriving (Show, Generic) diff --git a/services/gundeck/src/Gundeck/Push.hs b/services/gundeck/src/Gundeck/Push.hs index 5b282837ecd..02c6984873b 100644 --- a/services/gundeck/src/Gundeck/Push.hs +++ b/services/gundeck/src/Gundeck/Push.hs @@ -72,7 +72,7 @@ import Wire.API.Push.Token qualified as Public push :: [Push] -> Gundeck () push ps = do - bulk :: Bool <- view (options . optSettings . setBulkPush) + bulk :: Bool <- view (options . settings . bulkPush) rs <- if bulk then (Right <$> pushAll ps) `catch` (pure . Left . Seq.singleton) @@ -95,7 +95,7 @@ class MonadThrow m => MonadPushAll m where mpaRunWithBudget :: Int -> a -> m a -> m a instance MonadPushAll Gundeck where - mpaNotificationTTL = view (options . optSettings . setNotificationTTL) + mpaNotificationTTL = view (options . settings . notificationTTL) mpaMkNotificationId = mkNotificationId mpaListAllPresences = runWithDefaultRedis . Presence.listAll mpaBulkPush = Web.bulkPush @@ -126,7 +126,7 @@ class Monad m => MonadMapAsync m where mntgtPerPushConcurrency :: m (Maybe Int) instance MonadMapAsync Gundeck where - mntgtPerPushConcurrency = view (options . optSettings . setPerNativePushConcurrency) + mntgtPerPushConcurrency = view (options . settings . perNativePushConcurrency) mntgtMapAsync f l = do perPushConcurrency <- mntgtPerPushConcurrency case perPushConcurrency of @@ -451,9 +451,9 @@ addToken uid cid newtok = mpaRunWithBudget 1 (Left Public.AddTokenErrorNoBudget) let trp = t ^. tokenTransport let app = t ^. tokenApp let tok = t ^. token - env <- view (options . optAws . awsArnEnv) - aws <- view awsEnv - ept <- Aws.execute aws (Aws.createEndpoint uid trp env app tok) + env <- view (options . aws . arnEnv) + aws' <- view awsEnv + ept <- Aws.execute aws' (Aws.createEndpoint uid trp env app tok) case ept of Left (Aws.EndpointInUse arn) -> do Log.info $ "arn" .= toText arn ~~ msg (val "ARN in use") @@ -483,8 +483,8 @@ addToken uid cid newtok = mpaRunWithBudget 1 (Left Public.AddTokenErrorNoBudget) when (n >= 3) $ do Log.err $ msg (val "AWS SNS inconsistency w.r.t. " +++ toText arn) throwM (mkError status500 "server-error" "Server Error") - aws <- view awsEnv - ept <- Aws.execute aws (Aws.lookupEndpoint arn) + aws' <- view awsEnv + ept <- Aws.execute aws' (Aws.lookupEndpoint arn) case ept of Nothing -> create (n + 1) t Just ep -> diff --git a/services/gundeck/src/Gundeck/Push/Native.hs b/services/gundeck/src/Gundeck/Push/Native.hs index 7156463f283..752351340d4 100644 --- a/services/gundeck/src/Gundeck/Push/Native.hs +++ b/services/gundeck/src/Gundeck/Push/Native.hs @@ -52,7 +52,7 @@ push :: NativePush -> [Address] -> Gundeck () push _ [] = pure () push m [a] = push1 m a push m addrs = do - perPushConcurrency <- view (options . optSettings . setPerNativePushConcurrency) + perPushConcurrency <- view (options . settings . perNativePushConcurrency) case perPushConcurrency of -- send all at once Nothing -> void $ mapConcurrently (push1 m) addrs @@ -123,9 +123,9 @@ push1 = push1' 0 let trp = t ^. tokenTransport let app = t ^. tokenApp let tok = t ^. token - env <- view (options . optAws . awsArnEnv) - aws <- view awsEnv - ept <- Aws.execute aws (Aws.createEndpoint uid trp env app tok) + env <- view (options . aws . arnEnv) + aws' <- view awsEnv + ept <- Aws.execute aws' (Aws.createEndpoint uid trp env app tok) case ept of Left (Aws.EndpointInUse arn) -> Log.info $ "arn" .= toText arn ~~ msg (val "ARN in use") @@ -157,7 +157,7 @@ push1 = push1' 0 let r = singleton (target (a ^. addrUser) & targetClients .~ [c]) let t = a ^. addrPushToken let p = singletonPayload (PushRemove t) - Stream.add i r p =<< view (options . optSettings . setNotificationTTL) + Stream.add i r p =<< view (options . settings . notificationTTL) publish :: NativePush -> Address -> Aws.Amazon Result publish m a = flip catches pushException $ do @@ -194,7 +194,7 @@ publish m a = flip catches pushException $ do -- migrated to the token and endpoint of the new address. deleteTokens :: [Address] -> Maybe Address -> Gundeck () deleteTokens tokens new = do - aws <- view awsEnv + aws' <- view awsEnv forM_ tokens $ \a -> do Log.info $ field "user" (UUID.toASCIIBytes (toUUID (a ^. addrUser))) @@ -202,30 +202,30 @@ deleteTokens tokens new = do ~~ field "arn" (toText (a ^. addrEndpoint)) ~~ msg (val "Deleting push token") Data.delete (a ^. addrUser) (a ^. addrTransport) (a ^. addrApp) (a ^. addrToken) - ept <- Aws.execute aws (Aws.lookupEndpoint (a ^. addrEndpoint)) + ept <- Aws.execute aws' (Aws.lookupEndpoint (a ^. addrEndpoint)) for_ ept $ \ep -> let us = Set.delete (a ^. addrUser) (ep ^. Aws.endpointUsers) in if Set.null us - then delete aws a + then delete aws' a else case new of - Nothing -> update aws a us + Nothing -> update aws' a us Just a' -> do mapM_ (migrate a a') us - update aws a' (ep ^. Aws.endpointUsers) - delete aws a + update aws' a' (ep ^. Aws.endpointUsers) + delete aws' a where - delete aws a = do + delete aws' a = do Log.info $ field "user" (UUID.toASCIIBytes (toUUID (a ^. addrUser))) ~~ field "arn" (toText (a ^. addrEndpoint)) ~~ msg (val "Deleting SNS endpoint") - Aws.execute aws (Aws.deleteEndpoint (a ^. addrEndpoint)) - update aws a us = do + Aws.execute aws' (Aws.deleteEndpoint (a ^. addrEndpoint)) + update aws' a us = do Log.info $ field "user" (UUID.toASCIIBytes (toUUID (a ^. addrUser))) ~~ field "arn" (toText (a ^. addrEndpoint)) ~~ msg (val "Updating SNS endpoint") - Aws.execute aws (Aws.updateEndpoint us (a ^. addrToken) (a ^. addrEndpoint)) + Aws.execute aws' (Aws.updateEndpoint us (a ^. addrToken) (a ^. addrEndpoint)) migrate a a' u = do let oldArn = a ^. addrEndpoint let oldTok = a ^. addrToken diff --git a/services/gundeck/src/Gundeck/React.hs b/services/gundeck/src/Gundeck/React.hs index ac34e68e987..d97f4312ccc 100644 --- a/services/gundeck/src/Gundeck/React.hs +++ b/services/gundeck/src/Gundeck/React.hs @@ -37,7 +37,7 @@ import Gundeck.Env import Gundeck.Instances () import Gundeck.Monad import Gundeck.Notification.Data qualified as Stream -import Gundeck.Options (optSettings, setNotificationTTL) +import Gundeck.Options (notificationTTL, settings) import Gundeck.Push.Data qualified as Push import Gundeck.Push.Native.Types import Gundeck.Push.Websocket qualified as Web @@ -162,7 +162,7 @@ deleteToken u ev tk cl = do n = Notification i False p r = singleton (target u & targetClients .~ [cl]) void $ Web.push n r (Just u) Nothing Set.empty - Stream.add i r p =<< view (options . optSettings . setNotificationTTL) + Stream.add i r p =<< view (options . settings . notificationTTL) Push.delete u (t ^. tokenTransport) (t ^. tokenApp) tk mkPushToken :: Event -> Token -> ClientId -> PushToken diff --git a/services/gundeck/src/Gundeck/Run.hs b/services/gundeck/src/Gundeck/Run.hs index 8db0f115f12..3f7c9d1f6f4 100644 --- a/services/gundeck/src/Gundeck/Run.hs +++ b/services/gundeck/src/Gundeck/Run.hs @@ -39,7 +39,7 @@ import Gundeck.Aws qualified as Aws import Gundeck.Env import Gundeck.Env qualified as Env import Gundeck.Monad -import Gundeck.Options +import Gundeck.Options hiding (host, port) import Gundeck.React import Gundeck.ThreadBudget import Imports hiding (head) @@ -62,8 +62,8 @@ run o = do runClient (e ^. cstate) $ versionCheck schemaVersion let l = e ^. applog - s <- newSettings $ defaultServer (unpack $ o ^. optGundeck . epHost) (o ^. optGundeck . epPort) l m - let throttleMillis = fromMaybe defSqsThrottleMillis $ o ^. (optSettings . setSqsThrottleMillis) + s <- newSettings $ defaultServer (unpack $ o ^. gundeck . host) (o ^. gundeck . port) l m + let throttleMillis = fromMaybe defSqsThrottleMillis $ o ^. (settings . sqsThrottleMillis) lst <- Async.async $ Aws.execute (e ^. awsEnv) (Aws.listen throttleMillis (runDirect e . onEvent)) wtbs <- forM (e ^. threadBudgetState) $ \tbs -> Async.async $ runDirect e $ watchThreadBudgetState m tbs 10 @@ -81,7 +81,7 @@ run o = do where middleware :: Env -> Wai.Middleware middleware e = - versionMiddleware (fold (o ^. optSettings . setDisabledAPIVersions)) + versionMiddleware (fold (o ^. settings . disabledAPIVersions)) . waiPrometheusMiddleware sitemap . GZip.gunzip . GZip.gzip GZip.def diff --git a/services/gundeck/src/Gundeck/ThreadBudget/Internal.hs b/services/gundeck/src/Gundeck/ThreadBudget/Internal.hs index 4918560c12e..4f311bb072c 100644 --- a/services/gundeck/src/Gundeck/ThreadBudget/Internal.hs +++ b/services/gundeck/src/Gundeck/ThreadBudget/Internal.hs @@ -135,10 +135,10 @@ runWithBudget' metrics (ThreadBudgetState limits ref) spent fallback action = do key <- liftIO nextRandom (`finally` unregister ref key) $ do oldsize <- allocate ref key spent - let softLimitBreached = maybe False (oldsize >=) (limits ^. limitSoft) - hardLimitBreached = maybe False (oldsize >=) (limits ^. limitHard) + let softLimitBreached = maybe False (oldsize >=) (limits ^. soft) + hardLimitBreached = maybe False (oldsize >=) (limits ^. hard) warnNoBudget softLimitBreached hardLimitBreached oldsize - if maybe True (oldsize <) (limits ^. limitHard) + if maybe True (oldsize <) (limits ^. hard) then go key oldsize else pure fallback where @@ -154,14 +154,14 @@ runWithBudget' metrics (ThreadBudgetState limits ref) spent fallback action = do -- iff soft and/or hard limit are breached, log a warning-level message. warnNoBudget :: Bool -> Bool -> Int -> m () warnNoBudget False False _ = pure () - warnNoBudget soft hard oldsize = do - let limit = if hard then "hard" else "soft" + warnNoBudget soft' hard' oldsize = do + let limit = if hard' then "hard" else "soft" metric = "net.nativepush." <> limit <> "_limit_breached" counterIncr (path metric) metrics LC.warn $ "spent" LC..= show oldsize - LC.~~ "soft-breach" LC..= soft - LC.~~ "hard-breach" LC..= hard + LC.~~ "soft-breach" LC..= soft' + LC.~~ "hard-breach" LC..= hard' LC.~~ LC.msg ("runWithBudget: " <> limit <> " limit reached") -- | Fork a thread that checks with the given frequency if any async handles stored in the @@ -194,9 +194,9 @@ recordMetrics :: recordMetrics metrics limits ref = do (BudgetMap spent _) <- readIORef ref gaugeSet (fromIntegral spent) (path "net.nativepush.thread_budget_allocated") metrics - forM_ (limits ^. limitHard) $ \lim -> + forM_ (limits ^. hard) $ \lim -> gaugeSet (fromIntegral lim) (path "net.nativepush.thread_budget_hard_limit") metrics - forM_ (limits ^. limitSoft) $ \lim -> + forM_ (limits ^. soft) $ \lim -> gaugeSet (fromIntegral lim) (path "net.nativepush.thread_budget_soft_limit") metrics threadDelayNominalDiffTime :: NominalDiffTime -> MonadIO m => m () diff --git a/services/gundeck/test/integration/API.hs b/services/gundeck/test/integration/API.hs index 5956d356057..930d83fa1c3 100644 --- a/services/gundeck/test/integration/API.hs +++ b/services/gundeck/test/integration/API.hs @@ -50,7 +50,8 @@ import Data.Set qualified as Set import Data.Text.Encoding qualified as T import Data.UUID qualified as UUID import Data.UUID.V4 -import Gundeck.Options +import Gundeck.Options hiding (bulkPush) +import Gundeck.Options qualified as O import Gundeck.Types import Gundeck.Types.Common qualified import Imports @@ -407,10 +408,10 @@ targetClientPush = do storeNotificationsEvenWhenRedisIsDown :: TestM () storeNotificationsEvenWhenRedisIsDown = do ally <- randomId - origRedisEndpoint <- view $ tsOpts . optRedis + origRedisEndpoint <- view $ tsOpts . redis let proxyPort = 10112 - redisProxyServer <- liftIO . async $ runRedisProxy (origRedisEndpoint ^. rHost) (origRedisEndpoint ^. rPort) proxyPort - withSettingsOverrides (optRedis .~ RedisEndpoint "localhost" proxyPort (origRedisEndpoint ^. rConnectionMode)) $ do + redisProxyServer <- liftIO . async $ runRedisProxy (origRedisEndpoint ^. O.host) (origRedisEndpoint ^. O.port) proxyPort + withSettingsOverrides (redis .~ RedisEndpoint "localhost" proxyPort (origRedisEndpoint ^. connectionMode)) $ do let pload = textPayload "hello" push = buildPush ally [(ally, RecipientClientsAll)] pload gu <- view tsGundeck @@ -912,7 +913,7 @@ testRedisMigration = do let presence = Presence uid con cannonURI Nothing 1 "" redis2 <- view tsRedis2 - withSettingsOverrides (optRedisAdditionalWrite ?~ redis2) $ do + withSettingsOverrides (redisAdditionalWrite ?~ redis2) $ do g <- view tsGundeck setPresence g presence !!! const 201 @@ -921,7 +922,7 @@ testRedisMigration = do map resource . decodePresence <$> (getPresence g (toByteString' uid) (getPresence g (toByteString' uid) ServiceName -> (Socket -> IO a) -> IO b -runTCPServer mhost port server = withSocketsDo $ do - addr <- resolve Stream mhost port True +runTCPServer mhost port' server = withSocketsDo $ do + addr <- resolve Stream mhost port' True clientThreads <- newTVarIO [] E.bracket (open addr) (cleanupClients clientThreads) (loop clientThreads) where @@ -70,8 +70,8 @@ runTCPServer mhost port server = withSocketsDo $ do mapM_ killThread =<< readTVarIO clientThreads resolve :: SocketType -> Maybe HostName -> ServiceName -> Bool -> IO AddrInfo -resolve socketType mhost port passive = - head <$> getAddrInfo (Just hints) mhost (Just port) +resolve socketType mhost port' passive = + head <$> getAddrInfo (Just hints) mhost (Just port') where hints = defaultHints diff --git a/services/gundeck/test/unit/ThreadBudget.hs b/services/gundeck/test/unit/ThreadBudget.hs index 45182fea0a3..bd06c866dea 100644 --- a/services/gundeck/test/unit/ThreadBudget.hs +++ b/services/gundeck/test/unit/ThreadBudget.hs @@ -276,7 +276,7 @@ postcondition model@(Model (Just _)) cmd@Measure {} resp@(MeasureResponse concre Model (Just state) = transition model cmd resp threadLimit :: Int threadLimit = case opaque state of - (tbs, _, _) -> tbs ^?! Control.Lens.to threadBudgetLimits . limitHard . _Just + (tbs, _, _) -> tbs ^?! Control.Lens.to threadBudgetLimits . hard . _Just -- number of running threads is never above the limit. threadLimitExceeded = Annotate "thread limit exceeded" $ concreteRunning .<= threadLimit -- FUTUREWORK: check that the number of running threads matches the model exactly. looks diff --git a/services/spar/src/Spar/API.hs b/services/spar/src/Spar/API.hs index a6e82976950..5c27ad4407d 100644 --- a/services/spar/src/Spar/API.hs +++ b/services/spar/src/Spar/API.hs @@ -256,9 +256,9 @@ authreq authreqttl msucc merr idpid = do form@(SAML.FormRedirect _ ((^. SAML.rqID) -> reqid)) <- do idp :: IdP <- IdPConfigStore.getConfig idpid let mbtid :: Maybe TeamId - mbtid = case fromMaybe defWireIdPAPIVersion (idp ^. SAML.idpExtraInfo . wiApiVersion) of + mbtid = case fromMaybe defWireIdPAPIVersion (idp ^. SAML.idpExtraInfo . apiVersion) of WireIdPAPIV1 -> Nothing - WireIdPAPIV2 -> Just $ idp ^. SAML.idpExtraInfo . wiTeam + WireIdPAPIV2 -> Just $ idp ^. SAML.idpExtraInfo . team SAML2.authReq authreqttl (SamlProtocolSettings.spIssuer mbtid) idpid VerdictFormatStore.store authreqttl reqid vformat pure form @@ -370,7 +370,7 @@ idpGetAll :: Sem r IdPList idpGetAll zusr = withDebugLog "idpGetAll" (const Nothing) $ do teamid <- Brig.getZUsrCheckPerm zusr ReadIdp - _idplProviders <- IdPConfigStore.getConfigsByTeam teamid + _providers <- IdPConfigStore.getConfigsByTeam teamid pure IdPList {..} -- | Delete empty IdPs, or if @"purge=true"@ in the HTTP query, delete all users @@ -399,18 +399,18 @@ idpDelete :: Sem r NoContent idpDelete mbzusr idpid (fromMaybe False -> purge) = withDebugLog "idpDelete" (const Nothing) $ do idp <- IdPConfigStore.getConfig idpid - (zusr, team) <- authorizeIdP mbzusr idp + (zusr, teamId) <- authorizeIdP mbzusr idp let issuer = idp ^. SAML.idpMetadata . SAML.edIssuer whenM (idpDoesAuthSelf idp zusr) $ throwSparSem SparIdPCannotDeleteOwnIdp - SAMLUserStore.getAllByIssuerPaginated issuer >>= assertEmptyOrPurge team + SAMLUserStore.getAllByIssuerPaginated issuer >>= assertEmptyOrPurge teamId updateOldIssuers idp updateReplacingIdP idp -- Delete tokens associated with given IdP (we rely on the fact that -- each IdP has exactly one team so we can look up all tokens -- associated with the team and then filter them) - tokens <- ScimTokenStore.lookupByTeam team + tokens <- ScimTokenStore.lookupByTeam teamId for_ tokens $ \ScimTokenInfo {..} -> - when (stiIdP == Just idpid) $ ScimTokenStore.delete team stiId + when (stiIdP == Just idpid) $ ScimTokenStore.delete teamId stiId -- Delete IdP config do IdPConfigStore.deleteConfig idp @@ -418,11 +418,11 @@ idpDelete mbzusr idpid (fromMaybe False -> purge) = withDebugLog "idpDelete" (co pure NoContent where assertEmptyOrPurge :: TeamId -> Cas.Page (SAML.UserRef, UserId) -> Sem r () - assertEmptyOrPurge team page = do + assertEmptyOrPurge teamId page = do forM_ (Cas.result page) $ \(uref, uid) -> do mAccount <- BrigAccess.getAccount NoPendingInvitations uid let mUserTeam = userTeam . accountUser =<< mAccount - when (mUserTeam == Just team) $ do + when (mUserTeam == Just teamId) $ do if purge then do SAMLUserStore.delete uid uref @@ -430,7 +430,7 @@ idpDelete mbzusr idpid (fromMaybe False -> purge) = withDebugLog "idpDelete" (co else do throwSparSem SparIdPHasBoundUsers when (Cas.hasMore page) $ - SAMLUserStore.nextPage page >>= assertEmptyOrPurge team + SAMLUserStore.nextPage page >>= assertEmptyOrPurge teamId updateOldIssuers :: IdP -> Sem r () updateOldIssuers _ = pure () @@ -442,11 +442,11 @@ idpDelete mbzusr idpid (fromMaybe False -> purge) = withDebugLog "idpDelete" (co -- leave old issuers dangling for now. updateReplacingIdP :: IdP -> Sem r () - updateReplacingIdP idp = forM_ (idp ^. SAML.idpExtraInfo . wiOldIssuers) $ \oldIssuer -> do + updateReplacingIdP idp = forM_ (idp ^. SAML.idpExtraInfo . oldIssuers) $ \oldIssuer -> do iid <- - view SAML.idpId <$> case fromMaybe defWireIdPAPIVersion $ idp ^. SAML.idpExtraInfo . wiApiVersion of + view SAML.idpId <$> case fromMaybe defWireIdPAPIVersion $ idp ^. SAML.idpExtraInfo . apiVersion of WireIdPAPIV1 -> IdPConfigStore.getIdPByIssuerV1 oldIssuer - WireIdPAPIV2 -> IdPConfigStore.getIdPByIssuerV2 oldIssuer (idp ^. SAML.idpExtraInfo . wiTeam) + WireIdPAPIV2 -> IdPConfigStore.getIdPByIssuerV2 oldIssuer (idp ^. SAML.idpExtraInfo . team) IdPConfigStore.clearReplacedBy $ Replaced iid idpDoesAuthSelf :: IdP -> UserId -> Sem r Bool @@ -497,8 +497,9 @@ idpCreateXML zusr raw idpmeta mReplaces (fromMaybe defWireIdPAPIVersion -> apive teamid <- Brig.getZUsrCheckPerm zusr CreateUpdateDeleteIdp GalleyAccess.assertSSOEnabled teamid assertNoScimOrNoIdP teamid - handle <- maybe (IdPConfigStore.newHandle teamid) (pure . IdPHandle . fromRange) mHandle - idp <- validateNewIdP apiversion idpmeta teamid mReplaces handle + idp <- + maybe (IdPConfigStore.newHandle teamid) (pure . IdPHandle . fromRange) mHandle + >>= validateNewIdP apiversion idpmeta teamid mReplaces IdPRawMetadataStore.store (idp ^. SAML.idpId) raw IdPConfigStore.insertConfig idp forM_ mReplaces $ \replaces -> @@ -558,21 +559,21 @@ validateNewIdP :: Maybe SAML.IdPId -> IdPHandle -> m IdP -validateNewIdP apiversion _idpMetadata teamId mReplaces handle = withDebugLog "validateNewIdP" (Just . show . (^. SAML.idpId)) $ do +validateNewIdP apiversion _idpMetadata teamId mReplaces idHandle = withDebugLog "validateNewIdP" (Just . show . (^. SAML.idpId)) $ do _idpId <- SAML.IdPId <$> Random.uuid - oldIssuers :: [SAML.Issuer] <- case mReplaces of + oldIssuersList :: [SAML.Issuer] <- case mReplaces of Nothing -> pure [] Just replaces -> do idp <- IdPConfigStore.getConfig replaces - pure $ (idp ^. SAML.idpMetadata . SAML.edIssuer) : (idp ^. SAML.idpExtraInfo . wiOldIssuers) + pure $ (idp ^. SAML.idpMetadata . SAML.edIssuer) : (idp ^. SAML.idpExtraInfo . oldIssuers) let requri = _idpMetadata ^. SAML.edRequestURI - _idpExtraInfo = WireIdP teamId (Just apiversion) oldIssuers Nothing handle + _idpExtraInfo = WireIdP teamId (Just apiversion) oldIssuersList Nothing idHandle enforceHttps requri mbIdp <- case apiversion of WireIdPAPIV1 -> IdPConfigStore.getIdPByIssuerV1Maybe (_idpMetadata ^. SAML.edIssuer) WireIdPAPIV2 -> IdPConfigStore.getIdPByIssuerV2Maybe (_idpMetadata ^. SAML.edIssuer) teamId Logger.log Logger.Debug $ show (apiversion, _idpMetadata, teamId, mReplaces) - Logger.log Logger.Debug $ show (_idpId, oldIssuers, mbIdp) + Logger.log Logger.Debug $ show (_idpId, oldIssuersList, mbIdp) let failWithIdPClash :: m () failWithIdPClash = throwSparSem . SparNewIdPAlreadyInUse $ case apiversion of @@ -625,7 +626,7 @@ idpUpdateXML zusr raw idpmeta idpid mHandle = withDebugLog "idpUpdateXML" (Just GalleyAccess.assertSSOEnabled teamid IdPRawMetadataStore.store (idp ^. SAML.idpId) raw let idp' :: IdP = case mHandle of - Just idpHandle -> idp & (SAML.idpExtraInfo . wiHandle) .~ IdPHandle (fromRange idpHandle) + Just idpHandle -> idp & (SAML.idpExtraInfo . handle) .~ IdPHandle (fromRange idpHandle) Nothing -> idp -- (if raw metadata is stored and then spar goes out, raw metadata won't match the -- structured idp config. since this will lead to a 5xx response, the client is expected to @@ -633,10 +634,10 @@ idpUpdateXML zusr raw idpmeta idpid mHandle = withDebugLog "idpUpdateXML" (Just IdPConfigStore.insertConfig idp' -- if the IdP issuer is updated, the old issuer must be removed explicitly. -- if this step is ommitted (due to a crash) resending the update request should fix the inconsistent state. - let mbteamid = case fromMaybe defWireIdPAPIVersion $ idp' ^. SAML.idpExtraInfo . wiApiVersion of + let mbteamid = case fromMaybe defWireIdPAPIVersion $ idp' ^. SAML.idpExtraInfo . apiVersion of WireIdPAPIV1 -> Nothing WireIdPAPIV2 -> Just teamid - forM_ (idp' ^. SAML.idpExtraInfo . wiOldIssuers) (flip IdPConfigStore.deleteIssuer mbteamid) + forM_ (idp' ^. SAML.idpExtraInfo . oldIssuers) (flip IdPConfigStore.deleteIssuer mbteamid) pure idp' -- | Check that: idp id is valid; calling user is admin in that idp's home team; team id in @@ -660,7 +661,7 @@ validateIdPUpdate :: validateIdPUpdate zusr _idpMetadata _idpId = withDebugLog "validateIdPUpdate" (Just . show . (_2 %~ (^. SAML.idpId))) $ do previousIdP <- IdPConfigStore.getConfig _idpId (_, teamId) <- authorizeIdP zusr previousIdP - unless (previousIdP ^. SAML.idpExtraInfo . wiTeam == teamId) $ + unless (previousIdP ^. SAML.idpExtraInfo . team == teamId) $ throw errUnknownIdP _idpExtraInfo <- do let previousIssuer = previousIdP ^. SAML.idpMetadata . SAML.edIssuer @@ -671,7 +672,7 @@ validateIdPUpdate zusr _idpMetadata _idpId = withDebugLog "validateIdPUpdate" (J pure $ previousIdP ^. SAML.idpExtraInfo else do idpIssuerInUse <- - ( case fromMaybe defWireIdPAPIVersion $ previousIdP ^. SAML.idpExtraInfo . wiApiVersion of + ( case fromMaybe defWireIdPAPIVersion $ previousIdP ^. SAML.idpExtraInfo . apiVersion of WireIdPAPIV1 -> IdPConfigStore.getIdPByIssuerV1Maybe newIssuer WireIdPAPIV2 -> IdPConfigStore.getIdPByIssuerV2Maybe newIssuer teamId ) @@ -681,7 +682,7 @@ validateIdPUpdate zusr _idpMetadata _idpId = withDebugLog "validateIdPUpdate" (J ) if idpIssuerInUse then throwSparSem SparIdPIssuerInUse - else pure $ previousIdP ^. SAML.idpExtraInfo & wiOldIssuers %~ nub . (previousIssuer :) + else pure $ previousIdP ^. SAML.idpExtraInfo & oldIssuers %~ nub . (previousIssuer :) let requri = _idpMetadata ^. SAML.edRequestURI enforceHttps requri @@ -712,7 +713,7 @@ authorizeIdP :: Sem r (UserId, TeamId) authorizeIdP Nothing _ = throw (SAML.CustomError $ SparNoPermission (cs $ show CreateUpdateDeleteIdp)) authorizeIdP (Just zusr) idp = do - let teamid = idp ^. SAML.idpExtraInfo . wiTeam + let teamid = idp ^. SAML.idpExtraInfo . team GalleyAccess.assertHasPermission teamid CreateUpdateDeleteIdp zusr pure (zusr, teamid) @@ -736,8 +737,8 @@ internalDeleteTeam :: ) => TeamId -> Sem r NoContent -internalDeleteTeam team = do - deleteTeam team +internalDeleteTeam teamId = do + deleteTeam teamId pure NoContent internalPutSsoSettings :: diff --git a/services/spar/src/Spar/App.hs b/services/spar/src/Spar/App.hs index 2dceac0b0eb..f32f221433d 100644 --- a/services/spar/src/Spar/App.hs +++ b/services/spar/src/Spar/App.hs @@ -205,18 +205,18 @@ autoprovisionSamlUser :: autoprovisionSamlUser idp buid suid = do guardReplacedIdP guardScimTokens - createSamlUserWithId (idp ^. idpExtraInfo . wiTeam) buid suid defaultRole + createSamlUserWithId (idp ^. idpExtraInfo . team) buid suid defaultRole where -- Replaced IdPs are not allowed to create new wire accounts. guardReplacedIdP :: Sem r () guardReplacedIdP = do - unless (isNothing $ idp ^. idpExtraInfo . wiReplacedBy) $ do + unless (isNothing $ idp ^. idpExtraInfo . replacedBy) $ do throwSparSem $ SparCannotCreateUsersOnReplacedIdP (cs . SAML.idPIdToST $ idp ^. idpId) -- IdPs in teams with scim tokens are not allowed to auto-provision. guardScimTokens :: Sem r () guardScimTokens = do - let teamid = idp ^. idpExtraInfo . wiTeam + let teamid = idp ^. idpExtraInfo . team scimtoks <- ScimTokenStore.lookupByTeam teamid unless (null scimtoks) $ do throwSparSem SparSamlCredentialsNotFound @@ -361,7 +361,7 @@ getUserByUrefViaOldIssuerUnsafe idp (SAML.UserRef _ subject) = do where uref = SAML.UserRef oldIssuer subject - foldM tryFind Nothing (idp ^. idpExtraInfo . wiOldIssuers) + foldM tryFind Nothing (idp ^. idpExtraInfo . oldIssuers) -- | After a user has been found using 'findUserWithOldIssuer', update it everywhere so that -- the old IdP is not needed any more next time. @@ -397,18 +397,18 @@ verdictHandlerResultCore idp = \case pure $ VerifyHandlerDenied reasons SAML.AccessGranted uref -> do uid :: UserId <- do - let team = idp ^. idpExtraInfo . wiTeam + let team' = idp ^. idpExtraInfo . team err = SparUserRefInNoOrMultipleTeams . cs . show $ uref getUserByUrefUnsafe uref >>= \case Just usr -> do - if userTeam usr == Just team + if userTeam usr == Just team' then pure (userId usr) else throwSparSem err Nothing -> do getUserByUrefViaOldIssuerUnsafe idp uref >>= \case Just (olduref, usr) -> do let uid = userId usr - if userTeam usr == Just team + if userTeam usr == Just team' then moveUserToNewIssuer olduref uref uid >> pure uid else throwSparSem err Nothing -> do @@ -572,11 +572,11 @@ deleteTeam :: ) => TeamId -> Sem r () -deleteTeam team = do - ScimTokenStore.deleteByTeam team +deleteTeam team' = do + ScimTokenStore.deleteByTeam team' -- Since IdPs are not shared between teams, we can look at the set of IdPs -- used by the team, and remove everything related to those IdPs, too. - idps <- IdPConfigStore.getConfigsByTeam team + idps <- IdPConfigStore.getConfigsByTeam team' for_ idps $ \idp -> do let issuer = idp ^. SAML.idpMetadata . SAML.edIssuer SAMLUserStore.deleteByIssuer issuer diff --git a/services/spar/src/Spar/Run.hs b/services/spar/src/Spar/Run.hs index 8c6df422ab8..58681ad8974 100644 --- a/services/spar/src/Spar/Run.hs +++ b/services/spar/src/Spar/Run.hs @@ -28,7 +28,7 @@ module Spar.Run ) where -import Bilge +import qualified Bilge import Cassandra as Cas import qualified Cassandra.Schema as Cas import qualified Cassandra.Settings as Cas @@ -52,7 +52,7 @@ import Spar.Options import Spar.Orphans () import System.Logger.Class (Logger) import qualified System.Logger.Extended as Log -import Util.Options (casEndpoint, casFilterNodesByDatacentre, casKeyspace, epHost, epPort) +import Util.Options (endpoint, filterNodesByDatacentre, host, keyspace, port) import Wire.API.Routes.Version.Wai import Wire.Sem.Logger.TinyLog @@ -64,7 +64,7 @@ initCassandra opts lgr = do let cassOpts = cassandra opts connectString <- maybe - (Cas.initialContactsPlain (cassOpts ^. casEndpoint . epHost)) + (Cas.initialContactsPlain (cassOpts ^. endpoint . host)) (Cas.initialContactsDisco "cassandra_spar" . cs) (discoUrl opts) cas <- @@ -72,15 +72,15 @@ initCassandra opts lgr = do Cas.defSettings & Cas.setLogger (Cas.mkLogger (Log.clone (Just "cassandra.spar") lgr)) & Cas.setContacts (NE.head connectString) (NE.tail connectString) - & Cas.setPortNumber (fromIntegral $ cassOpts ^. casEndpoint . epPort) - & Cas.setKeyspace (Keyspace $ cassOpts ^. casKeyspace) + & Cas.setPortNumber (fromIntegral $ cassOpts ^. endpoint . port) + & Cas.setKeyspace (Keyspace $ cassOpts ^. keyspace) & Cas.setMaxConnections 4 & Cas.setMaxStreams 128 & Cas.setPoolStripes 4 & Cas.setSendTimeout 3 & Cas.setResponseTimeout 10 & Cas.setProtocolVersion V4 - & Cas.setPolicy (Cas.dcFilterPolicyIfConfigured lgr (cassOpts ^. casFilterNodesByDatacentre)) + & Cas.setPolicy (Cas.dcFilterPolicyIfConfigured lgr (cassOpts ^. filterNodesByDatacentre)) runClient cas $ Cas.versionCheck Data.schemaVersion pure cas @@ -104,14 +104,14 @@ mkApp sparCtxOpts = do let logLevel = samlToLevel $ saml sparCtxOpts ^. SAML.cfgLogLevel sparCtxLogger <- Log.mkLogger logLevel (logNetStrings sparCtxOpts) (logFormat sparCtxOpts) sparCtxCas <- initCassandra sparCtxOpts sparCtxLogger - sparCtxHttpManager <- newManager defaultManagerSettings + sparCtxHttpManager <- Bilge.newManager Bilge.defaultManagerSettings let sparCtxHttpBrig = - Bilge.host (sparCtxOpts ^. to brig . epHost . to cs) - . Bilge.port (sparCtxOpts ^. to brig . epPort) + Bilge.host (sparCtxOpts ^. to brig . host . to cs) + . Bilge.port (sparCtxOpts ^. to brig . port) $ Bilge.empty let sparCtxHttpGalley = - Bilge.host (sparCtxOpts ^. to galley . epHost . to cs) - . Bilge.port (sparCtxOpts ^. to galley . epPort) + Bilge.host (sparCtxOpts ^. to galley . host . to cs) + . Bilge.port (sparCtxOpts ^. to galley . port) $ Bilge.empty let wrappedApp = versionMiddleware (fold (disabledAPIVersions sparCtxOpts)) @@ -131,9 +131,9 @@ mkApp sparCtxOpts = do if Wai.requestMethod req == "POST" && Wai.pathInfo req == ["sso", "finalize-login"] then Just out else Nothing - pure (wrappedApp, let sparCtxRequestId = RequestId "N/A" in Env {..}) + pure (wrappedApp, let sparCtxRequestId = Bilge.RequestId "N/A" in Env {..}) -lookupRequestIdMiddleware :: (RequestId -> Application) -> Application +lookupRequestIdMiddleware :: (Bilge.RequestId -> Application) -> Application lookupRequestIdMiddleware mkapp req cont = do - let reqid = maybe def RequestId $ lookupRequestId req + let reqid = maybe def Bilge.RequestId $ lookupRequestId req mkapp reqid req cont diff --git a/services/spar/src/Spar/Sem/IdPConfigStore/Cassandra.hs b/services/spar/src/Spar/Sem/IdPConfigStore/Cassandra.hs index 30c985dd9df..56f60c6c4f3 100644 --- a/services/spar/src/Spar/Sem/IdPConfigStore/Cassandra.hs +++ b/services/spar/src/Spar/Sem/IdPConfigStore/Cassandra.hs @@ -38,7 +38,8 @@ import Spar.Data.Instances () import Spar.Error import Spar.Sem.IdPConfigStore (IdPConfigStore (..), Replaced (..), Replacing (..)) import URI.ByteString -import Wire.API.User.IdentityProvider +import Wire.API.User.IdentityProvider hiding (apiVersion, oldIssuers, replacedBy, team) +import qualified Wire.API.User.IdentityProvider as IP idPToCassandra :: forall m r a. @@ -59,8 +60,8 @@ idPToCassandra = DeleteConfig idp -> let idpid = idp ^. SAML.idpId issuer = idp ^. SAML.idpMetadata . SAML.edIssuer - team = idp ^. SAML.idpExtraInfo . wiTeam - in embed @m $ deleteIdPConfig idpid issuer team + team' = idp ^. SAML.idpExtraInfo . IP.team + in embed @m $ deleteIdPConfig idpid issuer team' SetReplacedBy r r11 -> embed @m $ setReplacedBy r r11 ClearReplacedBy r -> embed @m $ clearReplacedBy r DeleteIssuer i t -> embed @m $ deleteIssuer i t @@ -85,32 +86,32 @@ insertIdPConfig idp = do NL.head (idp ^. SAML.idpMetadata . SAML.edCertAuthnResponse), NL.tail (idp ^. SAML.idpMetadata . SAML.edCertAuthnResponse), -- (the 'List1' is split up into head and tail to make migration from one-element-only easier.) - idp ^. SAML.idpExtraInfo . wiTeam, - idp ^. SAML.idpExtraInfo . wiApiVersion, - idp ^. SAML.idpExtraInfo . wiOldIssuers, - idp ^. SAML.idpExtraInfo . wiReplacedBy, - Just (unIdPHandle $ idp ^. SAML.idpExtraInfo . wiHandle) + idp ^. SAML.idpExtraInfo . IP.team, + idp ^. SAML.idpExtraInfo . IP.apiVersion, + idp ^. SAML.idpExtraInfo . IP.oldIssuers, + idp ^. SAML.idpExtraInfo . IP.replacedBy, + Just (unIdPHandle $ idp ^. SAML.idpExtraInfo . handle) ) addPrepQuery byIssuer ( idp ^. SAML.idpMetadata . SAML.edIssuer, - idp ^. SAML.idpExtraInfo . wiTeam, + idp ^. SAML.idpExtraInfo . IP.team, idp ^. SAML.idpId ) addPrepQuery byTeam ( idp ^. SAML.idpId, - idp ^. SAML.idpExtraInfo . wiTeam + idp ^. SAML.idpExtraInfo . IP.team ) where ensureDoNotMixApiVersions :: m () ensureDoNotMixApiVersions = do - let thisVersion = fromMaybe defWireIdPAPIVersion $ idp ^. SAML.idpExtraInfo . wiApiVersion + let thisVersion = fromMaybe defWireIdPAPIVersion $ idp ^. SAML.idpExtraInfo . IP.apiVersion issuer = idp ^. SAML.idpMetadata . SAML.edIssuer failIfNot :: WireIdPAPIVersion -> IdP -> m () failIfNot expectedVersion idp' = do - let actualVersion = fromMaybe defWireIdPAPIVersion $ idp' ^. SAML.idpExtraInfo . wiApiVersion + let actualVersion = fromMaybe defWireIdPAPIVersion $ idp' ^. SAML.idpExtraInfo . IP.apiVersion unless (actualVersion == expectedVersion) $ throwError InsertIdPConfigCannotMixApiVersions @@ -144,10 +145,10 @@ newUniqueHandle = newUniqueHandle' 1 where newUniqueHandle' :: Int -> [Text] -> Text newUniqueHandle' n handles = - let handle = "IdP " <> pack (show n) - in if handle `elem` handles + let handle' = "IdP " <> pack (show n) + in if handle' `elem` handles then newUniqueHandle' (n + 1) handles - else handle + else handle' getIdPConfig :: forall m. @@ -293,7 +294,7 @@ doNotMixApiVersions :: IdP -> m () doNotMixApiVersions expectVersion idp = do - let actualVersion = fromMaybe defWireIdPAPIVersion (idp ^. SAML.idpExtraInfo . wiApiVersion) + let actualVersion = fromMaybe defWireIdPAPIVersion (idp ^. SAML.idpExtraInfo . IP.apiVersion) unless (actualVersion == expectVersion) $ do throwError $ case expectVersion of WireIdPAPIV1 -> AttemptToGetV1IssuerViaV2API diff --git a/services/spar/src/Spar/Sem/IdPConfigStore/Mem.hs b/services/spar/src/Spar/Sem/IdPConfigStore/Mem.hs index 2c3a5ad0b02..a7f0ff7c4fb 100644 --- a/services/spar/src/Spar/Sem/IdPConfigStore/Mem.hs +++ b/services/spar/src/Spar/Sem/IdPConfigStore/Mem.hs @@ -75,7 +75,7 @@ insertConfig iw = . M.filter ( \iw' -> (iw' ^. SAML.idpMetadata . SAML.edIssuer /= iw ^. SAML.idpMetadata . SAML.edIssuer) - || (iw' ^. SAML.idpExtraInfo . IP.wiTeam /= iw ^. SAML.idpExtraInfo . IP.wiTeam) + || (iw' ^. SAML.idpExtraInfo . IP.team /= iw ^. SAML.idpExtraInfo . IP.team) ) getConfig :: SAML.IdPId -> TypedState -> IP.IdP @@ -106,14 +106,14 @@ getIdByIssuerWithTeamMaybe iss team mp = fl :: IP.IdP -> Bool fl idp = idp ^. SAML.idpMetadata . SAML.edIssuer == iss - && idp ^. SAML.idpExtraInfo . IP.wiTeam == team + && idp ^. SAML.idpExtraInfo . IP.team == team getConfigsByTeam :: TeamId -> TypedState -> [IP.IdP] getConfigsByTeam team = filter fl . M.elems where fl :: IP.IdP -> Bool - fl idp = idp ^. SAML.idpExtraInfo . IP.wiTeam == team + fl idp = idp ^. SAML.idpExtraInfo . IP.team == team deleteConfig :: IP.IdP -> TypedState -> TypedState deleteConfig idp = @@ -126,7 +126,7 @@ updateReplacedBy :: Maybe SAML.IdPId -> SAML.IdPId -> IP.IdP -> IP.IdP updateReplacedBy mbReplacing replaced idp = idp & if idp ^. SAML.idpId == replaced - then SAML.idpExtraInfo . IP.wiReplacedBy .~ mbReplacing + then SAML.idpExtraInfo . IP.replacedBy .~ mbReplacing else id deleteIssuer :: SAML.Issuer -> TypedState -> TypedState diff --git a/services/spar/test-integration/Test/Spar/APISpec.hs b/services/spar/test-integration/Test/Spar/APISpec.hs index 3ec850ab8c6..2da4aea9ea1 100644 --- a/services/spar/test-integration/Test/Spar/APISpec.hs +++ b/services/spar/test-integration/Test/Spar/APISpec.hs @@ -258,12 +258,12 @@ specFinalizeLogin = do context "happy flow" $ do it "responds with a very peculiar 'allowed' HTTP response" $ do env <- ask - let apiVersion = env ^. teWireIdPAPIVersion + let apiVer = env ^. teWireIdPAPIVersion (_, tid, idp, (_, privcreds)) <- registerTestIdPWithMeta - liftIO $ fromMaybe defWireIdPAPIVersion (idp ^. idpExtraInfo . wiApiVersion) `shouldBe` apiVersion + liftIO $ fromMaybe defWireIdPAPIVersion (idp ^. idpExtraInfo . apiVersion) `shouldBe` apiVer spmeta <- getTestSPMetadata tid authnreq <- negotiateAuthnRequest idp - let audiencePath = case apiVersion of + let audiencePath = case apiVer of WireIdPAPIV1 -> "/sso/finalize-login" WireIdPAPIV2 -> "/sso/finalize-login/" <> toByteString' tid liftIO $ authnreq ^. rqIssuer . fromIssuer . to URI.uriPath `shouldBe` audiencePath @@ -621,7 +621,7 @@ specCRUDIdentityProvider = do (owner :: UserId, _teamid :: TeamId) <- call $ createUserWithTeam (env ^. teBrig) (env ^. teGalley) callIdpGetAll (env ^. teSpar) (Just owner) - `shouldRespondWith` (null . _idplProviders) + `shouldRespondWith` (null . _providers) context "some idps are registered" $ do context "client is team owner with email" $ do it "returns a non-empty empty list" $ do @@ -629,7 +629,7 @@ specCRUDIdentityProvider = do (SampleIdP metadata _ _ _) <- makeSampleIdPMetadata (owner, _, _) <- registerTestIdPFrom metadata (env ^. teMgr) (env ^. teBrig) (env ^. teGalley) (env ^. teSpar) callIdpGetAll (env ^. teSpar) (Just owner) - `shouldRespondWith` (not . null . _idplProviders) + `shouldRespondWith` (not . null . _providers) context "client is team owner without email" $ do it "returns a non-empty empty list" $ do env <- ask @@ -637,7 +637,7 @@ specCRUDIdentityProvider = do (firstOwner, tid, idp) <- registerTestIdPFrom metadata (env ^. teMgr) (env ^. teBrig) (env ^. teGalley) (env ^. teSpar) ssoOwner <- mkSsoOwner firstOwner tid idp privcreds callIdpGetAll (env ^. teSpar) (Just ssoOwner) - `shouldRespondWith` (not . null . _idplProviders) + `shouldRespondWith` (not . null . _providers) describe "DELETE /identity-providers/:idp" $ do testGetPutDelete (\o t i _ -> callIdpDelete' o t i) context "zuser has wrong team" $ do @@ -722,12 +722,12 @@ specCRUDIdentityProvider = do (SampleIdP metadata _ _ _) <- makeSampleIdPMetadata idp <- call $ callIdpCreate (env ^. teWireIdPAPIVersion) (env ^. teSpar) (Just owner) metadata callIdpGet (env ^. teSpar) (Just owner) (idp ^. idpId) - `shouldRespondWith` ((== IdPHandle "IdP 1") . (\idp' -> idp' ^. (SAML.idpExtraInfo . wiHandle))) + `shouldRespondWith` ((== IdPHandle "IdP 1") . (\idp' -> idp' ^. (SAML.idpExtraInfo . handle))) let expected = IdPHandle "kukku mukku" callIdpUpdateWithHandle (env ^. teSpar) (Just owner) (idp ^. idpId) (IdPMetadataValue (cs $ SAML.encode metadata) undefined) expected `shouldRespondWith` ((== 200) . statusCode) callIdpGet (env ^. teSpar) (Just owner) (idp ^. idpId) - `shouldRespondWith` ((== expected) . (\idp' -> idp' ^. (SAML.idpExtraInfo . wiHandle))) + `shouldRespondWith` ((== expected) . (\idp' -> idp' ^. (SAML.idpExtraInfo . handle))) it "updates IdP metadata and creates a new IdP with the first metadata" $ do env <- ask (owner, _) <- call $ createUserWithTeam (env ^. teBrig) (env ^. teGalley) @@ -785,8 +785,8 @@ specCRUDIdentityProvider = do idp <- runSpar $ IdPEffect.getConfig idpid1 liftIO $ do (idp ^. idpMetadata . edIssuer) `shouldBe` (idpmeta1 ^. edIssuer) - (idp ^. idpExtraInfo . wiOldIssuers) `shouldBe` [] - (idp ^. idpExtraInfo . wiReplacedBy) `shouldBe` Nothing + (idp ^. idpExtraInfo . oldIssuers) `shouldBe` [] + (idp ^. idpExtraInfo . replacedBy) `shouldBe` Nothing let -- change idp metadata (only issuer, to be precise), and look at new issuer and -- old issuers. @@ -798,8 +798,8 @@ specCRUDIdentityProvider = do idp <- runSpar $ IdPEffect.getConfig idpid1 liftIO $ do (idp ^. idpMetadata . edIssuer) `shouldBe` (new ^. edIssuer) - sort (idp ^. idpExtraInfo . wiOldIssuers) `shouldBe` sort (olds <&> (^. edIssuer)) - (idp ^. idpExtraInfo . wiReplacedBy) `shouldBe` Nothing + sort (idp ^. idpExtraInfo . oldIssuers) `shouldBe` sort (olds <&> (^. edIssuer)) + (idp ^. idpExtraInfo . replacedBy) `shouldBe` Nothing -- update the name a few times, ending up with the original one. change idpmeta1' [idpmeta1] @@ -819,7 +819,7 @@ specCRUDIdentityProvider = do liftIO $ do statusCode resp `shouldBe` 200 idp ^. idpMetadata . edIssuer `shouldBe` issuer2 - idp ^. idpExtraInfo . wiOldIssuers `shouldBe` [idpmeta1 ^. edIssuer] + idp ^. idpExtraInfo . oldIssuers `shouldBe` [idpmeta1 ^. edIssuer] it "migrates old users to new idp on their next login (auto-prov)" $ do env <- ask (owner1, _, idp1@((^. idpId) -> idpid1), (IdPMetadataValue _ idpmeta1, privkey1)) <- registerTestIdPWithMeta @@ -916,7 +916,7 @@ specCRUDIdentityProvider = do check :: HasCallStack => Bool -> Int -> String -> Either String () -> TestSpar () check useNewPrivKey expectedStatus expectedHtmlTitle expectedCookie = do (idp, oldPrivKey, newPrivKey) <- initidp - let tid = idp ^. idpExtraInfo . wiTeam + let tid = idp ^. idpExtraInfo . team env <- ask (_, authnreq) <- call $ callAuthnReq (env ^. teSpar) (idp ^. idpId) spmeta <- getTestSPMetadata tid @@ -1024,14 +1024,14 @@ specCRUDIdentityProvider = do liftIO $ do idp1 `shouldBe` idp1' idp2 `shouldBe` idp2' - (idp1 ^. (SAML.idpExtraInfo . wiHandle)) `shouldBe` IdPHandle "IdP 1" - (idp2 ^. (SAML.idpExtraInfo . wiHandle)) `shouldBe` IdPHandle "IdP 2" + (idp1 ^. (SAML.idpExtraInfo . handle)) `shouldBe` IdPHandle "IdP 1" + (idp2 ^. (SAML.idpExtraInfo . handle)) `shouldBe` IdPHandle "IdP 2" it "explicitly set handle on IdP create" $ do env <- ask (owner, _) <- call $ createUserWithTeam (env ^. teBrig) (env ^. teGalley) (SampleIdP metadata _ _ _) <- makeSampleIdPMetadata let expected = IdPHandle "kukku mukku" - actual <- (\idp -> idp ^. (SAML.idpExtraInfo . wiHandle)) <$> call (callIdpCreateWithHandle (env ^. teWireIdPAPIVersion) (env ^. teSpar) (Just owner) metadata expected) + actual <- (\idp -> idp ^. (SAML.idpExtraInfo . handle)) <$> call (callIdpCreateWithHandle (env ^. teWireIdPAPIVersion) (env ^. teSpar) (Just owner) metadata expected) liftIO $ actual `shouldBe` expected context "client is owner without email" $ do it "responds with 2xx; makes IdP available for GET /identity-providers/" $ do @@ -1065,22 +1065,22 @@ specCRUDIdentityProvider = do idp1' <- call $ callIdpGet (env ^. teSpar) (Just owner1) (idp1 ^. SAML.idpId) idp2' <- call $ callIdpGet (env ^. teSpar) (Just owner1) (idp2 ^. SAML.idpId) liftIO $ do - (idp1 & idpExtraInfo . wiReplacedBy .~ (idp1' ^. idpExtraInfo . wiReplacedBy)) `shouldBe` idp1' + (idp1 & idpExtraInfo . replacedBy .~ (idp1' ^. idpExtraInfo . replacedBy)) `shouldBe` idp1' idp2 `shouldBe` idp2' idp1 ^. idpMetadata . SAML.edIssuer `shouldBe` (idpmeta1 ^. SAML.edIssuer) idp2 ^. idpMetadata . SAML.edIssuer `shouldBe` issuer2 idp2 ^. idpId `shouldNotBe` idp1 ^. idpId - idp2 ^. idpExtraInfo . wiOldIssuers `shouldBe` [idpmeta1 ^. edIssuer] - idp1' ^. idpExtraInfo . wiReplacedBy `shouldBe` Just (idp2 ^. idpId) + idp2 ^. idpExtraInfo . oldIssuers `shouldBe` [idpmeta1 ^. edIssuer] + idp1' ^. idpExtraInfo . replacedBy `shouldBe` Just (idp2 ^. idpId) -- erase everything that is supposed to be different between idp1, idp2, and make -- sure the result is equal. let erase :: IdP -> IdP erase = (idpId .~ (idp1 ^. idpId)) . (idpMetadata . edIssuer .~ (idp1 ^. idpMetadata . edIssuer)) - . (idpExtraInfo . wiOldIssuers .~ (idp1 ^. idpExtraInfo . wiOldIssuers)) - . (idpExtraInfo . wiReplacedBy .~ (idp1 ^. idpExtraInfo . wiReplacedBy)) - . (idpExtraInfo . wiHandle .~ (idp1 ^. idpExtraInfo . wiHandle)) + . (idpExtraInfo . oldIssuers .~ (idp1 ^. idpExtraInfo . oldIssuers)) + . (idpExtraInfo . replacedBy .~ (idp1 ^. idpExtraInfo . replacedBy)) + . (idpExtraInfo . handle .~ (idp1 ^. idpExtraInfo . handle)) erase idp1 `shouldBe` erase idp2 it "users can still login on old idp as before" $ do env <- ask @@ -1211,7 +1211,7 @@ specDeleteCornerCases = describe "delete corner cases" $ do createViaSamlResp :: HasCallStack => IdP -> SignPrivCreds -> SAML.UserRef -> TestSpar ResponseLBS createViaSamlResp idp privCreds (SAML.UserRef _ subj) = do - let tid = idp ^. idpExtraInfo . wiTeam + let tid = idp ^. idpExtraInfo . team authnReq <- negotiateAuthnRequest idp spmeta <- getTestSPMetadata tid authnResp <- runSimpleSP $ mkAuthnResponseWithSubj subj privCreds idp spmeta authnReq True @@ -1297,7 +1297,7 @@ specScimAndSAML = do mkNameID subj (Just "https://federation.foobar.com/nidp/saml2/metadata") (Just "https://prod-nginz-https.wire.com/sso/finalize-login") Nothing authnreq <- negotiateAuthnRequest idp - spmeta <- getTestSPMetadata (idp ^. idpExtraInfo . wiTeam) + spmeta <- getTestSPMetadata (idp ^. idpExtraInfo . team) authnresp :: SignedAuthnResponse <- runSimpleSP $ mkAuthnResponseWithSubj subjectWithQualifier privcreds idp spmeta authnreq True ssoid <- getSsoidViaAuthResp authnresp @@ -1565,8 +1565,8 @@ specReAuthSsoUserWithPassword = if withIdp then do SampleIdP idpmeta _privkey _ _ <- makeSampleIdPMetadata - apiVersion <- view teWireIdPAPIVersion - idp <- call $ callIdpCreate apiVersion (env ^. teSpar) (Just owner) idpmeta + apiVer <- view teWireIdPAPIVersion + idp <- call $ callIdpCreate apiVer (env ^. teSpar) (Just owner) idpmeta pure $ Just (idp ^. idpId) else pure Nothing -- then user gets upgraded to scim with or without SAML diff --git a/services/spar/test-integration/Test/Spar/AppSpec.hs b/services/spar/test-integration/Test/Spar/AppSpec.hs index a0aa834dd0b..6009dd511e5 100644 --- a/services/spar/test-integration/Test/Spar/AppSpec.hs +++ b/services/spar/test-integration/Test/Spar/AppSpec.hs @@ -152,7 +152,7 @@ requestAccessVerdict idp isGranted mkAuthnReq = do raw <- mkAuthnReq (idp ^. SAML.idpId) bdy <- maybe (error "authreq") pure $ responseBody raw either (error . show) pure $ Servant.mimeUnrender (Servant.Proxy @SAML.HTML) bdy - spmeta <- getTestSPMetadata (idp ^. idpExtraInfo . User.wiTeam) + spmeta <- getTestSPMetadata (idp ^. idpExtraInfo . User.team) (privKey, _, _) <- DSig.mkSignCredsWithCert Nothing 96 authnresp :: SAML.AuthnResponse <- do case authnreq of diff --git a/services/spar/test-integration/Test/Spar/DataSpec.hs b/services/spar/test-integration/Test/Spar/DataSpec.hs index 46f7fe88e64..b81715f6f89 100644 --- a/services/spar/test-integration/Test/Spar/DataSpec.hs +++ b/services/spar/test-integration/Test/Spar/DataSpec.hs @@ -154,7 +154,7 @@ spec = do it "getIdPByIssuer works" $ do idp <- makeTestIdP () <- runSpar $ IdPEffect.insertConfig idp - midp <- getIdPByIssuer (idp ^. idpMetadata . edIssuer) (idp ^. SAML.idpExtraInfo . wiTeam) + midp <- getIdPByIssuer (idp ^. idpMetadata . edIssuer) (idp ^. SAML.idpExtraInfo . team) liftIO $ midp `shouldBe` Just idp it "getIdPConfigsByTeam works" $ do skipIdPAPIVersions [WireIdPAPIV1] @@ -176,10 +176,10 @@ spec = do idpOrError <- runSparE $ IdPEffect.getConfig (idp ^. idpId) liftIO $ idpOrError `shouldBe` Left (SAML.CustomError $ IdpDbError IdpNotFound) do - midp <- getIdPByIssuer (idp ^. idpMetadata . edIssuer) (idp ^. SAML.idpExtraInfo . wiTeam) + midp <- getIdPByIssuer (idp ^. idpMetadata . edIssuer) (idp ^. SAML.idpExtraInfo . team) liftIO $ midp `shouldBe` Nothing do - midp <- getIdPByIssuer (idp ^. idpMetadata . edIssuer) (idp ^. SAML.idpExtraInfo . wiTeam) + midp <- getIdPByIssuer (idp ^. idpMetadata . edIssuer) (idp ^. SAML.idpExtraInfo . team) liftIO $ midp `shouldBe` Nothing do idps <- runSpar $ IdPEffect.getConfigsByTeam teamid @@ -274,7 +274,7 @@ testDeleteTeam = it "cleans up all the right tables after deletion" $ do -- The config from 'issuer_idp': do let issuer = idp ^. SAML.idpMetadata . SAML.edIssuer - mbIdp <- getIdPByIssuer issuer (idp ^. SAML.idpExtraInfo . wiTeam) + mbIdp <- getIdPByIssuer issuer (idp ^. SAML.idpExtraInfo . team) liftIO $ mbIdp `shouldBe` Nothing -- The config from 'team_idp': do diff --git a/services/spar/test-integration/Test/Spar/Scim/UserSpec.hs b/services/spar/test-integration/Test/Spar/Scim/UserSpec.hs index fae49de6ac4..709a659088d 100644 --- a/services/spar/test-integration/Test/Spar/Scim/UserSpec.hs +++ b/services/spar/test-integration/Test/Spar/Scim/UserSpec.hs @@ -1057,7 +1057,7 @@ samlUserShouldSatisfy uref property = do createViaSamlResp :: HasCallStack => IdP -> SAML.SignPrivCreds -> SAML.UserRef -> TestSpar ResponseLBS createViaSamlResp idp privCreds (SAML.UserRef _ subj) = do authnReq <- negotiateAuthnRequest idp - let tid = idp ^. SAML.idpExtraInfo . User.wiTeam + let tid = idp ^. SAML.idpExtraInfo . User.team spmeta <- getTestSPMetadata tid authnResp <- runSimpleSP $ @@ -1135,7 +1135,7 @@ testCreateUserTimeout = do tryquery (filterBy "externalId" $ fromEmail email) waitUserExpiration = do - timeoutSecs <- view (teTstOpts . to cfgBrigSettingsTeamInvitationTimeout) + timeoutSecs <- view (teTstOpts . to brigSettingsTeamInvitationTimeout) Control.Exception.assert (timeoutSecs < 30) $ do threadDelay $ (timeoutSecs + 1) * 1_000_000 diff --git a/services/spar/test-integration/Util/Core.hs b/services/spar/test-integration/Util/Core.hs index bc3342f6e79..2a13b750abf 100644 --- a/services/spar/test-integration/Util/Core.hs +++ b/services/spar/test-integration/Util/Core.hs @@ -139,7 +139,7 @@ module Util.Core ) where -import Bilge hiding (getCookie) -- we use Web.Cookie instead of the http-client type +import Bilge hiding (getCookie, host, port) -- we use Web.Cookie instead of the http-client type import qualified Bilge import Bilge.Assert (Assertions, (!!!), ( -- would be a good place to look for code to steal. mkEnv :: HasCallStack => IntegrationConfig -> Opts -> IO TestEnv -mkEnv _teTstOpts _teOpts = do - _teMgr :: Manager <- newManager defaultManagerSettings - sparCtxLogger <- Log.mkLogger (samlToLevel $ saml _teOpts ^. SAML.cfgLogLevel) (logNetStrings _teOpts) (logFormat _teOpts) - _teCql :: ClientState <- initCassandra _teOpts sparCtxLogger - let _teBrig = endpointToReq (cfgBrig _teTstOpts) - _teGalley = endpointToReq (cfgGalley _teTstOpts) - _teSpar = endpointToReq (cfgSpar _teTstOpts) - _teSparEnv = Spar.Env {..} - _teWireIdPAPIVersion = WireIdPAPIV2 - sparCtxOpts = _teOpts - sparCtxCas = _teCql - sparCtxHttpManager = _teMgr - sparCtxHttpBrig = _teBrig empty - sparCtxHttpGalley = _teGalley empty +mkEnv tstOpts opts = do + mgr :: Manager <- newManager defaultManagerSettings + sparCtxLogger <- Log.mkLogger (samlToLevel $ saml opts ^. SAML.cfgLogLevel) (logNetStrings opts) (logFormat opts) + cql :: ClientState <- initCassandra opts sparCtxLogger + let brig = endpointToReq tstOpts.brig + galley = endpointToReq tstOpts.galley + spar = endpointToReq tstOpts.spar + sparEnv = Spar.Env {..} + wireIdPAPIVersion = WireIdPAPIV2 + sparCtxOpts = opts + sparCtxCas = cql + sparCtxHttpManager = mgr + sparCtxHttpBrig = brig empty + sparCtxHttpGalley = galley empty sparCtxRequestId = RequestId "" - pure TestEnv {..} + pure $ + TestEnv + mgr + cql + brig + galley + spar + sparEnv + opts + tstOpts + wireIdPAPIVersion destroyEnv :: HasCallStack => TestEnv -> IO () destroyEnv _ = pure () @@ -377,9 +387,9 @@ createUserWithTeamDisableSSO brg gly = do ] bdy <- selfUser . responseJsonUnsafe <$> post (brg . path "/i/users" . contentJson . body p) let (uid, Just tid) = (userId bdy, userTeam bdy) - (team : _) <- (^. Galley.teamListTeams) <$> getTeams uid gly + (team' : _) <- (^. Galley.teamListTeams) <$> getTeams uid gly () <- - Control.Exception.assert {- "Team ID in registration and team table do not match" -} (tid == team ^. Galley.teamId) $ + Control.Exception.assert {- "Team ID in registration and team table do not match" -} (tid == team' ^. Galley.teamId) $ pure () selfTeam <- userTeam . selfUser <$> getSelfProfile brg uid () <- @@ -728,22 +738,22 @@ zConn :: ByteString -> Request -> Request zConn = header "Z-Connection" endpointToReq :: Endpoint -> (Bilge.Request -> Bilge.Request) -endpointToReq ep = Bilge.host (ep ^. epHost . to cs) . Bilge.port (ep ^. epPort) +endpointToReq ep = Bilge.host (ep ^. host . to cs) . Bilge.port (ep ^. port) endpointToSettings :: Endpoint -> Warp.Settings -endpointToSettings endpoint = +endpointToSettings ep = Warp.defaultSettings - { Warp.settingsHost = Imports.fromString . cs $ endpoint ^. epHost, - Warp.settingsPort = fromIntegral $ endpoint ^. epPort + { Warp.settingsHost = Imports.fromString . cs $ ep ^. host, + Warp.settingsPort = fromIntegral $ ep ^. port } endpointToURL :: MonadIO m => Endpoint -> Text -> m URI -endpointToURL endpoint urlpath = either err pure url +endpointToURL ep urlpath = either err pure url where url = parseURI' ("http://" <> urlhost <> ":" <> urlport) <&> (=/ urlpath) - urlhost = cs $ endpoint ^. epHost - urlport = cs . show $ endpoint ^. epPort - err = liftIO . throwIO . ErrorCall . show . (,(endpoint, url)) + urlhost = cs $ ep ^. host + urlport = cs . show $ ep ^. port + err = liftIO . throwIO . ErrorCall . show . (,(ep, url)) -- spar specifics @@ -821,10 +831,10 @@ registerTestIdPFrom :: SparReq -> m (UserId, TeamId, IdP) registerTestIdPFrom metadata mgr brig galley spar = do - apiVersion <- view teWireIdPAPIVersion + apiVer <- view teWireIdPAPIVersion liftIO . runHttpT mgr $ do (uid, tid) <- createUserWithTeam brig galley - (uid,tid,) <$> callIdpCreate apiVersion spar (Just uid) metadata + (uid,tid,) <$> callIdpCreate apiVer spar (Just uid) metadata getCookie :: KnownSymbol name => proxy name -> ResponseLBS -> Either String (SAML.SimpleSetCookie name) getCookie proxy rsp = do @@ -850,7 +860,7 @@ hasPersistentCookieHeader rsp = do tryLogin :: HasCallStack => SignPrivCreds -> IdP -> NameID -> TestSpar SAML.UserRef tryLogin privkey idp userSubject = do env <- ask - let tid = idp ^. idpExtraInfo . wiTeam + let tid = idp ^. idpExtraInfo . team spmeta <- getTestSPMetadata tid (_, authnreq) <- call $ callAuthnReq (env ^. teSpar) (idp ^. SAML.idpId) idpresp <- runSimpleSP $ mkAuthnResponseWithSubj userSubject privkey idp spmeta authnreq True @@ -865,7 +875,7 @@ tryLogin privkey idp userSubject = do tryLoginFail :: HasCallStack => SignPrivCreds -> IdP -> NameID -> String -> TestSpar () tryLoginFail privkey idp userSubject bodyShouldContain = do env <- ask - let tid = idp ^. idpExtraInfo . wiTeam + let tid = idp ^. idpExtraInfo . team spmeta <- getTestSPMetadata tid (_, authnreq) <- call $ callAuthnReq (env ^. teSpar) (idp ^. SAML.idpId) idpresp <- runSimpleSP $ mkAuthnResponseWithSubj userSubject privkey idp spmeta authnreq True @@ -946,7 +956,7 @@ loginCreatedSsoUser :: m (UserId, Cookie) loginCreatedSsoUser nameid idp privCreds = do env <- ask - let tid = idp ^. idpExtraInfo . wiTeam + let tid = idp ^. idpExtraInfo . team authnReq <- negotiateAuthnRequest idp spmeta <- getTestSPMetadata tid authnResp <- runSimpleSP $ mkAuthnResponseWithSubj nameid privCreds idp spmeta authnReq True diff --git a/services/spar/test-integration/Util/Scim.hs b/services/spar/test-integration/Util/Scim.hs index e070ff6b7e7..ef714ed42e3 100644 --- a/services/spar/test-integration/Util/Scim.hs +++ b/services/spar/test-integration/Util/Scim.hs @@ -62,7 +62,7 @@ import qualified Web.Scim.Schema.User.Phone as Phone import qualified Wire.API.Team.Member as Member import Wire.API.Team.Role (Role, defaultRole) import Wire.API.User -import Wire.API.User.IdentityProvider +import Wire.API.User.IdentityProvider hiding (team) import Wire.API.User.RichInfo import Wire.API.User.Scim diff --git a/services/spar/test-integration/Util/Types.hs b/services/spar/test-integration/Util/Types.hs index ecdf4db4aff..777470f2bb2 100644 --- a/services/spar/test-integration/Util/Types.hs +++ b/services/spar/test-integration/Util/Types.hs @@ -50,7 +50,6 @@ import Data.Aeson import qualified Data.Aeson as Aeson import Data.Aeson.TH import Imports -import SAML2.WebSSO.Types.TH (deriveJSONOptions) import Spar.API () import qualified Spar.App as Spar import Spar.Options @@ -93,14 +92,14 @@ data TestEnv = TestEnv type Select = TestEnv -> (Request -> Request) data IntegrationConfig = IntegrationConfig - { cfgBrig :: Endpoint, - cfgGalley :: Endpoint, - cfgSpar :: Endpoint, - cfgBrigSettingsTeamInvitationTimeout :: Int + { brig :: Endpoint, + galley :: Endpoint, + spar :: Endpoint, + brigSettingsTeamInvitationTimeout :: Int } deriving (Show, Generic) -deriveFromJSON deriveJSONOptions ''IntegrationConfig +deriveFromJSON Aeson.defaultOptions ''IntegrationConfig makeLenses ''TestEnv diff --git a/services/spar/test/Arbitrary.hs b/services/spar/test/Arbitrary.hs index 7480a1fcdc0..d8b2daf6839 100644 --- a/services/spar/test/Arbitrary.hs +++ b/services/spar/test/Arbitrary.hs @@ -1,5 +1,4 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} -{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeSynonymInstances #-} {-# OPTIONS_GHC -Wno-orphans #-} {-# OPTIONS_GHC -Wno-redundant-constraints #-} @@ -39,9 +38,7 @@ import Wire.API.User.IdentityProvider import Wire.API.User.Saml instance Arbitrary IdPList where - arbitrary = do - _idplProviders <- arbitrary - pure $ IdPList {..} + arbitrary = IdPList <$> arbitrary instance Arbitrary WireIdP where arbitrary = WireIdP <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary diff --git a/tools/stern/src/Stern/API.hs b/tools/stern/src/Stern/API.hs index 4da3fe838dd..fda4370e032 100644 --- a/tools/stern/src/Stern/API.hs +++ b/tools/stern/src/Stern/API.hs @@ -78,7 +78,7 @@ start o = do Server.runSettingsWithShutdown s (servantApp e) Nothing where server :: Env -> Server.Server - server e = Server.defaultServer (unpack $ stern o ^. epHost) (stern o ^. epPort) (e ^. applog) (e ^. metrics) + server e = Server.defaultServer (unpack $ stern o ^. host) (stern o ^. port) (e ^. applog) (e ^. metrics) servantApp :: Env -> Application servantApp e = diff --git a/tools/stern/src/Stern/App.hs b/tools/stern/src/Stern/App.hs index a2fb31b6ba9..1e4a1f2bfde 100644 --- a/tools/stern/src/Stern/App.hs +++ b/tools/stern/src/Stern/App.hs @@ -74,7 +74,7 @@ newEnv o = do Env (mkRequest $ O.brig o) (mkRequest $ O.galley o) (mkRequest $ O.gundeck o) (mkRequest $ O.ibis o) (mkRequest $ O.galeb o) l mt def <$> newManager where - mkRequest s = Bilge.host (encodeUtf8 (s ^. epHost)) . Bilge.port (s ^. epPort) $ Bilge.empty + mkRequest s = Bilge.host (encodeUtf8 (s ^. host)) . Bilge.port (s ^. port) $ Bilge.empty newManager = Bilge.newManager (Bilge.defaultManagerSettings {Bilge.managerResponseTimeout = responseTimeoutMicro 10000000}) -- Monads diff --git a/tools/stern/src/Stern/Types.hs b/tools/stern/src/Stern/Types.hs index aa3e9af280a..b62994c943d 100644 --- a/tools/stern/src/Stern/Types.hs +++ b/tools/stern/src/Stern/Types.hs @@ -141,8 +141,8 @@ newtype MarketoResult = MarketoResult deriving (Eq, Show, ToJSON, FromJSON) data ConsentLogAndMarketo = ConsentLogAndMarketo - { clamConsentLog :: ConsentLog, - clamMarketo :: MarketoResult + { consentLog :: ConsentLog, + marketo :: MarketoResult } deriving (Eq, Show) diff --git a/tools/stern/test/integration/Main.hs b/tools/stern/test/integration/Main.hs index 08fb5b41e07..6c95115b870 100644 --- a/tools/stern/test/integration/Main.hs +++ b/tools/stern/test/integration/Main.hs @@ -36,7 +36,7 @@ import System.Logger qualified as Logger import Test.Tasty import Test.Tasty.Options import TestSetup -import Util.Options +import Util.Options (Endpoint (Endpoint)) import Util.Test data IntegrationConfig = IntegrationConfig