I would like to implement some transparent encryption/decryption layer between the filesystem and the display that would be pretty transparent for obsidian. For that purpose, I should be able to intercept obsidian reads/write to and from the filesystem in order to encrypt/decrypt the arraybuffers.
Most of the read/write method I find are on the Vault API, and they seems to be deferred to a DataAdapter object who will leverage the filesystem’s API. I guess from the API that the default Adapter used is FileSystemAdapter, which has many read/write methods. I would prefer that the API supports the notion of decorators or custom chain of adapter but would it work (albeit a bit ugly) to make an EncryptionAdapter deferring to the FileSystemAdapter and registering that one in the Vault instead of the default one? If feels to me that duplicating any behaviour existing in the FileSystemAdapter would just be fragile, errorprone and undesirable.
Maybe I also miss some parts of the API where read/write occur that make it unworkable? I also don’t know when Vault will call read/readBinary/append/…
Also the replacement should happen very early before Obsidian starts to read the vault content with the default adapter, do plugin get some very early event hook to make changes to Vault before it starts reading files?