File tree Expand file tree Collapse file tree 3 files changed +21
-7
lines changed
crypto-ffi/bindings/jvm/src/test/kotlin/com/wire/crypto Expand file tree Collapse file tree 3 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -220,7 +220,7 @@ internal class E2EITest : HasMockDeliveryService() {
220220
221221 bob.transaction { ctx -> ctx.createConversation(id, CREDENTIAL_TYPE_DEFAULT , CONVERSATION_CONFIGURATION_DEFAULT ) }
222222
223- val aliceKp = alice.transaction { ctx -> ctx.clientKeypackages( CIPHERSUITE_DEFAULT , CREDENTIAL_TYPE_DEFAULT , 1U ).first() }
223+ val aliceKp = alice.transaction { ctx -> ctx.clientKeypackagesShort( 1u ).first() }
224224 bob.transaction { ctx -> ctx.addClientsToConversation(id, listOf (aliceKp)) }
225225 val welcome = HasMockDeliveryService .mockDeliveryService.getLatestWelcome()
226226 val groupId = alice.transaction { ctx -> ctx.processWelcomeMessage(welcome, CUSTOM_CONFIGURATION_DEFAULT ).id }
Original file line number Diff line number Diff line change @@ -153,15 +153,15 @@ class MLSTest : HasMockDeliveryService() {
153153 // by default, no key packages are generated
154154 assertThat(
155155 alice.transaction { ctx ->
156- ctx.clientValidKeypackagesCount( CIPHERSUITE_DEFAULT , CREDENTIAL_TYPE_DEFAULT )
156+ ctx.getKeypackages().size
157157 }
158- ).isEqualTo(0 .toULong() )
158+ ).isEqualTo(0 )
159159 assertThat(alice.transaction { ctx -> ctx.clientKeypackagesShort(200U ) }).isNotEmpty().hasSize(200 )
160160 assertThat(
161161 alice.transaction { ctx ->
162- ctx.clientValidKeypackagesCount( CIPHERSUITE_DEFAULT , CREDENTIAL_TYPE_DEFAULT )
162+ ctx.getKeypackages().size
163163 }
164- ).isEqualTo(200 .toULong() )
164+ ).isEqualTo(200 )
165165 }
166166
167167 @Test
Original file line number Diff line number Diff line change @@ -105,5 +105,19 @@ suspend fun CoreCryptoContext.createConversationShort(
105105 id : ConversationId
106106) = createConversation(id, CREDENTIAL_TYPE_DEFAULT , CONVERSATION_CONFIGURATION_DEFAULT )
107107
108- /* * Shorthand for getting keypackages with defaults */
109- suspend fun CoreCryptoContext.clientKeypackagesShort (amount : UInt ) = clientKeypackages(CIPHERSUITE_DEFAULT , CREDENTIAL_TYPE_DEFAULT , amount)
108+ /* * Shorthand for generating keypackages with defaults */
109+ suspend fun CoreCryptoContext.clientKeypackagesShort (amount : UInt ): List <Keypackage > {
110+ val credentials = findCredentials(
111+ clientId = null ,
112+ publicKey = null ,
113+ ciphersuite = CIPHERSUITE_DEFAULT ,
114+ credentialType = CREDENTIAL_TYPE_DEFAULT ,
115+ earliestValidity = null
116+ )
117+ val credential = credentials.last()
118+
119+ return List (amount.toInt()) { _ ->
120+ // cycle through credentials if amount > credentials.size
121+ generateKeypackage(credential)
122+ }
123+ }
You can’t perform that action at this time.
0 commit comments