verifyAssertion

open fun verifyAssertion(validatedAttestation: ValidatedAttestation, assertion: ByteArray, expectedChallenge: ByteArray, validCounters: LongRange): Result<Assertion>(source)

Deprecated

To be removed in Warden Supreme 1.3. Confusing API

Replace with

validateAssertionOverChallenge(validatedAttestation, assertion, expectedChallenge, lastSeenCounter = validCounters.first, maxCounterAdvance = validCounters.last - 1 - validCounters.first)

Verifies an assertion whose entire client data is expectedChallenge, tied to a previously stored attestation. The client must have passed SHA-256(expectedChallenge) as clientDataHash to generateAssertion. The challenge is not stored inside the assertion; signature verification cryptographically binds the assertion to expectedChallenge.

The attestation is not verified again! There is no timeliness guarantee of any kind, so manually verify the freshness of the challenge before calling this function

A Note on Counters:
AppAttest only checks whether the signature counter BEFORE SIGNING AN ASSERTION is higher than a provided value. That is, a value of 0 will always work. Warden Supreme also allows checking for a maximum, hence validCounters. If you don't care for it, just pass Long.MAX_VALUE as upper bound (inclusive).
Also note that the upper bound will also be calculated on the value BEFORE creating the assertion!

Parameters

validatedAttestation

the previously validated attestation

expectedChallenge

the server-issued challenge used as the complete client data

validCounters

The range of valid counters


open fun verifyAssertion(validatedAttestation: ValidatedAttestation, assertion: ByteArray, referenceClientData: ByteArray, validCounters: LongRange, expectedChallenge: ByteArray, validator: AssertionChallengeValidator): Result<Assertion>(source)

Deprecated

To be removed in Warden Supreme 1.3. Confusing API

Replace with

validator.validateAssertion(validatedAttestation, assertion, referenceClientData = referenceClientData, expectedChallenge = expectedChallenge, lastSeenCounter = validCounters.first, maxCounterAdvance = validCounters.last - 1 - validCounters.first)

Verifies an assertion over arbitrary client data, tied to a previously stored attestation.

referenceClientData must contain the exact, unhashed bytes whose SHA-256 digest the client passed to generateAssertion. App Attest assertions do not contain those bytes. Signature verification proves their integrity, while validator is responsible for parsing them and verifying that they contain expectedChallenge. The caller must obtain the expected challenge from trusted server-side state and enforce its expiry and single use.

The attestation is not verified again! There is no timeliness guarantee of any kind, so manually verify the freshness of the challenge before calling this function

A Note on Counters:
AppAttest only checks whether the signature counter is higher than a provided value. That is, a value of 0 will always work. Warden Supreme also allows checking for a maximum, hence validCounters. If you don't care for it, just pass Long.MAX_VALUE as upper bound (inclusive).
Also note that the upper bound will also be calculated on the value BEFORE creating the assertion!

Parameters

validatedAttestation

the previously validated attestation

validCounters

The range of valid counters

validator

an AssertionChallengeValidator that extracts and verifies expectedChallenge in referenceClientData