Expand description
The checksum that proves a snapshot reached the server as the server sent it, and the rate limit that stops a client which keeps sending corrupt ones.
The signature is HMAC-SHA256, in lowercase hex, under the application’s encryption key, over
Snapshot::signed_bytes. The child list is outside the signature because the browser rewrites
it while morphing the DOM; every other part of the envelope is covered.
Constants§
- MAX_
FAILURES - How many corrupt snapshots one client may send before the rate limit stops it.
Functions§
- ensure_
allowed - Fails with
TooManyChecksumFailureswhen the client is over the limit. - limit
- Ten failures in ten minutes.
- rate_
limit_ key - The cache key of one client,
livewire-checksum-failures:{ip}. - record_
failure - Counts one corrupt snapshot for the client.
- reset
- Forgets a client’s failures, which the tests use.
- sign
- Signs the snapshot’s
signed_bytes()under the application’s encryption key. - verify
- Whether the snapshot’s checksum matches, compared in constant time.
- verify_
or_ error - Verifies or fails with
LivewireError::CorruptPayload.