Skip to content

Commit

Permalink
adjust for VC-API spec
Browse files Browse the repository at this point in the history
  • Loading branch information
jchartrand committed Oct 9, 2024
1 parent 40197b9 commit a86995e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,17 @@ export async function build (opts = {}) {
try {
const tenantName = req.params.tenantName // the issuer instance/tenant with which to sign
const authHeader = req.headers.authorization
const unSignedVC = req.body

const body = req.body
const unSignedVC = body.credential ? body.credential : body

Check failure on line 91 in src/app.js

View workflow job for this annotation

GitHub Actions / lint (16.x)

Trailing spaces not allowed
await verifyAuthHeader(authHeader, tenantName)
// NOTE: we throw the error here which will then be caught by middleware errorhandler
if (!unSignedVC || !Object.keys(unSignedVC).length) throw new IssuingException(400, 'A verifiable credential must be provided in the body')
const vcWithStatus = enableStatusService
? await callService(`http://${statusService}/credentials/status/allocate`, unSignedVC)
: unSignedVC
const signedVC = await callService(`http://${signingService}/instance/${tenantName}/credentials/sign`, vcWithStatus)
return res.json(signedVC)
return res.status(201).json(signedVC)
} catch (error) {
// have to catch async errors and forward error handling
// middleware
Expand Down

0 comments on commit a86995e

Please sign in to comment.