Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve encrypt/decrypt flow #125

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

danfinlay
Copy link
Contributor

@danfinlay danfinlay commented Sep 4, 2021

Made encrypt/decrypt a "fully functional" flow, so the test dapp can
actually be used as an encrypted messenger.

Changes some element ordering, and the encryption is no longer assumed to the connected address, but requires input, so this could break an e2e test that relies on it.

Fixes #124

Looks like this:
image

Made encrypt/decrypt a "fully functional" flow, so the test dapp can
actually be used as an encrypted messenger.

Fixes #124
@danfinlay danfinlay requested a review from a team as a code owner September 4, 2021 01:10
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

This design looks good! This will almost certainly break the e2e tests, but we can fix those easily enough. We should publish this as a breaking change to indicate that.

I think the button disabled state logic needs some cleanup. For the two new inputs (public encryption key and encrypted message), we could add listeners to enable the associated button when they are non-empty.

@@ -258,12 +258,17 @@ <h4 class="card-title">
<button
class="btn btn-primary btn-lg btn-block mb-3"
id="getEncryptionKeyButton"
disabled
Copy link
Member

Choose a reason for hiding this comment

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

Why was this removed? The intention was to have all of the buttons that rely upon an account being connected to start as disabled until we know whether something is connected or not.

Copy link
Member

Choose a reason for hiding this comment

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

The same goes for the "decrypt" button.


<button
class="btn btn-primary btn-lg btn-block mb-3"
id="encryptButton"
disabled
Copy link
Member

Choose a reason for hiding this comment

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

Similarly, this one was meant to be disabled until we have a public encryption key to encrypt with.

@@ -6,6 +6,7 @@ import {
recoverTypedSignatureLegacy,
recoverTypedSignature,
recoverTypedSignature_v4 as recoverTypedSignatureV4,
decrypt,
Copy link
Member

Choose a reason for hiding this comment

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

This line is causing the linter to fail

encryptMessageInput.value.length > 0
) {
if (encryptButton.disabled) {
encryptButton.disabled = false;
Copy link
Member

Choose a reason for hiding this comment

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

Was this deleted to allow encrypting an empty message? I'm not sure why that was disallowed to being with 🤔 Does that work?

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.

Make the "encrypt/decrypt" section usable as a minimal messenger
2 participants