Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ when verifying. For example, if you expect the challenge to be equal to

```kotlin
// Create a ChallengeChecker
val challengeChecker = ChallengeMatcher("challenge123")
val challengeChecker = ChallengeMatcher(ByteString.copyFromUtf8("challenge123"))

// Verify an attestation certificate chain with the checker
val result = verifier.verify(certificateChain, challengeChecker)
Expand All @@ -57,9 +57,14 @@ with an `InMemoryLruCache` like in this sample:
```kotlin
val cacheSize = 100

// Create a ChainedChallengeChecker with desired ChallengeCheckers
// Create a ChainedChallengeChecker with desired ChallengeCheckers. The
// coroutineScope is used to run each individual checker.
val challengeChecker =
ChainedChallengeChecker.of(ChallengeMatcher("expectedChallenge"), InMemoryLruCache(cacheSize))
ChainedChallengeChecker.of(
coroutineScope,
ChallengeMatcher(ByteString.copyFromUtf8("expectedChallenge")),
InMemoryLruCache(cacheSize),
)

// Verify an attestation certificate chain with the checker
val result = verifier.verify(certificateChain, challengeChecker)
Expand Down
6 changes: 4 additions & 2 deletions src/main/kotlin/Extension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,9 @@ data class PatchLevel(val yearMonth: YearMonth, val version: Int? = null) {
partitionName: String = "",
logFn: (String) -> Unit = { _ -> },
): PatchLevel? {
check(patchLevel is ASN1Integer) { "Must be an ASN1Integer, was ${this::class.simpleName}" }
check(patchLevel is ASN1Integer) {
"Must be an ASN1Integer, was ${patchLevel::class.simpleName}"
}
return from(patchLevel.value.toString(), partitionName, logFn)
}

Expand Down Expand Up @@ -768,7 +770,7 @@ private inline fun <reified T> ASN1Encodable.toSet(): Set<T> {
return this.map {
if (it !is T) {
throw ExtensionParsingException(
"Object must be a ${T::class.simpleName}, was ${this::class.simpleName}"
"Object must be a ${T::class.simpleName}, was ${it::class.simpleName}"
)
}
it
Expand Down
Loading