diff options
author | Mark Haines <mjark@negativecurvature.net> | 2014-12-16 13:53:43 +0000 |
---|---|---|
committer | Mark Haines <mjark@negativecurvature.net> | 2014-12-16 13:53:43 +0000 |
commit | 2af40cfa14ba579c156349ae3457a55bc93f8548 (patch) | |
tree | 2b94b53c72d51fc170549213ed8cb88556c2b501 /synapse/storage/signatures.py | |
parent | Add a script for talking matrix federation adding X-Matrix Authorization (diff) | |
parent | Fix pyflakes (diff) | |
download | synapse-2af40cfa14ba579c156349ae3457a55bc93f8548.tar.xz |
Merge pull request #25 from matrix-org/events_refactor
Event refactor
Diffstat (limited to 'synapse/storage/signatures.py')
-rw-r--r-- | synapse/storage/signatures.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/synapse/storage/signatures.py b/synapse/storage/signatures.py index eea4f21065..3a705119fd 100644 --- a/synapse/storage/signatures.py +++ b/synapse/storage/signatures.py @@ -13,8 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +from twisted.internet import defer + from _base import SQLBaseStore +from syutil.base64util import encode_base64 + class SignatureStore(SQLBaseStore): """Persistence for event signatures and hashes""" @@ -67,6 +71,21 @@ class SignatureStore(SQLBaseStore): f ) + @defer.inlineCallbacks + def add_event_hashes(self, event_ids): + hashes = yield self.get_event_reference_hashes( + event_ids + ) + hashes = [ + { + k: encode_base64(v) for k, v in h.items() + if k == "sha256" + } + for h in hashes + ] + + defer.returnValue(zip(event_ids, hashes)) + def _get_event_reference_hashes_txn(self, txn, event_id): """Get all the hashes for a given PDU. Args: |