atuinsh/atuin

[Bug]: attempting to decrypt with incorrect key

abs3ntdev opened this issue · 7 comments

What did you expect to happen?

atuin sync completes with no errors

What happened?

i get an error saying:

0/0 up/down to record store
53667 in history index, but 37153 in history store
Running automatic history store init...
Error: attempting to decrypt with incorrect key. currently using ***, expecting ***

Location:
    atuin-client/src/record/encryption.rs:132:9

Atuin doctor output

atuin:
  version: 18.1.0
  sync:
    cloud: false
    records: true
    auto_sync: true
    last_sync: 2024-03-21 6:58:58.225402477 +00:00:00
shell:
  name: zsh
  plugins:
  - atuin
system:
  os: Arch Linux
  arch: x86_64
  version: unknown
  disks:
  - name: /dev/nvme0n1p3
    filesystem: ext4
  - name: /dev/nvme0n1p1
    filesystem: vfat

Code of Conduct

  • I agree to follow this project's Code of Conduct

Why would you expect atuin sync to complete with no errors when it literally cannot decrypt the data?

What about the wrong key? Should it then encrypt your "new" local data with the wrong key and sync the encrypted data to the server? In that case you would have inconsistent data on the server that couldn't be read from any other clients that actually use the correct key.

Sorry, I just don't understand why there shouldn't be an error.

I am not saying the error is incorrect. I am confused why I am getting it when my key has not changed. the only change I made was adding these values to my config.toml and try to run atuin sync

[sync]
records = true

[dotfiles]
enabled = true

If somehow the key doesn't match what was initially used do I just need to wipe the db and sync -f from local? I am not sure what steps need to resolve the error.

That all depends. When you first setup sync was it on this machine? Are there any other machines where the sync still works?
Does the output of atuin status tell you that you are logged in?

this is the original machine yes. my laptop gives the same error

atuin status gives the following:

Atuin v18.1.0 - Build rev NO_GIT

[Local]
Sync frequency: 0
Last sync: 2024-03-23 1:10:45.041718915 +00:00:00
[Remote]
Address: ****
Username: abs3nt

Ok, agreed. This makes no sense then. It looked like you entered the key incorrectly when setting up sync.
I did some digging and found an answer from ellie on the forum:

https://forum.atuin.sh/t/sync-v2-testing/124/8?u=tessus

atuin store purge
cleared up the error. seems like the laptop most likely ran at some point without logging in or something similar to the forum post. thank you!

You are welcome. Sorry again for misunderstanding the issue.