Table of Contents

Class ChannelService

Namespace
EchoHub.Server.Services
Assembly
EchoHub.Server.dll
public class ChannelService : IChannelService
Inheritance
ChannelService
Implements
Inherited Members

Constructors

ChannelService(IServiceScopeFactory, PresenceTracker, SpamGuard, ServerLogsService, ILogger<ChannelService>)

public ChannelService(IServiceScopeFactory scopeFactory, PresenceTracker presenceTracker, SpamGuard spamGuard, ServerLogsService serverLogs, ILogger<ChannelService> logger)

Parameters

scopeFactory IServiceScopeFactory
presenceTracker PresenceTracker
spamGuard SpamGuard
serverLogs ServerLogsService
logger ILogger<ChannelService>

Methods

CreateChannelAsync(Guid, string, string?, bool, string?, string?, string?)

public Task<ChannelOperationResult> CreateChannelAsync(Guid creatorUserId, string name, string? topic, bool isPublic, string? password = null, string? encryptionSalt = null, string? wrappedRoomKey = null)

Parameters

creatorUserId Guid
name string
topic string
isPublic bool
password string
encryptionSalt string
wrappedRoomKey string

Returns

Task<ChannelOperationResult>

DeleteChannelAsync(Guid, string)

public Task<ChannelOperationResult> DeleteChannelAsync(Guid callerUserId, string channelName)

Parameters

callerUserId Guid
channelName string

Returns

Task<ChannelOperationResult>

EnsureChannelMembershipAsync(Guid, string, string?)

public Task<(bool Success, string? Error, bool PasswordRequired)> EnsureChannelMembershipAsync(Guid userId, string channelName, string? password = null)

Parameters

userId Guid
channelName string
password string

Returns

Task<(bool Success, string Error, bool PasswordRequired)>

EnsureSystemChannelAsync(string, string?)

public Task<ChannelDto> EnsureSystemChannelAsync(string channelName, string? topic = null)

Parameters

channelName string
topic string

Returns

Task<ChannelDto>

GetChannelByNameAsync(string)

public Task<ChannelDto?> GetChannelByNameAsync(string channelName)

Parameters

channelName string

Returns

Task<ChannelDto>

GetChannelCryptoAsync(string)

public Task<ChannelCryptoDto?> GetChannelCryptoAsync(string channelName)

Parameters

channelName string

Returns

Task<ChannelCryptoDto>

GetChannelKeyEnvelopeAsync(string)

public Task<(string? EncryptionSalt, string? WrappedRoomKey)> GetChannelKeyEnvelopeAsync(string channelName)

Parameters

channelName string

Returns

Task<(string EncryptionSalt, string WrappedRoomKey)>

GetChannelListAsync()

public Task<List<ChannelListItem>> GetChannelListAsync()

Returns

Task<List<ChannelListItem>>

GetChannelMetaAsync(string)

public Task<ChannelMetaDto?> GetChannelMetaAsync(string channelName)

Parameters

channelName string

Returns

Task<ChannelMetaDto>

GetChannelTopicAsync(string)

public Task<(string? Topic, bool Exists)> GetChannelTopicAsync(string channelName)

Parameters

channelName string

Returns

Task<(string Topic, bool Exists)>

GetChannelsAsync(Guid, int, int)

public Task<PaginatedResponse<ChannelDto>> GetChannelsAsync(Guid userId, int offset, int limit)

Parameters

userId Guid
offset int
limit int

Returns

Task<PaginatedResponse<ChannelDto>>

RekeyChannelAsync(Guid, string, string, string, string, string)

Changes an encrypted channel's passphrase by swapping the join-gate hash and the wrapped room key. The room content key itself never changes, so history stays readable — the client re-wraps it under the new passphrase-derived key. Creator only: admins cannot rekey a room whose passphrase they don't know.

public Task<ChannelOperationResult> RekeyChannelAsync(Guid callerUserId, string channelName, string oldPassword, string newPassword, string newEncryptionSalt, string newWrappedRoomKey)

Parameters

callerUserId Guid
channelName string
oldPassword string
newPassword string
newEncryptionSalt string
newWrappedRoomKey string

Returns

Task<ChannelOperationResult>

SetChannelPasswordAsync(Guid, string, string?)

Sets, changes, or clears (null) a channel's join password. Creator or admin only. Not available on end-to-end encrypted channels — those change passphrase via RekeyChannelAsync(Guid, string, string, string, string, string) so the room key envelope stays consistent.

public Task<ChannelOperationResult> SetChannelPasswordAsync(Guid callerUserId, string channelName, string? password)

Parameters

callerUserId Guid
channelName string
password string

Returns

Task<ChannelOperationResult>

UpdateTopicAsync(Guid, string, string?)

public Task<ChannelOperationResult> UpdateTopicAsync(Guid callerUserId, string channelName, string? topic)

Parameters

callerUserId Guid
channelName string
topic string

Returns

Task<ChannelOperationResult>