Rather than hardcoding numbers, use an enum with the constant values.
This will make it easier to reason about what the constants mean.
Signed-off-by: Sean Cross <sean@xobs.io>
Users are confused when they are prompted to enter a PIN code for
the first time with no preparation. Update the format request message
to prime users for the task.
After a prune, key fill/scan can crash because there is an assumption
that data is always resident in the cache for a small key.
This code handles the case where the small key data was evicted during
a prune, and reads the data back in just for that key on demand.
Furthermore, during a `sync` call, it will pull in the key data
that corresponds to the page containing just the small key, allowing
that page to be re-composed and replaced in memory. caching is used
on the decryption of the small key page so the expensive bit
of the call should only happen once per small key bank.
tested with pddb-ci and manually in hosted mode.
A portion of code was re-written to make it clear that only the
length of allocated data is copied to/from disk and memory, instead
of the reserved space as the previous code would indicate. The reserved
space is guaranteed to be zero because the RAM-based page for composing
the small key block is zero-ized prior to operations; left comments
reminding me of this in the future so I don't accidentally optimize
something out and cause data leakage between small keys because I'm
allowing the reserved areas to contain stale data.
this fixes a problem where backups fail when autobacklight is
enabled, because autobacklight is constantly querying the PDDB
for the length of the autobacklight timeout, even after the
PDDB is unmounted.
this is to allow a UX process to clear the "waiting for boot"
indicator once an attempt has completed.
right now, it responds *after* the mount process is done,
so the "please waiting" text persists even doing a format.
I think that is...appropriate?
The initial wait message is now rendered by the first app
that owns the screen (currently shellchat).
The location where the pop-up modal is rendered is also now bracketed
directly around the mount call to avoid interference with other
edge cases that may pop up modals.
This commit shows two notifications:
1. as soon as the device boots, a notification greets the user and
tells them everything is fine, the device is booting
2. as soon as the user enters (or doesn't) enter the password, a
notification tell the user Xous is loading and mounting PDDB
I spent too much time on this but I believe it's a nice UX improvement.
if the buffer fills up to the point where there isn't enough
space for the 8-bytes of header, a split_at() call will fail before
the routine even gets to decide if the record can fit.
abort the loop if the buffer is that full.