All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.com.wire.crypto.client.E2EIModel.kt Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
package com.wire.crypto.client

@JvmInline
value class RotateBundle(private val value: com.wire.crypto.RotateBundle) {
    val commits: Map
        get() = value.commits.asSequence().map { (clientId, commit) -> clientId.toClientId() to commit.lift() }.toMap()
    val newKeyPackages: List get() = value.newKeyPackages.map { MLSKeyPackage(it) }
    val keyPackageRefsToRemove: List get() = value.keyPackageRefsToRemove.map { MLSKeyPackageRef(it) }
    /**
     * New CRL distribution points that appeared by the introduction of a new credential
     */
    val crlNewDistributionPoints: CrlDistributionPoints? get() = value.crlNewDistributionPoints?.toCrlDistributionPoint()
}

fun com.wire.crypto.RotateBundle.toRotateBundle() = RotateBundle(this)

/**
 * Supporting struct for CRL registration result
 */
data class CRLRegistration(
    /**
     * Whether this CRL modifies the old CRL (i.e. has a different revocated cert list)
     */
    val dirty: Boolean,
    /**
     * Optional expiration timestamp
     */
    val expiration: Long?,
) {
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as CRLRegistration

        if (dirty != other.dirty) return false
        if (expiration != other.expiration) return false

        return true
    }

    override fun hashCode(): Int {
        var result = dirty.hashCode()
        result = 31 * result + (expiration?.hashCode() ?: 0)
        return result
    }
}

fun com.wire.crypto.CrlRegistration.lift() = CRLRegistration(dirty, expiration?.toLong())




© 2015 - 2024 Weber Informatics LLC | Privacy Policy