Add user identity system with channel pairing and web /link command
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.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Luna.Channels.Abstractions;
|
||||
using Luna.Configuration;
|
||||
using Luna.Identity.Abstractions;
|
||||
using Luna.Shared;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -11,6 +12,7 @@ namespace Luna.Channels.Telegram;
|
||||
|
||||
public class TelegramAdapter(
|
||||
IChannelManager channelManager,
|
||||
IUserIdentityService identityService,
|
||||
ITelegramBotClient botClient,
|
||||
TelegramOptions options,
|
||||
ILogger<TelegramAdapter> adapterLogger,
|
||||
@@ -60,6 +62,9 @@ public class TelegramAdapter(
|
||||
return;
|
||||
}
|
||||
|
||||
if (await channel.VerifyChannelLinkAsync() == false)
|
||||
return;
|
||||
|
||||
var channelMessage = new ChannelMessage(
|
||||
MessageId: message.Id.ToString(),
|
||||
ConversationId: chat.Id.ToString(),
|
||||
@@ -86,6 +91,7 @@ public class TelegramAdapter(
|
||||
var channel = new TelegramChannel(
|
||||
chatId.ToString(),
|
||||
botClient,
|
||||
identityService,
|
||||
channelLogger,
|
||||
options);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user