File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
crates/matrix-sdk-indexeddb/src/event_cache_store/serializer Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -42,3 +42,24 @@ pub trait Indexed: Sized {
42
42
serializer : & IndexeddbSerializer ,
43
43
) -> Result < Self , Self :: Error > ;
44
44
}
45
+
46
+ /// A trait for encoding types which will be used as keys in IndexedDB.
47
+ ///
48
+ /// Each implementation represents a key on an [`Indexed`] type.
49
+ pub trait IndexedKey < T : Indexed > {
50
+ /// Any extra data used to construct the key.
51
+ type KeyComponents ;
52
+
53
+ /// Encodes the key components into a type that can be used as a key in
54
+ /// IndexedDB.
55
+ ///
56
+ /// Note that this function takes an [`IndexeddbSerializer`] as an
57
+ /// argument, which provides the necessary context for encryption and
58
+ /// decryption, in the case that certain components of the key must be
59
+ /// encrypted before storage.
60
+ fn encode (
61
+ room_id : & RoomId ,
62
+ components : & Self :: KeyComponents ,
63
+ serializer : & IndexeddbSerializer ,
64
+ ) -> Self ;
65
+ }
You can’t perform that action at this time.
0 commit comments