Skip to content

Comments

Autofill Service to be able to give password hints directly and save passwords from autofill#162

Open
difanta wants to merge 12 commits intohegocre:mainfrom
difanta:main
Open

Autofill Service to be able to give password hints directly and save passwords from autofill#162
difanta wants to merge 12 commits intohegocre:mainfrom
difanta:main

Conversation

@difanta
Copy link

@difanta difanta commented Feb 12, 2026

This is a work in progress implementation of some features that I would consider very important for the Autofill Service.

  1. Let Autofill Service give hints right away instead of having to open the main app to complete the insertion
  2. Added AppLock activity that opens when the user selects an hint with the app lock enabled, the lock UI is shown and when completed the autofill request is completed. This uses Dataset.setAuthentication
  3. Support saving from the Autofill Service, this takes the first non null and non empty username and password, the searchHint as url and label and saves into new password or updates existing ones that match searchHint

This is still work in progress from an optimization perspective, and also I would like external opinion on a few choices.

  1. The Autofill Service on every Autofill Request syncs passwords with the Api, this is of course not ideal in a very limited time constrained service. If the app is rarely opened I find it necessary that the service syncs passwords, but maybe some other periodic background options are possible?
  2. Now the Service shows a list of hints of passwords matching searchHint, after those the original "NextcloudPasswords" hint that opens the app to select the password, and a "Generate Password" hint only if there are no passwords matching searchHint. This hint autofills a password already generated (according to the User preferences) while completing the FillRequest
  3. Saving works but needs more features, for example support for multiple-page logins, a dialog to choose the label of the password before saving (or maybe open the UI from the app to edit all the fields), support for inserting the master password if not saved

If anyone has the time to review this, I would much like to hear your thoughts, cheers.

… opening app; service opens app lock prompt if needed via Dataset.setAuthentication; autofill service can now save from autofill (wip)
@hegocre
Copy link
Owner

hegocre commented Feb 12, 2026

Hello,

Thank you very much for your work! I took a quick look at your code, and it looks nice!

To answer your questions:

  1. I think it would be great to do some form of rate limiting, specially because the autofill request method is called multiple times in the same autofill session (or at least, that's what I remember from when I created the service a while ago). Maybe, there could be a last sync parameter saved, and if it is less than let's say a couple of hours, the service does not sync.
  2. That's great for me!
  3. I like the idea of opening the edit password view, so the user can add some fields if he wants.

Thank you again!

…formation in intents, so no need for a separate lock only activity but rather main activity is in charge of authenticating and answering; fix building Save Info, now should work in most common cases, including delayed username and password insertion; wip: dedicated UI to handle save requests (create/update)
@hegocre
Copy link
Owner

hegocre commented Feb 17, 2026

Hello!

I have been able to install and try the app, and I have found two issues, to an otherwise amazing work!!

  • The first time fulfilling an autofill request (at least on a website), it only shows the nextcloud passwords and the generate options. When reloading, the options appear fine.
  • The autofill suggestions don't seem to follow the Strict domain matching setting.

Thanks again for your contribution!

Best regards.

only support saving from version P;
@difanta
Copy link
Author

difanta commented Feb 21, 2026

Hi! I finally managed to get some work done, I have fixed the issue of the first autofill request not showing the correct passwords, it did not wait correctly for the decryption and so they were only ready by the second request.

I don't know what might cause the fact that strict domain matching is not followed, I've found a small modification to make in order to make the code identical to NCPNavHost but I would have to investigate further if this is not sufficient.

In any case a few updates:

Now the autofill service runs only with cached keychain and passwords, this is the only way to make it fast enough to be usable. A deferred update must be the way to sync passwords periodically.

The autofill response is always handled by the main app, and specifically a new interface (AutofillData) is passed down by the components of the app until NCPNavHost handles them. There are 4 possible cases
1 "FromId" - A password was clicked in the autofill completion -> After passwords are decrypted directly answer the autofill with the password with that id. This case is directly done by the AutofillService, not by the main app, if and only if there is no app lock or it is already unlocked
2 "ChoosePwd" - The user clicked the button to choose the password in the app, usual behaviour of the old autofill
3 "Save" - The user chose to save (or update) a new (or existing) password -> the password list is filtered for that domain, the user is free to create or edit passwords on the list. When opening one it automatically inserts the new label, url, username and password. Then the user saves the new or updated password(s) and must do a back gesture to exit the passwords app
4 "SaveAutofill" - Same as Save but triggered only when clicking on the "Create new password" hint, the user is free to create one or more passwords and eventually will click "Save and autofill" on one of them (the autofill does not go through due to a bug I'm investigating but this is basically done)

I'm missing a translation, which I don't know how to do and, if you agree, an icon to replace the big "Nextcloud Passwords" hint to something smaller such as ">" or any icon that fits the idea. Look for TODO if you'd like to spot these.

@difanta difanta marked this pull request as ready for review February 22, 2026 20:34
@difanta
Copy link
Author

difanta commented Feb 22, 2026

This should be ready, the create password bug is solved.
Strict domain matching might not be possible beacuse the only domain that the autofill service can read from the structure is AssistStructure.ViewNode#getWebDomain(), and this does not output the full url.
The only open things are the translation of "Create new password" and the decision about the icon/text to use for the "open main app" button.

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -XX:+UseParallelGC
org.gradle.java.home=C:\\Program Files\\Java\\latest\\jdk-21
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this shouldn't be here? It produces a build error in systems where the jdk is not at this exact path

Copy link
Author

@difanta difanta Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I messed up a commit with things i kept local, should be good now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants