mdouchement / standardfile

Yet Another Standardfile (standardnotes server) Implementation written in Golang
MIT License
80 stars 9 forks source link

[libsf] could not unseal item Note: EncryptedItemKey: invalid secret format #102

Closed mdouchement closed 1 year ago

mdouchement commented 1 year ago

Something seems to have changed in the official client that breaks libsf.

mdouchement commented 1 year ago

I don't know why but there was an entry with 5 components in the enc_item_key & content instead of 4. The extra component is e30= which is {} encoded in base64:

{
  "uuid": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx",
  "created_at": "2022-12-18T21:45:15.825Z",
  "updated_at": "2023-07-13T19:50:49.684819139Z",
  "user_uuid": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx",
  "content": "004:hex_string:base64_string:base64_string:e30=",
  "content_type": "Note",
  "items_key_id": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx",
  "enc_item_key": "004:hex_string:base64_string:base64_string:e30=",
  "deleted": false
}

The spec has not been modified since one year.

It seems there is a new component which is additionalData: https://github.com/standardnotes/app/blob/e1f1be96cbeee740f1ad5913847c2df356ab303a/packages/encryption/src/Domain/Operator/004/Operator004.spec.ts#L28