Claims-based authorization
I'm thinking about implementing a system based on automerge with claims-based authorization (like JWT).
While I can sign changes from getChanges and verify the signature before calling applyChanges to ensure the authenticity, I don't see a way to implement authorization with the current API.
The basic idea is to augment each change with a signed token that proves that the actor (or associated user) is allowed to perform that change. I think automerge should stay agnostic to the concrete implementation, but providing an API to enable that would open up interesting opportunities, especially for decentralized software.
From my current understanding I think this requires at least:
- a callback as optional argument to
applyChangesthat gets called for each decoded change and can decide wether to apply or decline the change based on the decoded change and the path from the root of the document to the object being updated.
In addition it might be interesting to
- allow client specific meta-data for changes (which then are also passed as argument to the callback)
This meta-data could be used to associate the change with the respective signed token. I think the meta-data might be optional and an external association could be implemented by the consuming project. On the one hand it would make the API more convenient, but looking though the implementation, especially the columnar once, that would require a lot of changes and require the client project to implement custom decoders.
Source: automerge/automerge-classic