Skip to content

Issuance: de-duplicate credential requests #749

@paullatzelsperger

Description

@paullatzelsperger

Feature Request

Credential requests for the same holder PID should be gracefully handled on the issuer side.

The issuer service should check if an IssuanceProcess already exists for that same holder PID, and if it does, it simply returns successfully.

Which Areas Would Be Affected?

DcpIssuerServiceImpl

Why Is the Feature Desired?

credential requests should be idempotent

Who will sponsor this feature?

Please @-mention the committer that will sponsor your feature.

Solution Proposal

in DcpIssuerServiceImpl#initiateCredentialsIssuance add something like:

  @Override
    public ServiceResult<CredentialRequestMessage.Response> initiateCredentialsIssuance(String participantContextId, CredentialRequestMessage message, DcpRequestContext context) {
        if (message.getCredentials().isEmpty()) {
            return ServiceResult.badRequest("No credentials requested");
        }
        
        // add this:
        var existingIssuanceProcess = findByHolderPid(message.holderPid());
        if(existingIssuanceProcess != null){
            return new CredentialRequestMessage.Response(existingIssuanceProcess()))
        }
       

        // ... 

    }

note that this snippet is just pseudo-code, because the check must happen within the same transaction!

Metadata

Metadata

Labels

feature_requestNew feature request, awaiting triage

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions