Skip to content

feat: add option to force encryption#6410

Merged
nicodh merged 4 commits into
mainfrom
enforce-e2ee
May 27, 2026
Merged

feat: add option to force encryption#6410
nicodh merged 4 commits into
mainfrom
enforce-e2ee

Conversation

@nicodh

@nicodh nicodh commented May 23, 2026

Copy link
Copy Markdown
Member

No description provided.

@nicodh nicodh mentioned this pull request May 23, 2026
5 tasks
@r10s r10s added blocker This issue is blocking a new release enhancement New feature or request labels May 26, 2026
@nicodh nicodh marked this pull request as ready for review May 26, 2026 14:04
@nicodh nicodh requested a review from WofWca May 26, 2026 14:04
@nicodh

nicodh commented May 26, 2026

Copy link
Copy Markdown
Member Author

See the related PR in Android deltachat/deltachat-android#4431

@WofWca WofWca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Works.

Comment thread packages/frontend/src/stores/settings.ts Outdated
Comment thread packages/frontend/src/components/LoginForm.tsx Outdated
<option value={Socket.plain}>{tx('off')}</option>
</DeltaSelect>

<div className='delta-form-group delta-switch'>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Quite misleading placement of the setting, but yep I see that Android's doing the same.
Do we want toggling the switch to take effect immediately or only when the form gets submitted?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hmm, good question. The "cancel" button somehow implies "discard my changes" so maybe an unexpected behaviour if we change it immediately. On the other hand this settings is anyway an "expert" feature that should be only changed by people who know what they are doing. And of course "Login" is also a bit strange for saving a value that is not related to the login. But that is all a result of the mentioned "misplacement" of this setting.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  • if it is not an unreasonable effort, we should apply the changes only when "OK" is hit, we also changed that on android at deltachat/deltachat-android@40faa3d

  • in any case, however, it should be the really last option in the "more settings", so after "certificate checks"

  • for clarity: no need to add it to "untranslated", there is the existing string enforce_e2ee saying "Enforce Encryption for All Relays", which is clearer. position was discussed a lot, it is fine, if ppl do not find the option without explicitly knowing it exist by other means

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok, I changed the behaviour. The setting is not applied when the user cancels the form.

The translation still waits for #6416 to be approved. Then the untranslated entry will be removed.

@WofWca WofWca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tested again, both of the places where LoginForm is used. Works. I didn't test the "error" path though.
The code looks alright. The setting only gets saved on success.

Comment on lines +156 to +157
overflow: visible;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
overflow: visible;

This doesn't do anything, right? It's the default value anyway.

const [accountSettings, setAccountSettings] =
useState<Credentials>(defaultCredentials())
const [forceEncryption, setForceEncryption] = useState<boolean>(
settingsStore?.settings['force_encryption'] !== '0'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
settingsStore?.settings['force_encryption'] !== '0'
settingsStore?.settings['force_encryption'] === '1'

We already changed this in one place, so let's be consistent? Especially here where the settingsStore can be nullish. See #6410 (comment)

[accountId, openDialog, selectAccount, credentials]
const settingsStore = useSettingsStore()[0]
const [forceEncryption, setForceEncryption] = useState<boolean>(
settingsStore?.settings['force_encryption'] !== '0'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
settingsStore?.settings['force_encryption'] !== '0'
settingsStore?.settings['force_encryption'] === '1'

See #6410 (comment)

Comment on lines +298 to +301
SettingsStoreInstance.effect.setCoreSetting(
'force_encryption',
forceEncryption ? '0' : '1'
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is basically unused now, right?

@nicodh nicodh merged commit 8ee313e into main May 27, 2026
12 checks passed
@nicodh nicodh deleted the enforce-e2ee branch May 27, 2026 15:49
r404r pushed a commit to r404r/deltachat-desktop that referenced this pull request May 31, 2026
* fix: only save e2ee setting after successful login
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocker This issue is blocking a new release enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants