Introduce Luna.Identity project with user identity service, pairing code generation, and channel linking. Channels (Telegram, CLI) now verify link status before routing messages and prompt users to pair via the web interface. WebChannel handles /link <channel-type> <code> commands to complete the pairing flow. Fix inverted expiration check in IsPairingCodeExpired that caused codes to be treated as expired immediately after creation.
46 lines
1.6 KiB
C#
46 lines
1.6 KiB
C#
using Luna.Channels.Abstractions;
|
|
using Luna.Shared;
|
|
|
|
namespace Luna.Channels.Tests.Stubs;
|
|
|
|
public class TelegramChannelStub : IChannel
|
|
{
|
|
public string ChannelId => throw new NotImplementedException();
|
|
public string ChannelType => throw new NotImplementedException();
|
|
public string DisplayName => throw new NotImplementedException();
|
|
public bool IsConnected => throw new NotImplementedException();
|
|
|
|
public event ChannelMessageReceivedEventHandler? MessageReceived;
|
|
public event ChannelConnectionChangedEventHandler? ConnectionStateChanged;
|
|
|
|
public Task<bool> VerifyChannelLinkAsync()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public Task SendMessageAsync(ChannelMessage message, CancellationToken cancellationToken = default) =>
|
|
throw new NotImplementedException();
|
|
|
|
public Task SendStreamingMessageAsync(
|
|
IAsyncEnumerable<ChatStreamUpdate> messageStream,
|
|
CancellationToken cancellationToken = default) =>
|
|
throw new NotImplementedException();
|
|
|
|
public void RaiseMessageReceived(object? sender, ChannelMessage message)
|
|
{
|
|
RaiseMessageReceived(new ChannelMessageReceivedEventArgs
|
|
{
|
|
Channel = this,
|
|
Message = message
|
|
});
|
|
}
|
|
|
|
public void Dispose() => throw new NotImplementedException();
|
|
|
|
internal void RaiseMessageReceived(ChannelMessageReceivedEventArgs args) =>
|
|
MessageReceived?.Invoke(this, args);
|
|
|
|
internal void RaiseConnectionStateChanged(ChannelConnectionEventArgs args) =>
|
|
ConnectionStateChanged?.Invoke(this, args);
|
|
}
|