can set puppet id encryption in the config.yaml

This commit is contained in:
zhaoYangguang 2020-12-08 16:25:09 +08:00
parent be7c67981b
commit b62a28ef64
4 changed files with 18 additions and 4 deletions

View File

@ -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"`

View File

@ -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

View File

@ -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

2
go.mod
View File

@ -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