Documentation ¶
Index ¶
- Constants
- Variables
- type ASIntent
- func (as *ASIntent) CreateRoom(ctx context.Context, req *mautrix.ReqCreateRoom) (id.RoomID, error)
- func (as *ASIntent) DeleteRoom(ctx context.Context, roomID id.RoomID, puppetsOnly bool) error
- func (as *ASIntent) DownloadMedia(ctx context.Context, uri id.ContentURIString, file *event.EncryptedFileInfo) ([]byte, error)
- func (as *ASIntent) EnsureInvited(ctx context.Context, roomID id.RoomID, userID id.UserID) error
- func (as *ASIntent) EnsureJoined(ctx context.Context, roomID id.RoomID) error
- func (as *ASIntent) GetMXID() id.UserID
- func (as *ASIntent) InviteUser(ctx context.Context, roomID id.RoomID, userID id.UserID) error
- func (as *ASIntent) MarkRead(ctx context.Context, roomID id.RoomID, eventID id.EventID, ts time.Time) error
- func (as *ASIntent) MarkTyping(ctx context.Context, roomID id.RoomID, typingType bridgev2.TypingType, ...) error
- func (as *ASIntent) MarkUnread(ctx context.Context, roomID id.RoomID, unread bool) error
- func (as *ASIntent) MuteRoom(ctx context.Context, roomID id.RoomID, until time.Time) error
- func (as *ASIntent) SendMessage(ctx context.Context, roomID id.RoomID, eventType event.Type, ...) (*mautrix.RespSendEvent, error)
- func (as *ASIntent) SendState(ctx context.Context, roomID id.RoomID, eventType event.Type, stateKey string, ...) (*mautrix.RespSendEvent, error)
- func (as *ASIntent) SetAvatarURL(ctx context.Context, avatarURL id.ContentURIString) error
- func (as *ASIntent) SetDisplayName(ctx context.Context, name string) error
- func (as *ASIntent) SetExtraProfileMeta(ctx context.Context, data any) error
- func (as *ASIntent) TagRoom(ctx context.Context, roomID id.RoomID, tag event.RoomTag, isTagged bool) error
- func (as *ASIntent) UploadMedia(ctx context.Context, roomID id.RoomID, data []byte, fileName, mimeType string) (url id.ContentURIString, file *event.EncryptedFileInfo, err error)
- type CommandProcessor
- type Connector
- func (br *Connector) BatchSend(ctx context.Context, roomID id.RoomID, req *mautrix.ReqBeeperBatchSend) (*mautrix.RespBeeperBatchSend, error)
- func (br *Connector) BotIntent() bridgev2.MatrixAPI
- func (br *Connector) FormatGhostMXID(userID networkid.UserID) id.UserID
- func (br *Connector) GenerateContentURI(ctx context.Context, mediaID networkid.MediaID) (id.ContentURIString, error)
- func (br *Connector) GenerateDeterministicEventID(roomID id.RoomID, _ networkid.PortalKey, messageID networkid.MessageID, ...) id.EventID
- func (br *Connector) GetCapabilities() *bridgev2.MatrixCapabilities
- func (br *Connector) GetMemberInfo(ctx context.Context, roomID id.RoomID, userID id.UserID) (*event.MemberEventContent, error)
- func (br *Connector) GetMembers(ctx context.Context, roomID id.RoomID) (map[id.UserID]*event.MemberEventContent, error)
- func (br *Connector) GetPowerLevels(ctx context.Context, roomID id.RoomID) (*event.PowerLevelsEventContent, error)
- func (br *Connector) GetProvisioning() IProvisioningAPI
- func (br *Connector) GetPublicAddress() string
- func (br *Connector) GetRouter() *mux.Router
- func (br *Connector) GhostIntent(userID networkid.UserID) bridgev2.MatrixAPI
- func (br *Connector) Init(bridge *bridgev2.Bridge)
- func (br *Connector) NewUserIntent(ctx context.Context, userID id.UserID, accessToken string) (bridgev2.MatrixAPI, string, error)
- func (br *Connector) ParseGhostMXID(userID id.UserID) (networkid.UserID, bool)
- func (br *Connector) PingServer() (start, serverTs, end time.Time)
- func (br *Connector) SendBridgeStatus(ctx context.Context, state *status.BridgeState) error
- func (br *Connector) SendMessageCheckpoints(checkpoints []*status.MessageCheckpoint) error
- func (br *Connector) SendMessageStatus(ctx context.Context, ms *bridgev2.MessageStatus, ...)
- func (br *Connector) ServerName() string
- func (br *Connector) Start(ctx context.Context) error
- func (br *Connector) Stop()
- func (br *Connector) UpdateBotProfile(ctx context.Context)
- type Crypto
- type CryptoHelper
- func (helper *CryptoHelper) Client() *mautrix.Client
- func (helper *CryptoHelper) Decrypt(ctx context.Context, evt *event.Event) (*event.Event, error)
- func (helper *CryptoHelper) Encrypt(ctx context.Context, roomID id.RoomID, evtType event.Type, ...) (err error)
- func (helper *CryptoHelper) HandleMemberEvent(ctx context.Context, evt *event.Event)
- func (helper *CryptoHelper) Init(ctx context.Context) error
- func (helper *CryptoHelper) RequestSession(ctx context.Context, roomID id.RoomID, senderKey id.SenderKey, ...)
- func (helper *CryptoHelper) Reset(ctx context.Context, startAfterReset bool)
- func (helper *CryptoHelper) ResetSession(ctx context.Context, roomID id.RoomID)
- func (helper *CryptoHelper) ShareKeys(ctx context.Context) error
- func (helper *CryptoHelper) Start()
- func (helper *CryptoHelper) Stop()
- func (helper *CryptoHelper) WaitForSession(ctx context.Context, roomID id.RoomID, senderKey id.SenderKey, ...) bool
- type IProvisioningAPI
- type ProvLogin
- type ProvisioningAPI
- func (prov *ProvisioningAPI) AuthMiddleware(h http.Handler) http.Handler
- func (prov *ProvisioningAPI) GetContactList(w http.ResponseWriter, r *http.Request)
- func (prov *ProvisioningAPI) GetLoginFlows(w http.ResponseWriter, r *http.Request)
- func (prov *ProvisioningAPI) GetLoginForRequest(w http.ResponseWriter, r *http.Request) *bridgev2.UserLogin
- func (prov *ProvisioningAPI) GetLogins(w http.ResponseWriter, r *http.Request)
- func (prov *ProvisioningAPI) GetResolveIdentifier(w http.ResponseWriter, r *http.Request)
- func (prov *ProvisioningAPI) GetRouter() *mux.Router
- func (prov *ProvisioningAPI) GetUser(r *http.Request) *bridgev2.User
- func (prov *ProvisioningAPI) Init()
- func (prov *ProvisioningAPI) PostCreateDM(w http.ResponseWriter, r *http.Request)
- func (prov *ProvisioningAPI) PostCreateGroup(w http.ResponseWriter, r *http.Request)
- func (prov *ProvisioningAPI) PostLoginStart(w http.ResponseWriter, r *http.Request)
- func (prov *ProvisioningAPI) PostLoginSubmitInput(w http.ResponseWriter, r *http.Request)
- func (prov *ProvisioningAPI) PostLoginWait(w http.ResponseWriter, r *http.Request)
- func (prov *ProvisioningAPI) PostLogout(w http.ResponseWriter, r *http.Request)
- type RespGetContactList
- type RespGetLogins
- type RespLoginFlows
- type RespResolveIdentifier
- type RespSubmitLogin
- type SQLCryptoStore
Constants ¶
View Source
const ContentURIMaxLength = 255
View Source
const MediaIDPrefix = "\U0001F408"
View Source
const MediaIDTruncatedHashLength = 16
Variables ¶
View Source
var ( ErrMismatchingMXID = errors.New("whoami result does not match custom mxid") ErrNoAccessToken = errors.New("no access token provided") ErrNoMXID = errors.New("no mxid provided") )
View Source
var CommandDiscardMegolmSession = &commands.FullHandler{ Func: func(ce *commands.Event) { matrix := ce.Bridge.Matrix.(*Connector) if matrix.Crypto == nil { ce.Reply("This bridge instance doesn't have end-to-bridge encryption enabled") } else { matrix.Crypto.ResetSession(ce.Ctx, ce.RoomID) ce.Reply("Successfully reset Megolm session in this room. New decryption keys will be shared the next time a message is sent from the remote network.") } }, Name: "discard-megolm-session", Aliases: []string{"discard-session"}, Help: commands.HelpMeta{ Section: commands.HelpSectionAdmin, Description: "Discard the Megolm session in the room", }, RequiresAdmin: true, }
View Source
var CommandLoginMatrix = &commands.FullHandler{ Func: fnLoginMatrix, Name: "login-matrix", Help: commands.HelpMeta{ Section: commands.HelpSectionAuth, Description: "Enable double puppeting.", Args: "<_access token_>", }, RequiresLogin: true, }
View Source
var CommandLogoutMatrix = &commands.FullHandler{ Func: fnLogoutMatrix, Name: "logout-matrix", Help: commands.HelpMeta{ Section: commands.HelpSectionAuth, Description: "Disable double puppeting.", }, RequiresLogin: true, }
View Source
var CommandPingMatrix = &commands.FullHandler{ Func: fnPingMatrix, Name: "ping-matrix", Help: commands.HelpMeta{ Section: commands.HelpSectionAuth, Description: "Ping the Matrix server with the double puppet.", }, }
View Source
var CommandSetPowerLevel = &commands.FullHandler{ Func: fnSetPowerLevel, Name: "set-pl", Aliases: []string{"set-power-level"}, Help: commands.HelpMeta{ Section: commands.HelpSectionAdmin, Description: "Change the power level in a portal room.", Args: "[_user ID_] <_power level_>", }, RequiresAdmin: true, RequiresPortal: true, }
View Source
var DuplicateMessageIndex = crypto.DuplicateMessageIndex
View Source
var MinSpecVersion = mautrix.SpecV14
View Source
var NoSessionFound = crypto.NoSessionFound
View Source
var UnknownMessageIndex = olm.UnknownMessageIndex
Functions ¶
This section is empty.
Types ¶
type ASIntent ¶
type ASIntent struct { Matrix *appservice.IntentAPI Connector *Connector }
ASIntent implements the bridge ghost API interface using a real Matrix homeserver as the backend.
func (*ASIntent) CreateRoom ¶
func (*ASIntent) DeleteRoom ¶
func (*ASIntent) DownloadMedia ¶
func (as *ASIntent) DownloadMedia(ctx context.Context, uri id.ContentURIString, file *event.EncryptedFileInfo) ([]byte, error)
func (*ASIntent) EnsureInvited ¶
func (*ASIntent) EnsureJoined ¶
func (*ASIntent) InviteUser ¶
func (*ASIntent) MarkTyping ¶
func (*ASIntent) MarkUnread ¶
func (*ASIntent) SendMessage ¶
func (*ASIntent) SetAvatarURL ¶
func (*ASIntent) SetDisplayName ¶
func (*ASIntent) SetExtraProfileMeta ¶
func (*ASIntent) UploadMedia ¶
type CommandProcessor ¶
type Connector ¶
type Connector struct { AS *appservice.AppService Bot *appservice.IntentAPI StateStore *sqlstatestore.SQLStateStore Crypto Crypto Log *zerolog.Logger Config *bridgeconfig.Config Bridge *bridgev2.Bridge Provisioning *ProvisioningAPI DoublePuppet *doublePuppetUtil MediaProxy *mediaproxy.MediaProxy MediaConfig mautrix.RespMediaConfig SpecVersions *mautrix.RespVersions Capabilities *bridgev2.MatrixCapabilities IgnoreUnsupportedServer bool EventProcessor *appservice.EventProcessor Websocket bool OnWebsocketReplaced func() // contains filtered or unexported fields }
func NewConnector ¶
func NewConnector(cfg *bridgeconfig.Config) *Connector
func (*Connector) FormatGhostMXID ¶
func (*Connector) GenerateContentURI ¶
func (*Connector) GenerateDeterministicEventID ¶
func (*Connector) GetCapabilities ¶
func (br *Connector) GetCapabilities() *bridgev2.MatrixCapabilities
func (*Connector) GetMemberInfo ¶
func (*Connector) GetMembers ¶
func (*Connector) GetPowerLevels ¶
func (*Connector) GetProvisioning ¶
func (br *Connector) GetProvisioning() IProvisioningAPI
func (*Connector) GetPublicAddress ¶
func (*Connector) GhostIntent ¶
func (*Connector) NewUserIntent ¶
func (*Connector) ParseGhostMXID ¶
func (*Connector) PingServer ¶
func (*Connector) SendBridgeStatus ¶
func (*Connector) SendMessageCheckpoints ¶
func (br *Connector) SendMessageCheckpoints(checkpoints []*status.MessageCheckpoint) error
func (*Connector) SendMessageStatus ¶
func (br *Connector) SendMessageStatus(ctx context.Context, ms *bridgev2.MessageStatus, evt *bridgev2.MessageStatusEventInfo)
func (*Connector) ServerName ¶
func (*Connector) UpdateBotProfile ¶
type Crypto ¶
type Crypto interface { HandleMemberEvent(context.Context, *event.Event) Decrypt(context.Context, *event.Event) (*event.Event, error) Encrypt(context.Context, id.RoomID, event.Type, *event.Content) error WaitForSession(context.Context, id.RoomID, id.SenderKey, id.SessionID, time.Duration) bool RequestSession(context.Context, id.RoomID, id.SenderKey, id.SessionID, id.UserID, id.DeviceID) ResetSession(context.Context, id.RoomID) Init(ctx context.Context) error Start() Stop() Reset(ctx context.Context, startAfterReset bool) Client() *mautrix.Client }
func NewCryptoHelper ¶
type CryptoHelper ¶
type CryptoHelper struct {
// contains filtered or unexported fields
}
func (*CryptoHelper) Client ¶
func (helper *CryptoHelper) Client() *mautrix.Client
func (*CryptoHelper) HandleMemberEvent ¶
func (helper *CryptoHelper) HandleMemberEvent(ctx context.Context, evt *event.Event)
func (*CryptoHelper) RequestSession ¶
func (*CryptoHelper) Reset ¶
func (helper *CryptoHelper) Reset(ctx context.Context, startAfterReset bool)
func (*CryptoHelper) ResetSession ¶
func (helper *CryptoHelper) ResetSession(ctx context.Context, roomID id.RoomID)
func (*CryptoHelper) ShareKeys ¶
func (helper *CryptoHelper) ShareKeys(ctx context.Context) error
ShareKeys uploads the given number of one-time-keys to the server.
func (*CryptoHelper) Start ¶
func (helper *CryptoHelper) Start()
func (*CryptoHelper) Stop ¶
func (helper *CryptoHelper) Stop()
type IProvisioningAPI ¶
type ProvisioningAPI ¶
func (*ProvisioningAPI) AuthMiddleware ¶
func (prov *ProvisioningAPI) AuthMiddleware(h http.Handler) http.Handler
func (*ProvisioningAPI) GetContactList ¶
func (prov *ProvisioningAPI) GetContactList(w http.ResponseWriter, r *http.Request)
func (*ProvisioningAPI) GetLoginFlows ¶
func (prov *ProvisioningAPI) GetLoginFlows(w http.ResponseWriter, r *http.Request)
func (*ProvisioningAPI) GetLoginForRequest ¶
func (prov *ProvisioningAPI) GetLoginForRequest(w http.ResponseWriter, r *http.Request) *bridgev2.UserLogin
func (*ProvisioningAPI) GetLogins ¶
func (prov *ProvisioningAPI) GetLogins(w http.ResponseWriter, r *http.Request)
func (*ProvisioningAPI) GetResolveIdentifier ¶
func (prov *ProvisioningAPI) GetResolveIdentifier(w http.ResponseWriter, r *http.Request)
func (*ProvisioningAPI) GetRouter ¶
func (prov *ProvisioningAPI) GetRouter() *mux.Router
func (*ProvisioningAPI) GetUser ¶
func (prov *ProvisioningAPI) GetUser(r *http.Request) *bridgev2.User
func (*ProvisioningAPI) Init ¶
func (prov *ProvisioningAPI) Init()
func (*ProvisioningAPI) PostCreateDM ¶
func (prov *ProvisioningAPI) PostCreateDM(w http.ResponseWriter, r *http.Request)
func (*ProvisioningAPI) PostCreateGroup ¶
func (prov *ProvisioningAPI) PostCreateGroup(w http.ResponseWriter, r *http.Request)
func (*ProvisioningAPI) PostLoginStart ¶
func (prov *ProvisioningAPI) PostLoginStart(w http.ResponseWriter, r *http.Request)
func (*ProvisioningAPI) PostLoginSubmitInput ¶
func (prov *ProvisioningAPI) PostLoginSubmitInput(w http.ResponseWriter, r *http.Request)
func (*ProvisioningAPI) PostLoginWait ¶
func (prov *ProvisioningAPI) PostLoginWait(w http.ResponseWriter, r *http.Request)
func (*ProvisioningAPI) PostLogout ¶
func (prov *ProvisioningAPI) PostLogout(w http.ResponseWriter, r *http.Request)
type RespGetContactList ¶
type RespGetContactList struct {
Contacts []*RespResolveIdentifier `json:"contacts"`
}
type RespGetLogins ¶
type RespGetLogins struct {
LoginIDs []networkid.UserLoginID `json:"login_ids"`
}
type RespLoginFlows ¶
type RespResolveIdentifier ¶
type RespResolveIdentifier struct { ID networkid.UserID `json:"id,omitempty"` Name string `json:"name,omitempty"` AvatarURL id.ContentURIString `json:"avatar_url,omitempty"` Identifiers []string `json:"identifiers,omitempty"` MXID id.UserID `json:"mxid,omitempty"` DMRoomID id.RoomID `json:"dm_room_mxid,omitempty"` }
type RespSubmitLogin ¶
type SQLCryptoStore ¶
type SQLCryptoStore struct { *crypto.SQLCryptoStore UserID id.UserID GhostIDFormat string }
func NewSQLCryptoStore ¶
func NewSQLCryptoStore(db *dbutil.Database, log dbutil.DatabaseLogger, accountID string, userID id.UserID, ghostIDFormat, pickleKey string) *SQLCryptoStore
func (*SQLCryptoStore) GetRoomJoinedOrInvitedMembers ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.