Skip to content

Commit

Permalink
applies minor copy and style updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kezike committed Apr 23, 2024
1 parent 26c9f95 commit 051648c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 89 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ IMPORTANT NOTE ABOUT VERSIONING: If you are using a Docker Hub image of this rep
- [DID Registries](#did-registries)
- [Usage](#usage)
- [Allocate Status Position](#allocate-status-position)
- [Revoke](#revoke)
- [Revocation and suspension](#revocation-and-suspension)
- [Versioning](#versioning)
- [Logging](#logging)
- [Log Levels](#log-levels)
Expand Down Expand Up @@ -209,7 +209,7 @@ Now, your next step would be to sign this Verifiable Credential. You could pass

NOTE: CURL can get a bit clunky if you want to experiment more (e.g., by changing what goes into the VC before signing), so you might consider trying [Postman](https://www.postman.com/downloads) which makes it easier to construct and send HTTP calls.

### Revoke
### Revocation and suspension

Revocation and suspension are fully explained in the [Bitstring Status List](https://www.w3.org/TR/vc-bitstring-status-list/) specification and our implemenations thereof, but effectively, it amounts to POSTing an object to the revocation endpoint, like so:

Expand Down
16 changes: 10 additions & 6 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,20 @@ export async function build(opts = {}) {
const vc = req.body;
if (!vc || !Object.keys(vc).length) {
next({
message: 'A verifiable credential must be provided in the body',
message: 'A Verifiable Credential must be provided in the body.',
code: 400
});
}
const vcWithStatus = await status.allocateSupportedStatuses(vc);
return res.json(vcWithStatus);
} catch (e) {
// We catch the async errors and pass them to the error handler.
if (!e.message) {e.message = "Error when allocating status position."}
if (!e.message) {
e.message = 'Unable to allocate status position.'
}
// Note that if e contains a code property, the following spread of e will
// (correctly) overwrite the 500
next({code: 500, ...e});
next({ code: 500, ...e });
}
});

Expand All @@ -52,7 +54,7 @@ export async function build(opts = {}) {
const updateRequest = req.body;
if (!updateRequest || !updateRequest.credentialId || !updateRequest.credentialStatus) {
next({
message: 'A status update request must be provided in the body',
message: 'A status update request must be provided in the body.',
code: 400
});
}
Expand All @@ -70,10 +72,12 @@ export async function build(opts = {}) {
return res.status(updateStatusResponse.code).json(updateStatusResponse);
} catch (e) {
// We catch the async errors and pass them to the error handler.
if (!e.message) {e.message = "Error updating credential status position."}
if (!e.message) {
e.message = 'Error updating credential status position.'
}
// Note that if e contains a code property, the following spread of e will
// (correctly) overwrite the 500
next({code: 500, ...e});
next({ code: 500, ...e });
}
});

Expand Down
4 changes: 2 additions & 2 deletions src/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ describe('api', () => {
});

it('returns unchanged credential when status already set ', async () => {
const allocateStatus = sinon.fake.returns(getUnsignedVCWithStatus());
const statusManagerStub = { allocateStatus };
const allocateSupportedStatuses = sinon.fake.returns(getUnsignedVCWithStatus());
const statusManagerStub = { allocateSupportedStatuses };
await status.initializeStatusManager(statusManagerStub);
const app = await build();

Expand Down
3 changes: 2 additions & 1 deletion src/test-fixtures/fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import testVC from './testVC.js';

const validCredentialId = 'urn:uuid:951b475e-b795-43bc-ba8f-a2d01efd2eb1';
const invalidCredentialId = 'kj09ij';
const invalidCredentialIdErrorMessage = `An error occurred in status-service-db: Unable to find credential with ID ${invalidCredentialId}`;
const invalidCredentialIdErrorMessage = 'An error occurred in status-service-db: ' +
`Unable to find credential with ID ${invalidCredentialId}`;

const credentialStatus = {
"id": "https://digitalcredentials.github.io/credential-status-jc-test/XA5AAK1PV4#16",
Expand Down
3 changes: 2 additions & 1 deletion src/test-fixtures/testVC.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ export default {
"name": "Introduction to Wonderfullness"
}
}
}
}

77 changes: 0 additions & 77 deletions src/test-fixtures/vc.js

This file was deleted.

0 comments on commit 051648c

Please sign in to comment.