aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-07-15 12:02:34 +0100
committerGitHub <noreply@github.com>2020-07-15 12:02:34 +0100
commit9dd2ed7f6513e8fa677dee8d7dafa33f9c7afdfc (patch)
tree5c09582128d156aa2b6629cdaae626b44357b48d /internal
parentb4c07995d68dbeffa2161920cb4cd61ea2be8389 (diff)
Implement key uploads (#1202)
* Add storage layer for postgres/sqlite * Return OTK counts when inserting new keys * Hook up the key DB and make a test pass * Convert postgres queries to be sqlite queries * Blacklist test due to requiring rejected events * Unbreak tests * Update blacklist
Diffstat (limited to 'internal')
-rw-r--r--internal/config/config.go5
-rw-r--r--internal/config/config_test.go2
-rw-r--r--internal/setup/monolith.go2
3 files changed, 8 insertions, 1 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index ac6249d6..53145efe 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -174,6 +174,9 @@ type Dendrite struct {
// The ServerKey database caches the public keys of remote servers.
// It may be accessed by the FederationAPI, the ClientAPI, and the MediaAPI.
ServerKey DataSource `yaml:"server_key"`
+ // The E2EKey database stores one-time public keys for devices in addition to
+ // signed device keys. Used for E2E.
+ E2EKey DataSource `yaml:"e2e_key"`
// The SyncAPI stores information used by the SyncAPI server.
// It is only accessed by the SyncAPI server.
SyncAPI DataSource `yaml:"sync_api"`
@@ -602,6 +605,7 @@ func (config *Dendrite) checkDatabase(configErrs *configErrors) {
checkNotEmpty(configErrs, "database.sync_api", string(config.Database.SyncAPI))
checkNotEmpty(configErrs, "database.room_server", string(config.Database.RoomServer))
checkNotEmpty(configErrs, "database.current_state", string(config.Database.CurrentState))
+ checkNotEmpty(configErrs, "database.e2e_key", string(config.Database.E2EKey))
}
// checkListen verifies the parameters listen.* are valid.
@@ -615,6 +619,7 @@ func (config *Dendrite) checkListen(configErrs *configErrors) {
checkNotEmpty(configErrs, "listen.server_key_api", string(config.Listen.EDUServer))
checkNotEmpty(configErrs, "listen.user_api", string(config.Listen.UserAPI))
checkNotEmpty(configErrs, "listen.current_state_server", string(config.Listen.CurrentState))
+ checkNotEmpty(configErrs, "listen.key_server", string(config.Listen.KeyServer))
}
// checkLogging verifies the parameters logging.* are valid.
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
index 9b776a50..6b819872 100644
--- a/internal/config/config_test.go
+++ b/internal/config/config_test.go
@@ -56,6 +56,7 @@ database:
room_server: "postgresql:///room_server"
appservice: "postgresql:///appservice"
current_state: "postgresql:///current_state"
+ e2e_key: "postgresql:///e2e_key"
listen:
room_server: "localhost:7770"
client_api: "localhost:7771"
@@ -66,6 +67,7 @@ listen:
edu_server: "localhost:7778"
user_api: "localhost:7779"
current_state_server: "localhost:7775"
+ key_server: "localhost:7776"
logging:
- type: "file"
level: "info"
diff --git a/internal/setup/monolith.go b/internal/setup/monolith.go
index 9ae62948..39013a2c 100644
--- a/internal/setup/monolith.go
+++ b/internal/setup/monolith.go
@@ -68,7 +68,7 @@ func (m *Monolith) AddAllPublicRoutes(publicMux *mux.Router) {
publicMux, m.Config, m.KafkaProducer, m.DeviceDB, m.AccountDB,
m.FedClient, m.RoomserverAPI,
m.EDUInternalAPI, m.AppserviceAPI, m.StateAPI, transactions.New(),
- m.FederationSenderAPI, m.UserAPI, m.ExtPublicRoomsProvider,
+ m.FederationSenderAPI, m.UserAPI, m.KeyAPI, m.ExtPublicRoomsProvider,
)
federationapi.AddPublicRoutes(
publicMux, m.Config, m.UserAPI, m.FedClient,