Commit graph

236 commits

Author SHA1 Message Date
bunnie
81a9355ef8 vault: use platform-neutral ux-api instead of graphics-server 2025-02-21 17:51:04 +08:00
bunnie
4f14a67504 formatting changes due to changes in nightly rust
needed to get a clean check on gh
2025-02-01 22:26:40 +08:00
bunnie
043dfd84ae update formatting to latest nightly rules 2024-09-24 01:49:45 +08:00
bunnie
e5bd1cffb9 port apps/vault to use xous-ipc 0.10 2024-09-23 14:19:13 +08:00
bunnie
34e6f46d63 formatting changes that resulted from the regex search
a bunch of lines are shorter or different length now which
triggers a mandatory reformat. this patch cleans that up,
so that going forward the manual rework patches are clearer and
not tied up with formatting patches.
2024-09-22 15:31:14 +08:00
bunnie
a1bf70b9ed regex search/replace instances of xous_ipc::String to String
split into a couple commits for ease of committing
2024-09-22 14:14:55 +08:00
bunnie
c8d45479eb rust 1.80 fixes for vault 2024-08-19 02:39:21 +08:00
bunnie
4a1f32cffd clean up warning that emerged in rust updates 2024-04-01 15:57:19 +08:00
bunnie
fb68eb9dd2 cleanup datetime API deprecation warnings 2024-02-08 13:46:24 +08:00
bunnie
995d5398da upgrade vault API to use latest hash/hkdf 2024-01-31 04:02:36 +08:00
bunnie
9f5a5d0ada rustfmt vs rustc linter: FIGHT
rustfmt shortened some blocks to be one-liners.
the blocks ensure the contents have Drop called on them.
the linter hates the braces, saying they are unused.

Perhaps, in fact, the contents don't need Drop called
on them exactly at that time because there isn't a conflicting
statement elsewhere in the block that uses it. It *might*
be right.

But then, later on, when you write some code that assumes
that implicit Drop happened, guess what. You'll spend hours
scratching your head as to what went wrong.

