Fix the keys

This commit is contained in:
Neil Alexander 2020-11-25 17:03:13 +00:00
parent 7f138126ab
commit b075d167f8
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 7 additions and 4 deletions

View file

@ -97,7 +97,7 @@ func (m *DendriteMonolith) Start() {
var sk ed25519.PrivateKey
var pk ed25519.PublicKey
yggfile := fmt.Sprintf("%s/dendrite-yggdrasil.conf", m.StorageDirectory)
if _, err := os.Stat(yggfile); !os.IsNotExist(err) {
if _, err := os.Stat(yggfile); err == nil {
yggconf, e := ioutil.ReadFile(yggfile)
if e != nil {
panic(err)
@ -107,10 +107,12 @@ func (m *DendriteMonolith) Start() {
panic(err)
}
if mapconf["SigningPrivateKey"] != nil && mapconf["SigningPublicKey"] != nil {
if sk, err = hex.DecodeString(mapconf["SigningPrivateKey"].(string)); err != nil {
m.config.SigningPrivateKey = mapconf["SigningPrivateKey"].(string)
m.config.SigningPublicKey = mapconf["SigningPublicKey"].(string)
if sk, err = hex.DecodeString(m.config.SigningPrivateKey); err != nil {
panic(err)
}
if pk, err = hex.DecodeString(mapconf["SigningPublicKey"].(string)); err != nil {
if pk, err = hex.DecodeString(m.config.SigningPublicKey); err != nil {
panic(err)
}
} else {
@ -157,7 +159,7 @@ func (m *DendriteMonolith) Start() {
cfg := &config.Dendrite{}
cfg.Defaults()
cfg.Global.ServerName = gomatrixserverlib.ServerName(m.config.SigningPublicKey)
cfg.Global.ServerName = gomatrixserverlib.ServerName(hex.EncodeToString(pk))
cfg.Global.PrivateKey = sk
cfg.Global.KeyID = gomatrixserverlib.KeyID(signing.KeyID)
cfg.Global.Kafka.UseNaffka = true

1
go.mod
View file

@ -47,6 +47,7 @@ require (
golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9
golang.org/x/mobile v0.0.0-20200801112145-973feb4309de // indirect
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68
gopkg.in/h2non/bimg.v1 v1.1.4
gopkg.in/yaml.v2 v2.3.0
)