openwallet-foundation-labs / identity-credential

Apache License 2.0
149 stars 76 forks source link

PassphrasePrompt need title, body, and buttons #663

Open davidz25 opened 6 days ago

davidz25 commented 6 days ago

Just tried out PassphrasePrompt and it looks like this

image

and appears right after the consent prompt. This is really confusing, how would the user know what to do here? The answer is that they don't, we need some helpful text explaining what is going on. The other problem is that the code completely ignores the passed-in constraints.

To fix the first problem, we need PassphrasePrompt to take title and content and from showPresentationFlow() we should pass in "Enter PIN" or "Enter Passphrase" depending on the value of passphraseConstraints. For content we should put "Enter the PIN for the document" or "Enter the passphrase for the document", depending.

To fix the second problem, if the passphrase/PIN is not fixed length (when constraints.minLength == constraints.maxLength) then add a "Next" button. If not, call onPassphraseEntered() when the user has entered the fixed length.

Also, add a "Cancel" button, make showPassphrase() return String?, and return null when the the prompt is canceled (when the user presses the "Cancel" button)

davidz25 commented 6 days ago

Also, I just noticed that showPassphrasePrompt() takes checkWeakPassphrase which doesn't make any sense ... this is a feature of PassphraseEntryField and it's intended to only be used when the user is creating a passphrase. So showPassphrasePrompt() should not take that as a parameter and it should pass checkWeakPassphrase = false to the underlying PassphraseEntryField.

davidz25 commented 2 days ago

It would be good to get this done soon.