|
| 1 | +diff --git a/build/modules/credentials/protocol/revocation-notification/services/RevocationNotificationService.js b/build/modules/credentials/protocol/revocation-notification/services/RevocationNotificationService.js |
| 2 | +index 55686de9c2bc38ef66eb59862bbac8d110cb242e..ebf8278aa296d9f1dc45763d6f054b2ea6423dd9 100644 |
| 3 | +--- a/build/modules/credentials/protocol/revocation-notification/services/RevocationNotificationService.js |
| 4 | ++++ b/build/modules/credentials/protocol/revocation-notification/services/RevocationNotificationService.js |
| 5 | +@@ -48,22 +48,57 @@ let RevocationNotificationService = class RevocationNotificationService { |
| 6 | + }, |
| 7 | + ], |
| 8 | + }; |
| 9 | +- this.logger.trace(`Getting record by query for revocation notification:`, query); |
| 10 | +- const credentialRecord = await this.credentialRepository.getSingleByQuery(agentContext, query); |
| 11 | +- credentialRecord.revocationNotification = new RevocationNotification_1.RevocationNotification(comment); |
| 12 | +- await this.credentialRepository.update(agentContext, credentialRecord); |
| 13 | ++ this.logger.trace(`Getting Credential Exchange record by query for revocation notification:`, query) |
| 14 | ++ let credentialExchangeRecord = await this.credentialRepository.findSingleByQuery(agentContext, query) |
| 15 | ++ |
| 16 | ++ if (!credentialExchangeRecord) { |
| 17 | ++ const w3cCredentialQuery = { |
| 18 | ++ $or: [ |
| 19 | ++ { |
| 20 | ++ anonCredsRevocationRegistryId, |
| 21 | ++ anonCredsCredentialRevocationId, |
| 22 | ++ }, |
| 23 | ++ { |
| 24 | ++ anonCredsUnqualifiedRevocationRegistryId: anonCredsRevocationRegistryId, |
| 25 | ++ anonCredsCredentialRevocationId, |
| 26 | ++ }, |
| 27 | ++ ], |
| 28 | ++ } |
| 29 | ++ this.logger.trace( |
| 30 | ++ `Credential Exchange Record not found. Getting W3C credential record by query for revocation notification:`, |
| 31 | ++ w3cCredentialQuery |
| 32 | ++ ) |
| 33 | ++ |
| 34 | ++ const w3cCredentialRepository = agentContext.dependencyManager.resolve(vc_1.W3cCredentialRepository) |
| 35 | ++ const w3cCredentialRecord = await w3cCredentialRepository.getSingleByQuery(agentContext, w3cCredentialQuery) |
| 36 | ++ |
| 37 | ++ // Find credential exchange record associated with this credential |
| 38 | ++ credentialExchangeRecord = |
| 39 | ++ (await this.credentialRepository.getAll(agentContext)).find((record) => |
| 40 | ++ record.credentials.find((item) => item.credentialRecordId === w3cCredentialRecord.id) |
| 41 | ++ ) ?? null |
| 42 | ++ } |
| 43 | ++ |
| 44 | ++ if (!credentialExchangeRecord) { |
| 45 | ++ throw new CredoError_1.CredoError( |
| 46 | ++ `No associated Credential Exchange record found for revocation id ${anonCredsCredentialRevocationId}` |
| 47 | ++ ) |
| 48 | ++ } |
| 49 | ++ |
| 50 | ++ credentialExchangeRecord.revocationNotification = new RevocationNotification_1.RevocationNotification(comment); |
| 51 | ++ await this.credentialRepository.update(agentContext, credentialExchangeRecord); |
| 52 | + this.logger.trace('Emitting RevocationNotificationReceivedEvent'); |
| 53 | + this.eventEmitter.emit(agentContext, { |
| 54 | + type: CredentialEvents_1.CredentialEventTypes.RevocationNotificationReceived, |
| 55 | + payload: { |
| 56 | + // Clone record to prevent mutations after emitting event. |
| 57 | +- credentialRecord: credentialRecord.clone(), |
| 58 | ++ credentialRecord: credentialExchangeRecord.clone(), |
| 59 | + }, |
| 60 | + }); |
| 61 | + } |
| 62 | + /** |
| 63 | + * Process a received {@link V1RevocationNotificationMessage}. This will create a |
| 64 | +- * {@link RevocationNotification} and store it in the corresponding {@link CredentialRecord} |
| 65 | ++ * {@link RevocationNotification} and store it in the corresponding {@link CredentialExchangeRecord} |
| 66 | + * |
| 67 | + * @param messageContext message context of RevocationNotificationMessageV1 |
| 68 | + */ |
| 69 | +@@ -102,7 +137,7 @@ let RevocationNotificationService = class RevocationNotificationService { |
| 70 | + } |
| 71 | + /** |
| 72 | + * Process a received {@link V2RevocationNotificationMessage}. This will create a |
| 73 | +- * {@link RevocationNotification} and store it in the corresponding {@link CredentialRecord} |
| 74 | ++ * {@link RevocationNotification} and store it in the corresponding {@link CredentialExchangeRecord} |
| 75 | + * |
| 76 | + * @param messageContext message context of RevocationNotificationMessageV2 |
| 77 | + */ |
| 78 | +diff --git a/build/modules/dif-presentation-exchange/DifPresentationExchangeService.js b/build/modules/dif-presentation-exchange/DifPresentationExchangeService.js |
| 79 | +index f1723e774dc337b8ceae11cf5765d222fd07ea24..9c5db89eec796e1df88e77104b282d22c3b8f4b4 100644 |
| 80 | +--- a/build/modules/dif-presentation-exchange/DifPresentationExchangeService.js |
| 81 | ++++ b/build/modules/dif-presentation-exchange/DifPresentationExchangeService.js |
| 82 | +@@ -177,7 +177,18 @@ let DifPresentationExchangeService = class DifPresentationExchangeService { |
| 83 | + presentationSubmission.descriptor_map.push(...descriptorMap); |
| 84 | + }); |
| 85 | + return { |
| 86 | +- verifiablePresentations: verifiablePresentationResultsWithFormat.flatMap((resultWithFormat) => resultWithFormat.verifiablePresentationResult.verifiablePresentations.map((vp) => (0, utils_2.getVerifiablePresentationFromEncoded)(agentContext, vp))), |
| 87 | ++ verifiablePresentations: verifiablePresentationResultsWithFormat.flatMap((resultWithFormat) => { |
| 88 | ++ if (resultWithFormat.verifiablePresentationResult.verifiablePresentations) { |
| 89 | ++ return resultWithFormat.verifiablePresentationResult.verifiablePresentations.map((vp) => |
| 90 | ++ (0, utils_2.getVerifiablePresentationFromEncoded)(agentContext, vp) |
| 91 | ++ ) |
| 92 | ++ } else { |
| 93 | ++ return (0, utils_2.getVerifiablePresentationFromEncoded)( |
| 94 | ++ agentContext, |
| 95 | ++ resultWithFormat.verifiablePresentationResult.verifiablePresentation |
| 96 | ++ ) |
| 97 | ++ } |
| 98 | ++ }), |
| 99 | + presentationSubmission, |
| 100 | + presentationSubmissionLocation: verifiablePresentationResultsWithFormat[0].verifiablePresentationResult.presentationSubmissionLocation, |
| 101 | + }; |
| 102 | +diff --git a/build/transport/WsOutboundTransport.js b/build/transport/WsOutboundTransport.js |
| 103 | +index ab9df20f9fedc4def4f486b9431ac669e899e609..ed898fd92d4a18d0110a77345687f9c1eecebf7b 100644 |
| 104 | +--- a/build/transport/WsOutboundTransport.js |
| 105 | ++++ b/build/transport/WsOutboundTransport.js |
| 106 | +@@ -43,7 +43,16 @@ class WsOutboundTransport { |
| 107 | + this.transportTable.forEach((socket) => { |
| 108 | + socket.removeEventListener('message', this.handleMessageEvent); |
| 109 | + if (socket.readyState !== this.WebSocketClass.CLOSED) { |
| 110 | +- stillOpenSocketClosingPromises.push(new Promise((resolve) => socket.once('close', resolve))); |
| 111 | ++ stillOpenSocketClosingPromises.push( |
| 112 | ++ new Promise((resolve) => { |
| 113 | ++ const closeHandler = () => { |
| 114 | ++ socket.removeEventListener('close', closeHandler) |
| 115 | ++ resolve() |
| 116 | ++ } |
| 117 | ++ |
| 118 | ++ socket.addEventListener('close', closeHandler) |
| 119 | ++ }) |
| 120 | ++ ); |
| 121 | + socket.close(); |
| 122 | + } |
| 123 | + }); |
0 commit comments