standardnotes / desktop

[Moved to https://github.com/standardnotes/app] A free, open-source, and end-to-end encrypted notes app. https://standardnotes.com
GNU Affero General Public License v3.0
1.4k stars 115 forks source link

No associated key found for item encrypted with latest protocol version #690

Open sdobz opened 3 years ago

sdobz commented 3 years ago

I recently upgraded to encryption protocol 4 on a self hosted copy of standard notes

Some time later I attempted to log in via https://app.standardnotes.org/ and my notes would not load, with the error

Error: No associated key found for item encrypted with latest protocol version.

When I got onto my desktop I upgraded both server and client

After a logout and fresh open of the app I enter

  1. Username
  2. Password
  3. Syncing server url

And I see in the developer tools:

Uncaught (in promise) Error: Already signing in.
    at h.signIn (app.js:2)
    at p.login (app.js:2)
sync.standardnotes.org/auth/sign_in:1 Failed to load resource: the server responded with a status of 401 ()
app.js:2 Uncaught (in promise) Error: Already signing in.
    at h.signIn (app.js:2)
    at p.login (app.js:2)
Error: No associated key found for item encrypted with latest protocol version.
    at Gn.keyToUseForDecryptionOfPayload (app.js:2)
    at Gn.payloadByDecryptingPayload (app.js:2)
    at Br.handleSuccessServerResponse (app.js:2)
    at async br.receiver (app.js:2)
    at async br.run (app.js:2)
    at async Br.sync (app.js:2)
    at async Br.downloadFirstSync (app.js:2)

I am able to decrypt my backups using the decrypt.html document (thanks, this is the excellent decision making I want to support) but I cannot get the desktop or web clients to sync to the server.

Poking around in the (ugh minified, thankfully not mangled) code: All of the items have items_key_id of null

Poking the database says that all but one of my notes have a null items_key_id, I wasn't immediately able to tell its version.

I guess I can purge the notes and restore from a backup, sounds inconvenient and potentially lossy.

Is there a way to recover?

Potential factors:

It's probably related to some strange edge case related to migrating from 003 to 004

moughxyz commented 3 years ago

We've found an issue recently where data could end up in a tangled state if you import data into your account that belongs to another account, while also satisfying some other rare factors that you may have encountered. This could also happen if using a browser like Firefox and you delete history, but not offline data, and then upon opening the app, it asks you to re-enter your credentials, and you do—this causes some data entanglement. This is fixed in 3.6.6 which was released today.

At this point if you do have the proper backups the best solution is using those. I do not think it will be lossy, but you can verify they are working correctly by opening the web or desktop app in a non-signed in state, and importing the backup. If all looks good, clear local data, clear account data, sign into account, and import the backup.