Skip to content

Commit d8deeed

Browse files
committed
fixup! Add app/device attestation for gated info-server requests
1 parent 7c7cde3 commit d8deeed

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/util/attestation.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,11 @@ const performHandshake = async (): Promise<CachedToken | undefined> => {
159159
if (assertResponse.ok) {
160160
return parseTokenResponse(await assertResponse.json())
161161
}
162-
// Server rejected the assertion: discard the key and re-attest.
162+
// Server rejected the assertion: the enrolled key is no longer trusted,
163+
// so any previously-minted token is suspect too. Drop it now so gated
164+
// callers do not keep sending a token the server already rejects while
165+
// re-enrollment is in progress; discard the key and re-attest.
166+
cachedToken = undefined
163167
console.warn(
164168
`[attestation] assertion rejected (${assertResponse.status}); re-attesting`
165169
)
@@ -191,6 +195,9 @@ const performHandshake = async (): Promise<CachedToken | undefined> => {
191195
if (assertResponse.ok) {
192196
return parseTokenResponse(await assertResponse.json())
193197
}
198+
// Server rejected the assertion: drop the now-suspect cached token (see
199+
// the iOS branch above) before discarding the key and re-attesting.
200+
cachedToken = undefined
194201
console.warn(
195202
`[attestation] assertion rejected (${assertResponse.status}); re-attesting`
196203
)

0 commit comments

Comments
 (0)