I just stuck a comment in the block to keep rustfmt from
thinking it should format that block.
2024-01-14 23:34:07 +08:00
bunnie
454ecac95a fix rustfmt::skip warning
turns out, stackoverflow has out of date info. woohoo!
2024-01-14 23:12:52 +08:00
bunnie
70340eb7bf format apps/vault
just our own code is formatted, vendored in files are skipped.
2024-01-14 19:09:53 +08:00
bunnie
3d1f5b032f skip formatting of vendored files
this will help make merges/patches easier against OpenSK
2024-01-14 19:09:19 +08:00
bunnie
367ede62b1 convert usbd-human-interface-device to xous-usb-hid 2023-11-16 17:27:00 +08:00
bunnie
4d949d153b Add option to generat number-only passwords (#446)
This commit adds explicit selection knobs for all possible
types of characters and symbols.

A side effect is there is also now an error loop to handle the
case that none of the knobs are selected. The user cannot
proceed with generation until at least one type is selected.

When no alphabetic characters are selected, "exclude similar" is
now false, which allows all of the numbers to be picked from.
Normally, 1, 0, etc. are avoided to make it easier for humans
to read/copy the passwords without ambiguity. This does reduce
the total entropy slightly, but ideally you are using the
password generator with a long setting (20 or so characters)
so you're well beyond the worry of losing entropy due to dropping
the few similar characters.
2023-11-15 19:14:08 +08:00
bunnie
419e547641 bump usbd-hid-device crate to latest
API changes to see if we want to absorb this prior to forking.
2023-11-12 00:02:07 +08:00
bunnie
000d6606ce helps to actually have the line uncommented for the fix to work... 2023-09-19 01:59:38 +08:00
bunnie
43b0beecd4 add work-around to keep ct_eq from being optimized out
See #416 for details
2023-09-19 00:58:50 +08:00
bunnie
bdf70ab0e4 refactor API to upgrade subtle API in attempt to fix ct_eq problem
this didn't work, but, it's probably worth leaving the change in
place because this might fix other stuff we don't know about.
2023-09-18 23:55:33 +08:00
bunnie
a40663bd63 refresh item cache after leaving host readout mode 2023-08-14 14:21:53 +08:00
bunnie
93a2dc0515 add option to type usernames as well as passwords
passwords is the "quick default", you have to pop down by
one on the menu to type a username.

This should address #401.
2023-08-08 01:19:51 +08:00
bunnie
9932d971c4 clean up the warnings that are deemed safe to clean up
one warning remains, will address this in a future PR.
2023-07-16 17:55:28 +08:00
bunnie
cae402fad0 fix case where an idle font selection menu can crash the system while in TOTP mode
when the font menu is raised while in TOTP mode, the "pump"
thread continues to prompt for redraws, which can eventually lead to
an overflow of the server queue on the main thread that leads to
deadlock and eventually a crash.

This patch does two things:

- splits the allow_host variable and the allow_totp_rendering variable
so that the two flags have distinct meanings

- use the allow_totp_rendering variable to control when the
totp thread is allowed to pump the main thread to animate the
timer bar.

Previously the allow_host variable was introduced to control access
to sensitive data, and it incidentally was also used to control
TOTP rendering because when host readout is activated this can
freeze the UI for extended periods of time.

By splitting the flag we can now control both independently of
each other. Rendering still stops when host readout is enabled,
but it also stops when any other blocking dialog boxes are popped up,
hopefully preventing future crashes if a user is distracted in
the middle of a UX flow that can block the main loop.
2023-07-06 16:36:10 +08:00
bunnie
dfffa48715 move default system font to gam/src/lib.rs SYSTEM_STYLE
default system font can be statically changed by modifying
the SYSTEM_STYLE constant.

This of course will lead to a request for a dynamically
configurable preference for font size. However, early
on it was decided this is a bad idea. Here's why.

We don't provide for dynamic system-wide font selection
because this adds a lot of complexity to what would otherwise
be static code: this is a deliberate choice to improve code
density and performance. If the system font were dynamically
adjustable, then every character rendered we would potentially
have to query the PDDB for the current system font setting.

The impact of this could be mitigated by caching values but
then what happens when you actually change the font? now
you need a registry to fire messages off to all dependent
crates with cached values to flush their caches and redraw
(or you punt and force a reboot if you change font sizes,
but still, you're creating a dependency on a lot of plumbing
for even the simplest crates).

Plus, with a static font selection, the compiler can take constants
like the font height and compose them with other fitting
parameters into optimized load/stores of borders and spacings
for the static case; if you make it dynamic, all those multiplies,
adds and divides now get pulled into the main rendering loop
and are recomputed all the time. For example, if you have a static
const list of items that need to be rendered, even if the code to
compute the height of the list is written as a for loop, the compiler
will know the list is constant, and the font height is constant,
and it can condense that all into a single number at compile time,
eliminating all the code for the for loop.

If you leave the option open to change that, that entire piece
of code has to be generated and executed even though in practice
nobody changes the parameter.
2023-07-05 13:39:11 +08:00
Jean-Pierre De Jesus DIAZ
2af737b57e
xous-rs: move LANG variable to locales
This change is made with the intention of making the xous-rs crate a bit
more freestanding without depending on the xtask build system.

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2023-06-15 18:23:12 +02:00
bunnie
08aac2c285 limit loading screen to password transitions
it interferes with the ctap2 tests
2023-06-07 01:41:14 +08:00
bunnie
5f5d926462 comment out the filter performance profiling
it's fast enough now that probably the performance profiling
accounts for a non-trivial portion of the runtime
2023-06-06 20:13:45 +08:00
bunnie
93d07e3cb8 cleanup debug crumbs 2023-06-06 20:07:47 +08:00
bunnie
63299c7ca6 bump release notes and comments 2023-06-06 19:52:45 +08:00
bunnie
6bb5569c9f add a screen to indicate when databases are reloading
since the operation can take quite a while
2023-06-06 19:31:26 +08:00
bunnie
567d9db2cd optimize the ui cache routines
rely more on the cache retaining consistency with the disk
versus always reloading from the disk to speed up performance.

might be useful to make a routine that can also check coherency
periodically, because with the new format the cache could
co-exist along side the database for a very long time without
any checking.
2023-06-06 19:17:24 +08:00
bunnie
4c180810a5 fixup sorting so that it only goes by lowercase values 2023-06-06 16:54:08 +08:00
bunnie
bd5b482cb0 rework list filtering to use an unsorted vec instead of btreemap
also eliminates references, copying and locking of items in the
sorted btreemap.

turns out that ... sorting is much cheaper than copying or maintaining
references, because copies to heap items require allocs which are
under the hoood several sorts to find the place to stick the alloc
memory, and shared references require locks.
2023-06-06 15:33:55 +08:00
bunnie
fa436c0845 fix bugs so that the implementation is working
as suspected, the shared lock is killer on performance.
2023-06-05 22:50:59 +08:00
bunnie
9bb3ac0db7 first stab at refactoring filter to be faster 2023-06-05 04:57:26 +08:00
bunnie
5a2df4432c technical debt: cleanup UTRA package
- make the "base" field no longer public. It is accessible, but only
through an `unsafe` method, because, it is unsafe.
- add accessors to offest/mask fields. Because, it's not at all
unsafe to access these, and it can be useful for bit-ops that are
not part of the generic set of UTRA.
- add Arc to AtomicCSR, and require `std` for AtomicCSR types.
This should not break anything, I checked inside @foundation-devices
keyOS and they don't seem to be using AtomicCSR anywhere.

The Arc makes it a bit safer to clone the AtomicCSR base pointer
and share it between threads, but it will have an impact on performance.
The USB stack (which requires AtomicCSR) was regression testing and the
impact seems minimal.

Recall that the main purpose of AtomicCSR is to provide a CSR accessor
that does not require a mutable reference to the base object. This
can make certain Rust idioms a bit cleaner. We wrap the base accessor
in Arc+Atomic to try and improve the safety of throwing the borrow
checker under the bus, but it's still not perfect because hardware
mutable state can have side-effects within hardware itself that cannot
be modeled or checked by Rust's borrow checker.
2023-05-23 18:11:24 +08:00
bunnie
08602773b9 tweak the test case generator for vault 2023-05-23 02:13:33 +08:00
bunnie
99f9278568 cleanup bitrot in testing routines 2023-05-23 00:14:35 +08:00
bunnie
6e16ef163f WIP #325
This hopefully resolves #325 but I'm unable to test it because
the U2F demo site I use for testing seems to have been disabled.
2023-05-22 18:36:22 +08:00
bunnie
2aa51736f5 fix #353 and possibly also #333
this adds a configurable autotype delay, and also adds a
left-handed mode option to the `vault` ui.

more testing is needed for #333, I think.
2023-05-22 17:22:17 +08:00
bunnie
6ec99fa7da add multi-line text editing support to TextEntry, and insertion points
TextEntry boxes can now specify "growable" as an option; if this
is set true, then, the fields within are considered to be multi-line
fields that can grow to fill the screen (even pushing lower ui
elements off the screen...); however a text line is limited to
256 characters so generally the overflow issue is hopefully rare-ish.

Left/right arrow keys conjure up an insertion point to allow for
deleting and inserting text in the middle of a field.

The main quirk is that if you enter text that causes a field to grow in
size, the overall dialog box can't grow any larger, so the text simply
overflows into the UI element above the current line, without limit.

Need to check for interactions with other elements that should
not be affected but it passes some simple test cases in `vault`.
2023-05-17 23:27:07 +08:00
bunnie
d6a87666ab add bip39 password entry prompt 2023-05-17 04:12:25 +08:00
bunnie
f93d9de3f1 add BIP-39 entry for passwords in vault
If the "notes" field starts with the characters
"bip39" (case insensitive), then, the password field is
interpreted as a hexadecimal encoding of BIP39 entropy.

To create a BIP-39 entry, leave the password field blank,
and then start the Notes field with the characters 'bip39',
and this will trigger a dialog box that will only allow
valid bip39 entry and check the checksum etc.

To view the BIP-39, after opening up the entry for "edit",
close it, and it will pop up a second dialog box that interprets
the hex data as BIP-39 words.

You could also in theory enter the hex digits yourself into
the password field, if you're masochist.
2023-05-17 03:53:55 +08:00
Jean-Pierre De Jesus DIAZ
3e2eb63663
imports: remove com_rs-ref
The crate just re-exports the com_rs crate. This patch changes usages of
com_rs-ref to use com_rs directly.

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2023-05-02 14:33:17 +02:00
bunnie
cb3c81d0fb fix #357: regenerate password if password field is blank in vault 2023-04-12 23:19:11 +08:00
bunnie
cd0269036d WIP: #334
I don't have a way to test this, but maybe you can give it a try
and see if it fixes as described in the issue.
2023-03-24 23:08:50 +08:00
bunnie
4fa4becc58 fix #310 + revert other "fixes"
Turns out the testbench failures are due to the testbench
being out of date. OpenSK is correct, the tests are wrong.

See discussions here:

https://github.com/google/OpenSK/issues/586
https://github.com/google/OpenSK/issues/584
https://github.com/google/OpenSK/issues/582

We'll await updates to the test tool and fold those into CI,
and leave the current failures standing.
2023-02-07 23:03:29 +08:00
bunnie
2191503f0c fix #304
this adds a "kicker" thread that gets updated with a target time
to kick the UX by the FIDO2 USB handler. When the target time is
met, an "update" command is issued to the UX.

This hopefully creates an efficient mechanism for triggering a
UX redraw that also has an acceptable delay.
2023-01-30 23:14:16 +08:00
bunnie
797bb0adc6 fix https://github.com/google/OpenSK/issues/584
I suspect this fix is actually the correct solution to the problem,
but refer to the issue above for tracking.
2023-01-30 18:34:43 +08:00