Skip to content

Commit

Permalink
fix: duplicate offer being created on issuers side while negotiating …
Browse files Browse the repository at this point in the history
…offer as a holder (openwallet-foundation#2023)

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>
  • Loading branch information
GHkrishna authored Sep 5, 2024
1 parent 4485dc9 commit 5ddd37a
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ export class V2CredentialProtocol<CFs extends CredentialFormatService[] = Creden
let credentialRecord = await this.findByProperties(messageContext.agentContext, {
threadId: proposalMessage.threadId,
role: CredentialRole.Issuer,
connectionId: connection?.id,
})

const formatServices = this.getFormatServicesFromMessage(proposalMessage.formats)
Expand Down Expand Up @@ -207,6 +206,15 @@ export class V2CredentialProtocol<CFs extends CredentialFormatService[] = Creden
expectedConnectionId: credentialRecord.connectionId,
})

// This makes sure that the sender of the incoming message is authorized to do so.
if (!credentialRecord?.connectionId) {
await connectionService.matchIncomingMessageToRequestMessageInOutOfBandExchange(messageContext, {
expectedConnectionId: credentialRecord?.connectionId,
})

credentialRecord.connectionId = connection?.id
}

await this.credentialFormatCoordinator.processProposal(messageContext.agentContext, {
credentialRecord,
formatServices,
Expand Down

0 comments on commit 5ddd37a

Please sign in to comment.