@@ -1048,6 +1048,7 @@ OlmDevice.prototype.addInboundGroupSession = async function(
10481048 'readwrite' , [
10491049 IndexedDBCryptoStore . STORE_INBOUND_GROUP_SESSIONS ,
10501050 IndexedDBCryptoStore . STORE_INBOUND_GROUP_SESSIONS_WITHHELD ,
1051+ IndexedDBCryptoStore . STORE_SHARED_HISTORY_INBOUND_GROUP_SESSIONS ,
10511052 ] , ( txn ) => {
10521053 /* if we already have this session, consider updating it */
10531054 this . _getInboundGroupSession (
@@ -1104,6 +1105,12 @@ OlmDevice.prototype.addInboundGroupSession = async function(
11041105 this . _cryptoStore . storeEndToEndInboundGroupSession (
11051106 senderKey , sessionId , sessionData , txn ,
11061107 ) ;
1108+
1109+ if ( ! existingSession && extraSessionData . sharedHistory ) {
1110+ this . _cryptoStore . addSharedHistoryInboundGroupSession (
1111+ roomId , senderKey , sessionId , txn ,
1112+ ) ;
1113+ }
11071114 } finally {
11081115 session . free ( ) ;
11091116 }
@@ -1383,6 +1390,7 @@ OlmDevice.prototype.getInboundGroupSessionKey = async function(
13831390 "forwarding_curve25519_key_chain" :
13841391 sessionData . forwardingCurve25519KeyChain || [ ] ,
13851392 "sender_claimed_ed25519_key" : senderEd25519Key ,
1393+ "shared_history" : sessionData . sharedHistory || false ,
13861394 } ;
13871395 } ,
13881396 ) ;
@@ -1415,10 +1423,24 @@ OlmDevice.prototype.exportInboundGroupSession = function(
14151423 "session_key" : session . export_session ( messageIndex ) ,
14161424 "forwarding_curve25519_key_chain" : session . forwardingCurve25519KeyChain || [ ] ,
14171425 "first_known_index" : session . first_known_index ( ) ,
1426+ "org.matrix.msc3061.shared_history" : sessionData . sharedHistory || false ,
14181427 } ;
14191428 } ) ;
14201429} ;
14211430
1431+ OlmDevice . prototype . getSharedHistoryInboundGroupSessions = async function ( roomId ) {
1432+ let result ;
1433+ await this . _cryptoStore . doTxn (
1434+ 'readonly' , [
1435+ IndexedDBCryptoStore . STORE_SHARED_HISTORY_INBOUND_GROUP_SESSIONS ,
1436+ ] , ( txn ) => {
1437+ result = this . _cryptoStore . getSharedHistoryInboundGroupSessions ( roomId , txn ) ;
1438+ } ,
1439+ logger . withPrefix ( "[getSharedHistoryInboundGroupSessionsForRoom]" ) ,
1440+ ) ;
1441+ return result ;
1442+ } ;
1443+
14221444// Utilities
14231445// =========
14241446
0 commit comments