atuinsh/atuin

[Bug]: encryption key is not a valid base64 encoding with key_path

thomas-bouvier opened this issue · 2 comments

What did you expect to happen?

Hello,

I set the key_path attribute to a file containing an Atuin key in plain text. When loging to Atuin using atuin login -u ..., and not providing any key path with -k, I expected the key file provided in the config to be read by Atuin.

(I am using NixOS, so the key_path attribute is set by Nix in my case)

I couldn't find in the docs if the encryption key has to be stored in plain text.

What happened?

When setting the key_path attribute to a file containing an Atuin key in plain text, the following error is triggered:

Error: could not load encryption key

Caused by:
   0: encryption key is not a valid base64 encoding
   1: Invalid symbol 32, offset 4.

Location:
    crates/atuin-client/src/encryption.rs:88:10

Here is the throwaway key generated by Atuin to reproduce the issue:

throwaway_key.txt

Is the encryption key expected to be base64-encoded?

Atuin doctor output

The issue also arises with version 18.2.0.


{
  "atuin": {
    "version": "18.3.0",
    "sync": null,
    "sqlite_version": "3.44.0"
  },
  "shell": {
    "name": "zsh",
    "default": "zsh",
    "plugins": [
      "atuin"
    ],
    "preexec": "built-in"
  },
  "system": {
    "os": "NixOS",
    "arch": "x86_64",
    "version": "24.05",
    "disks": [
      {
        "name": "/dev/disk/by-label/ROOT",
        "filesystem": "ext4"
      },
      {
        "name": "/dev/disk/by-label/ROOT",
        "filesystem": "ext4"
      },
      {
        "name": "/dev/sda1",
        "filesystem": "vfat"
      }
    ]
  }
}


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct