Description
Feature description
It would be very helpful to be able to replace the logic how nodeId
is generated for tables or any other autogenerated resources. This will allow us to encrypt or mask restricted content in the nodeId. Which will be especially useful for the projects that are migrating to postgraphile.
Motivating example
Example:
When a resource.primary_key
is a restricted information, we want to return to the user the primary key, but encrypted, so only the server can decrypt the value, which will allow us to mask the data but the server will be able to understand what have been masked. In a system where there is already a large code designed around the idea that resource.primary_key
is a restricted information, the only thing that is missing is to also hide it in the nodeId
. It's possible to introduce a new resource with a primary key which is not related to the original resource and also add a relation between those 2 resources that only the server can access, but it can be easily avoided by allowing us to change the logic of generating and reading the nodeId
.
Breaking changes
I'm not await what this will break, but I guess that internally, postgraphile is using the content of the nodeId
, so if we are adding an option to replace the logic, maybe we will also need an API which will return the data postgraphile needs? Like
{
write: (resource) => `any string that the "read" function below understands`,
read: (nodeId) => ({original: [Type, id], otherExtractedData: 'data' }),
// The "original" field is what postgraphile needs
}
Supporting development
I [tick all that apply]:
- am interested in building this feature myself
- am interested in collaborating on building this feature
- am willing to help testing this feature before it's released
- am willing to write a test-driven test suite for this feature (before it exists)
- am a Graphile sponsor ❤️
- have an active support or consultancy contract with Graphile
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
🌳 Triage
Activity