Skip to content

Commit b2a54e3

Browse files
committed
test(jvm): add test that basic top-level credential can be created
1 parent 7280b67 commit b2a54e3

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

crypto-ffi/bindings/jvm/src/main/kotlin/com/wire/crypto/MlsModel.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,10 @@ fun ByteArray.toAvsSecret() = SecretKey(this)
3232

3333
/** Construct a GroupInfo from bytes */
3434
fun ByteArray.toGroupInfo() = GroupInfo(this)
35+
36+
/** Construct a new Credential from ciphersuite and client id */
37+
@Throws(CoreCryptoException::class)
38+
fun Credential.Companion.basic(
39+
ciphersuite: Ciphersuite,
40+
clientId: ClientId
41+
): Credential = credentialBasic(ciphersuite, clientId)

crypto-ffi/bindings/jvm/src/test/kotlin/com/wire/crypto/MLSTest.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,4 +475,14 @@ class MLSTest : HasMockDeliveryService() {
475475
)
476476
}
477477
}
478+
479+
@Test
480+
fun can_construct_basic_credential(): TestResult {
481+
val scope = TestScope()
482+
return scope.runTest {
483+
val credential = Credential.basic(CIPHERSUITE_DEFAULT, genClientId())
484+
assertEquals(credential.type(), CredentialType.BASIC)
485+
assertEquals<ULong>(credential.earliestValidity(), 0u)
486+
}
487+
}
478488
}

0 commit comments

Comments
 (0)