/** * Channel Access Control Utilities * * Implements hierarchical access control for groups and topics * */ import type { NormalizedAllowFrom, AllowFromMatch, GroupAccessResult, GroupPolicy } from '@xopcai/xopc/channels/channel-domain.js'; import type { TelegramGroupConfig, TelegramTopicConfig } from './config-types.js'; /** * Normalize allowFrom list to structured format */ export declare function normalizeAllowFrom(list?: Array): NormalizedAllowFrom; /** * Normalize allowFrom combining config and store */ export declare function normalizeAllowFromWithStore(params: { allowFrom?: Array; storeAllowFrom?: string[]; }): NormalizedAllowFrom; /** * Check if sender is allowed based on normalized allowFrom */ export declare function isSenderAllowed(params: { allow: NormalizedAllowFrom; senderId?: string; senderUsername?: string; }): boolean; /** * Resolve sender allowlist match */ export declare function resolveSenderAllowMatch(params: { allow: NormalizedAllowFrom; senderId?: string; senderUsername?: string; }): AllowFromMatch; /** * Evaluate base group access (group/topic enabled, allowFrom override) */ export declare function evaluateGroupBaseAccess(params: { isGroup: boolean; groupConfig?: TelegramGroupConfig; topicConfig?: TelegramTopicConfig; hasGroupAllowOverride: boolean; effectiveGroupAllow: NormalizedAllowFrom; senderId?: string; senderUsername?: string; }): GroupAccessResult; /** * Evaluate group policy access (open/disabled/allowlist) */ export declare function evaluateGroupPolicyAccess(params: { isGroup: boolean; groupPolicy: GroupPolicy; effectiveGroupAllow: NormalizedAllowFrom; senderId?: string; senderUsername?: string; }): GroupAccessResult; /** * Resolve group policy from config hierarchy */ export declare function resolveGroupPolicy(params: { topicConfig?: TelegramTopicConfig; groupConfig?: TelegramGroupConfig; accountGroupPolicy?: GroupPolicy; defaultGroupPolicy?: GroupPolicy; }): GroupPolicy; /** * Resolve requireMention from config hierarchy */ export declare function resolveRequireMention(params: { topicConfig?: TelegramTopicConfig; groupConfig?: TelegramGroupConfig; defaultRequireMention?: boolean; }): boolean; /** * Build mention regexes for bot username */ export declare function buildMentionRegex(botUsername: string): RegExp; /** * Check if message has bot mention (text or entity) */ export declare function hasBotMention(params: { botUsername: string; text?: string; entities?: Array<{ type: string; offset: number; length: number; }>; }): boolean; /** * Remove bot mention from text */ export declare function removeBotMention(text: string, botUsername: string): string;