aboutsummaryrefslogtreecommitdiff
path: root/roomserver
diff options
context:
space:
mode:
authorDevon Hudson <devonhudson@librem.one>2023-06-14 16:42:09 +0100
committerDevon Hudson <devonhudson@librem.one>2023-06-14 16:42:09 +0100
commit5aaa539e3eb8ef1f1f601468c786f2d7f891394f (patch)
treef581926cfc1c909f7628344c98da39de46aa7537 /roomserver
parente4665979bfbe006368d55189f074e456fe19b198 (diff)
Fix senderID/key conversions
Diffstat (limited to 'roomserver')
-rw-r--r--roomserver/internal/perform/perform_create_room.go3
-rw-r--r--roomserver/storage/postgres/user_room_keys_table.go2
-rw-r--r--roomserver/storage/sqlite3/user_room_keys_table.go3
3 files changed, 5 insertions, 3 deletions
diff --git a/roomserver/internal/perform/perform_create_room.go b/roomserver/internal/perform/perform_create_room.go
index fd8055e0..dcaf8dca 100644
--- a/roomserver/internal/perform/perform_create_room.go
+++ b/roomserver/internal/perform/perform_create_room.go
@@ -16,6 +16,7 @@ package perform
import (
"context"
+ "crypto/ed25519"
"encoding/json"
"fmt"
"net/http"
@@ -74,7 +75,7 @@ func (c *Creator) PerformCreateRoom(ctx context.Context, userID spec.UserID, roo
JSON: spec.InternalServerError{},
}
}
- senderID = spec.SenderID(spec.Base64Bytes(key).Encode())
+ senderID = spec.SenderID(spec.Base64Bytes(key.Public().(ed25519.PublicKey)).Encode())
} else {
senderID = spec.SenderID(userID.String())
}
diff --git a/roomserver/storage/postgres/user_room_keys_table.go b/roomserver/storage/postgres/user_room_keys_table.go
index dbb4af34..dd4d9ab1 100644
--- a/roomserver/storage/postgres/user_room_keys_table.go
+++ b/roomserver/storage/postgres/user_room_keys_table.go
@@ -145,7 +145,7 @@ func (s *userRoomKeysStatements) BulkSelectUserNIDs(ctx context.Context, txn *sq
if err = rows.Scan(&userRoomKeyPair.EventStateKeyNID, &userRoomKeyPair.RoomNID, &publicKey); err != nil {
return nil, err
}
- result[string(publicKey)] = userRoomKeyPair
+ result[spec.Base64Bytes(publicKey).Encode()] = userRoomKeyPair
}
return result, rows.Err()
}
diff --git a/roomserver/storage/sqlite3/user_room_keys_table.go b/roomserver/storage/sqlite3/user_room_keys_table.go
index 84c8b54e..d58b8ac3 100644
--- a/roomserver/storage/sqlite3/user_room_keys_table.go
+++ b/roomserver/storage/sqlite3/user_room_keys_table.go
@@ -25,6 +25,7 @@ import (
"github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/dendrite/roomserver/storage/tables"
"github.com/matrix-org/dendrite/roomserver/types"
+ "github.com/matrix-org/gomatrixserverlib/spec"
)
const userRoomKeysSchema = `
@@ -159,7 +160,7 @@ func (s *userRoomKeysStatements) BulkSelectUserNIDs(ctx context.Context, txn *sq
if err = rows.Scan(&userRoomKeyPair.EventStateKeyNID, &userRoomKeyPair.RoomNID, &publicKey); err != nil {
return nil, err
}
- result[string(publicKey)] = userRoomKeyPair
+ result[spec.Base64Bytes(publicKey).Encode()] = userRoomKeyPair
}
return result, rows.Err()
}