diff --git a/config/bridge.go b/config/bridge.go index 0c4e019..31b08ac 100644 --- a/config/bridge.go +++ b/config/bridge.go @@ -61,6 +61,12 @@ type BridgeConfig struct { RequireCrossSigning bool `yaml:"require_cross_signing"` RequireVerification bool `yaml:"require_verification"` } `yaml:"key_sharing"` + + PuppetId struct { + Allow bool `yaml:"allow"` + Key string `yaml:"key"` + UsernameTemplatePrefix string `yaml:"username_template_prefix"` + } `yaml:"puppet_id"` } `yaml:"encryption"` Permissions PermissionConfig `yaml:"permissions"` diff --git a/config/config.go b/config/config.go index 208ed1b..fb19b7d 100644 --- a/config/config.go +++ b/config/config.go @@ -99,10 +99,10 @@ func (config *Config) MakeAppService() (*appservice.AppService, error) { as.HomeserverURL = config.Homeserver.Address as.Host.Hostname = config.AppService.Hostname as.Host.Port = config.AppService.Port - patch.ThirdPartyIdEncrypt = true + patch.ThirdPartyIdEncrypt = config.Bridge.Encryption.PuppetId.Allow patch.AsBotName = config.AppService.Bot.Username - patch.AsUserPrefix = "skype&" - patch.XorKey = "hudsds1y" + patch.AsUserPrefix = config.Bridge.Encryption.PuppetId.UsernameTemplatePrefix + patch.XorKey = config.Bridge.Encryption.PuppetId.Key var err error as.Registration, err = config.GetRegistration() return as, err diff --git a/example-config.yaml b/example-config.yaml index 78c8cfc..d0c4d59 100644 --- a/example-config.yaml +++ b/example-config.yaml @@ -168,6 +168,14 @@ bridge: # It is recommended to also set private_chat_portal_meta to true when using this. default: false + puppet_id: + # when set to true, the matrixid of the contact (puppet) from the bridge to the matrix will be encrypted into another string + default: false + # 8 characters + key: '12dsf323' + # Use the username_template prefix. (Warning: At present, username_template cannot be too complicated, otherwise this function may cause unknown errors) + username_template_prefix: 'skype&' + # Permissions for using the bridge. # Permitted values: # relaybot - Talk through the relaybot (if enabled), no access otherwise diff --git a/go.mod b/go.mod index ac80bb8..b0f7011 100644 --- a/go.mod +++ b/go.mod @@ -18,4 +18,4 @@ require ( maunium.net/go/mautrix v0.8.0-rc.4 ) -replace maunium.net/go/mautrix => github.com/pidongqianqian/mautrix-go v0.8.0-rc.4.0.20201126070406-7b13ac473bcc +replace maunium.net/go/mautrix => github.com/pidongqianqian/mautrix-go v0.8.0-rc.4.0.20201208081810-787323a21113