package e2ee // Manager holds the process-wide selected E2EE backend (or none, if E2EE // is disabled), reachable from both the xmpp and telegram packages without // either importing the other's e2ee-specific glue (see gateway.E2EE, set by // xmpp.NewComponent, which both packages already import). type Manager struct { backend Backend } // NewManager wraps backend for process-wide access. Pass nil to represent // E2EE being disabled - every call site is expected to treat that the same // as "behave exactly as if this feature didn't exist" (see Backend's ok // return). func NewManager(backend Backend) *Manager { return &Manager{backend: backend} } // Backend returns the selected backend. ok is false if m is nil or backend // was nil (E2EE disabled) - callers should treat a nil Manager the same as // one built via NewManager(nil). func (m *Manager) Backend() (backend Backend, ok bool) { if m == nil || m.backend == nil { return nil, false } return m.backend, true }