# Cannot Delete or Rotate Encryption Keys

**URL:** https://meta.discourse.org/t/cannot-delete-or-rotate-encryption-keys/268215
**Category:** Bug
**Tags:** encrypt
**Created:** [June 13, 2023, 8:51pm UTC](https://meta.discourse.org/t/cannot-delete-or-rotate-encryption-keys/268215 "2023-06-13T20:51:02Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![JimmyHoke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jimmyhoke/32/341886_2.png) [@JimmyHoke](https://meta.discourse.org/u/JimmyHoke)
#### Post date: [June 13, 2023, 8:51pm UTC](https://meta.discourse.org/t/cannot-delete-or-rotate-encryption-keys/268215/1 "2023-06-13T20:51:03Z")

</div>

> [@Discourse Encrypt (deprecated)](https://meta.discourse.org/t/discourse-encrypt-for-private-messages/107918):
>
> play_button Original Plugin Description Last edited by @david 2024-12-03T15:46:08Z (UTC) play_button Check document

Users cannot disable encryption or rotate keys. The button to disable encryption remains disabled after username is entered. And rotating keys fails with a “Sorry, an error has occurred.”

---

<div class="post-metadata">

### Author: ![satonotdead](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/satonotdead/32/447830_2.png) [@satonotdead](https://meta.discourse.org/u/satonotdead)
#### Post date: [July 1, 2023, 11:20pm UTC](https://meta.discourse.org/t/cannot-delete-or-rotate-encryption-keys/268215/2 "2023-07-01T23:20:08Z")

</div>

How can I safely _remove_ (and delete all on database) the plugin to start again?

I can’t read any encrypted message and I tried a few users, devices, all correctly enabled. I used PMs encrypted before but now they are not working at all.

If I try to disable the PMs I just can’t ‘delete all my encrypted messages’ and I see CSS button form not allowed to continue 🚫

The issue seems to be related to trying to removing all devices and enable them from scratch but I’m not sure about it.

_Please, sorry if it’s related to my actual configuration, I can follow your directions and test if that’s the case. I hope to help someone in similar situation._

### logs

```plaintext
Scoped order is ignored, it's forced to be batch order.

activerecord-7.0.4.3/lib/active_record/relation/batches.rb:292:in `act_on_ignored_order'  
activerecord-7.0.4.3/lib/active_record/relation/batches.rb:215:in `in_batches'  
activerecord-7.0.4.3/lib/active_record/relation/batches.rb:137:in `find_in_batches'  
activerecord-7.0.4.3/lib/active_record/relation/batches.rb:70:in `find_each'  
/var/www/discourse/lib/post_destroyer.rb:170:in `perform_delete'  
/var/www/discourse/lib/post_destroyer.rb:77:in `destroy'  
/var/www/discourse/plugins/discourse-encrypt/app/jobs/scheduled/encrypted_post_timer_evaluator.rb:25:in `block (3 levels) in execute' 
/var/www/discourse/plugins/discourse-encrypt/app/jobs/scheduled/encrypted_post_timer_evaluator.rb:23:in `each' 
/var/www/discourse/plugins/discourse-encrypt/app/jobs/scheduled/encrypted_post_timer_evaluator.rb:23:in `block (2 levels) in execute' 
activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction' 
activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt' 
activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize' 
activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt' 
activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize' 
activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction' 
activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction' 
activerecord-7.0.4.3/lib/active_record/transactions.rb:209:in `transaction'  
/var/www/discourse/plugins/discourse-encrypt/app/jobs/scheduled/encrypted_post_timer_evaluator.rb:9:in `block in execute' 
activerecord-7.0.4.3/lib/active_record/relation/batches.rb:71:in `each'  
activerecord-7.0.4.3/lib/active_record/relation/batches.rb:71:in `block in find_each'  
activerecord-7.0.4.3/lib/active_record/relation/batches.rb:138:in `block in find_in_batches'  
activerecord-7.0.4.3/lib/active_record/relation/batches.rb:245:in `block in in_batches'  
activerecord-7.0.4.3/lib/active_record/relation/batches.rb:229:in `loop'  
activerecord-7.0.4.3/lib/active_record/relation/batches.rb:229:in `in_batches'  
activerecord-7.0.4.3/lib/active_record/relation/batches.rb:137:in `find_in_batches'  
activerecord-7.0.4.3/lib/active_record/relation/batches.rb:70:in `find_each'  
/var/www/discourse/plugins/discourse-encrypt/app/jobs/scheduled/encrypted_post_timer_evaluator.rb:8:in `execute' 
/var/www/discourse/app/jobs/base.rb:292:in `block (2 levels) in perform'  
rails_multisite-5.0.0/lib/rails_multisite/connection_management.rb:82:in `with_connection'
/var/www/discourse/app/jobs/base.rb:279:in `block in perform'  
/var/www/discourse/app/jobs/base.rb:275:in `each'  
/var/www/discourse/app/jobs/base.rb:275:in `perform'  
/var/www/discourse/app/jobs/base.rb:346:in `perform'  
mini_scheduler-0.16.0/lib/mini_scheduler/manager.rb:122:in `process_queue'  
mini_scheduler-0.16.0/lib/mini_scheduler/manager.rb:70:in `worker_loop'  
mini_scheduler-0.16.0/lib/mini_scheduler/manager.rb:59:in `block (2 levels) in ensure_worker_threads'

job	Jobs::EncryptedPostTimerEvaluator

```

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [July 2, 2023, 7:28am UTC](https://meta.discourse.org/t/cannot-delete-or-rotate-encryption-keys/268215/3 "2023-07-02T07:28:01Z")

</div>

I have got my test site into a similar state and I’m also looking for answers on this. 🙂

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [July 6, 2023, 10:47am UTC](https://meta.discourse.org/t/cannot-delete-or-rotate-encryption-keys/268215/9 "2023-07-06T10:47:05Z")

</div>

I can replicate this.

Using a test user and activating the Encryption for the first time goes smoothly, but then there’s no way to disable it.

- Enable Encrypted Messages for a test user from their Preferences/Security
- Click on the wrench icon and ‘Disable Encrypted Messages’
- Button to Disable is greyed out and unpressable

 ![disable encrypted messages](https://global.discourse-cdn.com/meta/original/4X/3/5/7/357ac1e4f1f2bff0aa006a8f54eb934d41f929cb.png)

If you have encrypted messages and need to ‘type to confirm’ then this also presents an unpressable button:

 ![type to confirm](https://global.discourse-cdn.com/meta/original/4X/1/9/d/19de95c0f4634a814072390d847854128ad54f4b.png)

When enabling, this error appears in the browser console:

```plaintext
[PLUGIN discourse-encrypt] reopenWidget: Could not find widget quick-access-panel in registry widget.js:82
    reopenWidget widget.js:82
    reopenWidget plugin-api.js:654
    initialize decrypt-topics.js:104
    withPluginApi plugin-api.js:2159
    initialize decrypt-topics.js:101
    initialize app.js:173
    runInstanceInitializers Ember
    each dag-map.js:192
    walk dag-map.js:121
    each dag-map.js:66
    topsort dag-map.js:72
    Ember 4
    invoke queue.ts:201
    flush queue.ts:98
    flush deferred-action-queues.ts:75
    _end index.ts:616
    _boundAutorunEnd index.ts:257
    (Async: promise callback)
    n platform.ts:28
    flush Ember
    _scheduleAutorun index.ts:803
    _ensureInstance index.ts:791
    schedule index.ts:384
    Ember 6
    <anonymous> start-app.js:4
    <anonymous> discourse-boot.js:20
    <anonymous> discourse-boot.js:21

```

* * *

I also spotted a missing string for key rotation:

 ![missing string](https://global.discourse-cdn.com/meta/original/4X/d/6/f/d6f525132b12578820a69cd811dd286ba48fbf5a.png)

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [July 6, 2023, 11:19am UTC](https://meta.discourse.org/t/cannot-delete-or-rotate-encryption-keys/268215/10 "2023-07-06T11:19:53Z")

</div>

> [@JammyDodger](#):
>
> When enabling, this error appears in the browser console:
> 
> ```plaintext
> [PLUGIN discourse-encrypt] reopenWidget: Could not find widget quick-access-panel in registry widget.js:82
> 
> ```

These console warnings will be resolved by [this PR](https://github.com/discourse/discourse-encrypt/pull/259) - they’re not related to the problem in this topic.

---

<div class="post-metadata">

### Author: ![satonotdead](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/satonotdead/32/447830_2.png) [@satonotdead](https://meta.discourse.org/u/satonotdead)
#### Post date: [July 16, 2023, 10:10pm UTC](https://meta.discourse.org/t/cannot-delete-or-rotate-encryption-keys/268215/11 "2023-07-16T22:10:18Z")

</div>

I’m still can’t remove encrypt on my account (and I have last version of Encrypt plus Discourse):

 ![Screenshot_20230716_185911](https://global.discourse-cdn.com/meta/original/4X/c/5/2/c5258b578129385778f96e1056264163f931dcf1.png)

The button keeps disabled and I need to start again because I lost my keys (I’m trying, there is no issue at deleting encrypted messages) and I want to start from zero 🙂

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [July 24, 2023, 12:36pm UTC](https://meta.discourse.org/t/cannot-delete-or-rotate-encryption-keys/268215/16 "2023-07-24T12:36:01Z")

</div>

@cvx has been working on some improvements to these modal popups in discourse-encrypt, so things should be working much better now. Please let us know if you’re still running into any issues after updating.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [July 25, 2023, 7:00am UTC](https://meta.discourse.org/t/cannot-delete-or-rotate-encryption-keys/268215/17 "2023-07-25T07:00:21Z")

</div>

This topic was automatically closed after 18 hours. New replies are no longer allowed.
