Editing a Credential
Sequence Diagram
User Request
- The user (manager) initiates the edit of a credential.
- The client sends a request to the server to fetch all users who have access to the credential.
- The server returns the list of users with access to the credential.
Background Service Processing
- The user modifies the credential fields and sends the updated fields to the background service.
- The background service sends the updated credential fields to the WASM service for encryption with each user’s public key.
- The WASM service encrypts the updated credential fields with each user’s public key.
- The WASM service returns the encrypted credential fields to the background service.
[ { "userId": "user_id_1", "fields": [ { "fieldId": "field_id", "fieldValue": "encrypted_field_value_user1" } ] }, { "userId": "user_id_2", "fields": [ { "fieldId": "field_id", "fieldValue": "encrypted_field_value_user2" } ] }]
- The background service returns the encrypted credential fields for each user to the client.
- The client then sends the whole payload to hash and then sign
- The client sends the payload to the server with signature in the header.
Server Processing
- The client sends the payload (encrypted credential fields for each user) to the server.
{ "credentialId": "credential_id", "users": [ { "userId": "user_id_1", "fields": [ { "fieldId": "field_id", "fieldValue": "encrypted_field_value_user1" } ] }, { "userId": "user_id_2", "fields": [ { "fieldId": "field_id", "fieldValue": "encrypted_field_value_user2" } ] } ]}
- The server processes the request after verifying the signature.
- For each user: The server moves the old fields of the user to the fields_archive table. The server adds the new fields to the fields table.
- The server returns the response (success/failure) to the user.
Note: Only the manager of a credential can edit it. When a credential is edited, the old fields of every user are moved to the
fields_archive
table, and the new fields are added to the fields
table. This ensures that the changes are reflected for all users who have access to the credential.