From 12a367900d019874b3a27c47a391fecd73e7250f Mon Sep 17 00:00:00 2001 From: Kayode Ezike Date: Wed, 12 Jun 2024 07:06:52 -0400 Subject: [PATCH] allocates only revocation status by default --- src/app.js | 2 +- src/app.test.js | 8 ++++---- src/status.js | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app.js b/src/app.js index 72b636d..cf4b0df 100644 --- a/src/app.js +++ b/src/app.js @@ -32,7 +32,7 @@ export async function build(opts = {}) { code: 400 }); } - const vcWithStatus = await status.allocateSupportedStatuses(vc); + const vcWithStatus = await status.allocateRevocationStatus(vc); return res.json(vcWithStatus); } catch (e) { // We catch the async errors and pass them to the error handler. diff --git a/src/app.test.js b/src/app.test.js index 897ab50..8f70516 100644 --- a/src/app.test.js +++ b/src/app.test.js @@ -58,8 +58,8 @@ describe('api', () => { it('returns updated credential', async () => { const unsignedVCWithStatus = getUnsignedVCWithStatus(); - const allocateSupportedStatuses = sinon.fake.returns(unsignedVCWithStatus); - const statusManagerStub = { allocateSupportedStatuses }; + const allocateRevocationStatus = sinon.fake.returns(unsignedVCWithStatus); + const statusManagerStub = { allocateRevocationStatus }; await status.initializeStatusManager(statusManagerStub); const app = await build(); @@ -73,8 +73,8 @@ describe('api', () => { }); it('returns unchanged credential when status already set ', async () => { - const allocateSupportedStatuses = sinon.fake.returns(getUnsignedVCWithStatus()); - const statusManagerStub = { allocateSupportedStatuses }; + const allocateRevocationStatus = sinon.fake.returns(getUnsignedVCWithStatus()); + const statusManagerStub = { allocateRevocationStatus }; await status.initializeStatusManager(statusManagerStub); const app = await build(); diff --git a/src/status.js b/src/status.js index fd3bdf6..5431f41 100644 --- a/src/status.js +++ b/src/status.js @@ -72,11 +72,11 @@ async function getStatusManager() { return STATUS_LIST_MANAGER; } -async function allocateSupportedStatuses(verifiableCredential) { +async function allocateRevocationStatus(verifiableCredential) { const statusManager = await getStatusManager(); const result = verifiableCredential.credentialStatus ? verifiableCredential : - await statusManager.allocateSupportedStatuses(verifiableCredential); + await statusManager.allocateRevocationStatus(verifiableCredential); return result; } @@ -118,7 +118,7 @@ async function getStatusCredential(statusCredentialId) { export default { initializeStatusManager, getStatusManager, - allocateSupportedStatuses, + allocateRevocationStatus, updateStatus, getCredentialInfo, getStatusCredential