├── .github ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── ci-integration-tests.yml │ ├── ci-unit-tests.yml │ └── nightly.yml ├── .gitignore ├── AUTHORS.rst ├── CHANGES.md ├── CONTRIBUTING.md ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── MatrixSDK.podspec ├── MatrixSDK.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ ├── IDETemplateMacros.plist │ └── xcschemes │ ├── MatrixSDK-iOS.xcscheme │ └── MatrixSDK-macOS.xcscheme ├── MatrixSDK ├── Aggregations │ ├── Data │ │ ├── MXAggregatedReactions.h │ │ ├── MXAggregatedReactions.m │ │ ├── MXEventEditsListener.h │ │ ├── MXEventEditsListener.m │ │ ├── MXReactionCount.h │ │ ├── MXReactionCount.m │ │ ├── MXReactionCountChange.h │ │ ├── MXReactionCountChange.m │ │ ├── MXReactionCountChangeListener.h │ │ ├── MXReactionCountChangeListener.m │ │ ├── MXReactionOperation.h │ │ ├── MXReactionOperation.m │ │ ├── MXReactionRelation.h │ │ ├── MXReactionRelation.m │ │ └── Store │ │ │ ├── MXAggregationsStore.h │ │ │ └── Realm │ │ │ ├── MXRealmAggregationsMapper.h │ │ │ ├── MXRealmAggregationsMapper.m │ │ │ ├── MXRealmAggregationsStore.h │ │ │ ├── MXRealmAggregationsStore.m │ │ │ ├── MXRealmReactionCount.h │ │ │ ├── MXRealmReactionCount.m │ │ │ ├── MXRealmReactionRelation.h │ │ │ └── MXRealmReactionRelation.m │ ├── LocationSharing │ │ ├── MXBeaconAggregations.swift │ │ ├── MXBeaconInfoSummaryAllRoomListener.swift │ │ ├── MXBeaconInfoSummaryDeletionAllRoomListener.swift │ │ ├── MXBeaconInfoSummaryDeletionPerRoomListener.swift │ │ ├── MXBeaconInfoSummaryPerRoomListener.swift │ │ └── Store │ │ │ ├── MXBeaconInfoSummaryMemoryStore.swift │ │ │ ├── MXBeaconInfoSummaryStoreProtocol.swift │ │ │ └── Realm │ │ │ ├── MXBeaconInfoSummaryRealmStore.swift │ │ │ ├── MXRealmBeacon.swift │ │ │ ├── MXRealmBeaconInfo.swift │ │ │ ├── MXRealmBeaconInfoSummary.swift │ │ │ └── MXRealmBeaconMapper.swift │ ├── MXAggregatedEditsUpdater.h │ ├── MXAggregatedEditsUpdater.m │ ├── MXAggregatedPollsUpdater.swift │ ├── MXAggregatedReactionsUpdater.h │ ├── MXAggregatedReactionsUpdater.m │ ├── MXAggregatedReferencesUpdater.h │ ├── MXAggregatedReferencesUpdater.m │ ├── MXAggregations.h │ ├── MXAggregations.m │ └── MXAggregations_Private.h ├── Background │ ├── Crypto │ │ ├── MXBackgroundCrypto.swift │ │ └── MXBackgroundCryptoV2.swift │ ├── MXBackgroundPushRulesManager.swift │ ├── MXBackgroundStore.swift │ ├── MXBackgroundSyncService.swift │ ├── MXStopwatch.swift │ └── Store │ │ ├── MXSyncResponseStore.swift │ │ ├── MXSyncResponseStoreManager.swift │ │ ├── Model │ │ ├── MXCachedSyncResponse.h │ │ ├── MXCachedSyncResponse.m │ │ └── MXSyncResponseStoreMetaDataModel.swift │ │ └── SyncResponseFileStore │ │ └── MXSyncResponseFileStore.swift ├── Categories │ ├── MXEvent+Extensions.swift │ ├── MXKeysQueryResponse+Extensions.swift │ ├── MXRestClient+Extensions.swift │ ├── NSDictionary+MutableDeepCopy.h │ └── NSDictionary+MutableDeepCopy.m ├── ClientInformation │ └── MXClientInformationService.swift ├── ContentScan │ ├── Data │ │ ├── MXAntivirusScanStatus.h │ │ ├── MXAntivirusScanStatusFormatter.h │ │ ├── MXAntivirusScanStatusFormatter.m │ │ ├── MXContentScanEncryptedBody.h │ │ ├── MXContentScanEncryptedBody.m │ │ ├── MXEventScan.h │ │ ├── MXEventScan.m │ │ ├── MXMediaScan.h │ │ ├── MXMediaScan.m │ │ └── Store │ │ │ ├── MXEventScanStore.h │ │ │ ├── MXEventScanStoreDelegate.h │ │ │ ├── MXMediaScanStore.h │ │ │ ├── MXMediaScanStoreDelegate.h │ │ │ └── Realm │ │ │ ├── Event │ │ │ ├── MXRealmEventScan.h │ │ │ ├── MXRealmEventScan.m │ │ │ ├── MXRealmEventScanMapper.h │ │ │ ├── MXRealmEventScanMapper.m │ │ │ ├── MXRealmEventScanStore.h │ │ │ └── MXRealmEventScanStore.m │ │ │ ├── Media │ │ │ ├── MXRealmMediaScan.h │ │ │ ├── MXRealmMediaScan.m │ │ │ ├── MXRealmMediaScanMapper.h │ │ │ ├── MXRealmMediaScanMapper.m │ │ │ ├── MXRealmMediaScanStore.h │ │ │ └── MXRealmMediaScanStore.m │ │ │ └── RealmProvider │ │ │ ├── MXScanRealmFileProvider.h │ │ │ ├── MXScanRealmFileProvider.m │ │ │ ├── MXScanRealmInMemoryProvider.h │ │ │ ├── MXScanRealmInMemoryProvider.m │ │ │ └── MXScanRealmProvider.h │ ├── JSONModels │ │ ├── MXContentScanResult.h │ │ └── MXContentScanResult.m │ ├── MXScanManager.h │ ├── MXScanManager.m │ └── PKMessageWrapper.swift ├── Contrib │ └── Swift │ │ ├── Data │ │ ├── MX3PID.swift │ │ ├── MXEventTimeline.swift │ │ ├── MXRoom.swift │ │ ├── MXRoomState.swift │ │ └── MXSessionEventListener.swift │ │ ├── JSONModels │ │ ├── MXEvent.swift │ │ ├── MXJSONModels.swift │ │ └── MXRoomPowerLevels.swift │ │ ├── MXEnumConstants.swift │ │ ├── MXIdentityServerRestClient.swift │ │ ├── MXIdentityService.swift │ │ ├── MXImage.swift │ │ ├── MXResponse.swift │ │ ├── MXRestClient.swift │ │ ├── MXSession.swift │ │ └── ThreePidAdd │ │ └── MX3PidAddManager.swift ├── Crypto │ ├── Algorithms │ │ ├── MXDecryptionResult.h │ │ ├── MXDecryptionResult.m │ │ ├── MXEncrypting.h │ │ ├── MXEventDecryptionDecoration.swift │ │ ├── MXEventDecryptionResult.h │ │ ├── MXEventDecryptionResult.m │ │ └── RoomEvent │ │ │ ├── MXRoomEventDecryption.swift │ │ │ └── MXRoomEventEncryption.swift │ ├── CrossSigning │ │ ├── Data │ │ │ ├── MXCrossSigningInfo.h │ │ │ ├── MXCrossSigningInfo.m │ │ │ ├── MXCrossSigningInfo_Private.h │ │ │ └── MXCryptoUserIdentityWrapper.swift │ │ ├── JSONModels │ │ │ ├── MXCrossSigningKey.h │ │ │ └── MXCrossSigningKey.m │ │ ├── MXCrossSigning.h │ │ ├── MXCrossSigning.m │ │ ├── MXCrossSigningInfoSource.swift │ │ ├── MXCrossSigningTools.h │ │ ├── MXCrossSigningTools.m │ │ └── MXCrossSigningV2.swift │ ├── CryptoMachine │ │ ├── Extensions │ │ │ ├── EventEncryptionAlgorithm+String.swift │ │ │ ├── MXDeviceVerification+LocalTrust.swift │ │ │ ├── MXEventDecryptionResult+DecryptedEvent.swift │ │ │ └── MXRoomHistoryVisibility+HistoryVisibility.swift │ │ ├── MXCryptoMachine.swift │ │ ├── MXCryptoMachineStore.swift │ │ ├── MXCryptoProtocols.swift │ │ ├── MXCryptoRequests.swift │ │ ├── MXCryptoSDKLogger.swift │ │ └── MXKeysQueryScheduler.swift │ ├── Data │ │ ├── MXCryptoConstants.h │ │ ├── MXCryptoConstants.m │ │ ├── MXEncryptedAttachments.h │ │ ├── MXEncryptedAttachments.m │ │ ├── MXEncryptedContentFile.h │ │ ├── MXEncryptedContentFile.m │ │ ├── MXEncryptedContentKey.h │ │ ├── MXEncryptedContentKey.m │ │ ├── MXExportedOlmDevice.h │ │ ├── MXExportedOlmDevice.m │ │ ├── MXKey.h │ │ ├── MXKey.m │ │ ├── MXMegolmSessionData.h │ │ ├── MXMegolmSessionData.m │ │ ├── MXOlmSession.h │ │ ├── MXOlmSession.m │ │ ├── MXOlmSessionResult.h │ │ ├── MXOlmSessionResult.m │ │ ├── MXQueuedEncryption.h │ │ ├── MXQueuedEncryption.m │ │ ├── MXRoomSettings.swift │ │ ├── MXUsersDevicesMap.h │ │ ├── MXUsersDevicesMap.m │ │ └── Store │ │ │ ├── MXCryptoSecretStore.h │ │ │ └── MXCryptoVersion.h │ ├── Dehydration │ │ └── DehydrationService.swift │ ├── Devices │ │ ├── Data │ │ │ ├── MXCryptoDeviceWrapper.swift │ │ │ ├── MXDeviceInfo.h │ │ │ ├── MXDeviceInfo.m │ │ │ └── MXDeviceInfo_Private.h │ │ └── MXDeviceInfoSource.swift │ ├── KeyBackup │ │ ├── Data │ │ │ ├── Aes256 │ │ │ │ ├── MXAes256BackupAuthData.h │ │ │ │ └── MXAes256BackupAuthData.m │ │ │ ├── Curve25519 │ │ │ │ ├── MXCurve25519BackupAuthData.h │ │ │ │ └── MXCurve25519BackupAuthData.m │ │ │ ├── MXBaseKeyBackupAuthData.h │ │ │ ├── MXKeyBackupData.h │ │ │ ├── MXKeyBackupData.m │ │ │ ├── MXKeyBackupPreparationInfo.h │ │ │ ├── MXKeyBackupPreparationInfo.m │ │ │ ├── MXKeyBackupVersion.h │ │ │ ├── MXKeyBackupVersion.m │ │ │ ├── MXKeyBackupVersionTrust.h │ │ │ ├── MXKeyBackupVersionTrust.m │ │ │ ├── MXMegolmBackupCreationInfo.h │ │ │ └── MXMegolmBackupCreationInfo.m │ │ ├── Engine │ │ │ ├── MXCryptoKeyBackupEngine.swift │ │ │ ├── MXEncryptedKeyBackup.swift │ │ │ └── MXKeyBackupEngine.h │ │ ├── MXKeyBackup.h │ │ ├── MXKeyBackup.m │ │ ├── MXKeyBackupPassword.h │ │ ├── MXKeyBackupPassword.m │ │ ├── MXKeyBackup_Private.h │ │ ├── MXRecoveryKey.h │ │ └── MXRecoveryKey.m │ ├── KeyProvider │ │ ├── MXAesKeyData.h │ │ ├── MXAesKeyData.m │ │ ├── MXKeyData.h │ │ ├── MXKeyData.m │ │ ├── MXKeyProvider.h │ │ ├── MXKeyProvider.m │ │ ├── MXRawDataKey.h │ │ └── MXRawDataKey.m │ ├── KeySharing │ │ ├── Data │ │ │ ├── MXForwardedRoomKeyEventContent.h │ │ │ ├── MXForwardedRoomKeyEventContent.m │ │ │ ├── MXIncomingRoomKeyRequest.h │ │ │ ├── MXIncomingRoomKeyRequest.m │ │ │ ├── MXIncomingRoomKeyRequestCancellation.h │ │ │ ├── MXIncomingRoomKeyRequestCancellation.m │ │ │ ├── MXOutgoingRoomKeyRequest.h │ │ │ ├── MXOutgoingRoomKeyRequest.m │ │ │ ├── MXRoomKeyEventContent.h │ │ │ ├── MXRoomKeyEventContent.m │ │ │ └── MXSharedHistoryKeyRequest.swift │ │ ├── MXSharedHistoryKeyManager.swift │ │ ├── MXSharedHistoryKeyService.h │ │ ├── MXSharedHistoryKeyService.m │ │ ├── MXUnrequestedForwardedRoomKeyManager.swift │ │ └── Secret │ │ │ ├── Data │ │ │ ├── MXPendingSecretShareRequest.h │ │ │ └── MXPendingSecretShareRequest.m │ │ │ ├── JSONModels │ │ │ ├── MXSecretShareRequest.h │ │ │ ├── MXSecretShareRequest.m │ │ │ ├── MXSecretShareSend.h │ │ │ └── MXSecretShareSend.m │ │ │ ├── MXSecretShareManager.h │ │ │ └── MXSecretShareManager.m │ ├── MXCrypto.h │ ├── MXCrypto.m │ ├── MXCryptoV2.swift │ ├── MXCryptoV2Factory.swift │ ├── Recovery │ │ ├── Data │ │ │ ├── MXSecretRecoveryResult.h │ │ │ └── MXSecretRecoveryResult.m │ │ ├── MXRecoveryService.h │ │ ├── MXRecoveryService.m │ │ ├── MXRecoveryServiceDependencies.swift │ │ └── MXRecoveryService_Private.h │ ├── RoomKeys │ │ ├── MXRoomKeyInfo.swift │ │ └── MXRoomKeyResult.swift │ ├── SecretStorage │ │ ├── Data │ │ │ ├── MXSecretStorageKeyCreationInfo.h │ │ │ └── MXSecretStorageKeyCreationInfo.m │ │ ├── JSONModels │ │ │ ├── MXEncryptedSecretContent.h │ │ │ ├── MXEncryptedSecretContent.m │ │ │ ├── MXSecretStorageKeyContent.h │ │ │ ├── MXSecretStorageKeyContent.m │ │ │ ├── MXSecretStoragePassphrase.h │ │ │ └── MXSecretStoragePassphrase.m │ │ ├── MXCryptoSecretStoreV2.swift │ │ ├── MXSecretStorage.h │ │ ├── MXSecretStorage.m │ │ └── MXSecretStorage_Private.h │ ├── Trust │ │ ├── MXDeviceTrustLevel.h │ │ ├── MXDeviceTrustLevel.m │ │ ├── MXTrustLevelSource.swift │ │ ├── MXUserTrustLevel.h │ │ ├── MXUserTrustLevel.m │ │ ├── MXUsersTrustLevelSummary.h │ │ └── MXUsersTrustLevelSummary.m │ ├── Utils │ │ ├── MXAes.h │ │ ├── MXAes.m │ │ ├── MXAesHmacSha2.h │ │ ├── MXAesHmacSha2.m │ │ ├── MXCryptoTools.h │ │ ├── MXCryptoTools.m │ │ ├── MXHkdfSha256.h │ │ ├── MXHkdfSha256.m │ │ ├── MXMegolmExportEncryption.h │ │ └── MXMegolmExportEncryption.m │ └── Verification │ │ ├── Data │ │ ├── MXEmojiRepresentation.h │ │ ├── MXEmojiRepresentation.m │ │ ├── MXQRCodeData.h │ │ ├── MXQRCodeData.m │ │ ├── MXQRCodeDataBuilder.h │ │ ├── MXQRCodeDataBuilder.m │ │ ├── MXQRCodeDataCodable.h │ │ ├── MXQRCodeDataCoder.h │ │ ├── MXQRCodeDataCoder.m │ │ ├── MXSelfVerifyingMasterKeyNotTrustedQRCodeData.h │ │ ├── MXSelfVerifyingMasterKeyNotTrustedQRCodeData.m │ │ ├── MXSelfVerifyingMasterKeyTrustedQRCodeData.h │ │ ├── MXSelfVerifyingMasterKeyTrustedQRCodeData.m │ │ ├── MXTransactionCancelCode.h │ │ ├── MXTransactionCancelCode.m │ │ ├── MXVerifyingAnotherUserQRCodeData.h │ │ └── MXVerifyingAnotherUserQRCodeData.m │ │ ├── JSONModels │ │ ├── MXKeyVerificationAccept.h │ │ ├── MXKeyVerificationAccept.m │ │ ├── MXKeyVerificationCancel.h │ │ ├── MXKeyVerificationCancel.m │ │ ├── MXKeyVerificationDone.h │ │ ├── MXKeyVerificationDone.m │ │ ├── MXKeyVerificationJSONModel.h │ │ ├── MXKeyVerificationJSONModel.m │ │ ├── MXKeyVerificationKey.h │ │ ├── MXKeyVerificationKey.m │ │ ├── MXKeyVerificationMac.h │ │ ├── MXKeyVerificationMac.m │ │ ├── MXKeyVerificationReady.h │ │ ├── MXKeyVerificationReady.m │ │ ├── MXKeyVerificationRequestByDMJSONModel.h │ │ ├── MXKeyVerificationRequestByDMJSONModel.m │ │ ├── MXKeyVerificationRequestByToDeviceJSONModel.h │ │ ├── MXKeyVerificationRequestByToDeviceJSONModel.m │ │ ├── MXKeyVerificationStart.h │ │ ├── MXKeyVerificationStart.m │ │ ├── MXQRCodeKeyVerificationStart.h │ │ ├── MXQRCodeKeyVerificationStart.m │ │ ├── MXSASKeyVerificationStart.h │ │ └── MXSASKeyVerificationStart.m │ │ ├── MXKeyVerificationManager.h │ │ ├── MXKeyVerificationManager.m │ │ ├── MXKeyVerificationManagerV2.swift │ │ ├── Requests │ │ ├── MXKeyVerificationRequest.h │ │ ├── MXKeyVerificationRequest.m │ │ └── MXKeyVerificationRequestV2.swift │ │ ├── Status │ │ ├── MXKeyVerification.h │ │ ├── MXKeyVerification.m │ │ └── MXKeyVerificationStateResolver.swift │ │ └── Transactions │ │ ├── MXKeyVerificationTransaction.h │ │ ├── MXKeyVerificationTransaction.m │ │ ├── QRCode │ │ ├── MXQRCodeTransaction.h │ │ ├── MXQRCodeTransaction.m │ │ └── MXQRCodeTransactionV2.swift │ │ └── SAS │ │ ├── MXSASTransaction.h │ │ ├── MXSASTransaction.m │ │ └── MXSASTransactionV2.swift ├── Data │ ├── AutoDiscovery │ │ ├── MXAutoDiscovery.h │ │ ├── MXAutoDiscovery.m │ │ ├── MXDiscoveredClientConfig.h │ │ └── MXDiscoveredClientConfig.m │ ├── EventTimeline │ │ ├── MXEventTimeline.h │ │ ├── Room │ │ │ ├── MXRoomEventTimeline.h │ │ │ └── MXRoomEventTimeline.m │ │ └── Thread │ │ │ └── MXThreadEventTimeline.swift │ ├── EventsEnumerator │ │ ├── MXEventsByTypesEnumeratorOnArray.h │ │ ├── MXEventsByTypesEnumeratorOnArray.m │ │ ├── MXEventsEnumerator.h │ │ ├── MXEventsEnumeratorOnArray.h │ │ └── MXEventsEnumeratorOnArray.m │ ├── Filters │ │ ├── MXFilter.h │ │ ├── MXFilter.m │ │ ├── MXFilterJSONModel.h │ │ ├── MXFilterJSONModel.m │ │ ├── MXFilterObject.h │ │ ├── MXFilterObject.m │ │ ├── MXRoomEventFilter.h │ │ ├── MXRoomEventFilter.m │ │ ├── MXRoomFilter.h │ │ └── MXRoomFilter.m │ ├── MXAccountData.h │ ├── MXAccountData.m │ ├── MXCredentials.h │ ├── MXCredentials.m │ ├── MXEventListener.h │ ├── MXEventListener.m │ ├── MXGroup.h │ ├── MXGroup.m │ ├── MXInvite3PID.h │ ├── MXInvite3PID.m │ ├── MXMyUser.h │ ├── MXMyUser.m │ ├── MXPeekingRoom.h │ ├── MXPeekingRoom.m │ ├── MXPeekingRoomSummary.h │ ├── MXPeekingRoomSummary.m │ ├── MXRefreshTokenData.h │ ├── MXRefreshTokenData.m │ ├── MXRoom.h │ ├── MXRoom.m │ ├── MXRoomAccountData.h │ ├── MXRoomAccountData.m │ ├── MXRoomAccountDataUpdater.h │ ├── MXRoomAccountDataUpdater.m │ ├── MXRoomAccountDataUpdating.h │ ├── MXRoomLastMessage.h │ ├── MXRoomLastMessage.m │ ├── MXRoomMember.h │ ├── MXRoomMember.m │ ├── MXRoomMembers.h │ ├── MXRoomMembers.m │ ├── MXRoomMembersCount.h │ ├── MXRoomMembersCount.m │ ├── MXRoomNameDefaultStringLocalizer.h │ ├── MXRoomNameDefaultStringLocalizer.m │ ├── MXRoomNameStringLocalizerProtocol.h │ ├── MXRoomOperation.h │ ├── MXRoomOperation.m │ ├── MXRoomState.h │ ├── MXRoomState.m │ ├── MXRoomSummary.h │ ├── MXRoomSummary.m │ ├── MXRoomSummaryDataTypes.h │ ├── MXRoomSummaryProtocol.h │ ├── MXRoomSummarySentStatus.h │ ├── MXRoomSummaryUpdater.h │ ├── MXRoomSummaryUpdater.m │ ├── MXRoomThirdPartyInvite.h │ ├── MXRoomThirdPartyInvite.m │ ├── MXRoomType.h │ ├── MXRoomTypeMapper.swift │ ├── MXSendReplyEventDefaultStringLocalizer.h │ ├── MXSendReplyEventDefaultStringLocalizer.m │ ├── MXSendReplyEventStringLocalizerProtocol.h │ ├── MXSessionEventListener.h │ ├── MXSessionEventListener.m │ ├── MXUser.h │ ├── MXUser.m │ ├── ReplyEvent │ │ └── Parser │ │ │ ├── MXReplyEventBodyParts.h │ │ │ ├── MXReplyEventBodyParts.m │ │ │ ├── MXReplyEventFormattedBodyParts.h │ │ │ ├── MXReplyEventFormattedBodyParts.m │ │ │ ├── MXReplyEventParser.h │ │ │ ├── MXReplyEventParser.m │ │ │ ├── MXReplyEventParts.h │ │ │ └── MXReplyEventParts.m │ ├── RoomList │ │ ├── Common │ │ │ ├── MXBreadcrumbsRoomListDataFetcher.swift │ │ │ ├── MXRoomListDataFilterable.swift │ │ │ ├── MXRoomListDataSortable.swift │ │ │ ├── MXSuggestedRoomListDataCache.swift │ │ │ └── MXSuggestedRoomListDataFetcher.swift │ │ ├── CoreData │ │ │ ├── CoreDataContextable.swift │ │ │ ├── MXCoreDataRoomListDataFetcher.swift │ │ │ └── MXCoreDataRoomListDataManager.swift │ │ ├── MXRoomListData.swift │ │ ├── MXRoomListDataCounts.swift │ │ ├── MXRoomListDataFetchOptions.swift │ │ ├── MXRoomListDataFetcher.swift │ │ ├── MXRoomListDataFetcherDelegate.swift │ │ ├── MXRoomListDataFilterOptions.swift │ │ ├── MXRoomListDataManager.swift │ │ ├── MXRoomListDataPaginationOptions.swift │ │ ├── MXRoomListDataSortOptions.swift │ │ └── MXStore │ │ │ ├── MXStoreRoomListDataCounts.swift │ │ │ ├── MXStoreRoomListDataFetcher.swift │ │ │ └── MXStoreRoomListDataManager.swift │ ├── RoomSummaryStore │ │ ├── CoreData │ │ │ ├── MXCoreDataRoomSummaryStore.swift │ │ │ ├── MXCoreDataRoomSummaryStore.xcdatamodeld │ │ │ │ ├── .xccurrentversion │ │ │ │ ├── MXRoomSummaryCoreDataStore.xcdatamodel │ │ │ │ │ └── contents │ │ │ │ └── MXRoomSummaryCoreDataStore2.xcdatamodel │ │ │ │ │ └── contents │ │ │ ├── Models │ │ │ │ ├── MXRoomLastMessageMO.swift │ │ │ │ ├── MXRoomMembersCountMO.swift │ │ │ │ ├── MXRoomSummaryMO.swift │ │ │ │ └── MXUsersTrustLevelSummaryMO.swift │ │ │ └── NSManagedObject+MatrixSDK.swift │ │ ├── File │ │ │ ├── MXFileRoomSummaryStore.h │ │ │ └── MXFileRoomSummaryStore.m │ │ ├── MXRoomSummaryStore.h │ │ ├── Memory │ │ │ ├── MXMemoryRoomSummaryStore.h │ │ │ └── MXMemoryRoomSummaryStore.m │ │ └── Void │ │ │ ├── MXVoidRoomSummaryStore.h │ │ │ └── MXVoidRoomSummaryStore.m │ └── Store │ │ ├── MXCoreDataStore │ │ └── MXCoreDataStore.xcdatamodeld │ │ │ └── MXCoreDataStore.xcdatamodel │ │ │ └── contents │ │ ├── MXFileStore │ │ ├── MXFileRoomOutgoingMessagesStore.h │ │ ├── MXFileRoomOutgoingMessagesStore.m │ │ ├── MXFileRoomStore.h │ │ ├── MXFileRoomStore.m │ │ ├── MXFileStore.h │ │ ├── MXFileStore.m │ │ ├── MXFileStoreMetaData.h │ │ └── MXFileStoreMetaData.m │ │ ├── MXMemoryStore │ │ ├── MXMemoryRoomOutgoingMessagesStore.h │ │ ├── MXMemoryRoomOutgoingMessagesStore.m │ │ ├── MXMemoryRoomStore.h │ │ ├── MXMemoryRoomStore.m │ │ ├── MXMemoryStore.h │ │ ├── MXMemoryStore.m │ │ ├── MXReceiptData.h │ │ └── MXReceiptData.m │ │ ├── MXNoStore │ │ ├── MXNoStore.h │ │ └── MXNoStore.m │ │ ├── MXStore.h │ │ └── MXStoreService.swift ├── EventStream │ ├── MXEventStreamService.swift │ └── MXLiveEventListener.swift ├── HomeServer │ ├── MXHomeServerCapabilitiesService.swift │ └── MXRoomCapabilityType.swift ├── IdentityServer │ ├── MXIdentityServerRestClient.h │ ├── MXIdentityServerRestClient.m │ ├── MXIdentityService.h │ └── MXIdentityService.m ├── Info.plist ├── JSONModels │ ├── Aggregations │ │ ├── MXAggregationPaginatedResponse.h │ │ └── MXAggregationPaginatedResponse.m │ ├── Authentication │ │ ├── MXLoginPolicy.h │ │ ├── MXLoginPolicy.m │ │ ├── MXLoginPolicyData.h │ │ ├── MXLoginPolicyData.m │ │ ├── MXLoginTerms.h │ │ └── MXLoginTerms.m │ ├── AutoDiscovery │ │ ├── MXWellKnown.h │ │ ├── MXWellKnown.m │ │ ├── MXWellKnownAuthentication.h │ │ ├── MXWellKnownAuthentication.m │ │ ├── MXWellKnownBaseConfig.h │ │ ├── MXWellKnownBaseConfig.m │ │ ├── MXWellKnownTileServerConfig.h │ │ ├── MXWellKnownTileServerConfig.m │ │ ├── MXWellknownIntegrations.h │ │ └── MXWellknownIntegrations.m │ ├── Call │ │ ├── Events │ │ │ ├── MXAssertedIdentityModel.h │ │ │ ├── MXAssertedIdentityModel.m │ │ │ ├── MXCallAnswerEventContent.h │ │ │ ├── MXCallAnswerEventContent.m │ │ │ ├── MXCallAssertedIdentityEventContent.h │ │ │ ├── MXCallAssertedIdentityEventContent.m │ │ │ ├── MXCallCandidatesEventContent.h │ │ │ ├── MXCallCandidatesEventContent.m │ │ │ ├── MXCallCapabilitiesModel.h │ │ │ ├── MXCallCapabilitiesModel.m │ │ │ ├── MXCallEventContent.h │ │ │ ├── MXCallEventContent.m │ │ │ ├── MXCallHangupEventContent.h │ │ │ ├── MXCallHangupEventContent.m │ │ │ ├── MXCallInviteEventContent.h │ │ │ ├── MXCallInviteEventContent.m │ │ │ ├── MXCallNegotiateEventContent.h │ │ │ ├── MXCallNegotiateEventContent.m │ │ │ ├── MXCallRejectEventContent.h │ │ │ ├── MXCallRejectEventContent.m │ │ │ ├── MXCallRejectReplacementEventContent.h │ │ │ ├── MXCallRejectReplacementEventContent.m │ │ │ ├── MXCallReplacesEventContent.h │ │ │ ├── MXCallReplacesEventContent.m │ │ │ ├── MXCallSelectAnswerEventContent.h │ │ │ ├── MXCallSelectAnswerEventContent.m │ │ │ ├── MXUserModel.h │ │ │ └── MXUserModel.m │ │ ├── MXCallCandidate.h │ │ ├── MXCallCandidate.m │ │ ├── MXCallSessionDescription.h │ │ ├── MXCallSessionDescription.m │ │ ├── MXTurnServerResponse.h │ │ ├── MXTurnServerResponse.m │ │ └── MatrixRTC │ │ │ ├── MXCallNotify.h │ │ │ └── MXCallNotify.m │ ├── Capabilities │ │ ├── MXBooleanCapability.h │ │ ├── MXBooleanCapability.m │ │ ├── MXCapabilities.h │ │ ├── MXCapabilities.m │ │ ├── MXRoomVersionsCapability.h │ │ └── MXRoomVersionsCapability.m │ ├── Event │ │ ├── Content │ │ │ ├── MXEventContentLocation.h │ │ │ ├── MXEventContentLocation.m │ │ │ ├── MXEventContentPollStart.h │ │ │ ├── MXEventContentPollStart.m │ │ │ ├── MXEventContentRelatesTo.h │ │ │ └── MXEventContentRelatesTo.m │ │ ├── MXEventAnnotation.h │ │ ├── MXEventAnnotation.m │ │ ├── MXEventAnnotationChunk.h │ │ ├── MXEventAnnotationChunk.m │ │ ├── MXEventReference.h │ │ ├── MXEventReference.m │ │ ├── MXEventReferenceChunk.h │ │ ├── MXEventReferenceChunk.m │ │ ├── MXEventRelationThread.h │ │ ├── MXEventRelationThread.m │ │ ├── MXEventRelations.h │ │ ├── MXEventRelations.m │ │ ├── MXEventReplace.h │ │ ├── MXEventReplace.m │ │ ├── MXEventUnsignedData.h │ │ ├── MXEventUnsignedData.m │ │ ├── MXInReplyTo.h │ │ ├── MXInReplyTo.m │ │ ├── MXMentions.h │ │ └── MXMentions.m │ ├── IdentityServer │ │ ├── MXIdentityServerHashDetails.h │ │ └── MXIdentityServerHashDetails.m │ ├── Location │ │ ├── MXBeacon.h │ │ ├── MXBeacon.m │ │ ├── MXBeaconInfo.h │ │ ├── MXBeaconInfo.m │ │ ├── MXGeoURIComponents.swift │ │ ├── MXLocation.h │ │ └── MXLocation.m │ ├── Login │ │ ├── MXLoginSSOFlow.h │ │ ├── MXLoginSSOFlow.m │ │ ├── MXLoginSSOIdentityProvider.h │ │ ├── MXLoginSSOIdentityProvider.m │ │ └── MXLoginSSOIdentityProviderBrand.h │ ├── MXDevice.h │ ├── MXDevice.m │ ├── MXEvent.h │ ├── MXEvent.m │ ├── MXEventAssetType.h │ ├── MXJSONModel.h │ ├── MXJSONModel.m │ ├── MXJSONModels.h │ ├── MXJSONModels.m │ ├── MXMatrixVersions.h │ ├── MXMatrixVersions.m │ ├── MXRefreshResponse.h │ ├── MXRefreshResponse.m │ ├── MXRoomAliasResolution.h │ ├── MXRoomAliasResolution.m │ ├── MXRoomCreateContent.h │ ├── MXRoomCreateContent.m │ ├── MXRoomCreationParameters.h │ ├── MXRoomCreationParameters.m │ ├── MXRoomPowerLevels.h │ ├── MXRoomPowerLevels.m │ ├── MXRoomPredecessorInfo.h │ ├── MXRoomPredecessorInfo.m │ ├── MXRoomTombStoneContent.h │ ├── MXRoomTombStoneContent.m │ ├── MXServerNoticeContent.h │ ├── MXServerNoticeContent.m │ ├── MXTaggedEventInfo.h │ ├── MXTaggedEventInfo.m │ ├── MXTaggedEvents.h │ ├── MXTaggedEvents.m │ ├── MXVirtualRoomInfo.h │ ├── MXVirtualRoomInfo.m │ ├── Media │ │ ├── MXURLPreview.h │ │ └── MXURLPreview.m │ ├── Push │ │ ├── MXPusher.h │ │ ├── MXPusher.m │ │ ├── MXPusherData.h │ │ └── MXPusherData.m │ ├── Sync │ │ ├── Group │ │ │ ├── MXGroupSyncProfile.h │ │ │ ├── MXGroupSyncProfile.m │ │ │ ├── MXGroupsSyncResponse.h │ │ │ ├── MXGroupsSyncResponse.m │ │ │ ├── MXInvitedGroupSync.h │ │ │ └── MXInvitedGroupSync.m │ │ ├── MXDeviceListResponse.h │ │ ├── MXDeviceListResponse.m │ │ ├── MXInvitedRoomSync.h │ │ ├── MXInvitedRoomSync.m │ │ ├── MXPresenceSyncResponse.h │ │ ├── MXPresenceSyncResponse.m │ │ ├── MXRoomInviteState.h │ │ ├── MXRoomInviteState.m │ │ ├── MXRoomsSyncResponse.h │ │ ├── MXRoomsSyncResponse.m │ │ ├── MXSyncResponse.h │ │ ├── MXSyncResponse.m │ │ ├── MXToDeviceSyncResponse.h │ │ ├── MXToDeviceSyncResponse.m │ │ └── Room │ │ │ ├── MXRoomSync.h │ │ │ ├── MXRoomSync.m │ │ │ ├── MXRoomSyncAccountData.h │ │ │ ├── MXRoomSyncAccountData.m │ │ │ ├── MXRoomSyncEphemeral.h │ │ │ ├── MXRoomSyncEphemeral.m │ │ │ ├── MXRoomSyncState.h │ │ │ ├── MXRoomSyncState.m │ │ │ ├── MXRoomSyncSummary.h │ │ │ ├── MXRoomSyncSummary.m │ │ │ ├── MXRoomSyncTimeline.h │ │ │ ├── MXRoomSyncTimeline.m │ │ │ ├── MXRoomSyncUnreadNotifications.h │ │ │ └── MXRoomSyncUnreadNotifications.m │ └── ThirdParty │ │ ├── MXThirdPartyProtocol.h │ │ ├── MXThirdPartyProtocol.m │ │ ├── MXThirdPartyProtocolInstance.h │ │ ├── MXThirdPartyProtocolInstance.m │ │ ├── MXThirdPartyUserInstance.h │ │ ├── MXThirdPartyUserInstance.m │ │ ├── MXThirdPartyUsersResponse.h │ │ ├── MXThirdPartyUsersResponse.m │ │ ├── MXThirdpartyProtocolsResponse.h │ │ └── MXThirdpartyProtocolsResponse.m ├── Lib │ ├── NSObject+sortedKeys.h │ └── NSObject+sortedKeys.m ├── LocationSharing │ ├── MXBeaconInfoSummary.swift │ ├── MXBeaconInfoSummaryProtocol.swift │ ├── MXLocationService.swift │ └── MXLocationServiceError.swift ├── MXEnumConstants.h ├── MXEnumConstants.m ├── MXError.h ├── MXError.m ├── MXRestClient.h ├── MXRestClient.m ├── MXSDKOptions.h ├── MXSDKOptions.m ├── MXSession.h ├── MXSession.m ├── MXSessionStartupProgress.swift ├── MatrixSDK.h ├── MatrixSDKSwiftHeader.h ├── MatrixSDKVersion.m ├── NotificationCenter │ ├── Checker │ │ ├── MXPushRuleConditionChecker.h │ │ ├── MXPushRuleDisplayNameCondtionChecker.h │ │ ├── MXPushRuleDisplayNameCondtionChecker.m │ │ ├── MXPushRuleEventMatchConditionChecker.h │ │ ├── MXPushRuleEventMatchConditionChecker.m │ │ ├── MXPushRuleRoomMemberCountConditionChecker.h │ │ ├── MXPushRuleRoomMemberCountConditionChecker.m │ │ ├── MXPushRuleSenderNotificationPermissionConditionChecker.h │ │ └── MXPushRuleSenderNotificationPermissionConditionChecker.m │ ├── MXNotificationCenter.h │ ├── MXNotificationCenter.m │ └── ServiceTerms │ │ ├── MXServiceTerms.h │ │ ├── MXServiceTerms.m │ │ ├── MXServiceTermsRestClient.h │ │ └── MXServiceTermsRestClient.m ├── PushGateway │ ├── MXPushGatewayRestClient.h │ └── MXPushGatewayRestClient.m ├── Room │ ├── Membership │ │ └── MXMembershipTransitionState.h │ ├── Polls │ │ ├── PollAggregator.swift │ │ ├── PollBuilder.swift │ │ └── PollModels.swift │ └── State │ │ └── MXRoomInitialStateEventBuilder.swift ├── Space │ ├── MXRoomAliasAvailabilityChecker.swift │ ├── MXSpace.swift │ ├── MXSpaceChildContent.h │ ├── MXSpaceChildContent.m │ ├── MXSpaceChildInfo.swift │ ├── MXSpaceChildSummaryResponse.h │ ├── MXSpaceChildSummaryResponse.m │ ├── MXSpaceChildrenRequestParameters.swift │ ├── MXSpaceChildrenResponse.h │ ├── MXSpaceChildrenResponse.m │ ├── MXSpaceChildrenSummary.swift │ ├── MXSpaceCreationParameters.swift │ ├── MXSpaceFileStore.swift │ ├── MXSpaceGraphData.swift │ ├── MXSpaceNotificationCounter.swift │ ├── MXSpaceNotificationState.swift │ ├── MXSpaceService.swift │ └── MXSpaceStore.swift ├── Threads │ ├── MXThread.swift │ ├── MXThreadModel.swift │ ├── MXThreadNotificationsCount.swift │ ├── MXThreadProtocol.swift │ └── MXThreadingService.swift ├── ThreePidAdd │ ├── MX3PidAddManager.h │ ├── MX3PidAddManager.m │ ├── MX3PidAddSession.h │ └── MX3PidAddSession.m ├── Utils │ ├── Categories │ │ ├── Array.swift │ │ ├── Dictionary.swift │ │ ├── FileManager+AppGroupContainer.swift │ │ ├── FileManager+Backup.swift │ │ ├── NSArray+MatrixSDK.h │ │ ├── NSArray+MatrixSDK.m │ │ ├── NSArray.swift │ │ ├── NSData+MatrixSDK.h │ │ ├── NSData+MatrixSDK.m │ │ └── NSDictionary.swift │ ├── Logs │ │ ├── MXAnalyticsDestination.swift │ │ ├── MXLog.h │ │ ├── MXLog.swift │ │ ├── MXLogObjcWrapper.h │ │ ├── MXLogObjcWrapper.m │ │ ├── MXLogger.h │ │ └── MXLogger.m │ ├── MXAllowedCertificates.h │ ├── MXAllowedCertificates.m │ ├── MXAnalyticsDelegate.h │ ├── MXApplicationProtocol.h │ ├── MXAsyncTaskQueue.swift │ ├── MXBackgroundModeHandler.h │ ├── MXBackgroundTask.h │ ├── MXBase64Tools.h │ ├── MXBase64Tools.m │ ├── MXBugReportRestClient.h │ ├── MXBugReportRestClient.m │ ├── MXDateProvider.swift │ ├── MXEventAssetTypeMapper.swift │ ├── MXHTTPClient.h │ ├── MXHTTPClient.m │ ├── MXHTTPClient_Private.h │ ├── MXHTTPOperation.h │ ├── MXHTTPOperation.m │ ├── MXLRUCache.h │ ├── MXLRUCache.m │ ├── MXMemory.swift │ ├── MXMulticastDelegate.swift │ ├── MXServerNotices.h │ ├── MXServerNotices.m │ ├── MXTaskQueue.swift │ ├── MXThrottler.h │ ├── MXThrottler.m │ ├── MXToDevicePayload.swift │ ├── MXTools.h │ ├── MXTools.m │ ├── MXTools.swift │ ├── MXUIKitApplicationStateService.swift │ ├── MXUIKitBackgroundModeHandler.h │ ├── MXUIKitBackgroundModeHandler.m │ ├── MXUIKitBackgroundTask.h │ ├── MXUIKitBackgroundTask.m │ ├── MXWarnings.h │ ├── Media │ │ ├── MXMediaLoader.h │ │ ├── MXMediaLoader.m │ │ ├── MXMediaManager.h │ │ └── MXMediaManager.m │ ├── Profiling │ │ ├── MXBaseProfiler.h │ │ ├── MXBaseProfiler.m │ │ ├── MXProfiler.h │ │ ├── MXTaskProfile.h │ │ ├── MXTaskProfile.m │ │ ├── MXTaskProfileName.h │ │ └── MXTaskProfile_Private.h │ ├── Protocols │ │ └── MXSummable.swift │ └── Realm │ │ ├── MXRealmHelper.h │ │ ├── MXRealmHelper.m │ │ ├── RLMRealm+MatrixSDK.h │ │ ├── RLMRealm+MatrixSDK.m │ │ ├── RLMSupport.swift │ │ └── Realm+MatrixSDK.swift └── VoIP │ ├── CallKit │ ├── MXCallKitAdapter.h │ ├── MXCallKitAdapter.m │ ├── MXCallKitConfiguration.h │ └── MXCallKitConfiguration.m │ ├── CallStack │ ├── MXCallAudioSessionConfigurator.h │ ├── MXCallStack.h │ └── MXCallStackCall.h │ ├── MXCall.h │ ├── MXCall.m │ ├── MXCallManager.h │ ├── MXCallManager.m │ ├── MXiOSAudioOutputRoute.swift │ ├── MXiOSAudioOutputRouteType.swift │ ├── MXiOSAudioOutputRouter.swift │ └── MXiOSAudioOutputRouterDelegate.swift ├── MatrixSDKExtensions ├── MXAnalyticsDelegate │ └── GoogleAnalytics │ │ ├── MXGoogleAnalytics.h │ │ └── MXGoogleAnalytics.m └── VoIP │ └── Jingle │ ├── MXJingleCallAudioSessionConfigurator.h │ ├── MXJingleCallAudioSessionConfigurator.m │ ├── MXJingleCallStack.h │ ├── MXJingleCallStack.m │ ├── MXJingleCallStackCall.h │ ├── MXJingleCallStackCall.m │ ├── MXJingleCameraCaptureController.h │ ├── MXJingleCameraCaptureController.m │ ├── MXJingleVideoView.h │ └── MXJingleVideoView.m ├── MatrixSDKTests ├── Crypto │ ├── Algorithms │ │ └── RoomEvents │ │ │ ├── MXRoomEventDecryptionUnitTests.swift │ │ │ └── MXRoomEventEncryptionUnitTests.swift │ ├── CrossSigning │ │ ├── Data │ │ │ ├── MXCrossSigningInfoUnitTests.swift │ │ │ ├── MXCrossSigningInfo_v0 │ │ │ └── MXCrossSigningInfo_v1 │ │ ├── MXCrossSigningInfoSourceUnitTests.swift │ │ └── MXCrossSigningV2UnitTests.swift │ ├── CryptoMachine │ │ ├── DecryptedEvent+Stub.swift │ │ ├── Device+Stub.swift │ │ ├── Extensions │ │ │ └── EventEncryptionAlgorithmUnitTests.swift │ │ ├── MXCryptoMachineUnitTests.swift │ │ ├── MXCryptoProtocolStubs.swift │ │ ├── MXCryptoRequestsUnitTests.swift │ │ ├── MXKeyProviderStub.swift │ │ └── MXKeysQuerySchedulerUnitTests.swift │ ├── Data │ │ └── MXMegolmSessionDataUnitTests.swift │ ├── Devices │ │ ├── Data │ │ │ └── MXDeviceInfoUnitTests.swift │ │ └── MXDeviceInfoSourceUnitTests.swift │ ├── KeyBackup │ │ ├── Data │ │ │ └── MXKeyBackupVersion+Stub.swift │ │ └── Engine │ │ │ └── MXCryptoKeyBackupEngineUnitTests.swift │ ├── KeySharing │ │ ├── Data │ │ │ ├── MXForwardedRoomKeyEventContentUnitTests.swift │ │ │ └── MXRoomKeyEventContentUnitTests.swift │ │ └── MXUnrequestedForwardedRoomKeyManagerUnitTests.swift │ ├── Migration │ │ └── LegacyRealmStore │ │ │ ├── archived_encrypted_event │ │ │ ├── legacy_deprecated1_account.realm │ │ │ ├── legacy_deprecated3_account.realm │ │ │ ├── legacy_unverified_account.realm │ │ │ ├── legacy_verified_account.realm │ │ │ └── legacy_version2_account.realm │ ├── Trust │ │ └── MXTrustLevelSourceUnitTests.swift │ └── Verification │ │ ├── MXKeyVerificationManagerV2UnitTests.swift │ │ ├── Requests │ │ ├── MXKeyVerificationRequestV2UnitTests.swift │ │ └── VerificationRequestStub.swift │ │ ├── Status │ │ └── MXKeyVerificationStateResolverUnitTests.swift │ │ └── Transactions │ │ ├── QRCode │ │ ├── MXQRCodeTransactionV2UnitTests.swift │ │ └── QrCodeStub.swift │ │ └── SAS │ │ ├── MXSASTransactionV2UnitTests.swift │ │ └── SasStub.swift ├── Data │ ├── EventsEnumerator │ │ ├── EventsEnumeratorDataSourceStub.swift │ │ ├── MXEventsByTypesEnumeratorOnArrayTests.swift │ │ └── MXEventsEnumeratorOnArrayTests.swift │ └── Store │ │ └── MXMemoryStore │ │ └── MXMemoryRoomStoreUnitTests.swift ├── DirectRoomTests.m ├── Dummy.swift ├── Info.plist ├── JSONModels │ ├── MXEventFixtures.swift │ ├── MXEventTests.m │ └── MXKeysQueryResponseUnitTests.swift ├── MXAccountDataTests.m ├── MXAes256KeyBackupTests.m ├── MXAesUnitTests.m ├── MXAggregatedEditsTests.m ├── MXAggregatedEditsUnitTests.m ├── MXAggregatedPollsUpdaterTests.swift ├── MXAggregatedReactionTests.m ├── MXAggregatedReferenceTests.m ├── MXAggregatedReferenceUnitTests.m ├── MXAsyncTaskQueueUnitTests.swift ├── MXAuthenticationSessionUnitTests.swift ├── MXAutoDiscoveryTests.m ├── MXBackgroundSyncServiceTests.swift ├── MXBackgroundTaskUnitTests.swift ├── MXBaseKeyBackupTests.h ├── MXBaseKeyBackupTests.m ├── MXBeaconAggregationsTests.swift ├── MXBeaconInfoUnitTests.swift ├── MXClientInformationServiceUnitTests.swift ├── MXCoreDataRoomListDataManagerUnitTests.swift ├── MXCredentialsUnitTests.swift ├── MXCrossSigningTests.m ├── MXCryptoKeyVerificationTests.m ├── MXCryptoRecoveryServiceTests.m ├── MXCryptoSecretStorageTests.m ├── MXCryptoShareTests.m ├── MXCryptoTests.m ├── MXDeviceListOperationsPoolTests.swift ├── MXErrorUnitTests.m ├── MXEventAnnotationUnitTests.swift ├── MXEventReferenceUnitTests.swift ├── MXEventScanStoreUnitTests.m ├── MXFilterTests.m ├── MXFilterUnitTests.m ├── MXGeoURIComponentsUnitTests.swift ├── MXHTTPAdditionalHeadersUnitTests.m ├── MXHTTPClientTests.m ├── MXHomeserverCapabilitiesTests.swift ├── MXJSONModelTests.m ├── MXJSONModelUnitTests.m ├── MXKeyBackupUnitTests.swift ├── MXKeyProviderUnitTests.m ├── MXLazyLoadingTests.m ├── MXLocationServiceTests.swift ├── MXLoggerUnitTests.m ├── MXMatrixVersionsUnitTests.swift ├── MXMediaScanStoreUnitTests.m ├── MXMegolmExportEncryptionUnitTests.m ├── MXMyUserTests.m ├── MXNotificationCenterTests.m ├── MXPeekingRoomTests.m ├── MXPollAggregatorTests.swift ├── MXPollBuilderTests.swift ├── MXPollRelationTests.m ├── MXPushRuleUnitTests.m ├── MXQRCodeDataUnitTests.m ├── MXReceiptDataIntegrationTests.swift ├── MXReplyEventParserUnitTests.m ├── MXResponseUnitTests.swift ├── MXRestClientExtensionsTests.m ├── MXRestClientNoAuthAPITests.m ├── MXRestClientTests.m ├── MXRoomAliasAvailabilityCheckerResultTests.swift ├── MXRoomEventFilterUnitTests.swift ├── MXRoomEventTimelineTests.m ├── MXRoomListDataManagerTests.swift ├── MXRoomMemberTests.m ├── MXRoomStateDynamicTests.m ├── MXRoomStateTests.m ├── MXRoomStateUnitTests.swift ├── MXRoomSummaryTests.m ├── MXRoomSummaryTrustTests.m ├── MXRoomTests.m ├── MXSelfSignedHomeserverTests.m ├── MXSessionStartupProgressUnitTests.swift ├── MXSessionTests.m ├── MXSpaceChildContentTests.swift ├── MXSpaceServiceTest.swift ├── MXStoreFileStoreTests.m ├── MXStoreMemoryStoreTests.m ├── MXStoreNoStoreTests.m ├── MXStoreRoomListDataManagerUnitTests.swift ├── MXStoreTests.h ├── MXStoreTests.m ├── MXSyncResponseUnitTests.swift ├── MXThreadEventTimelineUnitTests.swift ├── MXThreadingServiceTests.swift ├── MXThreadingServiceUnitTests.swift ├── MXThreadsNotificationCountTests.swift ├── MXToDevicePayloadUnitTests.swift ├── MXToolsUnitTests.m ├── MXUserTests.m ├── MXVoIPTests.m ├── MatrixSDKTests-Bridging-Header.h ├── MatrixSDKTestsData.h ├── MatrixSDKTestsData.m ├── MatrixSDKTestsData.swift ├── MatrixSDKTestsE2EData.h ├── MatrixSDKTestsE2EData.m ├── MatrixSDKTestsE2EData.swift ├── MatrixSDKTestsSwiftHeader.h ├── Mocks │ ├── MXMockCallStack.h │ ├── MXMockCallStack.m │ ├── MXMockCallStackCall.h │ ├── MXMockCallStackCall.m │ ├── MXRestClientStub.h │ ├── MXRestClientStub.m │ └── MockRoomSummary.swift ├── TestPlans │ ├── AllTests.xctestplan │ ├── AllTestsWithSanitizers.xctestplan │ ├── AllWorkingTests.xctestplan │ ├── UnitTests.xctestplan │ └── UnitTestsWithSanitizers.xctestplan └── Utils │ ├── Logs │ └── MXAnalyticsDestinationUnitTests.swift │ ├── MXSession.swift │ ├── MXSessionTracker.swift │ ├── MXTaskQueueUnitTests.swift │ └── TestObserver.swift ├── Podfile ├── Podfile.lock ├── README.rst ├── build.sh ├── changelog.d ├── .gitignore └── _template.md.jinja ├── codecov.yml ├── fastlane └── Fastfile ├── lint.sh ├── scripts └── symbolicate │ ├── .gitignore │ ├── credentials.py │ └── symbolicate.py ├── test.sh └── towncrier.toml /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Pull Request Checklist 2 | 3 | 4 | 5 | * [ ] Pull request is based on the develop branch 6 | * [ ] Pull request contains a changelog file in ./changelog.d. See https://github.com/matrix-org/matrix-ios-sdk/blob/develop/CONTRIBUTING.md#changelog 7 | * [ ] Pull request includes a [sign off](https://github.com/matrix-org/matrix-ios-sdk/blob/develop/CONTRIBUTING.md#sign-off) 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | .vscode/ 5 | *.pbxuser 6 | !default.pbxuser 7 | *.mode1v3 8 | !default.mode1v3 9 | *.mode2v3 10 | !default.mode2v3 11 | *.perspectivev3 12 | !default.perspectivev3 13 | xcuserdata 14 | *.xccheckout 15 | *.moved-aside 16 | DerivedData 17 | *.hmap 18 | *.ipa 19 | *.xcuserstate 20 | *.DS_Store 21 | .vscode/ 22 | vendor/ 23 | 24 | # CocoaPods 25 | # 26 | # We recommend against adding the Pods directory to your .gitignore. However 27 | # you should judge for yourself, the pros and cons are mentioned at: 28 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 29 | # 30 | Pods/ 31 | 32 | # Do not track our workspace since it is created by CocoaPods 33 | *.xcworkspace 34 | 35 | # Fastlane 36 | fastlane/report.xml 37 | fastlane/Reports 38 | fastlane/README.md 39 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "fastlane" 4 | gem "cocoapods", '~>1.16.2' 5 | gem "xcode-install" 6 | gem "slather" 7 | -------------------------------------------------------------------------------- /MatrixSDK.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MatrixSDK.xcodeproj/xcshareddata/IDETemplateMacros.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | FILEHEADER 6 | 7 | // Copyright ___YEAR___ The Matrix.org Foundation C.I.C 8 | // 9 | // Licensed under the Apache License, Version 2.0 (the "License"); 10 | // you may not use this file except in compliance with the License. 11 | // You may obtain a copy of the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in writing, software 16 | // distributed under the License is distributed on an "AS IS" BASIS, 17 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | // See the License for the specific language governing permissions and 19 | // limitations under the License. 20 | // 21 | 22 | -------------------------------------------------------------------------------- /MatrixSDK/Aggregations/Data/MXAggregatedReactions.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXReactionCount.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /** 24 | `MXAggregatedReactions` is a summary of reactions on an event. 25 | */ 26 | @interface MXAggregatedReactions : NSObject 27 | 28 | @property (nonatomic) NSArray *reactions; 29 | 30 | - (nullable MXAggregatedReactions *)aggregatedReactionsWithNonZeroCount; 31 | 32 | @end 33 | 34 | NS_ASSUME_NONNULL_END 35 | -------------------------------------------------------------------------------- /MatrixSDK/Aggregations/Data/MXEventEditsListener.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | @class MXEvent; 22 | 23 | @interface MXEventEditsListener : NSObject 24 | 25 | @property (nonatomic) NSString *roomId; 26 | 27 | @property (nonatomic, copy) void (^notificationBlock)(MXEvent *replaceEvent); 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | -------------------------------------------------------------------------------- /MatrixSDK/Aggregations/Data/MXEventEditsListener.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXEventEditsListener.h" 18 | 19 | @implementation MXEventEditsListener 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MatrixSDK/Aggregations/Data/MXReactionCountChange.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXReactionCount.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | @interface MXReactionCountChange : NSObject 24 | 25 | @property (nonatomic, nullable) NSArray *inserted; 26 | @property (nonatomic, nullable) NSArray *modified; 27 | @property (nonatomic, nullable) NSArray *deleted; 28 | 29 | @property (nonatomic) BOOL changeDueToLocalEcho; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /MatrixSDK/Aggregations/Data/MXReactionCountChange.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXReactionCountChange.h" 18 | 19 | /** 20 | `MXReactionCountChange` represents changes on the reactions counts on an event. 21 | */ 22 | @implementation MXReactionCountChange 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /MatrixSDK/Aggregations/Data/MXReactionCountChangeListener.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXReactionCountChange.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | @interface MXReactionCountChangeListener : NSObject 24 | 25 | @property (nonatomic) NSString *roomId; 26 | 27 | // eventId -> changes 28 | @property (nonatomic, copy) void (^notificationBlock)(NSDictionary *changes); 29 | 30 | @end 31 | 32 | NS_ASSUME_NONNULL_END 33 | -------------------------------------------------------------------------------- /MatrixSDK/Aggregations/Data/MXReactionCountChangeListener.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXReactionCountChangeListener.h" 18 | 19 | @implementation MXReactionCountChangeListener 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MatrixSDK/Aggregations/Data/MXReactionOperation.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXReactionOperation.h" 18 | 19 | @implementation MXReactionOperation 20 | 21 | - (NSString *)description 22 | { 23 | NSString *sign = self.isAddOperation ? @"+" : @"-"; 24 | return [NSString stringWithFormat:@"%@: %@", self.reaction, sign]; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /MatrixSDK/Aggregations/Data/MXReactionRelation.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | /** 22 | `MXReactionRelation` stores relation between: 23 | - a reaction on an event 24 | - and the reaction event 25 | */ 26 | @interface MXReactionRelation : NSObject 27 | 28 | @property (nonatomic) NSString *eventId; 29 | @property (nonatomic) NSString *reaction; 30 | 31 | // TODO: We could add sender add senderId, originServerTs 32 | @property (nonatomic) NSString *reactionEventId; 33 | @property (nonatomic) uint64_t originServerTs; 34 | 35 | @end 36 | 37 | NS_ASSUME_NONNULL_END 38 | -------------------------------------------------------------------------------- /MatrixSDK/Aggregations/Data/MXReactionRelation.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXReactionRelation.h" 18 | 19 | @implementation MXReactionRelation 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MatrixSDK/Aggregations/Data/Store/Realm/MXRealmAggregationsStore.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXAggregationsStore.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | @interface MXRealmAggregationsStore : NSObject 24 | 25 | @end 26 | 27 | NS_ASSUME_NONNULL_END 28 | -------------------------------------------------------------------------------- /MatrixSDK/Aggregations/Data/Store/Realm/MXRealmReactionCount.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXRealmReactionCount.h" 18 | 19 | @implementation MXRealmReactionCount 20 | 21 | + (NSString *)primaryKey 22 | { 23 | return @"primaryKey"; 24 | } 25 | 26 | + (NSString *)primaryKeyFromEventId:(NSString *)eventId andReaction:(NSString *)reaction 27 | { 28 | return [NSString stringWithFormat:@"%@_%@", eventId, reaction]; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /MatrixSDK/Aggregations/Data/Store/Realm/MXRealmReactionRelation.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXRealmReactionRelation.h" 18 | 19 | @implementation MXRealmReactionRelation 20 | 21 | + (NSString *)primaryKey 22 | { 23 | return @"primaryKey"; 24 | } 25 | 26 | + (NSString*)primaryKeyFromEventId:(NSString*)eventId andReactionEventId:(NSString*)reactionEventId 27 | { 28 | return [NSString stringWithFormat:@"%@_%@", eventId, reactionEventId]; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /MatrixSDK/Aggregations/LocationSharing/MXBeaconInfoSummaryAllRoomListener.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2022 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | 19 | @objcMembers 20 | public class MXBeaconInfoSummaryAllRoomListener: NSObject { 21 | 22 | // MARK: - Properties 23 | 24 | let notificationHandler: ((_ roomId: String, MXBeaconInfoSummaryProtocol) -> Void) 25 | 26 | // MARK: - Setup 27 | 28 | init(notificationHandler: @escaping ((_ roomId: String, MXBeaconInfoSummaryProtocol) -> Void)) { 29 | self.notificationHandler = notificationHandler 30 | super.init() 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /MatrixSDK/Aggregations/LocationSharing/MXBeaconInfoSummaryPerRoomListener.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2022 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | 19 | @objcMembers 20 | public class MXBeaconInfoSummaryPerRoomListener: NSObject { 21 | 22 | // MARK: - Properties 23 | 24 | let roomId: String 25 | let notificationHandler: ((MXBeaconInfoSummaryProtocol) -> Void) 26 | 27 | // MARK: - Setup 28 | 29 | init(roomId: String, notificationHandler: @escaping ((MXBeaconInfoSummaryProtocol) -> Void)) { 30 | self.roomId = roomId 31 | self.notificationHandler = notificationHandler 32 | super.init() 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /MatrixSDK/Aggregations/MXAggregatedReferencesUpdater.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 The Matrix.org Foundation C.I.C 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXStore.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | @interface MXAggregatedReferencesUpdater : NSObject 24 | 25 | - (instancetype)initWithMatrixSession:(MXSession *)mxSession 26 | matrixStore:(id)matrixStore; 27 | 28 | #pragma mark - Data update 29 | - (void)handleReference:(MXEvent *)referenceEvent; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /MatrixSDK/Background/Crypto/MXBackgroundCrypto.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2022 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | 19 | /// Light-weight crypto protocol to be used with background services 20 | /// that can receive room keys and decrypt notification messages 21 | protocol MXBackgroundCrypto { 22 | func handleSyncResponse(_ syncResponse: MXSyncResponse) async 23 | func canDecryptEvent(_ event: MXEvent) -> Bool 24 | func decryptEvent(_ event: MXEvent) throws 25 | } 26 | -------------------------------------------------------------------------------- /MatrixSDK/Categories/NSDictionary+MutableDeepCopy.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | @protocol MutableDeepCopying 22 | - (id)mutableDeepCopy; 23 | @end 24 | 25 | @interface NSDictionary (MutableDeepCopy) 26 | 27 | @end 28 | 29 | @interface NSArray (MutableDeepCopy) 30 | @end 31 | 32 | NS_ASSUME_NONNULL_END 33 | -------------------------------------------------------------------------------- /MatrixSDK/ContentScan/Data/MXAntivirusScanStatus.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | 18 | /** 19 | `MXAntivirusScanStatus` represent the antivirus scan status. 20 | */ 21 | typedef NS_ENUM(NSInteger, MXAntivirusScanStatus) { 22 | MXAntivirusScanStatusUnknown = 0, 23 | MXAntivirusScanStatusInProgress, 24 | MXAntivirusScanStatusTrusted, 25 | MXAntivirusScanStatusInfected 26 | }; 27 | -------------------------------------------------------------------------------- /MatrixSDK/ContentScan/Data/MXAntivirusScanStatusFormatter.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | #import "MXAntivirusScanStatus.h" 19 | 20 | /** 21 | `MXAntivirusScanStatusFormatter` convert MXAntivirusScanStatus to readable string. 22 | */ 23 | @interface MXAntivirusScanStatusFormatter : NSObject 24 | 25 | + (nonnull NSString *)stringFromAntivirusScanStatus:(MXAntivirusScanStatus)antivirusScanStatus; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /MatrixSDK/ContentScan/Data/Store/Realm/Event/MXRealmEventScanMapper.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXEventScan.h" 20 | #import "MXRealmEventScan.h" 21 | 22 | /** 23 | `MXRealmEventScanMapper` is used to convert a `MXRealmEventScan` to a `MXEventScan`. 24 | */ 25 | @interface MXRealmEventScanMapper : NSObject 26 | 27 | - (nonnull MXEventScan*)eventScanFromRealmEventScan:(nonnull MXRealmEventScan*)realmEventScan; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /MatrixSDK/ContentScan/Data/Store/Realm/Event/MXRealmEventScanStore.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | #import "MXEventScanStore.h" 19 | #import "MXScanRealmProvider.h" 20 | 21 | /** 22 | The `MXRealmEventScanStore` is a Realm implementation of `MXEventScanStore`. 23 | */ 24 | @interface MXRealmEventScanStore : NSObject 25 | 26 | @property (nonatomic, weak, nullable) id delegate; 27 | 28 | - (nullable instancetype)initWithRealmProvider:(nonnull id)realmProvider; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /MatrixSDK/ContentScan/Data/Store/Realm/Media/MXRealmMediaScanMapper.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXMediaScan.h" 20 | #import "MXRealmMediaScan.h" 21 | 22 | /** 23 | `MXRealmMediaScanMapper` is used to convert a `MXRealmMediaScan` to a `MXMediaScan`. 24 | */ 25 | @interface MXRealmMediaScanMapper : NSObject 26 | 27 | - (nonnull MXMediaScan*)mediaScanFromRealmMediaScan:(nonnull MXRealmMediaScan*)realmMediaScan; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /MatrixSDK/ContentScan/Data/Store/Realm/Media/MXRealmMediaScanMapper.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXRealmMediaScanMapper.h" 18 | 19 | @implementation MXRealmMediaScanMapper 20 | 21 | - (nonnull MXMediaScan*)mediaScanFromRealmMediaScan:(nonnull MXRealmMediaScan*)realmMediaScan 22 | { 23 | MXMediaScan *mediaScan = [MXMediaScan new]; 24 | mediaScan.url = realmMediaScan.url; 25 | mediaScan.antivirusScanStatus = realmMediaScan.antivirusScanStatus; 26 | mediaScan.antivirusScanInfo = realmMediaScan.antivirusScanInfo; 27 | mediaScan.antivirusScanDate = realmMediaScan.antivirusScanDate; 28 | return mediaScan; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /MatrixSDK/ContentScan/Data/Store/Realm/RealmProvider/MXScanRealmProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | /** 20 | `MXScanRealmProvider` defines an interface that must be implemented to provide a Realm instance associated to an antivirus server domain. 21 | */ 22 | @protocol MXScanRealmProvider 23 | 24 | - (nullable instancetype)initWithAntivirusServerDomain:(nonnull NSString*)antivirusServerDomain; 25 | 26 | - (nullable RLMRealm*)realm; 27 | 28 | - (void)deleteAllObjects; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /MatrixSDK/ContentScan/JSONModels/MXContentScanResult.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXJSONModel.h" 18 | 19 | /** 20 | `MXContentScanResult` contains the antivirus scan result of a matrix content. 21 | */ 22 | @interface MXContentScanResult : MXJSONModel 23 | 24 | /** 25 | If true, the script ran with an exit code of 0. Otherwise it ran with a non-zero exit code. 26 | */ 27 | @property (nonatomic) BOOL clean; 28 | 29 | /** 30 | Human-readable information about the result. 31 | */ 32 | @property (nonatomic) NSString *info; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /MatrixSDK/ContentScan/JSONModels/MXContentScanResult.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXContentScanResult.h" 18 | 19 | @implementation MXContentScanResult 20 | 21 | + (id)modelFromJSON:(NSDictionary *)JSONDictionary 22 | { 23 | MXContentScanResult *contentScanResult = [[MXContentScanResult alloc] init]; 24 | if (contentScanResult) 25 | { 26 | MXJSONModelSetBoolean(contentScanResult.clean, JSONDictionary[@"clean"]); 27 | MXJSONModelSetString(contentScanResult.info, JSONDictionary[@"info"]); 28 | } 29 | return contentScanResult; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /MatrixSDK/Contrib/Swift/Data/MXSessionEventListener.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Avery Pierce 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import Foundation 18 | 19 | /** 20 | Block called when an event of the registered types has been handled by the `MXSession` instance. 21 | This is a specialisation of the `MXOnEvent` block. 22 | 23 | - parameters: 24 | - event: the new event. 25 | - direction: the origin of the event. 26 | - customObject: additional contect for the event. In case of room event, `customObject` is a `RoomState` instance. In the case of a presence, `customObject` is `nil`. 27 | */ 28 | public typealias MXOnSessionEvent = (_ event: MXEvent, _ direction: MXTimelineDirection, _ customObject: Any?) -> Void; 29 | -------------------------------------------------------------------------------- /MatrixSDK/Contrib/Swift/MXImage.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Avery Pierce 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import Foundation 18 | 19 | #if os(iOS) 20 | public typealias MXImage = UIImage 21 | #elseif os(OSX) 22 | public typealias MXImage = NSImage 23 | #endif 24 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Algorithms/MXEventDecryptionResult.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Vector Creations Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXEventDecryptionResult.h" 18 | 19 | @implementation MXEventDecryptionResult 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/CrossSigning/Data/MXCrossSigningInfo_Private.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXCrossSigningInfo.h" 18 | 19 | 20 | NS_ASSUME_NONNULL_BEGIN 21 | 22 | @interface MXCrossSigningInfo () 23 | 24 | - (instancetype)initWithUserId:(NSString *)userId; 25 | 26 | - (void)setTrustLevel:(MXUserTrustLevel*)trustLevel; 27 | - (BOOL)updateTrustLevel:(MXUserTrustLevel*)trustLevel; 28 | - (void)addCrossSigningKey:(MXCrossSigningKey*)crossSigningKey type:(NSString*)type; 29 | 30 | @end 31 | 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/CrossSigning/MXCrossSigning.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXCrossSigning.h" 18 | 19 | #pragma mark - Constants 20 | 21 | NSString *const MXCrossSigningMyUserDidSignInOnNewDeviceNotification = @"MXCrossSigningMyUserDidSignInOnNewDeviceNotification"; 22 | NSString *const MXCrossSigningDidChangeCrossSigningKeysNotification = @"MXCrossSigningDidChangeCrossSigningKeydNotification"; 23 | NSString *const MXCrossSigningNotificationDeviceIdsKey = @"deviceIds"; 24 | 25 | NSString *const MXCrossSigningErrorDomain = @"org.matrix.sdk.crosssigning"; 26 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/CrossSigning/MXCrossSigningTools.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | 22 | #pragma mark - Constants 23 | 24 | FOUNDATION_EXPORT NSString *const MXCrossSigningToolsErrorDomain; 25 | 26 | typedef NS_ENUM(NSInteger, MXCrossSigningToolsErrorCode) 27 | { 28 | MXCrossSigningToolsMissingSignatureErrorCode, 29 | }; 30 | 31 | NS_ASSUME_NONNULL_END 32 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/CrossSigning/MXCrossSigningTools.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXCrossSigningTools.h" 18 | 19 | #pragma mark - Constants 20 | 21 | NSString *const MXCrossSigningToolsErrorDomain = @"org.matrix.sdk.crosssigning.tools"; 22 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/CryptoMachine/Extensions/MXRoomHistoryVisibility+HistoryVisibility.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2023 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | import MatrixSDKCrypto 19 | 20 | extension MXRoomHistoryVisibility { 21 | var visibility: HistoryVisibility { 22 | switch self { 23 | case .worldReadable: 24 | return .worldReadable 25 | case .shared: 26 | return .shared 27 | case .invited: 28 | return .invited 29 | case .joined: 30 | return .joined 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Data/MXExportedOlmDevice.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import "MXExportedOlmDevice.h" 18 | 19 | @implementation MXExportedOlmDevice 20 | 21 | - (instancetype)initWithAccount:(NSString*)pickledAccount 22 | pickleKey:(NSData*)pickleKey 23 | forSessions:(NSArray*)sessions 24 | { 25 | self = [super init]; 26 | 27 | if (self) 28 | { 29 | self.pickledAccount = pickledAccount; 30 | self.pickleKey = pickleKey; 31 | self.sessions = sessions; 32 | } 33 | 34 | return self; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Data/MXOlmSession.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXOlmSession.h" 18 | 19 | @implementation MXOlmSession 20 | 21 | - (instancetype)initWithOlmSession:(OLMSession *)session deviceKey:(NSString *)deviceKey 22 | { 23 | self = [super init]; 24 | if (self) 25 | { 26 | _session = session; 27 | _deviceKey = deviceKey; 28 | _lastReceivedMessageTs = 0; 29 | } 30 | return self; 31 | } 32 | 33 | - (void)didReceiveMessage 34 | { 35 | _lastReceivedMessageTs = [[NSDate date] timeIntervalSince1970]; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Data/MXOlmSessionResult.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 OpenMarket Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXDeviceInfo.h" 20 | 21 | /** 22 | Represent an olm session result returned by [MXCrypto ensureOlmSessionsForUsers:]. 23 | */ 24 | @interface MXOlmSessionResult : NSObject 25 | 26 | - (instancetype)initWithDevice:(MXDeviceInfo*)device andOlmSession:(NSString*)sessionId; 27 | 28 | /** 29 | The device 30 | */ 31 | @property (nonatomic) MXDeviceInfo *device; 32 | 33 | /** 34 | Base64 olm session id. 35 | nil if no session could be established. 36 | */ 37 | @property (nonatomic) NSString *sessionId; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Data/MXOlmSessionResult.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 OpenMarket Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXOlmSessionResult.h" 18 | 19 | @implementation MXOlmSessionResult 20 | 21 | - (instancetype)initWithDevice:(MXDeviceInfo *)device andOlmSession:(NSString *)sessionId 22 | { 23 | self = [self init]; 24 | if (self) 25 | { 26 | _device = device; 27 | _sessionId = sessionId; 28 | } 29 | 30 | return self; 31 | } 32 | 33 | - (NSString *)description 34 | { 35 | return [NSString stringWithFormat:@" %@: %@", _device.deviceId, _sessionId]; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Data/MXQueuedEncryption.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 OpenMarket Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXQueuedEncryption.h" 18 | 19 | @implementation MXQueuedEncryption 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Devices/Data/MXDeviceInfo_Private.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXDeviceInfo.h" 18 | 19 | 20 | NS_ASSUME_NONNULL_BEGIN 21 | 22 | @interface MXDeviceInfo () 23 | 24 | - (void)setTrustLevel:(MXDeviceTrustLevel*)trustLevel; 25 | - (BOOL)updateTrustLevel:(MXDeviceTrustLevel*)trustLevel; 26 | 27 | @end 28 | 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/KeyBackup/Data/Curve25519/MXCurve25519BackupAuthData.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXJSONModel.h" 20 | #import "MXBaseKeyBackupAuthData.h" 21 | 22 | NS_ASSUME_NONNULL_BEGIN 23 | 24 | /** 25 | Data model for MXKeyBackupVersion.authData in case of kMXCryptoCurve25519KeyBackupAlgorithm. 26 | */ 27 | @interface MXCurve25519BackupAuthData : MXJSONModel 28 | 29 | /** 30 | The curve25519 public key used to encrypt the backups. 31 | */ 32 | @property (nonatomic) NSString *publicKey; 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/KeyBackup/Data/MXKeyBackupPreparationInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2022 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import "MXKeyBackupPreparationInfo.h" 18 | 19 | @interface MXKeyBackupPreparationInfo () 20 | 21 | @property (nonatomic, readwrite) NSData *privateKey; 22 | 23 | @property (nonatomic, readwrite) id authData; 24 | 25 | @end 26 | 27 | @implementation MXKeyBackupPreparationInfo 28 | 29 | - (instancetype)initWithPrivateKey:(NSData*)privateKey authData:(id)authData 30 | { 31 | if (self = [super init]) 32 | { 33 | self.privateKey = privateKey; 34 | self.authData = authData; 35 | } 36 | return self; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/KeyBackup/Data/MXKeyBackupVersionTrust.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXKeyBackupVersionTrust.h" 18 | 19 | @implementation MXKeyBackupVersionTrust 20 | 21 | - (instancetype)init 22 | { 23 | self = [super init]; 24 | if (self) 25 | { 26 | _usable = NO; 27 | _signatures = [NSArray new]; 28 | } 29 | return self; 30 | } 31 | 32 | @end 33 | 34 | @implementation MXKeyBackupVersionTrustSignature 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/KeyBackup/Data/MXMegolmBackupCreationInfo.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXMegolmBackupCreationInfo.h" 18 | 19 | @implementation MXMegolmBackupCreationInfo 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/KeyBackup/Engine/MXEncryptedKeyBackup.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2023 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | 19 | /// Helper class for batch importing key backups 20 | @objcMembers public class MXEncryptedKeyBackup: NSObject { 21 | public let roomId: String 22 | public let sessionId: String 23 | public let keyBackup: MXKeyBackupData 24 | 25 | public init(roomId: String, sessionId: String, keyBackup: MXKeyBackupData) { 26 | self.roomId = roomId 27 | self.sessionId = sessionId 28 | self.keyBackup = keyBackup 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/KeyBackup/MXKeyBackup_Private.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXKeyBackup.h" 18 | #import "MXKeyBackupEngine.h" 19 | #import "MXSecretShareManager.h" 20 | 21 | @class MXCrypto; 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | /** 26 | The `MXKeyBackup_Private` extension exposes internal operations. 27 | */ 28 | @interface MXKeyBackup () 29 | 30 | /** 31 | * Reset all local key backup data. 32 | */ 33 | - (void)resetKeyBackupData; 34 | 35 | - (BOOL)isSecretValid:(NSString*)secret forKeyBackupVersion:(MXKeyBackupVersion*)keyBackupVersion; 36 | 37 | @end 38 | 39 | NS_ASSUME_NONNULL_END 40 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/KeyProvider/MXKeyData.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | /// Different type of Key Data 20 | typedef NS_ENUM(NSUInteger, MXKeyType) 21 | { 22 | /// Key is based on a single raw data 23 | kRawData = 1, 24 | /// AES Key based on an IV and a KEY 25 | kAes 26 | }; 27 | 28 | NS_ASSUME_NONNULL_BEGIN 29 | 30 | /// Base class for Key Data returned by the MXKeyProviderDelegate. 31 | @interface MXKeyData : NSObject 32 | 33 | /// Type of the key 34 | @property (nonatomic, readonly) MXKeyType type; 35 | 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/KeyProvider/MXKeyData.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import "MXKeyData.h" 18 | 19 | @implementation MXKeyData 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/KeyProvider/MXRawDataKey.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import "MXRawDataKey.h" 18 | 19 | @interface MXRawDataKey() 20 | 21 | @property (nonatomic, strong) NSData *key; 22 | 23 | @end 24 | 25 | @implementation MXRawDataKey 26 | 27 | + (MXRawDataKey *) dataWithKey: (NSData *)key 28 | { 29 | return [[MXRawDataKey alloc] initWithKey: key]; 30 | } 31 | 32 | - (instancetype) initWithKey: (NSData *)key 33 | { 34 | self = [super init]; 35 | 36 | if (self) 37 | { 38 | self.key = key; 39 | } 40 | 41 | return self; 42 | } 43 | 44 | - (MXKeyType)type 45 | { 46 | return kRawData; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/KeySharing/Data/MXIncomingRoomKeyRequestCancellation.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 OpenMarket Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #import "MXIncomingRoomKeyRequestCancellation.h" 17 | 18 | @implementation MXIncomingRoomKeyRequestCancellation 19 | 20 | - (instancetype)initWithMXEvent:(MXEvent *)event 21 | { 22 | self = [super init]; 23 | if (self) 24 | { 25 | NSDictionary *content = event.content; 26 | 27 | _userId = event.sender; 28 | _deviceId = content[@"requesting_device_id"]; 29 | _requestId = content[@"request_id"]; 30 | } 31 | return self; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/KeySharing/Data/MXOutgoingRoomKeyRequest.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 OpenMarket Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXOutgoingRoomKeyRequest.h" 18 | 19 | @implementation MXOutgoingRoomKeyRequest 20 | 21 | - (NSString *)algorithm 22 | { 23 | return _requestBody[@"algorithm"]; 24 | } 25 | 26 | - (NSString *)roomId 27 | { 28 | return _requestBody[@"room_id"]; 29 | } 30 | 31 | - (NSString *)sessionId 32 | { 33 | return _requestBody[@"session_id"]; 34 | } 35 | 36 | - (NSString *)senderKey 37 | { 38 | return _requestBody[@"sender_key"]; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/KeySharing/MXSharedHistoryKeyService.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2022 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | NSString *const kMXSharedHistoryKeyName = @"org.matrix.msc3061.shared_history"; 20 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/KeySharing/Secret/Data/MXPendingSecretShareRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXSecretShareRequest.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /** 24 | A pending secret share request. 25 | */ 26 | @interface MXPendingSecretShareRequest : NSObject 27 | 28 | @property (nonatomic) MXSecretShareRequest *request; 29 | @property (nonatomic, nullable) NSArray *requestedDeviceIds; 30 | @property (nonatomic, copy) BOOL (^onSecretReceivedBlock)(NSString *secret); 31 | 32 | @end 33 | 34 | NS_ASSUME_NONNULL_END 35 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/KeySharing/Secret/Data/MXPendingSecretShareRequest.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXPendingSecretShareRequest.h" 18 | 19 | @implementation MXPendingSecretShareRequest 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/KeySharing/Secret/JSONModels/MXSecretShareSend.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXJSONModel.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /** 24 | Sent by a client to share a secret with another device, in response to a 25 | m.secret.request (`MXSecretShareRequest`) event. 26 | */ 27 | @interface MXSecretShareSend : MXJSONModel 28 | 29 | /** 30 | The ID of the request that this a response to. 31 | */ 32 | @property (nonatomic) NSString *requestId; 33 | 34 | /** 35 | The contents of the secret. 36 | */ 37 | @property (nonatomic) NSString *secret; 38 | 39 | @end 40 | 41 | NS_ASSUME_NONNULL_END 42 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/KeySharing/Secret/MXSecretShareManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXHTTPOperation.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | 24 | #pragma mark - Constants 25 | 26 | //! Secret identifiers 27 | extern const struct MXSecretId { 28 | __unsafe_unretained NSString *crossSigningMaster; 29 | __unsafe_unretained NSString *crossSigningSelfSigning; 30 | __unsafe_unretained NSString *crossSigningUserSigning; 31 | __unsafe_unretained NSString *keyBackup; 32 | __unsafe_unretained NSString *dehydratedDevice; 33 | } MXSecretId; 34 | 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Recovery/Data/MXSecretRecoveryResult.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | /** 22 | Result to [MXRecoveryService recoverSecrets:]. 23 | */ 24 | @interface MXSecretRecoveryResult : NSObject 25 | 26 | // All secrets got from the recovery 27 | @property (nonatomic) NSArray *secrets; 28 | 29 | // Secrets updated in local store 30 | @property (nonatomic) NSArray *updatedSecrets; 31 | 32 | // Invalid secrets (wrong version, bad signature). 33 | @property (nonatomic) NSArray *invalidSecrets; 34 | 35 | @end 36 | 37 | NS_ASSUME_NONNULL_END 38 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Recovery/Data/MXSecretRecoveryResult.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXSecretRecoveryResult.h" 18 | 19 | @implementation MXSecretRecoveryResult 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Recovery/MXRecoveryService_Private.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXRecoveryService.h" 18 | 19 | @class MXCrypto; 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | @interface MXRecoveryService () 24 | 25 | @end 26 | 27 | NS_ASSUME_NONNULL_END 28 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/RoomKeys/MXRoomKeyResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2022 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | 19 | @objc public enum MXRoomKeyType: Int { 20 | case safe 21 | case unsafe 22 | case unrequested 23 | } 24 | 25 | @objcMembers 26 | public class MXRoomKeyResult: NSObject { 27 | public let type: MXRoomKeyType 28 | public let info: MXRoomKeyInfo 29 | 30 | public init(type: MXRoomKeyType, info: MXRoomKeyInfo) { 31 | self.type = type 32 | self.info = info 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/SecretStorage/Data/MXSecretStorageKeyCreationInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXSecretStorageKeyContent.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /** 24 | Data returned by `[MXSecretStorageManager createKeyWithKeyId:]`. 25 | */ 26 | @interface MXSecretStorageKeyCreationInfo : NSObject 27 | 28 | @property (nonatomic) NSString *keyId; 29 | 30 | @property (nonatomic) MXSecretStorageKeyContent *content; 31 | 32 | @property (nonatomic) NSData *privateKey; 33 | @property (nonatomic) NSString *recoveryKey; 34 | 35 | @end 36 | 37 | NS_ASSUME_NONNULL_END 38 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/SecretStorage/Data/MXSecretStorageKeyCreationInfo.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXSecretStorageKeyCreationInfo.h" 18 | 19 | @implementation MXSecretStorageKeyCreationInfo 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/SecretStorage/JSONModels/MXEncryptedSecretContent.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXJSONModel.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /** 24 | `MXEncryptedSecretContent` describes the content of an encrypted secret in the user's account data. 25 | */ 26 | @interface MXEncryptedSecretContent : MXJSONModel 27 | 28 | // Unpadded base64-encoded 29 | @property (nonatomic, nullable) NSString *ciphertext; 30 | @property (nonatomic, nullable) NSString *mac; 31 | @property (nonatomic, nullable) NSString *iv; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Verification/Data/MXEmojiRepresentation.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | /** 22 | An emoji to use for verification. 23 | */ 24 | @interface MXEmojiRepresentation : NSObject 25 | 26 | /** 27 | The emoji. 28 | */ 29 | @property (nonatomic, readonly) NSString *emoji; 30 | 31 | /** 32 | The name of the emoji. 33 | Needs to be internationnalised. 34 | */ 35 | @property (nonatomic, readonly) NSString *name; 36 | 37 | - (instancetype)initWithEmoji:(NSString*)emoji andName:(NSString*)name; 38 | 39 | @end 40 | 41 | NS_ASSUME_NONNULL_END 42 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Verification/Data/MXEmojiRepresentation.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXEmojiRepresentation.h" 18 | 19 | @implementation MXEmojiRepresentation 20 | 21 | - (instancetype)initWithEmoji:(NSString *)emoji andName:(NSString *)name 22 | { 23 | self = [super init]; 24 | if (self) 25 | { 26 | _emoji = emoji; 27 | _name = name; 28 | } 29 | 30 | return self; 31 | } 32 | 33 | - (NSString *)description 34 | { 35 | return _emoji; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Verification/Data/MXQRCodeData.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXQRCodeData.h" 18 | 19 | static NSUInteger const kQRCodeFormatVersion = 2; 20 | 21 | @implementation MXQRCodeData 22 | 23 | @synthesize verificationMode; 24 | 25 | - (NSUInteger)version 26 | { 27 | return kQRCodeFormatVersion; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Verification/Data/MXSelfVerifyingMasterKeyNotTrustedQRCodeData.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXQRCodeData.h" 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | @interface MXSelfVerifyingMasterKeyNotTrustedQRCodeData : MXQRCodeData 22 | 23 | // then the current device's device key 24 | @property (nonatomic, strong, readonly, nullable) NSString *currentDeviceKey; 25 | 26 | // what the device thinks the user's master cross-signing key is 27 | @property (nonatomic, strong, readonly, nullable) NSString *userCrossSigningMasterKeyPublic; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Verification/Data/MXSelfVerifyingMasterKeyTrustedQRCodeData.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXQRCodeData.h" 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | @interface MXSelfVerifyingMasterKeyTrustedQRCodeData : MXQRCodeData 22 | 23 | // the user's own master cross-signing public key 24 | @property (nonatomic, strong, readonly) NSString *userCrossSigningMasterKeyPublic; 25 | 26 | // what the device thinks the other device's device key is 27 | @property (nonatomic, strong, readonly) NSString *otherDeviceKey; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Verification/Data/MXVerifyingAnotherUserQRCodeData.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXQRCodeData.h" 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | @interface MXVerifyingAnotherUserQRCodeData : MXQRCodeData 22 | 23 | // the user's own master cross-signing public key 24 | @property (nonatomic, strong, readonly) NSString *userCrossSigningMasterKeyPublic; 25 | 26 | // what the device thinks the other user's master cross-signing key is 27 | @property (nonatomic, strong, readonly) NSString *otherUserCrossSigningMasterKeyPublic; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Verification/JSONModels/MXKeyVerificationDone.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXKeyVerificationJSONModel.h" 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | /** 22 | Model for m.key.verification.done. 23 | As described at https://github.com/uhoreg/matrix-doc/blob/e2e_verification_in_dms/proposals/2241-e2e-verification-in-dms.md#concluding-a-key-verification 24 | */ 25 | @interface MXKeyVerificationDone : MXKeyVerificationJSONModel 26 | 27 | @end 28 | 29 | NS_ASSUME_NONNULL_END 30 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Verification/JSONModels/MXKeyVerificationDone.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXKeyVerificationDone.h" 18 | 19 | @implementation MXKeyVerificationDone 20 | 21 | + (instancetype)modelFromJSON:(NSDictionary *)JSONDictionary 22 | { 23 | return [[MXKeyVerificationDone alloc] initWithJSONDictionary:JSONDictionary]; 24 | } 25 | 26 | - (NSDictionary *)JSONDictionary 27 | { 28 | return self.JSONDictionaryWithTransactionId; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Verification/JSONModels/MXKeyVerificationKey.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXKeyVerificationJSONModel.h" 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | /** 22 | Sent by both devices to send their ephemeral Curve25519 public key the other device. 23 | */ 24 | @interface MXKeyVerificationKey : MXKeyVerificationJSONModel 25 | 26 | /** 27 | The device’s ephemeral public key, as an unpadded base64 string. 28 | */ 29 | @property (nonatomic, nullable) NSString *key; 30 | 31 | 32 | /** 33 | Check content validity. 34 | 35 | @return YES if valid. 36 | */ 37 | - (BOOL)isValid; 38 | 39 | @end 40 | 41 | NS_ASSUME_NONNULL_END 42 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Verification/JSONModels/MXKeyVerificationStart.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXKeyVerificationJSONModel.h" 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | /** 22 | Sent by Alice to initiate an interactive key verification. 23 | */ 24 | @interface MXKeyVerificationStart : MXKeyVerificationJSONModel 25 | 26 | /** 27 | The verification method to use. 28 | */ 29 | @property (nonatomic, nullable) NSString *method; 30 | 31 | /** 32 | Alice’s device ID. 33 | */ 34 | @property (nonatomic) NSString *fromDevice; 35 | 36 | /** 37 | Check content validity. 38 | 39 | @return YES if valid. 40 | */ 41 | - (BOOL)isValid; 42 | 43 | @end 44 | 45 | NS_ASSUME_NONNULL_END 46 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Verification/JSONModels/MXQRCodeKeyVerificationStart.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXKeyVerificationStart.h" 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | @interface MXQRCodeKeyVerificationStart : MXKeyVerificationStart 22 | 23 | /** 24 | The shared secret from the QR code, encoded using unpadded base64. 25 | */ 26 | @property (nonatomic, nullable) NSString *sharedSecret; 27 | 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Verification/Requests/MXKeyVerificationRequest.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | 18 | #import "MXKeyVerificationRequest.h" 19 | 20 | 21 | #warning File has not been annotated with nullability, see MX_ASSUME_MISSING_NULLABILITY_BEGIN 22 | 23 | #pragma mark - Constants 24 | NSString * const MXKeyVerificationRequestDidChangeNotification = @"MXKeyVerificationRequestDidChangeNotification"; 25 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Verification/Status/MXKeyVerification.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXKeyVerification.h" 18 | 19 | @implementation MXKeyVerification 20 | 21 | - (BOOL)isRequestAccepted 22 | { 23 | return self.state >= MXKeyVerificationStateTransactionStarted; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Verification/Transactions/MXKeyVerificationTransaction.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXKeyVerificationTransaction.h" 18 | 19 | #pragma mark - Constants 20 | NSString * const MXKeyVerificationTransactionDidChangeNotification = @"MXKeyVerificationTransactionDidChangeNotification"; 21 | -------------------------------------------------------------------------------- /MatrixSDK/Crypto/Verification/Transactions/QRCode/MXQRCodeTransaction.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXQRCodeTransaction.h" 18 | 19 | 20 | #import "MXCryptoTools.h" 21 | #import "NSArray+MatrixSDK.h" 22 | 23 | #import "MXQRCodeDataCoder.h" 24 | #import "MXBase64Tools.h" 25 | 26 | #import "MXVerifyingAnotherUserQRCodeData.h" 27 | #import "MXSelfVerifyingMasterKeyTrustedQRCodeData.h" 28 | #import "MXSelfVerifyingMasterKeyNotTrustedQRCodeData.h" 29 | 30 | NSString * const MXKeyVerificationMethodQRCodeShow = @"m.qr_code.show.v1"; 31 | NSString * const MXKeyVerificationMethodQRCodeScan = @"m.qr_code.scan.v1"; 32 | 33 | NSString * const MXKeyVerificationMethodReciprocate = @"m.reciprocate.v1"; 34 | -------------------------------------------------------------------------------- /MatrixSDK/Data/AutoDiscovery/MXDiscoveredClientConfig.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXDiscoveredClientConfig.h" 18 | 19 | @implementation MXDiscoveredClientConfig 20 | 21 | - (instancetype)initWithAction:(MXDiscoveredClientConfigAction)action 22 | { 23 | self = [self init]; 24 | if (self) 25 | { 26 | _action =action; 27 | } 28 | return self; 29 | } 30 | 31 | - (instancetype)initWithAction:(MXDiscoveredClientConfigAction)action andWellKnown:(MXWellKnown *)wellKnown 32 | { 33 | self = [self initWithAction:action]; 34 | if (self) 35 | { 36 | _wellKnown = wellKnown; 37 | } 38 | return self; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /MatrixSDK/Data/MXPeekingRoomSummary.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXRoomSummary.h" 18 | 19 | @class MXPeekingRoom; 20 | 21 | /** 22 | A `MXPeekingRoomSummary` instance works with the combination of a `MXPeekingRoomSummary` 23 | object where data for both is mounted in memory. 24 | */ 25 | @interface MXPeekingRoomSummary : MXRoomSummary 26 | 27 | /** 28 | Set the ephemeral `MXPeekingRoom` object attached to this room summary. 29 | 30 | @param peekingRoom the room associated with this summary. 31 | */ 32 | - (void)setPeekingRoom:(MXPeekingRoom*)peekingRoom; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /MatrixSDK/Data/MXPeekingRoomSummary.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXPeekingRoomSummary.h" 18 | 19 | #import "MXPeekingRoom.h" 20 | 21 | @interface MXPeekingRoomSummary () 22 | { 23 | // The associated mounted room 24 | __weak MXRoom *room; 25 | } 26 | @end 27 | 28 | @implementation MXPeekingRoomSummary 29 | 30 | -(void)setPeekingRoom:(MXPeekingRoom *)peekingRoom 31 | { 32 | room = peekingRoom; 33 | } 34 | 35 | - (MXRoom *)room 36 | { 37 | // Use the peeking room associated with this summary 38 | return room; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /MatrixSDK/Data/MXRefreshTokenData.m: -------------------------------------------------------------------------------- 1 | // 2 | // MXRefreshTokenData.m 3 | // MatrixSDK 4 | // 5 | // Created by David Langley on 17/12/2021. 6 | // 7 | 8 | #import 9 | #import "MXRefreshTokenData.h" 10 | 11 | @implementation MXRefreshTokenData 12 | - (instancetype)initWithUserId:(NSString*)userId 13 | homeserver:(NSString*)homeserver 14 | accessToken:(NSString*)accessToken 15 | refreshToken:(NSString*)refreshToken 16 | accessTokenExpiresAt:(uint64_t)accessTokenExpiresAt 17 | { 18 | self = [super init]; 19 | if (self) 20 | { 21 | _userId = userId; 22 | _homeserver = homeserver; 23 | _accessToken = accessToken; 24 | _refreshToken = refreshToken; 25 | _accessTokenExpiresAt = accessTokenExpiresAt; 26 | } 27 | return self; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /MatrixSDK/Data/MXRoomNameDefaultStringLocalizer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXRoomNameStringLocalizerProtocol.h" 20 | 21 | /** 22 | The `MXRoomNameDefaultStringLocalizer` implements default English localization 23 | strings for `MXRoomNameStringLocalizerProtocol`. 24 | */ 25 | @interface MXRoomNameDefaultStringLocalizer : NSObject 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /MatrixSDK/Data/MXRoomOperation.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Vector Creations Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXRoomOperation.h" 18 | 19 | @interface MXRoomOperation () 20 | { 21 | BOOL canceled; 22 | } 23 | @end 24 | 25 | @implementation MXRoomOperation 26 | 27 | - (BOOL)isCancelled 28 | { 29 | return canceled || _operation.isCancelled; 30 | } 31 | 32 | - (void)cancel 33 | { 34 | [_operation cancel]; 35 | canceled = YES; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /MatrixSDK/Data/MXRoomSummarySentStatus.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #ifndef MXRoomSummarySentStatus_h 18 | #define MXRoomSummarySentStatus_h 19 | 20 | typedef NS_ENUM(NSUInteger, MXRoomSummarySentStatus) 21 | { 22 | MXRoomSummarySentStatusOk, 23 | MXRoomSummarySentStatusSentFailed, 24 | MXRoomSummarySentStatusSentFailedDueToUnknownDevices 25 | }; 26 | 27 | #endif /* MXRoomSummarySentStatus_h */ 28 | -------------------------------------------------------------------------------- /MatrixSDK/Data/MXRoomThirdPartyInvite.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 OpenMarket Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXRoomThirdPartyInvite.h" 18 | 19 | #import "MXJSONModels.h" 20 | 21 | @implementation MXRoomThirdPartyInvite 22 | 23 | - (instancetype)initWithMXEvent:(MXEvent *)roomThirdPartyInviteEvent 24 | { 25 | self = [super init]; 26 | if (self) 27 | { 28 | MXJSONModelSetString(_displayname, roomThirdPartyInviteEvent.content[@"display_name"]); 29 | MXJSONModelSetString(_token, roomThirdPartyInviteEvent.stateKey); 30 | _originalEvent = roomThirdPartyInviteEvent; 31 | } 32 | return self; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /MatrixSDK/Data/MXSendReplyEventDefaultStringLocalizer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | #import "MXSendReplyEventStringLocalizerProtocol.h" 19 | 20 | /** 21 | A `MXSendReplyEventDefaultStringLocalizer` instance represents default localization strings used when send reply event to a message in a room. 22 | */ 23 | @interface MXSendReplyEventDefaultStringLocalizer : NSObject 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /MatrixSDK/Data/ReplyEvent/Parser/MXReplyEventBodyParts.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | @interface MXReplyEventBodyParts : NSObject 22 | 23 | @property (nonatomic, strong) NSString *replyTextPrefix; 24 | @property (nonatomic, strong) NSString *replyText; 25 | 26 | @end 27 | 28 | NS_ASSUME_NONNULL_END 29 | -------------------------------------------------------------------------------- /MatrixSDK/Data/ReplyEvent/Parser/MXReplyEventBodyParts.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXReplyEventBodyParts.h" 18 | 19 | @implementation MXReplyEventBodyParts 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MatrixSDK/Data/ReplyEvent/Parser/MXReplyEventFormattedBodyParts.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | #import "MXReplyEventBodyParts.h" 19 | 20 | NS_ASSUME_NONNULL_BEGIN 21 | 22 | @interface MXReplyEventFormattedBodyParts : MXReplyEventBodyParts 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /MatrixSDK/Data/ReplyEvent/Parser/MXReplyEventFormattedBodyParts.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXReplyEventFormattedBodyParts.h" 18 | 19 | @implementation MXReplyEventFormattedBodyParts 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MatrixSDK/Data/ReplyEvent/Parser/MXReplyEventParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXReplyEventParts.h" 20 | #import "MXEvent.h" 21 | 22 | NS_ASSUME_NONNULL_BEGIN 23 | 24 | /** 25 | Reply event parser. 26 | */ 27 | @interface MXReplyEventParser : NSObject 28 | 29 | - (nullable MXReplyEventParts*)parse:(MXEvent*)replyEvent; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /MatrixSDK/Data/RoomList/CoreData/CoreDataContextable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | import CoreData 19 | 20 | internal protocol CoreDataContextable { 21 | 22 | /// Managed object context to be used for main thread applications. 23 | /// Implementations should return a context with `.mainQueueConcurrencyType` concurrency type 24 | var mainManagedObjectContext: NSManagedObjectContext { get } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /MatrixSDK/Data/RoomList/MXRoomListDataFetcherDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | 19 | @objc 20 | /// Delegate for room list data fetcher. 21 | public protocol MXRoomListDataFetcherDelegate: AnyObject { 22 | 23 | /// Delegate method to be called when fetched data updated 24 | /// - Parameter fetcher: fetcher 25 | /// - Parameter totalCountsChanged true if the total counts changed or pagination disabled 26 | func fetcherDidChangeData(_ fetcher: MXRoomListDataFetcher, totalCountsChanged: Bool) 27 | } 28 | -------------------------------------------------------------------------------- /MatrixSDK/Data/RoomSummaryStore/CoreData/MXCoreDataRoomSummaryStore.xcdatamodeld/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _XCCurrentVersionName 6 | MXRoomSummaryCoreDataStore2.xcdatamodel 7 | 8 | 9 | -------------------------------------------------------------------------------- /MatrixSDK/Data/RoomSummaryStore/CoreData/NSManagedObject+MatrixSDK.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | import CoreData 19 | 20 | extension NSManagedObject { 21 | 22 | /// Entity name for the managed object 23 | static var entityName: String { 24 | guard let result = Self.entity().name else { 25 | fatalError("[\(String(describing: self))] could not get entity name") 26 | } 27 | return result 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /MatrixSDK/Data/RoomSummaryStore/Memory/MXMemoryRoomSummaryStore.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | #import "MXRoomSummaryStore.h" 19 | 20 | NS_ASSUME_NONNULL_BEGIN 21 | 22 | @interface MXMemoryRoomSummaryStore : NSObject 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /MatrixSDK/Data/RoomSummaryStore/Void/MXVoidRoomSummaryStore.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | #import "MXRoomSummaryStore.h" 19 | 20 | NS_ASSUME_NONNULL_BEGIN 21 | 22 | @interface MXVoidRoomSummaryStore : NSObject 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /MatrixSDK/Data/Store/MXFileStore/MXFileRoomOutgoingMessagesStore.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | /** 22 | `MXFileRoomOutgoingMessagesStore` extends MXMemoryRoomOutgoingMessagesStore to be able to serialise it for storing 23 | data into file system. 24 | 25 | This serialisation is done in the context of the multi-threading managed by [MXFileStore commit]. 26 | @see [MXFileRoomOutgoingMessagesStore encodeWithCoder] for more details. 27 | */ 28 | @interface MXFileRoomOutgoingMessagesStore : MXMemoryRoomOutgoingMessagesStore 29 | 30 | @end 31 | 32 | NS_ASSUME_NONNULL_END 33 | -------------------------------------------------------------------------------- /MatrixSDK/Data/Store/MXFileStore/MXFileRoomStore.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 OpenMarket Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXMemoryRoomStore.h" 18 | 19 | /** 20 | `MXFileRoomStore` extends MXMemoryRoomStore to be able to serialise it for storing 21 | data into file system. 22 | 23 | This serialisation is done in the context of the multi-threading managed by [MXFileStore commit]. 24 | @see [MXFileRoomStore encodeWithCoder] for more details. 25 | */ 26 | @interface MXFileRoomStore : MXMemoryRoomStore 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /MatrixSDK/Data/Store/MXNoStore/MXNoStore.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 OpenMarket Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXStore.h" 20 | 21 | /** 22 | `MXNoStore` is an implementation of the `MXStore` interface where no event is stored. 23 | That means that the Matrix SDK will always make requests to the home server to get events, 24 | even for those it already fetched. 25 | 26 | It stores minimal information like tokens in memory to make the SDK able to work using it. 27 | */ 28 | @interface MXNoStore : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /MatrixSDK/EventStream/MXLiveEventListener.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2022 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | /// Protocol used to monitor events of a specific session 18 | @objc 19 | public protocol MXLiveEventListener: AnyObject { 20 | 21 | /// Monitor changes to session state 22 | func onSessionStateChanged(state: MXSessionState) 23 | 24 | /// Monitor decryption attempts 25 | func onLiveEventDecryptionAttempted(event: MXEvent, result:MXEventDecryptionResult) 26 | 27 | /// Monitor to device events 28 | func onLiveToDeviceEvent(event: MXEvent) 29 | 30 | } 31 | -------------------------------------------------------------------------------- /MatrixSDK/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Authentication/MXLoginPolicy.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXJSONModel.h" 20 | #import "MXLoginPolicyData.h" 21 | 22 | NS_ASSUME_NONNULL_BEGIN 23 | 24 | @interface MXLoginPolicy : MXJSONModel 25 | 26 | /** 27 | Policy version 28 | */ 29 | @property (nonatomic) NSString *version; 30 | 31 | /** 32 | Localised policy data to displayed to the end user. 33 | 34 | Language code (like "en") -> Policy data 35 | */ 36 | @property (nonatomic) NSDictionary *data; 37 | 38 | @end 39 | 40 | NS_ASSUME_NONNULL_END 41 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Authentication/MXLoginPolicyData.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXJSONModel.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | @interface MXLoginPolicyData : MXJSONModel 24 | 25 | @property (nonatomic) NSString *name; 26 | @property (nonatomic) NSString *url; 27 | 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Authentication/MXLoginPolicyData.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXLoginPolicyData.h" 18 | 19 | @implementation MXLoginPolicyData 20 | 21 | + (id)modelFromJSON:(NSDictionary *)JSONDictionary 22 | { 23 | MXLoginPolicyData *loginPolicyData = [MXLoginPolicyData new]; 24 | if (loginPolicyData) 25 | { 26 | MXJSONModelSetString(loginPolicyData.name, JSONDictionary[@"name"]); 27 | MXJSONModelSetString(loginPolicyData.url, JSONDictionary[@"url"]); 28 | } 29 | 30 | return loginPolicyData; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownBaseConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific languagMXWellKnowne governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXJSONModel.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /** 24 | * https://matrix.org/docs/spec/client_server/r0.4.0.html#server-discovery 25 | * 26 | * { 27 | * "base_url": "https://matrix.org" 28 | * } 29 | */ 30 | @interface MXWellKnownBaseConfig : MXJSONModel 31 | 32 | @property (nonatomic) NSString *baseUrl; 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownTileServerConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific languagMXWellKnowne governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXJSONModel.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | @interface MXWellKnownTileServerConfig : MXJSONModel 24 | 25 | @property (nonatomic, strong, readonly) NSString *mapStyleURLString; 26 | 27 | @end 28 | 29 | NS_ASSUME_NONNULL_END 30 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Call/Events/MXCallAssertedIdentityEventContent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import "MXCallEventContent.h" 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | @class MXAssertedIdentityModel; 22 | 23 | /** 24 | `MXCallAssertedIdentityEventContent` represents the content of an `m.call.asserted_identity` event. 25 | */ 26 | @interface MXCallAssertedIdentityEventContent : MXCallEventContent 27 | 28 | /** 29 | An object giving information about the transfer target. 30 | */ 31 | @property (nonatomic, nullable) MXAssertedIdentityModel *assertedIdentity; 32 | 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Call/Events/MXCallCandidatesEventContent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | #import "MXCallEventContent.h" 19 | #import "MXCallCandidate.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /** 24 | `MXCallCandidatesEventContent` represents the content of an `m.call.candidates` event. 25 | */ 26 | @interface MXCallCandidatesEventContent : MXCallEventContent 27 | 28 | /** 29 | Array of object describing the candidates (@see MXCallCandidate). 30 | */ 31 | @property (nonatomic) NSArray *candidates; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Call/Events/MXCallCapabilitiesModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | /** 22 | `MXCallCapabilitiesModel` represents capabilities in `m.call.invite` and `m.call.answer` events. 23 | */ 24 | @interface MXCallCapabilitiesModel : MXJSONModel 25 | 26 | /** 27 | Capability defined by `m.call.transferee`. 28 | */ 29 | @property (nonatomic) BOOL transferee; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Call/Events/MXCallCapabilitiesModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import "MXCallCapabilitiesModel.h" 18 | 19 | @implementation MXCallCapabilitiesModel 20 | 21 | + (id)modelFromJSON:(NSDictionary *)JSONDictionary 22 | { 23 | MXCallCapabilitiesModel *capabilitiesModel = [[MXCallCapabilitiesModel alloc] init]; 24 | 25 | if (capabilitiesModel) 26 | { 27 | MXJSONModelSetBoolean(capabilitiesModel.transferee, JSONDictionary[@"m.call.transferee"]); 28 | } 29 | 30 | return capabilitiesModel; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Call/Events/MXCallRejectEventContent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | #import "MXCallEventContent.h" 19 | 20 | NS_ASSUME_NONNULL_BEGIN 21 | 22 | /** 23 | `MXCallRejectEventContent` represents the content of an `m.call.reject` event. 24 | */ 25 | @interface MXCallRejectEventContent : MXCallEventContent 26 | 27 | @end 28 | 29 | NS_ASSUME_NONNULL_END 30 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Call/Events/MXCallRejectEventContent.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import "MXCallRejectEventContent.h" 18 | 19 | @implementation MXCallRejectEventContent 20 | 21 | + (id)modelFromJSON:(NSDictionary *)JSONDictionary 22 | { 23 | MXCallRejectEventContent *callRejectEventContent = [[MXCallRejectEventContent alloc] init]; 24 | if (callRejectEventContent) 25 | { 26 | [callRejectEventContent parseJSON:JSONDictionary]; 27 | } 28 | 29 | return callRejectEventContent; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Call/Events/MXCallSelectAnswerEventContent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | #import "MXCallEventContent.h" 19 | 20 | NS_ASSUME_NONNULL_BEGIN 21 | 22 | /** 23 | `MXCallSelectAnswerEventContent` represents the content of an `m.call.select_answer` event. 24 | */ 25 | @interface MXCallSelectAnswerEventContent : MXCallEventContent 26 | 27 | /** 28 | The selected party id. 29 | */ 30 | @property (nonatomic) NSString *selectedPartyId; 31 | 32 | @end 33 | 34 | NS_ASSUME_NONNULL_END 35 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Call/MXCallCandidate.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | #import "MXJSONModel.h" 19 | 20 | /** 21 | `MXCallCandidate` represents a candidate description. 22 | */ 23 | @interface MXCallCandidate : MXJSONModel 24 | 25 | /** 26 | The SDP media type this candidate is intended for. 27 | */ 28 | @property (nonatomic) NSString *sdpMid; 29 | 30 | /** 31 | The index of the SDP 'm' line this candidate is intended for. 32 | */ 33 | @property (nonatomic) NSUInteger sdpMLineIndex; 34 | 35 | /** 36 | The SDP 'a' line of the candidate. 37 | */ 38 | @property (nonatomic) NSString *candidate; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Capabilities/MXBooleanCapability.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | #import 19 | 20 | NS_ASSUME_NONNULL_BEGIN 21 | 22 | /** 23 | Capability model for only `{"enabled": true | false}` JSON model. 24 | */ 25 | @interface MXBooleanCapability : MXJSONModel 26 | 27 | /** 28 | Flag indicating that the capability is enabled or not. 29 | */ 30 | @property (nonatomic, readonly, getter=isEnabled) BOOL enabled; 31 | 32 | @end 33 | 34 | NS_ASSUME_NONNULL_END 35 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Event/MXEventAnnotation.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXJSONModel.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | 24 | #pragma mark - Constants 25 | 26 | // "m.reaction" 27 | FOUNDATION_EXPORT NSString * _Nonnull const MXEventAnnotationReaction; 28 | 29 | 30 | /** 31 | JSON model for MXEvent.unsignedData.relations.annotation.chunk[]. 32 | */ 33 | @interface MXEventAnnotation : MXJSONModel 34 | 35 | @property (nonatomic, readonly) NSString *type; // "m.reaction" 36 | @property (nonatomic, readonly) NSString *key; // "👍" 37 | @property (nonatomic, readonly) NSUInteger count; 38 | 39 | @end 40 | 41 | NS_ASSUME_NONNULL_END 42 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Event/MXEventAnnotationChunk.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXJSONModel.h" 20 | 21 | @class MXEventAnnotation; 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | /** 26 | JSON model for MXEvent.unsignedData.relations.annotation. 27 | */ 28 | @interface MXEventAnnotationChunk : MXJSONModel 29 | 30 | @property (nonatomic, readonly) NSArray *chunk; 31 | @property (nonatomic, readonly) NSUInteger count; 32 | @property (nonatomic, readonly) BOOL limited; 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Event/MXEventReference.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXJSONModel.h" 20 | 21 | 22 | NS_ASSUME_NONNULL_BEGIN 23 | 24 | @interface MXEventReference : MXJSONModel 25 | 26 | /** 27 | Event id. 28 | */ 29 | @property (nonatomic, readonly) NSString *eventId; 30 | 31 | /** 32 | Event type. 33 | 34 | TODO: Remove nullable once Synapse respects MSC1849. 35 | */ 36 | @property (nonatomic, readonly, nullable) NSString *type; 37 | 38 | 39 | - (instancetype)initWithEventId:(NSString *)eventId type:(nullable NSString *)type; 40 | 41 | @end 42 | 43 | NS_ASSUME_NONNULL_END 44 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Event/MXEventReferenceChunk.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXJSONModel.h" 20 | #import "MXEventReference.h" 21 | 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | @interface MXEventReferenceChunk : MXJSONModel 26 | 27 | @property (nonatomic, readonly) NSArray *chunk; 28 | @property (nonatomic, readonly) NSUInteger count; 29 | @property (nonatomic, readonly) BOOL limited; 30 | 31 | - (instancetype)initWithChunk:(NSArray *)chunk count:(NSUInteger)count limited:(BOOL)limited; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Event/MXEventRelationThread.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | @interface MXEventRelationThread : MXJSONModel 22 | 23 | @property (nonatomic, readonly) MXEvent *latestEvent; 24 | @property (nonatomic, readonly) NSUInteger numberOfReplies; 25 | @property (nonatomic, readonly, getter=hasParticipated) BOOL participated; 26 | 27 | @end 28 | 29 | NS_ASSUME_NONNULL_END 30 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Event/MXEventReplace.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXJSONModel.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | @interface MXEventReplace : MXJSONModel 24 | 25 | @property (nonatomic, readonly) NSString *eventId; 26 | 27 | // TODO: Add originServerTs when it will be available. 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Event/MXInReplyTo.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import "MXJSONModel.h" 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | /** 22 | JSON model for MXEvent.content.relates_to.m.in_reply_to. 23 | */ 24 | @interface MXInReplyTo : MXJSONModel 25 | 26 | @property (nonatomic, readonly) NSString *eventId; 27 | 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Event/MXMentions.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2024 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | /** 22 | Describes whether an event mentions other users or the room 23 | */ 24 | @interface MXMentions : MXJSONModel 25 | 26 | /** 27 | The user IDs of room members who should be notified about this event. 28 | */ 29 | @property (nonatomic, nullable) NSArray *userIDs; 30 | 31 | /** 32 | Whether or not this event contains an @room mention. 33 | */ 34 | @property (nonatomic) BOOL room; 35 | 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/MXEventAssetType.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2022 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | /// Type of location asset being tracked 18 | /// See MSC 3488 for more details: https://github.com/matrix-org/matrix-spec-proposals/blob/matthew/location/proposals/3488-location.md 19 | typedef NS_ENUM(NSUInteger, MXEventAssetType) 20 | { 21 | MXEventAssetTypeGeneric, // A generic location without context 22 | MXEventAssetTypeUser, // User location, it can be static or live depending of event type 23 | MXEventAssetTypePin // Pin location (POI) 24 | }; 25 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/MXRoomAliasResolution.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2022 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | #import "MXRoomAliasResolution.h" 19 | 20 | @implementation MXRoomAliasResolution 21 | 22 | + (instancetype)modelFromJSON:(NSDictionary *)JSONDictionary 23 | { 24 | MXRoomAliasResolution *resolution = [[MXRoomAliasResolution alloc] init]; 25 | MXJSONModelSetString(resolution.roomId, JSONDictionary[@"room_id"]); 26 | MXJSONModelSetArray(resolution.servers, JSONDictionary[@"servers"]) 27 | return resolution; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/MXRoomPredecessorInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | 18 | #import 19 | #import "MXJSONModel.h" 20 | 21 | /** 22 | A `MXRoomPredecessorInfo` instance represents the predecessor informations from the content of a `m.room.create` event type. 23 | */ 24 | @interface MXRoomPredecessorInfo : MXJSONModel 25 | 26 | /** 27 | Room identifier of the previous version of the room. 28 | */ 29 | @property (nonatomic, copy, readonly, nonnull) NSString *roomId; 30 | 31 | /** 32 | Event id of the `m.room.tombstone` event type in the previous version of the room. 33 | */ 34 | @property (nonatomic, copy, readonly, nonnull) NSString *tombStoneEventId; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/MXRoomTombStoneContent.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | #import "MXJSONModel.h" 19 | 20 | /** 21 | A `MXRoomTombStoneContent` instance represents the content of a `m.room.tombstone` event type. 22 | */ 23 | @interface MXRoomTombStoneContent : MXJSONModel 24 | 25 | /** 26 | The reason message for the obsolence of the room. 27 | */ 28 | @property (nonatomic, copy, readonly, nonnull) NSString *body; 29 | 30 | /** 31 | The identifier of the room that comes in replacement. 32 | */ 33 | @property (nonatomic, copy, readonly, nonnull) NSString *replacementRoomId; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/MXTaggedEventInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import "MXJSONModel.h" 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | @interface MXTaggedEventInfo : MXJSONModel 22 | 23 | @property (nonatomic, nullable) NSArray *keywords; 24 | 25 | /** 26 | The origin server timestamp in milliseconds. 27 | */ 28 | @property (nonatomic) uint64_t originServerTs; 29 | 30 | /** 31 | The timestamp in milliseconds when this tag has been created. 32 | */ 33 | @property (nonatomic) uint64_t taggedAt; 34 | 35 | @end 36 | 37 | NS_ASSUME_NONNULL_END 38 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Push/MXPusherData.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXJSONModel.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | @interface MXPusherData : MXJSONModel 24 | 25 | /** 26 | Required if kind is http. The URL to use to send notifications to. 27 | */ 28 | @property (nonatomic, nullable, readonly) NSString *url; 29 | 30 | 31 | /** 32 | The format to use when sending notifications to the Push Gateway. 33 | */ 34 | @property (nonatomic, nullable, readonly) NSString *format; 35 | 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Sync/Group/MXGroupSyncProfile.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | /** 22 | `MXGroupSyncProfile` represents the profile of a group. 23 | */ 24 | @interface MXGroupSyncProfile : MXJSONModel 25 | 26 | /** 27 | The name of the group. 28 | */ 29 | @property (nonatomic) NSString *name; 30 | 31 | /** 32 | The URL for the group's avatar. 33 | */ 34 | @property (nonatomic) NSString *avatarUrl; 35 | 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Sync/Group/MXInvitedGroupSync.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | @class MXGroupSyncProfile; 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /** 24 | `MXInvitedGroupSync` represents a group invitation during server sync. 25 | */ 26 | @interface MXInvitedGroupSync : MXJSONModel 27 | 28 | /** 29 | The identifier of the inviter. 30 | */ 31 | @property (nonatomic) NSString *inviter; 32 | 33 | /** 34 | The group profile. 35 | */ 36 | @property (nonatomic) MXGroupSyncProfile *profile; 37 | 38 | @end 39 | 40 | NS_ASSUME_NONNULL_END 41 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Sync/MXDeviceListResponse.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | /** 22 | `MXDeviceListResponse` represents the devices that have changed. 23 | */ 24 | @interface MXDeviceListResponse : MXJSONModel 25 | 26 | /** 27 | List of user ids whose devices have changed (new, removed). 28 | */ 29 | @property (nonatomic, nullable) NSArray *changed; 30 | 31 | /** 32 | List of user ids who are no more tracked. 33 | */ 34 | @property (nonatomic, nullable) NSArray *left; 35 | 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Sync/MXPresenceSyncResponse.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | @class MXEvent; 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /** 24 | `MXPresenceSyncResponse` represents the updates to the presence status of other users during server sync. 25 | */ 26 | @interface MXPresenceSyncResponse : MXJSONModel 27 | 28 | /** 29 | List of presence events (array of MXEvent with type m.presence). 30 | */ 31 | @property (nonatomic) NSArray *events; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Sync/MXRoomInviteState.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | @class MXEvent; 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /** 24 | `MXRoomInviteState` represents the state of a room that the user has been invited to. 25 | */ 26 | @interface MXRoomInviteState : MXJSONModel 27 | 28 | /** 29 | List of state events (array of MXEvent). 30 | */ 31 | @property (nonatomic) NSArray *events; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Sync/MXToDeviceSyncResponse.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | @class MXEvent; 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /** 24 | `MXToDeviceSyncResponse` represents the data directly sent to one of user's devices. 25 | */ 26 | @interface MXToDeviceSyncResponse : MXJSONModel 27 | 28 | /** 29 | List of direct-to-device events. 30 | */ 31 | @property (nonatomic) NSArray *events; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Sync/Room/MXRoomSyncAccountData.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | @class MXEvent; 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /** 24 | `MXRoomSyncAccountData` represents the account data events for a room. 25 | */ 26 | @interface MXRoomSyncAccountData : MXJSONModel 27 | 28 | /** 29 | List of account data events (array of MXEvent). 30 | */ 31 | @property (nonatomic) NSArray *events; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Sync/Room/MXRoomSyncEphemeral.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | @class MXEvent; 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /** 24 | `MXRoomSyncEphemeral` represents the ephemeral events in the room that aren't recorded in the timeline or state of the room (e.g. typing). 25 | */ 26 | @interface MXRoomSyncEphemeral : MXJSONModel 27 | 28 | /** 29 | List of ephemeral events (array of MXEvent). 30 | */ 31 | @property (nonatomic) NSArray *events; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Sync/Room/MXRoomSyncState.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | @class MXEvent; 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /** 24 | `MXRoomSyncState` represents the state updates for a room during server sync. 25 | */ 26 | @interface MXRoomSyncState : MXJSONModel 27 | 28 | /** 29 | List of state events (array of MXEvent). The resulting state corresponds to the *start* of the timeline. 30 | */ 31 | @property (nonatomic) NSArray *events; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/Sync/Room/MXRoomSyncUnreadNotifications.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | /** 22 | `MXRoomSyncUnreadNotifications` represents the unread counts for a room. 23 | */ 24 | @interface MXRoomSyncUnreadNotifications : MXJSONModel 25 | 26 | /** 27 | The number of unread messages that match the push notification rules. 28 | */ 29 | @property (nonatomic) NSUInteger notificationCount; 30 | 31 | /** 32 | The number of highlighted unread messages (subset of notifications). 33 | */ 34 | @property (nonatomic) NSUInteger highlightCount; 35 | 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/ThirdParty/MXThirdPartyUserInstance.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | @interface MXThirdPartyUserInstance : MXJSONModel 22 | 23 | /** 24 | A Matrix User ID represting a third party user. 25 | */ 26 | @property (nonatomic) NSString *userId; 27 | 28 | /** 29 | The protocol ID that the third party user is a part of. 30 | */ 31 | @property (nonatomic) NSString *protocol; 32 | 33 | /** 34 | Information used to identify this third party user. 35 | */ 36 | @property (nonatomic) NSDictionary *fields; 37 | 38 | @end 39 | 40 | NS_ASSUME_NONNULL_END 41 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/ThirdParty/MXThirdPartyUserInstance.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import "MXThirdPartyUserInstance.h" 18 | 19 | @implementation MXThirdPartyUserInstance 20 | 21 | + (id)modelFromJSON:(NSDictionary *)JSONDictionary 22 | { 23 | MXThirdPartyUserInstance *response = [[MXThirdPartyUserInstance alloc] init]; 24 | if (response) 25 | { 26 | MXJSONModelSetString(response.userId, JSONDictionary[@"userid"]); 27 | MXJSONModelSetString(response.protocol, JSONDictionary[@"protocol"]); 28 | MXJSONModelSetDictionary(response.fields, JSONDictionary[@"fields"]); 29 | } 30 | 31 | return response; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/ThirdParty/MXThirdPartyUsersResponse.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | @class MXThirdPartyUserInstance; 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | @interface MXThirdPartyUsersResponse : MXJSONModel 24 | 25 | /** 26 | Third party users. 27 | */ 28 | @property (nonatomic) NSArray *users; 29 | 30 | @end 31 | 32 | NS_ASSUME_NONNULL_END 33 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/ThirdParty/MXThirdPartyUsersResponse.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import "MXThirdPartyUsersResponse.h" 18 | #import "MXThirdPartyUserInstance.h" 19 | 20 | @implementation MXThirdPartyUsersResponse 21 | 22 | + (instancetype)modelFromJSON:(NSDictionary *)JSONDictionary 23 | { 24 | MXThirdPartyUsersResponse *response = [[MXThirdPartyUsersResponse alloc] init]; 25 | if (response) 26 | { 27 | MXJSONModelSetMXJSONModelArray(response.users, MXThirdPartyUserInstance, (NSArray *)JSONDictionary); 28 | } 29 | 30 | return response; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /MatrixSDK/JSONModels/ThirdParty/MXThirdpartyProtocolsResponse.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | @class MXThirdPartyProtocol; 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /** 24 | `MXThirdpartyProtocolsResponse` represents the response of a thirdpartyProtocols request. 25 | */ 26 | @interface MXThirdpartyProtocolsResponse : MXJSONModel 27 | 28 | /** 29 | Available protocols. 30 | The key is the protocol name; the value, the protocol description. 31 | */ 32 | @property (nonatomic) NSDictionary *protocols; 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /MatrixSDK/Lib/NSObject+sortedKeys.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | /** 5 | Found at http://stackoverflow.com/questions/21672923/canonicalize-json-so-equivalent-objects-have-the-same-hash/21720585#21720585 6 | 7 | This category allows to produce a canonical JSON string from a NSDictionary. 8 | 9 | Usage: 10 | NSData * JSONData = [NSJSONSerialization dataWithJSONObject:[jsonObject objectWithSortedKeys] options:0 error:&error]; 11 | */ 12 | 13 | @interface NSObject (sortedKeys) 14 | 15 | /// Returns a proxy for the object in which all dictionary keys, including those of child objects at any level, will always be enumerated in sorted order. 16 | - (id)objectWithSortedKeys; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /MatrixSDK/MatrixSDKSwiftHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #ifndef MatrixSDKSwiftHeader_h 18 | #define MatrixSDKSwiftHeader_h 19 | 20 | #if __has_include() 21 | #import 22 | #elif __has_include("MatrixSDK-Swift.h") 23 | #import "MatrixSDK-Swift.h" 24 | #endif 25 | 26 | #endif /* MatrixSDKSwiftHeader_h */ 27 | -------------------------------------------------------------------------------- /MatrixSDK/MatrixSDKVersion.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | NSString *const MatrixSDKVersion = @"0.27.17"; 20 | -------------------------------------------------------------------------------- /MatrixSDK/NotificationCenter/Checker/MXPushRuleEventMatchConditionChecker.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 OpenMarket Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXPushRuleConditionChecker.h" 18 | 19 | /** 20 | `MXPushRuleEventMatchConditionChecker` checks conditions of type "event_match" (kMXPushRuleConditionStringEventMatch). 21 | */ 22 | @interface MXPushRuleEventMatchConditionChecker : NSObject 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /MatrixSDK/Room/Membership/MXMembershipTransitionState.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | /** 18 | `MXMembershipTransitionState` is an ephemeral state that represents the transitivity between the membership (MXMembership) states. 19 | */ 20 | typedef NS_ENUM(NSInteger, MXMembershipTransitionState) { 21 | MXMembershipTransitionStateUnknown, 22 | MXMembershipTransitionStateInvited, 23 | MXMembershipTransitionStateJoining, 24 | MXMembershipTransitionStateFailedJoining, 25 | MXMembershipTransitionStateJoined, 26 | MXMembershipTransitionStateLeaving, 27 | MXMembershipTransitionStateFailedLeaving, 28 | MXMembershipTransitionStateLeft 29 | }; 30 | -------------------------------------------------------------------------------- /MatrixSDK/Space/MXSpaceChildrenResponse.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | #import "MXJSONModel.h" 19 | #import "MXSpaceChildSummaryResponse.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /// Space API response 24 | @interface MXSpaceChildrenResponse : MXJSONModel 25 | 26 | /// Its presence indicates that there are more results to return. 27 | @property (nonatomic, nullable) NSString* nextBatch; 28 | 29 | /// Rooms information like name/avatar/type ... 30 | @property (nonatomic, nullable) NSArray* rooms; 31 | 32 | @end 33 | 34 | NS_ASSUME_NONNULL_END 35 | -------------------------------------------------------------------------------- /MatrixSDK/Space/MXSpaceChildrenResponse.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import "MXSpaceChildrenResponse.h" 18 | 19 | @implementation MXSpaceChildrenResponse 20 | 21 | + (id)modelFromJSON:(NSDictionary *)JSONDictionary 22 | { 23 | MXSpaceChildrenResponse *spaceChildrenResponse = [MXSpaceChildrenResponse new]; 24 | 25 | if (spaceChildrenResponse) 26 | { 27 | MXJSONModelSetString(spaceChildrenResponse.nextBatch, JSONDictionary[@"next_batch"]); 28 | MXJSONModelSetMXJSONModelArray(spaceChildrenResponse.rooms, MXSpaceChildSummaryResponse, JSONDictionary[@"rooms"]); 29 | } 30 | 31 | return spaceChildrenResponse; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /MatrixSDK/ThreePidAdd/MX3PidAddSession.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Matrix.org Foundation C.I.C 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MX3PidAddSession.h" 18 | 19 | #import "MXTools.h" 20 | 21 | @implementation MX3PidAddSession 22 | 23 | - (instancetype)initWithMedium:(NSString *)medium andAddress:(NSString *)address 24 | { 25 | self = [super init]; 26 | if (self) 27 | { 28 | _medium = [medium copy]; 29 | _address = [address copy]; 30 | _clientSecret = [MXTools generateSecret]; 31 | } 32 | return self; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /MatrixSDK/Utils/Categories/Array.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | 19 | internal extension Array { 20 | 21 | /// Split an array into smaller chunks. 22 | /// 23 | /// https://www.hackingwithswift.com/example-code/language/how-to-split-an-array-into-chunks 24 | /// 25 | /// - Parameter size: max size of splitted arrays 26 | /// - Returns: an array of splitted arrays 27 | func chunked(into size: Int) -> [[Element]] { 28 | return stride(from: 0, to: count, by: size).map { 29 | Array(self[$0 ..< Swift.min($0 + size, count)]) 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /MatrixSDK/Utils/Categories/Dictionary.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2022 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | 19 | internal extension Dictionary { 20 | func adding(key: Key, value: Value) -> [Key: Value] { 21 | var dict = self 22 | dict[key] = value 23 | return dict 24 | } 25 | 26 | func removing(key: Key) -> [Key: Value] { 27 | var dict = self 28 | dict[key] = nil 29 | return dict 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /MatrixSDK/Utils/Categories/FileManager+AppGroupContainer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2022 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | 19 | public extension FileManager { 20 | 21 | /** 22 | Get the url of the primary Matrix application group container. 23 | */ 24 | @objc func applicationGroupContainerURL() -> URL? { 25 | guard let appGroupId = MXSDKOptions.sharedInstance().applicationGroupIdentifier else { 26 | return nil 27 | } 28 | return containerURL(forSecurityApplicationGroupIdentifier: appGroupId) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /MatrixSDK/Utils/Categories/NSArray+MatrixSDK.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "NSArray+MatrixSDK.h" 18 | 19 | @implementation NSArray (MatrixSDK) 20 | 21 | - (NSArray *)mx_intersectArray:(NSArray *)array 22 | { 23 | NSMutableOrderedSet *set = [NSMutableOrderedSet orderedSetWithArray:self]; 24 | [set intersectSet: [NSSet setWithArray:array]]; 25 | 26 | return set.array; 27 | } 28 | 29 | - (NSArray*)mx_unionArray:(NSArray *)array 30 | { 31 | NSMutableOrderedSet *set = [NSMutableOrderedSet orderedSetWithArray:self]; 32 | [set unionSet:[NSSet setWithArray:array]]; 33 | 34 | return set.array; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /MatrixSDK/Utils/Categories/NSArray.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | 19 | internal extension NSArray { 20 | 21 | /// Merges two array. 22 | /// - Parameters: 23 | /// - lhs: First operand 24 | /// - rhs: Second operand 25 | /// - Returns: Merged array. 26 | static func + (lhs: NSArray, rhs: NSArray) -> NSArray { 27 | let array = NSMutableArray(array: lhs) 28 | rhs.forEach { array.add($0) } 29 | return array 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /MatrixSDK/Utils/MXDateProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2022 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | 19 | protocol MXDateProviding { 20 | func currentDate() -> Date 21 | } 22 | 23 | struct MXDateProvider: MXDateProviding { 24 | func currentDate() -> Date { 25 | Date() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /MatrixSDK/Utils/Profiling/MXBaseProfiler.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | #import "MXProfiler.h" 20 | #import "MXAnalyticsDelegate.h" 21 | 22 | NS_ASSUME_NONNULL_BEGIN 23 | 24 | /** 25 | A profiler that sends data to analytics. 26 | */ 27 | @interface MXBaseProfiler : NSObject 28 | 29 | @property (nonatomic, weak, nullable) id analytics; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /MatrixSDK/Utils/Profiling/MXTaskProfile_Private.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import "MXTaskProfile.h" 18 | 19 | 20 | NS_ASSUME_NONNULL_BEGIN 21 | 22 | /** 23 | The `MXTaskProfile_Private` extension exposes internal operations. 24 | */ 25 | @interface MXTaskProfile () 26 | 27 | - (instancetype)initWithName:(MXTaskProfileName)name; 28 | 29 | - (void)markAsCompleted; 30 | 31 | - (void)markAsPaused; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | 37 | -------------------------------------------------------------------------------- /MatrixSDK/Utils/Protocols/MXSummable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | 19 | public protocol MXSummable { 20 | static func +(lhs: Self, rhs: Self) -> Self 21 | } 22 | -------------------------------------------------------------------------------- /MatrixSDK/Utils/Realm/MXRealmHelper.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 New Vector Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class RLMRealmConfiguration; 20 | 21 | @interface MXRealmHelper : NSObject 22 | 23 | /** 24 | Get the Realm file extension. 25 | 26 | @return The Realm file extension. 27 | */ 28 | + (NSString*)realmFileExtension; 29 | 30 | /** 31 | Delete Realm files associated to a Realm configuration with file persistence. 32 | 33 | @param realmConfiguration The Realm configuration with a file URL. 34 | */ 35 | + (void)deleteRealmFilesForConfiguration:(RLMRealmConfiguration*)realmConfiguration; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /MatrixSDKExtensions/MXAnalyticsDelegate/GoogleAnalytics/MXGoogleAnalytics.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Avery Pierce 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | #import "MXAnalyticsDelegate.h" 19 | 20 | /** 21 | The `MXGoogleAnalytics` class is an implementation of the 22 | `MXAnalyticsDelegate` that reports stats to Google analytics. 23 | If the Google Analytics library is not available at runtime, 24 | this class does nothing. 25 | */ 26 | @interface MXGoogleAnalytics : NSObject 27 | @end 28 | -------------------------------------------------------------------------------- /MatrixSDKExtensions/VoIP/Jingle/MXJingleCallAudioSessionConfigurator.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Vector Creations Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXCallAudioSessionConfigurator.h" 20 | 21 | /** 22 | The `MXJingleCallAudioSessionConfigurator` is the implementation of the `MXCallAudioSessionConfigurator` protocol for using with WebRTC. 23 | */ 24 | @interface MXJingleCallAudioSessionConfigurator : NSObject 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /MatrixSDKExtensions/VoIP/Jingle/MXJingleCallStack.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 OpenMarket Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXCallStack.h" 20 | 21 | #import "MXJingleCallAudioSessionConfigurator.h" 22 | 23 | /** 24 | `MXJingleCallStack` is the implementation of the `MXCallStack` protocol using 25 | libjingle. 26 | 27 | @see https://developers.google.com/talk/libjingle/developer_guide 28 | */ 29 | NS_EXTENSION_UNAVAILABLE_IOS("Camera capture and video rendering are not available in app extensions.") 30 | @interface MXJingleCallStack : NSObject 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /MatrixSDKTests/Crypto/CrossSigning/Data/MXCrossSigningInfo_v0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-ios-sdk/36c9232c3167558a7d936f10e8bfa8d4a38deb7a/MatrixSDKTests/Crypto/CrossSigning/Data/MXCrossSigningInfo_v0 -------------------------------------------------------------------------------- /MatrixSDKTests/Crypto/CrossSigning/Data/MXCrossSigningInfo_v1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-ios-sdk/36c9232c3167558a7d936f10e8bfa8d4a38deb7a/MatrixSDKTests/Crypto/CrossSigning/Data/MXCrossSigningInfo_v1 -------------------------------------------------------------------------------- /MatrixSDKTests/Crypto/CryptoMachine/DecryptedEvent+Stub.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2022 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | import MatrixSDKCrypto 19 | 20 | extension DecryptedEvent { 21 | static func stub( 22 | clearEvent: [AnyHashable: Any] 23 | ) -> DecryptedEvent { 24 | return .init( 25 | clearEvent: MXTools.serialiseJSONObject(clearEvent), 26 | senderCurve25519Key: "", 27 | claimedEd25519Key: nil, 28 | forwardingCurve25519Chain: [], 29 | shieldState: .init( 30 | color: .none, 31 | code: nil, 32 | message: nil 33 | ) 34 | ) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /MatrixSDKTests/Crypto/CryptoMachine/MXKeyProviderStub.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2023 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | 19 | class MXKeyProviderStub: NSObject, MXKeyProviderDelegate { 20 | func isEncryptionAvailableForData(ofType dataType: String) -> Bool { 21 | return true 22 | } 23 | 24 | func hasKeyForData(ofType dataType: String) -> Bool { 25 | return true 26 | } 27 | 28 | func keyDataForData(ofType dataType: String) -> MXKeyData? { 29 | MXRawDataKey(key: "1234".data(using: .ascii)!) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /MatrixSDKTests/Crypto/Migration/LegacyRealmStore/archived_encrypted_event: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-ios-sdk/36c9232c3167558a7d936f10e8bfa8d4a38deb7a/MatrixSDKTests/Crypto/Migration/LegacyRealmStore/archived_encrypted_event -------------------------------------------------------------------------------- /MatrixSDKTests/Crypto/Migration/LegacyRealmStore/legacy_deprecated1_account.realm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-ios-sdk/36c9232c3167558a7d936f10e8bfa8d4a38deb7a/MatrixSDKTests/Crypto/Migration/LegacyRealmStore/legacy_deprecated1_account.realm -------------------------------------------------------------------------------- /MatrixSDKTests/Crypto/Migration/LegacyRealmStore/legacy_deprecated3_account.realm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-ios-sdk/36c9232c3167558a7d936f10e8bfa8d4a38deb7a/MatrixSDKTests/Crypto/Migration/LegacyRealmStore/legacy_deprecated3_account.realm -------------------------------------------------------------------------------- /MatrixSDKTests/Crypto/Migration/LegacyRealmStore/legacy_unverified_account.realm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-ios-sdk/36c9232c3167558a7d936f10e8bfa8d4a38deb7a/MatrixSDKTests/Crypto/Migration/LegacyRealmStore/legacy_unverified_account.realm -------------------------------------------------------------------------------- /MatrixSDKTests/Crypto/Migration/LegacyRealmStore/legacy_verified_account.realm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-ios-sdk/36c9232c3167558a7d936f10e8bfa8d4a38deb7a/MatrixSDKTests/Crypto/Migration/LegacyRealmStore/legacy_verified_account.realm -------------------------------------------------------------------------------- /MatrixSDKTests/Crypto/Migration/LegacyRealmStore/legacy_version2_account.realm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-ios-sdk/36c9232c3167558a7d936f10e8bfa8d4a38deb7a/MatrixSDKTests/Crypto/Migration/LegacyRealmStore/legacy_version2_account.realm -------------------------------------------------------------------------------- /MatrixSDKTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /MatrixSDKTests/MXBaseKeyBackupTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2022 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #import 18 | 19 | #import "MatrixSDKTestsData.h" 20 | #import "MatrixSDKTestsE2EData.h" 21 | 22 | NS_ASSUME_NONNULL_BEGIN 23 | 24 | @interface MXBaseKeyBackupTests : XCTestCase 25 | { 26 | MatrixSDKTestsData *matrixSDKTestsData; 27 | MatrixSDKTestsE2EData *matrixSDKTestsE2EData; 28 | } 29 | 30 | - (NSString*)algorithm; 31 | - (MXKeyBackupVersion*)fakeKeyBackupVersion; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /MatrixSDKTests/MXDeviceListOperationsPoolTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import XCTest 18 | 19 | import MatrixSDK 20 | 21 | class MXDeviceListOperationsPoolTests: XCTestCase { 22 | 23 | func testDeallocate() { 24 | var pool: MXDeviceListOperationsPool? = MXDeviceListOperationsPool(crypto: nil) 25 | weak var weakPool = pool 26 | MXDeviceListOperation(userIds: ["foo"], success: nil, failure: nil).add(to: pool) 27 | pool = nil 28 | XCTAssertNil(weakPool) 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /MatrixSDKTests/MatrixSDKTests-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #ifndef MatrixSDKTests_Bridging_Header_h 18 | #define MatrixSDKTests_Bridging_Header_h 19 | 20 | #import "MatrixSDKTestsData.h" 21 | #import "MatrixSDKTestsE2EData.h" 22 | #import "MXBackgroundTask.h" 23 | #import "MXUIKitBackgroundModeHandler.h" 24 | #import "MXApplicationProtocol.h" 25 | #import "MXRestClientStub.h" 26 | #import "MXCurve25519BackupAuthData.h" 27 | #import "MXAes256BackupAuthData.h" 28 | #import "MXSecretStorage_Private.h" 29 | #import "MXEncryptedSecretContent.h" 30 | 31 | #endif /* MatrixSDKTests_Bridging_Header_h */ 32 | -------------------------------------------------------------------------------- /MatrixSDKTests/MatrixSDKTestsSwiftHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 The Matrix.org Foundation C.I.C 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #ifndef MatrixSDKTestsSwiftHeader_h 18 | #define MatrixSDKTestsSwiftHeader_h 19 | 20 | 21 | #if __has_include() 22 | #import 23 | #elif __has_include("MatrixSDKTests-Swift.h") 24 | #import "MatrixSDKTests-Swift.h" 25 | #else 26 | #endif 27 | 28 | #endif /* MatrixSDKTestsSwiftHeader_h */ 29 | -------------------------------------------------------------------------------- /MatrixSDKTests/Mocks/MXMockCallStack.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 OpenMarket Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXCallStack.h" 20 | #import "MXCallEventContent.h" 21 | 22 | /** 23 | `MXMockCallStack` is a mock implementation of the `MXOpenWebRTCCall` protocol. 24 | */ 25 | @interface MXMockCallStack : NSObject 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /MatrixSDKTests/Mocks/MXMockCallStack.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 OpenMarket Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "MXMockCallStack.h" 18 | 19 | #import "MXMockCallStackCall.h" 20 | 21 | @implementation MXMockCallStack 22 | 23 | - (instancetype)init 24 | { 25 | self = [super init]; 26 | if (self) 27 | { 28 | } 29 | return self; 30 | } 31 | 32 | - (id)createCall 33 | { 34 | return [[MXMockCallStackCall alloc] init]; 35 | } 36 | 37 | @end 38 | 39 | -------------------------------------------------------------------------------- /MatrixSDKTests/Mocks/MXMockCallStackCall.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 OpenMarket Ltd 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | #import "MXCallStackCall.h" 20 | 21 | /** 22 | `MXMockCallStackCall` is a mock implementation of the `MXMCallStackCall` protocol. 23 | */ 24 | @interface MXMockCallStackCall : NSObject 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /MatrixSDKTests/TestPlans/AllTests.xctestplan: -------------------------------------------------------------------------------- 1 | { 2 | "configurations" : [ 3 | { 4 | "id" : "1FA4678B-FC03-4484-997A-D8629931F24B", 5 | "name" : "Configuration 1", 6 | "options" : { 7 | 8 | } 9 | } 10 | ], 11 | "defaultOptions" : { 12 | "codeCoverage" : { 13 | "targets" : [ 14 | { 15 | "containerPath" : "container:MatrixSDK.xcodeproj", 16 | "identifier" : "B14EF1C72397E90400758AF0", 17 | "name" : "MatrixSDK-macOS" 18 | } 19 | ] 20 | }, 21 | "targetForVariableExpansion" : { 22 | "containerPath" : "container:MatrixSDK.xcodeproj", 23 | "identifier" : "B14EF1C72397E90400758AF0", 24 | "name" : "MatrixSDK-macOS" 25 | }, 26 | "uiTestingScreenshotsLifetime" : "keepNever", 27 | "userAttachmentLifetime" : "keepNever" 28 | }, 29 | "testTargets" : [ 30 | { 31 | "target" : { 32 | "containerPath" : "container:MatrixSDK.xcodeproj", 33 | "identifier" : "B1E09A0D2397FA950057C069", 34 | "name" : "MatrixSDKTests-macOS" 35 | } 36 | } 37 | ], 38 | "version" : 1 39 | } 40 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | source 'https://cdn.cocoapods.org/' 2 | 3 | # Uncomment this line to define a global platform for your project 4 | 5 | # Expose Objective-C frameworks to Swift 6 | # Build and link dependencies as static frameworks 7 | use_frameworks! :linkage => :static 8 | 9 | abstract_target 'MatrixSDK' do 10 | 11 | pod 'AFNetworking', '~> 4.0.0' 12 | pod 'GZIP', '~> 1.3.0' 13 | 14 | pod 'SwiftyBeaver', '1.9.5' 15 | 16 | pod 'Realm', '10.27.0' 17 | pod 'libbase58', '~> 0.1.4' 18 | pod 'MatrixSDKCrypto', '0.11.0', :inhibit_warnings => true 19 | 20 | target 'MatrixSDK-iOS' do 21 | platform :ios, '13.0' 22 | 23 | target 'MatrixSDKTests-iOS' do 24 | inherit! :search_paths 25 | pod 'OHHTTPStubs', '~> 9.1.0' 26 | end 27 | end 28 | 29 | target 'MatrixSDK-macOS' do 30 | platform :osx, '10.15' 31 | 32 | target 'MatrixSDKTests-macOS' do 33 | inherit! :search_paths 34 | pod 'OHHTTPStubs', '~> 9.1.0' 35 | end 36 | end 37 | end 38 | 39 | post_install do |installer| 40 | installer.pods_project.targets.each do |target| 41 | target.build_configurations.each do |config| 42 | config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /changelog.d/.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore 2 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | status: 3 | project: 4 | default: 5 | # Commits pushed to master should not make the overall 6 | # project coverage decrease by more than 1%: 7 | target: auto 8 | threshold: 1% 9 | patch: false 10 | -------------------------------------------------------------------------------- /lint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | set -x 5 | 6 | pod update 7 | 8 | # Force lib lint on last Swift version 9 | echo "4.1" > .swift-version 10 | 11 | # Run CocoaPod lint in order to check pod submission 12 | bundle exec fastlane lint_pods 13 | -------------------------------------------------------------------------------- /scripts/symbolicate/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything 2 | * 3 | 4 | # But not these files... 5 | !.gitignore 6 | !*.py 7 | -------------------------------------------------------------------------------- /scripts/symbolicate/credentials.py: -------------------------------------------------------------------------------- 1 | # Your credentials on Matrix.org Jenkins 2 | jenkins = { 3 | 'login' : '', 4 | 'password' : '' 5 | } -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | set -x 5 | 6 | pod install 7 | #xcodebuild -workspace MatrixSDK.xcworkspace/ -scheme MatrixSDK -sdk iphonesimulator analyze 8 | 9 | git -C synapse pull || git clone https://github.com/matrix-org/synapse 10 | [ -d venv ] || virtualenv venv 11 | . venv/bin/activate 12 | 13 | #pip install --process-dependency-links synapse/ 14 | #python synapse/synapse/python_dependencies.py | xargs -n1 pip install 15 | 16 | pip install --upgrade pip 17 | pip install --upgrade --process-dependency-links https://github.com/matrix-org/synapse/tarball/master 18 | 19 | basedir=`pwd` 20 | function cleanup { 21 | echo `date "+%F %T"` - clean up 22 | cd $basedir 23 | cd synapse/demo 24 | ./stop.sh 25 | } 26 | trap cleanup EXIT 27 | 28 | cd synapse/demo 29 | ./stop.sh || true 30 | ./clean.sh 31 | ./start.sh --no-rate-limit 32 | 33 | echo `date "+%F %T"` - start xcode 34 | cd ../.. 35 | xcodebuild -workspace MatrixSDK.xcworkspace/ -scheme MatrixSDK -sdk iphonesimulator -destination 'name=iPhone 5s' test 2>&1 | ocunit2junit 36 | echo `date "+%F %T"` - xcode ended 37 | -------------------------------------------------------------------------------- /towncrier.toml: -------------------------------------------------------------------------------- 1 | [tool.towncrier] 2 | name = "Changes in" 3 | filename = "CHANGES.md" 4 | directory = "changelog.d" 5 | template = "changelog.d/_template.md.jinja" 6 | 7 | [[tool.towncrier.type]] 8 | directory = "feature" 9 | name = "✨ Features" 10 | showcontent = true 11 | 12 | [[tool.towncrier.type]] 13 | directory = "change" 14 | name = "🙌 Improvements" 15 | showcontent = true 16 | 17 | [[tool.towncrier.type]] 18 | directory = "bugfix" 19 | name = "🐛 Bugfixes" 20 | showcontent = true 21 | 22 | [[tool.towncrier.type]] 23 | directory = "api" 24 | name = "⚠️ API Changes" 25 | showcontent = true 26 | 27 | [[tool.towncrier.type]] 28 | directory = "i18n" 29 | name = "🗣 Translations" 30 | showcontent = true 31 | 32 | [[tool.towncrier.type]] 33 | directory = "build" 34 | name = "🧱 Build" 35 | showcontent = true 36 | 37 | [[tool.towncrier.type]] 38 | directory = "doc" 39 | name = "📄 Documentation" 40 | showcontent = true 41 | 42 | [[tool.towncrier.type]] 43 | directory = "wip" 44 | name = "🚧 In development 🚧" 45 | showcontent = true 46 | 47 | [[tool.towncrier.type]] 48 | directory = "misc" 49 | name = "Others" 50 | showcontent = true 51 | --------------------------------------------------------------------------------