Fix: Do not replace public verkey on mediator #2269
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a case when public verkey of the mediated agent is removed from the keylists of its mediator during establishing a connection.
Assuming there is mediation established for an agent.
If the DID was promoted to public via POST /wallet/did/public?did={}&mediation_id={non_empty_id} then an ATTRIB 'endpoint' transaction was created on the ledger with the url pointing to the mediator and the respective routing_keys.
Next, the Inviter creates an invitation using the public=true (or use_public_did: true) flag, the communication of the Inviter goes through the mediator as it should. Then in the Inviter's accept-request phase, the public verkey is removed from the keylist of the mediator.
That prevents any next attempts to answer to the Inviter's invitations with its public DID since the mediator does no longer have the routing key (verkey) associated to the public DID.
In conclusion, the public verkey must remain in the mediator as the routing key.