aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-09-12 10:19:02 +0100
committerNeil Alexander <neilalexander@users.noreply.github.com>2022-09-12 10:19:02 +0100
commit3a9dde28fda81067a2127258b09ff7c9accd5256 (patch)
tree4f77ac45a28e31d68108d365a606766b2f8171bd /build
parent5997c3245286b4a8df57054b1f311e5957836910 (diff)
P2P demo tweaks
Diffstat (limited to 'build')
-rw-r--r--build/gobind-pinecone/monolith.go8
-rw-r--r--build/gobind-yggdrasil/monolith.go8
2 files changed, 16 insertions, 0 deletions
diff --git a/build/gobind-pinecone/monolith.go b/build/gobind-pinecone/monolith.go
index b51e9778..91bbb687 100644
--- a/build/gobind-pinecone/monolith.go
+++ b/build/gobind-pinecone/monolith.go
@@ -218,6 +218,9 @@ func (m *DendriteMonolith) Start() {
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
panic("failed to load PEM key: " + err.Error())
}
+ if len(sk) != ed25519.PrivateKeySize {
+ panic("the private key is not long enough")
+ }
} else {
if sk, err = os.ReadFile(oldkeyfile); err != nil {
panic("failed to read the old private key: " + err.Error())
@@ -233,8 +236,13 @@ func (m *DendriteMonolith) Start() {
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
panic("failed to load PEM key: " + err.Error())
}
+ if len(sk) != ed25519.PrivateKeySize {
+ panic("the private key is not long enough")
+ }
}
+ pk = sk.Public().(ed25519.PublicKey)
+
var err error
m.listener, err = net.Listen("tcp", "localhost:65432")
if err != nil {
diff --git a/build/gobind-yggdrasil/monolith.go b/build/gobind-yggdrasil/monolith.go
index c671ae09..248b6c32 100644
--- a/build/gobind-yggdrasil/monolith.go
+++ b/build/gobind-yggdrasil/monolith.go
@@ -87,6 +87,9 @@ func (m *DendriteMonolith) Start() {
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
panic("failed to load PEM key: " + err.Error())
}
+ if len(sk) != ed25519.PrivateKeySize {
+ panic("the private key is not long enough")
+ }
} else {
if sk, err = os.ReadFile(oldkeyfile); err != nil {
panic("failed to read the old private key: " + err.Error())
@@ -103,8 +106,13 @@ func (m *DendriteMonolith) Start() {
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
panic("failed to load PEM key: " + err.Error())
}
+ if len(sk) != ed25519.PrivateKeySize {
+ panic("the private key is not long enough")
+ }
}
+ pk = sk.Public().(ed25519.PublicKey)
+
var err error
m.listener, err = net.Listen("tcp", "localhost:65432")
if err != nil {