@@ -122,7 +122,7 @@ export async function ccInit(
122122 const cc = CoreCrypto . new ( database ) ;
123123
124124 if ( clientId ) {
125- await cc . newTransaction ( async ( ctx ) => {
125+ await cc . transaction ( async ( ctx ) => {
126126 await ctx . mlsInit ( clientId , DELIVERY_SERVICE ) ;
127127 } ) ;
128128 }
@@ -154,7 +154,7 @@ export async function createConversation(
154154 cc : CoreCrypto ,
155155 conversationId : ConversationId
156156) : Promise < void > {
157- await cc . newTransaction ( async ( ctx ) => {
157+ await cc . transaction ( async ( ctx ) => {
158158 const credential = Credential . basic (
159159 ciphersuiteDefault ( ) ,
160160 randomClientId ( )
@@ -183,20 +183,20 @@ export async function invite(
183183 cc2 : CoreCrypto ,
184184 conversationId : ConversationId
185185) : Promise < GroupInfoBundle > {
186- const kp = await cc2 . newTransaction ( async ( ctx ) => {
187- const [ credentialRef ] = await ctx . getFilteredCredentials ( {
186+ const kp = await cc2 . transaction ( async ( ctx ) => {
187+ const [ credentialRef ] = await ctx . findCredentials ( {
188188 ciphersuite : DEFAULT_CIPHERSUITE ,
189189 credentialType : CredentialType . Basic ,
190190 } ) ;
191191 return await ctx . generateKeypackage ( credentialRef ! ) ;
192192 } ) ;
193- await cc1 . newTransaction ( ( ctx ) =>
193+ await cc1 . transaction ( ( ctx ) =>
194194 ctx . addClientsToConversation ( conversationId , [ kp ] )
195195 ) ;
196196 const { groupInfo, welcome } =
197197 await DELIVERY_SERVICE . getLatestCommitBundle ( ) ;
198198
199- await cc2 . newTransaction ( ( ctx ) =>
199+ await cc2 . transaction ( ( ctx ) =>
200200 ctx . processWelcomeMessage ( new Welcome ( welcome ! . copyBytes ( ) ) )
201201 ) ;
202202
@@ -223,17 +223,17 @@ export async function roundTripMessage(
223223 conversationId : ConversationId ,
224224 message : ArrayBuffer
225225) : Promise < ( ArrayBuffer | null ) [ ] > {
226- const encryptedByClient1 = await cc1 . newTransaction ( async ( ctx ) => {
226+ const encryptedByClient1 = await cc1 . transaction ( async ( ctx ) => {
227227 return await ctx . encryptMessage ( conversationId , message ) ;
228228 } ) ;
229- const decryptedByClient2 = await cc2 . newTransaction ( async ( ctx ) => {
229+ const decryptedByClient2 = await cc2 . transaction ( async ( ctx ) => {
230230 return await ctx . decryptMessage ( conversationId , encryptedByClient1 ) ;
231231 } ) ;
232232
233- const encryptedByClient2 = await cc2 . newTransaction ( async ( ctx ) => {
233+ const encryptedByClient2 = await cc2 . transaction ( async ( ctx ) => {
234234 return await ctx . encryptMessage ( conversationId , message ) ;
235235 } ) ;
236- const decryptedByClient1 = await cc1 . newTransaction ( async ( ctx ) => {
236+ const decryptedByClient1 = await cc1 . transaction ( async ( ctx ) => {
237237 return await ctx . decryptMessage ( conversationId , encryptedByClient2 ) ;
238238 } ) ;
239239
@@ -263,7 +263,7 @@ export async function proteusInit(
263263 const database = await openTestDatabase ( databaseName ?? clientName ) ;
264264
265265 const instance = CoreCrypto . new ( database ) ;
266- await instance . newTransaction ( async ( ctx ) => {
266+ await instance . transaction ( async ( ctx ) => {
267267 await ctx . proteusInit ( ) ;
268268 } ) ;
269269
@@ -287,11 +287,11 @@ export async function newProteusSessionFromPrekey(
287287 cc2 : CoreCrypto ,
288288 sessionId : string
289289) : Promise < void > {
290- const cc2Prekey = await cc2 . newTransaction ( async ( ctx ) => {
290+ const cc2Prekey = await cc2 . transaction ( async ( ctx ) => {
291291 return await ctx . proteusNewPrekey ( 10 ) ;
292292 } ) ;
293293
294- await cc1 . newTransaction ( async ( ctx ) => {
294+ await cc1 . transaction ( async ( ctx ) => {
295295 return await ctx . proteusSessionFromPrekey ( sessionId , cc2Prekey ) ;
296296 } ) ;
297297}
@@ -317,11 +317,11 @@ export async function newProteusSessionFromMessage(
317317 sessionId : string ,
318318 messageBytes : ArrayBuffer
319319) : Promise < ArrayBuffer > {
320- const encrypted = await cc1 . newTransaction ( async ( ctx ) => {
320+ const encrypted = await cc1 . transaction ( async ( ctx ) => {
321321 return await ctx . proteusEncrypt ( sessionId , messageBytes ) ;
322322 } ) ;
323323
324- const decrypted = await cc2 . newTransaction ( async ( ctx ) => {
324+ const decrypted = await cc2 . transaction ( async ( ctx ) => {
325325 return await ctx . proteusSessionFromMessage ( sessionId , encrypted ) ;
326326 } ) ;
327327
0 commit comments