Skip to content

Commit

Permalink
minor changes to DeferredDocument and UnsignedDocument
Browse files Browse the repository at this point in the history
  • Loading branch information
vkanellopoulos committed Sep 26, 2024
1 parent 1e258cf commit b7cc53e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,36 +59,6 @@ class DeferredDocument(
override val state: State
get() = base?.state ?: State.DEFERRED

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false

other as DeferredDocument

if (id != other.id) return false
if (docType != other.docType) return false
if (name != other.name) return false
if (usesStrongBox != other.usesStrongBox) return false
if (requiresUserAuth != other.requiresUserAuth) return false
if (createdAt != other.createdAt) return false
if (state != other.state) return false
if (!relatedData.contentEquals(other.relatedData)) return false

return true
}

override fun hashCode(): Int {
var result = id.hashCode()
result = 31 * result + docType.hashCode()
result = 31 * result + name.hashCode()
result = 31 * result + usesStrongBox.hashCode()
result = 31 * result + requiresUserAuth.hashCode()
result = 31 * result + createdAt.hashCode()
result = 31 * result + state.hashCode()
result = 31 * result + relatedData.contentHashCode()
return result
}

override fun toString(): String {
return "DeferredDocument(id='$id', docType='$docType', name='$name', usesStrongBox=$usesStrongBox, requiresUserAuth=$requiresUserAuth, createdAt=$createdAt, state=$state, relatedData=${relatedData.contentToString()})"
}
Expand All @@ -103,8 +73,8 @@ class DeferredDocument(
requiresUserAuth = baseDocument.requiresUserAuth,
createdAt = baseDocument.createdAt,
certificatesNeedAuth = baseDocument.pendingCredentials
.firstOrNull { it is SecureAreaBoundCredential }
?.let { it as SecureAreaBoundCredential }
.filterIsInstance<SecureAreaBoundCredential>()
.firstOrNull()
?.attestation
?.certChain
?.javaX509Certificates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,13 @@ open class UnsignedDocument(
usesStrongBox = baseDocument.usesStrongBox,
requiresUserAuth = baseDocument.requiresUserAuth,
createdAt = baseDocument.createdAt,
certificatesNeedAuth = baseDocument.pendingCredentials.firstOrNull() { it is SecureAreaBoundCredential }
?.let { it as SecureAreaBoundCredential }
certificatesNeedAuth = baseDocument.pendingCredentials
.filterIsInstance<SecureAreaBoundCredential>()
.firstOrNull()
?.attestation
?.certChain
?.javaX509Certificates
?: emptyList(),
).also { it.base = baseDocument }
}


}

0 comments on commit b7cc53e

Please sign in to comment.