MLSConversationDataSource

internal class MLSConversationDataSource(selfUserId: UserId, keyPackageRepository: KeyPackageRepository, conversationDAO: ConversationDAO, clientApi: ClientApi, mlsPublicKeysRepository: MLSPublicKeysRepository, proposalTimersFlow: MutableSharedFlow<ProposalTimer>, keyPackageLimitsProvider: KeyPackageLimitsProvider, mutex: Mutex, idMapper: IdMapper = MapperProvider.idMapper(), conversationMapper: ConversationMapper = MapperProvider.conversationMapper(selfUserId), dispatchers: KaliumDispatcher = KaliumDispatcherImpl) : MLSConversationRepository

Constructors

Link copied to clipboard
constructor(selfUserId: UserId, keyPackageRepository: KeyPackageRepository, conversationDAO: ConversationDAO, clientApi: ClientApi, mlsPublicKeysRepository: MLSPublicKeysRepository, proposalTimersFlow: MutableSharedFlow<ProposalTimer>, keyPackageLimitsProvider: KeyPackageLimitsProvider, mutex: Mutex, idMapper: IdMapper = MapperProvider.idMapper(), conversationMapper: ConversationMapper = MapperProvider.conversationMapper(selfUserId), dispatchers: KaliumDispatcher = KaliumDispatcherImpl)

Functions

Link copied to clipboard
open suspend override fun addMemberToMLSGroup(mlsContext: MlsCoreCryptoContext, groupID: GroupID, userIdList: List<UserId>, cipherSuite: CipherSuite, allowPartialMemberList: Boolean = false): Either<CoreFailure, MLSAdditionResult>
Link copied to clipboard
open suspend override fun clearProposalTimer(groupID: GroupID)
Link copied to clipboard
open suspend override fun commitPendingProposals(mlsContext: MlsCoreCryptoContext, groupID: GroupID): Either<CoreFailure, Unit>
Link copied to clipboard
open suspend override fun decryptMessage(mlsContext: MlsCoreCryptoContext, message: ByteArray, groupID: GroupID): Either<CoreFailure, List<DecryptedMessageBundle>>
Link copied to clipboard
open suspend override fun encryptMessage(mlsContext: MlsCoreCryptoContext, groupID: GroupID, content: ByteArray): Either<CoreFailure, ByteArray>
Link copied to clipboard
open suspend override fun encryptTargetedMessage(mlsContext: MlsCoreCryptoContext, groupID: GroupID, recipient: CryptoQualifiedClientId, content: ByteArray, transient: Boolean): Either<CoreFailure, ByteArray>
Link copied to clipboard
open suspend override fun encryptTransientMessage(mlsContext: MlsCoreCryptoContext, groupID: GroupID, content: ByteArray): Either<CoreFailure, ByteArray>
Link copied to clipboard
open suspend override fun establishMLSGroup(mlsContext: MlsCoreCryptoContext, groupID: GroupID, members: List<UserId>, publicKeys: MLSPublicKeys? = null, allowSkippingUsersWithoutKeyPackages: Boolean = false): Either<CoreFailure, MLSAdditionResult>

Establishes an MLS (Messaging Layer Security) group with the specified group ID and members.

Link copied to clipboard
open suspend override fun establishMLSSubConversationGroup(mlsContext: MlsCoreCryptoContext, groupID: GroupID, parentId: ConversationId): Either<CoreFailure, Unit>
Link copied to clipboard
open suspend override fun getClientIdentity(mlsContext: MlsCoreCryptoContext, clientId: ClientId): Either<CoreFailure, WireIdentity?>
Link copied to clipboard
open suspend override fun getLocalGroupEpoch(mlsContext: MlsCoreCryptoContext, groupID: GroupID): Either<CoreFailure, ULong>
Link copied to clipboard
open suspend override fun getMembersIdentities(mlsClient: MLSClient, conversationId: ConversationId, userIds: List<UserId>): Either<CoreFailure, Map<UserId, List<WireIdentity>>>
open suspend override fun getMLSGroupsRequiringKeyingMaterialUpdate(threshold: Duration): Either<CoreFailure, List<GroupID>>
Link copied to clipboard
open suspend override fun getUserIdentity(mlsContext: MlsCoreCryptoContext, userId: UserId): Either<CoreFailure, List<WireIdentity>>
Link copied to clipboard
open suspend override fun hasEstablishedMLSGroup(mlsContext: MlsCoreCryptoContext, groupID: GroupID): Either<MLSFailure, Boolean>
Link copied to clipboard
open suspend override fun hasWrongExternalSender(mlsContext: MlsCoreCryptoContext, groupID: GroupID, cipherSuite: CipherSuite): Either<CoreFailure, Boolean>

Whether the external sender of groupID, a group hosted on the self backend, is not the self backend's removal key, so every proposal the backend sends to the group fails its signature check.

Link copied to clipboard
open suspend override fun isLocalGroupEpochStale(mlsContext: MlsCoreCryptoContext, groupID: GroupID, currentRemoteEpoch: ULong): Either<CoreFailure, Boolean>

Determines whether the known group epoch is stale (outdated), when compared to the provided epoch.

Link copied to clipboard
open suspend override fun joinGroupByExternalCommit(mlsContext: MlsCoreCryptoContext, groupID: GroupID, groupInfo: ByteArray): Either<CoreFailure, Unit>
Link copied to clipboard
open suspend override fun leaveGroup(mlsContext: MlsCoreCryptoContext, groupID: GroupID): Either<CoreFailure, Unit>
Link copied to clipboard
open suspend override fun migrateConversationCredential(mlsContext: MlsCoreCryptoContext, credentialRef: CryptoCredentialRef, groupID: GroupID)

Migrate groupID when it still uses another credential.

Link copied to clipboard
open override fun observeProposalTimers(): Flow<ProposalTimer>
Link copied to clipboard
open suspend override fun prepareX509KeyPackages(mlsContext: MlsCoreCryptoContext, credentialRef: CryptoCredentialRef): PreparedX509KeyPackages

Generate a replacement set of key packages for an installed credential.

Link copied to clipboard
open suspend override fun removeClientsFromMLSGroup(mlsContext: MlsCoreCryptoContext, groupID: GroupID, clientIdList: List<QualifiedClientID>): Either<CoreFailure, Unit>
Link copied to clipboard
open suspend override fun removeMembersFromMLSGroup(mlsContext: MlsCoreCryptoContext, groupID: GroupID, userIdList: List<UserId>): Either<CoreFailure, Unit>
Link copied to clipboard
open suspend override fun replaceX509KeyPackages(clientId: ClientId, preparedKeyPackages: PreparedX509KeyPackages): Either<E2EIFailure, Unit>

Replace backend key packages. This must run outside a Core Crypto transaction.

Link copied to clipboard
open suspend override fun setProposalTimer(timer: ProposalTimer, inMemory: Boolean = false)
Link copied to clipboard
open suspend override fun updateGroupIdAndState(conversationId: ConversationId, newGroupId: GroupID, newEpoch: Long, groupState: ConversationEntity.GroupState = ConversationEntity.GroupState.PENDING_JOIN): Either<CoreFailure, Unit>
Link copied to clipboard
open suspend override fun updateKeyingMaterial(mlsContext: MlsCoreCryptoContext, groupID: GroupID): Either<CoreFailure, Unit>