digitalbazaar / bedrock-vc-delivery

A Bedrock module for delivering issued VCs
Other
0 stars 0 forks source link

Add dev application identity for `vc-exchanger`. #26

Closed JSAssassin closed 1 year ago

mattcollier commented 1 year ago

@JSAssassin can you explain why this is necessary? It certainly may be the case, but usually the default app identity key is used in dev:

https://github.com/digitalbazaar/bedrock-app-identity/blob/main/lib/config.js#L9

JSAssassin commented 1 year ago

@mattcollier without this service ID configuration, I get the following error when trying to generate an exchanger config in veres-exchanger.

2023-07-19T13:44:07.748Z - error: [express] error workerPid=70875, workerId=491dd71d86b2f249, details={
  "error": {
    "name": "NotAllowedError",
    "message": "Expected meter service type \"vc-exchanger\" is not a configured client.",
    "details": {
      "url": "https://localhost:59443/meters/z19rFxRY87zW8qmBr8d8sAQYx/usage",
      "httpStatusCode": 403,
      "public": true
    },
    "cause": null,
    "stack": "NotAllowedError: Expected meter service type \"vc-exchanger\" is not a configured client.\n    at _getUsage (file:///Users/tashid.gyeltshen/Desktop/Veres/veres-exchanger/node_modules/@bedrock/meter-usage-reporter/lib/meters.js:492:11)\n    at Module.hasAvailable (file:///Users/tashid.gyeltshen/Desktop/Veres/veres-exchanger/node_modules/@bedrock/meter-usage-reporter/lib/meters.js:234:47)\n    at file:///Users/tashid.gyeltshen/Desktop/Veres/veres-exchanger/node_modules/@bedrock/service-core/lib/http/configs.js:48:50\n    at asyncMiddleware (file:///Users/tashid.gyeltshen/Desktop/Veres/veres-exchanger/node_modules/@bedrock/express/lib/index.js:562:20)\n    at Layer.handle [as handle_request] (/Users/tashid.gyeltshen/Desktop/Veres/veres-exchanger/node_modules/express/lib/router/layer.js:95:5)\n    at next (/Users/tashid.gyeltshen/Desktop/Veres/veres-exchanger/node_modules/express/lib/router/route.js:144:13)\n    at validate (file:///Users/tashid.gyeltshen/Desktop/Veres/veres-exchanger/node_modules/@bedrock/validation/lib/index.js:192:5)\n    at Layer.handle [as handle_request] (/Users/tashid.gyeltshen/Desktop/Veres/veres-exchanger/node_modules/express/lib/router/layer.js:95:5)\n    at next (/Users/tashid.gyeltshen/Desktop/Veres/veres-exchanger/node_modules/express/lib/router/route.js:144:13)\n    at cors (/Users/tashid.gyeltshen/Desktop/Veres/veres-exchanger/node_modules/cors/lib/index.js:188:7)",
    "type": "NotAllowedError"
  }
}

Noticed that the same is done for the vc issuer and verifier, so I thought this must the right thing to do. https://github.com/digitalbazaar/veres-meter/blob/7cb8e47a039961976c8314c26e355eb5ec7ab9d5/configs/veres-meter.js#L27-L45 https://github.com/digitalbazaar/bedrock-vc-issuer/blob/main/lib/config.js#L39-L46 https://github.com/digitalbazaar/bedrock-vc-verifier/blob/main/lib/config.js#L39-L46

mattcollier commented 1 year ago

@JSAssassin Thank you for the additional info. It looks like the test suite here works because it has an internal meter and the service was setup in the test suite itself: https://github.com/digitalbazaar/bedrock-vc-delivery/blob/main/test/test.config.js#L32