diff options
author | Erik Johnston <erik@matrix.org> | 2015-04-02 10:06:22 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-04-02 10:06:22 +0100 |
commit | 779f7b0f443bfab351702161763b62b7bb6a27d8 (patch) | |
tree | 43729d7eb2030bf124ca0d8fa742ffa056bdb79f /synapse/storage/keys.py | |
parent | Fix SQLite support (diff) | |
download | synapse-779f7b0f443bfab351702161763b62b7bb6a27d8.tar.xz |
Fix unicode support
Diffstat (limited to 'synapse/storage/keys.py')
-rw-r--r-- | synapse/storage/keys.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/synapse/storage/keys.py b/synapse/storage/keys.py index 25fef79434..d3b9b38664 100644 --- a/synapse/storage/keys.py +++ b/synapse/storage/keys.py @@ -57,15 +57,18 @@ class KeyStore(SQLBaseStore): OpenSSL.crypto.FILETYPE_ASN1, tls_certificate ) fingerprint = hashlib.sha256(tls_certificate_bytes).hexdigest() - return self._simple_insert( + return self._simple_upsert( table="server_tls_certificates", - values={ + keyvalues={ "server_name": server_name, "fingerprint": fingerprint, + }, + values={ "from_server": from_server, "ts_added_ms": time_now_ms, "tls_certificate": buffer(tls_certificate_bytes), }, + desc="store_server_certificate", ) @defer.inlineCallbacks @@ -106,13 +109,16 @@ class KeyStore(SQLBaseStore): ts_now_ms (int): The time now in milliseconds verification_key (VerifyKey): The NACL verify key. """ - return self._simple_insert( + return self._simple_upsert( table="server_signature_keys", - values={ + keyvalues={ "server_name": server_name, "key_id": "%s:%s" % (verify_key.alg, verify_key.version), + }, + values={ "from_server": from_server, "ts_added_ms": time_now_ms, "verify_key": buffer(verify_key.encode()), }, + desc="store_server_verify_key", ) |