Skip to content

Commit

Permalink
allocates only revocation status by default
Browse files Browse the repository at this point in the history
  • Loading branch information
kezike committed Jun 12, 2024
1 parent d43e6f7 commit 12a3679
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions src/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();

Expand Down
6 changes: 3 additions & 3 deletions src/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -118,7 +118,7 @@ async function getStatusCredential(statusCredentialId) {
export default {
initializeStatusManager,
getStatusManager,
allocateSupportedStatuses,
allocateRevocationStatus,
updateStatus,
getCredentialInfo,
getStatusCredential
Expand Down

0 comments on commit 12a3679

Please sign in to comment.