Add user that modified the document in trigger

In our document collections, we also want to store a “changes” stream (an array of the users that modified the document and when).

Unfortunately, we can not trust the clients to do this on their own so we figured adding a trigger on the document would make the most sense but there seems to be no way of getting the user that triggered the change. Any ideas if this is possible?

The other idea would be to create a custom function that does the modifications and also adds this information, but at that point, we can do it in our Next.js backend…