devicecheck-appattest
devicecheck-appattest copied to clipboard
Minor issue with exception message on creation time check
https://github.com/veehaitch/devicecheck-appattest/blob/cb26211f63c1e2e7949deafe2efdf352daca27fa/src/main/kotlin/ch/veehait/devicecheck/appattest/receipt/ReceiptValidator.kt#L172
// 5. Verify that the receipt’s creation time, given in field 12, is no more than five minutes old.
// This helps to thwart replay attacks.
if (notAfter.isAfter(receiptPayload.creationTime.value)) {
throw ReceiptException.InvalidPayload("Receipt's creation time is after $notAfter")
}
right message should be: "Receipt's creation time is before $notAfter"
(yeah, message still not very easy-understandable. best i have in mind - "Receipt's creation time is older than $maxAge")
Thanks a lot for reporting. You're right, the exception's message isn't accurate.
After giving it some more thought, I even came to the conclusion that the name of the parameter should be notBefore
rather than notAfter
. I'd appreciate it if you cold take a look at #38 which hopefully addresses this issue while also making the parameter more approachable.
Looks good, thanks :))