Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed the overwritten revocation interval patch #1549

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 37 additions & 13 deletions .yarn/patches/@aries-framework-anoncreds-npm-0.4.0-4d3b4e769d.patch
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
diff --git a/build/utils/getRevocationRegistries.js b/build/utils/getRevocationRegistries.js
index 659e85e5d206ae9ba291383325403f922b2e9e1d..533750be7cfc1d04a9e6eb3edc8771e37b743b02 100644
index 659e85e5d206ae9ba291383325403f922b2e9e1d..0a30ed45f36271e65dc7f6504b8b77afa59ccce8 100644
--- a/build/utils/getRevocationRegistries.js
+++ b/build/utils/getRevocationRegistries.js
@@ -33,6 +33,7 @@ async function getRevocationRegistriesForRequest(agentContext, proofRequest, sel
@@ -33,6 +33,8 @@ async function getRevocationRegistriesForRequest(agentContext, proofRequest, sel
nonRevoked: (_b = proofRequest.requested_predicates[referent].non_revoked) !== null && _b !== void 0 ? _b : proofRequest.non_revoked,
});
}
+ const revocationRegistryPromises = []
+
+ const revocationRegistryPromises = [];
for (const { referent, selectedCredential, nonRevoked, type } of referentCredentials) {
if (!selectedCredential.credentialInfo) {
throw new core_1.AriesFrameworkError(`Credential for referent '${referent} does not have credential info for revocation state creation`);
@@ -55,38 +56,43 @@ async function getRevocationRegistriesForRequest(agentContext, proofRequest, sel
@@ -54,39 +56,45 @@ async function getRevocationRegistriesForRequest(agentContext, proofRequest, sel
const registry = agentContext.dependencyManager
.resolve(services_1.AnonCredsRegistryService)
.getRegistryForIdentifier(agentContext, revocationRegistryId);
// Fetch revocation registry definition if not in revocation registries list yet
- // Fetch revocation registry definition if not in revocation registries list yet
- if (!revocationRegistries[revocationRegistryId]) {
- const { revocationRegistryDefinition, resolutionMetadata } = await registry.getRevocationRegistryDefinition(agentContext, revocationRegistryId);
- if (!revocationRegistryDefinition) {
- throw new core_1.AriesFrameworkError(`Could not retrieve revocation registry definition for revocation registry ${revocationRegistryId}: ${resolutionMetadata.message}`);
+
+ const getRevocationRegistry = async () => {
+ // Fetch revocation registry definition if not in revocation registries list yet
+ if (!revocationRegistries[revocationRegistryId]) {
+ const { revocationRegistryDefinition, resolutionMetadata } = await registry.getRevocationRegistryDefinition(agentContext, revocationRegistryId);
+ if (!revocationRegistryDefinition) {
Expand Down Expand Up @@ -73,31 +77,33 @@ index 659e85e5d206ae9ba291383325403f922b2e9e1d..533750be7cfc1d04a9e6eb3edc8771e3
+ }
}
}
+ revocationRegistryPromises.push(getRevocationRegistry())
+
+ revocationRegistryPromises.push(getRevocationRegistry());
}
}
+ // await all revocation registry statuses asynchronously
+ await Promise.all(revocationRegistryPromises)
+ await Promise.all(revocationRegistryPromises);
agentContext.config.logger.debug(`Retrieved revocation registries for proof request`, {
revocationRegistries,
});
@@ -104,6 +110,7 @@ async function getRevocationRegistriesForRequest(agentContext, proofRequest, sel
@@ -104,6 +112,7 @@ async function getRevocationRegistriesForRequest(agentContext, proofRequest, sel
exports.getRevocationRegistriesForRequest = getRevocationRegistriesForRequest;
async function getRevocationRegistriesForProof(agentContext, proof) {
const revocationRegistries = {};
+ const revocationRegistryPromises = [];
for (const identifier of proof.identifiers) {
const revocationRegistryId = identifier.rev_reg_id;
const timestamp = identifier.timestamp;
@@ -114,25 +121,29 @@ async function getRevocationRegistriesForProof(agentContext, proof) {
@@ -113,26 +122,30 @@ async function getRevocationRegistriesForProof(agentContext, proof) {
const registry = agentContext.dependencyManager
.resolve(services_1.AnonCredsRegistryService)
.getRegistryForIdentifier(agentContext, revocationRegistryId);
// Fetch revocation registry definition if not already fetched
- // Fetch revocation registry definition if not already fetched
- if (!revocationRegistries[revocationRegistryId]) {
- const { revocationRegistryDefinition, resolutionMetadata } = await registry.getRevocationRegistryDefinition(agentContext, revocationRegistryId);
- if (!revocationRegistryDefinition) {
- throw new core_1.AriesFrameworkError(`Could not retrieve revocation registry definition for revocation registry ${revocationRegistryId}: ${resolutionMetadata.message}`);
+ const getRevocationRegistry = async () => {
+ // Fetch revocation registry definition if not already fetched
+ if (!revocationRegistries[revocationRegistryId]) {
+ const { revocationRegistryDefinition, resolutionMetadata } = await registry.getRevocationRegistryDefinition(agentContext, revocationRegistryId);
+ if (!revocationRegistryDefinition) {
Expand Down Expand Up @@ -128,9 +134,27 @@ index 659e85e5d206ae9ba291383325403f922b2e9e1d..533750be7cfc1d04a9e6eb3edc8771e3
}
- revocationRegistries[revocationRegistryId].revocationStatusLists[timestamp] = revocationStatusList;
}
+ revocationRegistryPromises.push(getRevocationRegistry())
+ revocationRegistryPromises.push(getRevocationRegistry());
}
+ await Promise.all(revocationRegistryPromises)
+ await Promise.all(revocationRegistryPromises);
return revocationRegistries;
}
exports.getRevocationRegistriesForProof = getRevocationRegistriesForProof;
diff --git a/build/utils/revocationInterval.js b/build/utils/revocationInterval.js
index 728732d5119b879a2a2399eab6e6430b62796106..5c69ea0731c0fbdc0ff4820891d67773c7105b3b 100644
--- a/build/utils/revocationInterval.js
+++ b/build/utils/revocationInterval.js
@@ -7,9 +7,9 @@ function assertBestPracticeRevocationInterval(revocationInterval) {
if (!revocationInterval.to) {
throw new core_1.AriesFrameworkError(`Presentation requests proof of non-revocation with no 'to' value specified`);
}
- if ((revocationInterval.from || revocationInterval.from === 0) && revocationInterval.to !== revocationInterval.from) {
- throw new core_1.AriesFrameworkError(`Presentation requests proof of non-revocation with an interval from: '${revocationInterval.from}' that does not match the interval to: '${revocationInterval.to}', as specified in Aries RFC 0441`);
- }
+ // if ((revocationInterval.from || revocationInterval.from === 0) && revocationInterval.to !== revocationInterval.from) {
+ // throw new core_1.AriesFrameworkError(`Presentation requests proof of non-revocation with an interval from: '${revocationInterval.from}' that does not match the interval to: '${revocationInterval.to}', as specified in Aries RFC 0441`);
+ // }
}
exports.assertBestPracticeRevocationInterval = assertBestPracticeRevocationInterval;
//# sourceMappingURL=revocationInterval.js.map
\ No newline at end of file
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ __metadata:

"@aries-framework/anoncreds@patch:@aries-framework/anoncreds@npm%3A0.4.0#./.yarn/patches/@aries-framework-anoncreds-npm-0.4.0-4d3b4e769d.patch::locator=bc-wallet-mobile%40workspace%3A.":
version: 0.4.0
resolution: "@aries-framework/anoncreds@patch:@aries-framework/anoncreds@npm%3A0.4.0#./.yarn/patches/@aries-framework-anoncreds-npm-0.4.0-4d3b4e769d.patch::version=0.4.0&hash=c6c7d3&locator=bc-wallet-mobile%40workspace%3A."
resolution: "@aries-framework/anoncreds@patch:@aries-framework/anoncreds@npm%3A0.4.0#./.yarn/patches/@aries-framework-anoncreds-npm-0.4.0-4d3b4e769d.patch::version=0.4.0&hash=695f0a&locator=bc-wallet-mobile%40workspace%3A."
dependencies:
"@aries-framework/core": 0.4.0
bn.js: ^5.2.1
class-transformer: 0.5.1
class-validator: 0.14.0
reflect-metadata: ^0.1.13
checksum: 64d2c17e308e6fcbea6da97d0f337af5f5d0e37ba5b9e1e458eb59dec0252a85b20ba11fa876d8bb1d279e2a69ebe1a77cc117d3062a7f14dff063e2c9d34aba
checksum: 7de0cc1a924de60a0e05256831be35907b1d53a18de8d8d716242537099d100f6b1253692295f02b958002b6f1f5fd3388126d779ccd4960d78a4995c7e54943
languageName: node
linkType: hard

Expand Down
Loading