diff --git a/app/src/main/java/com/futo/polycentric/core/Models.kt b/app/src/main/java/com/futo/polycentric/core/Models.kt index f273a21dc62216e4d2e885425964797ad8860ebd..b1c40aa731e79455f5a274e5fa5054218e48558f 100644 --- a/app/src/main/java/com/futo/polycentric/core/Models.kt +++ b/app/src/main/java/com/futo/polycentric/core/Models.kt @@ -474,6 +474,22 @@ class ProcessSecret(val system: KeyPair, val process: Process) { return ProcessHandle(this, system.publicKey) } + override fun hashCode(): Int { + return combineHashCodes(listOf(system.hashCode(), process.hashCode())) + } + + override fun toString(): String { + return "(system: $system, process: $process)" + } + + override fun equals(other: Any?): Boolean { + if (other !is ProcessSecret) { + return false + } + + return system == other.system && process == other.process + } + companion object { fun fromProto(proto: Protocol.StorageTypeProcessSecret): ProcessSecret { if (!proto.hasSystem()) { @@ -590,6 +606,18 @@ data class KeyPair(val privateKey: PrivateKey, val publicKey: PublicKey) { return "(privateKey: $privateKey, publicKey: $publicKey)" } + override fun hashCode(): Int { + return combineHashCodes(listOf(privateKey.hashCode(), publicKey.hashCode())) + } + + override fun equals(other: Any?): Boolean { + if (other !is KeyPair) { + return false + } + + return privateKey == other.privateKey && publicKey == other.publicKey + } + companion object { fun fromProto(proto: Protocol.KeyPair): KeyPair { return KeyPair(