aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-08-31 10:41:32 +0100
committerGitHub <noreply@github.com>2022-08-31 10:41:32 +0100
commitba0b3adab4de7865afd467b61638437b1af39fce (patch)
tree4330451062846ebf6718ac3695ea61b59739cd0f /test
parent02ec00b1bbeb43f68a4f9b1f19ee6282e4a34194 (diff)
Pinecone standalone refactoring (#2685)
This refactors the `dendrite-demo-pinecone` executable so that it: 1. Converts the old `.key` file into a standard `.pem` file 2. Allows passing in the `--config` option to supply a normal Dendrite configuration file, so that you can configure PostgreSQL instead of SQLite, appservices and all the other usual stuff
Diffstat (limited to 'test')
-rw-r--r--test/keys.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/keys.go b/test/keys.go
index fb156ef2..05f7317c 100644
--- a/test/keys.go
+++ b/test/keys.go
@@ -15,6 +15,7 @@
package test
import (
+ "crypto/ed25519"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
@@ -44,6 +45,10 @@ func NewMatrixKey(matrixKeyPath string) (err error) {
if err != nil {
return err
}
+ return SaveMatrixKey(matrixKeyPath, data[3:])
+}
+
+func SaveMatrixKey(matrixKeyPath string, data ed25519.PrivateKey) error {
keyOut, err := os.OpenFile(matrixKeyPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
if err != nil {
return err
@@ -62,7 +67,7 @@ func NewMatrixKey(matrixKeyPath string) (err error) {
Headers: map[string]string{
"Key-ID": fmt.Sprintf("ed25519:%s", keyID[:6]),
},
- Bytes: data[3:],
+ Bytes: data,
})
return err
}