11---
22components :
3+ securitySchemes :
4+ hmac :
5+ type : apiKey
6+ name : Authorization
7+ in : header
8+ description : ' HMAC-SHA256 signature. Format: HMAC sig={base64_encoded_signature}.
9+ The signature is computed from the request body using the shared secret key.'
310 schemas :
411 CertificationCreateRequestBody :
512 type : object
@@ -433,43 +440,43 @@ components:
433440 required :
434441 - status
435442 responses :
436- e85a7efe856f3b4a33e16865be21f15d :
443+ fce2c5f59cd97181b0cb69aafab2022a :
437444 description : Created Certification.
438445 content :
439446 application/json :
440447 schema :
441448 " $ref " : " #/components/schemas/CertificationResponseBody"
442- 6125a62221e212bb815526051661dbdc :
449+ 0ea4ab356e2a8b5ccab72cf7a3ce02e1 :
443450 description : User error.
444451 content :
445452 application/json :
446453 schema :
447454 " $ref " : " #/components/schemas/ErrorResponseBody"
448- 2e75eacc71eb2f0502fa228d762d5a55 :
455+ f1ce98ed91709726d022bca82c6ade1a :
449456 description : User error.
450457 content :
451458 application/json :
452459 schema :
453460 " $ref " : " #/components/schemas/ErrorResponseBody"
454- 90dc71790b26f81c5e56146f6d9f5018 :
461+ 3b0ea479d309b77a0516d51bce083571 :
455462 description : A Certification
456463 content :
457464 application/json :
458465 schema :
459466 " $ref " : " #/components/schemas/CertificationResponseBody"
460- f03eaaaf493bc30b5c43df958dbb7e8e :
467+ dfa2e176967676c731ccb4a96d74f8f6 :
461468 description : Not found.
462469 content :
463470 application/json :
464471 schema :
465472 " $ref " : " #/components/schemas/ErrorResponseBody"
466- d490eeb4ff1770bf36c95bf8931bb69e :
473+ d5f88820bbb77585eef9547c048da107 :
467474 description : Response
468475 content :
469476 application/json :
470477 schema :
471478 " $ref " : " #/components/schemas/ece4f2c15f241af4536e1132d15a279a"
472- 4a0c71781938225c26730e68f030c36c :
479+ 8d921f7b0646bf9b04d277eae3a87fe1 :
473480 description : Response
474481 content :
475482 application/json :
@@ -485,7 +492,7 @@ components:
485492 type : string
486493 style : simple
487494 requestBodies :
488- 3ac5de20e865f14a0346ef405d86aca7 :
495+ 6937948de9fee00ae4778aea1159f62d :
489496 description : The Certification data.
490497 content :
491498 application/json :
@@ -499,7 +506,6 @@ components:
499506 certification_type :
500507 " $ref " : " #/components/schemas/CertificationCreateRequestBody/examples/certification_type"
501508 required : false
502- securitySchemes : {}
503509 headers : {}
504510 examples : {}
505511 links : {}
@@ -510,13 +516,49 @@ info:
510516 summary : System for tracking and certifying community engagement requirements for
511517 Medicaid
512518 description : |
513- # Welcome to the Community Engagement Medicaid API
519+ # Community Engagement Medicaid API
514520
515- This is the OpenAPI spec for interacting with the Community Engagement Medicaid API.
521+ ## Authentication
516522
517- ## Getting Started
523+ All API endpoints (except `/api/healthcheck`) require HMAC-SHA256 authentication.
518524
519- This demo API has no required authentication at the moment.
525+ ### Request Format
526+ ```
527+ Authorization: HMAC sig={base64_signature}
528+ ```
529+
530+ ### Generating the Signature
531+
532+ 1. Take the raw JSON request body
533+ 2. Compute HMAC-SHA256 using the shared secret key
534+ 3. Base64-encode (strict) the result
535+
536+ **Ruby Example:**
537+ ```ruby
538+ body = { member_id: "123" }.to_json
539+ signature = Base64.strict_encode64(
540+ OpenSSL::HMAC.digest("sha256", secret_key, body)
541+ )
542+ # Header: Authorization: HMAC sig=#{signature}
543+ ```
544+
545+ **curl Example (POST):**
546+ ```bash
547+ BODY='{"member_id":"123"}'
548+ SIG=$(echo -n "$BODY" | openssl dgst -sha256 -hmac "$API_SECRET_KEY" -binary | base64)
549+ curl -X POST https://api.example.com/api/certifications \
550+ -H "Content-Type: application/json" \
551+ -H "Authorization: HMAC sig=$SIG" \
552+ -d "$BODY"
553+ ```
554+
555+ **curl Example (GET):**
556+ ```bash
557+ # For GET requests (no body), the signature is computed from an empty string
558+ SIG=$(echo -n "" | openssl dgst -sha256 -hmac "$API_SECRET_KEY" -binary | base64)
559+ curl -X GET https://api.example.com/api/certifications/{id} \
560+ -H "Authorization: HMAC sig=$SIG"
561+ ```
520562 termsOfService : ' '
521563 contact :
522564 name : Nava PBC
@@ -540,14 +582,16 @@ paths:
540582 description : " #"
541583 operationId : POST__api_certifications
542584 requestBody :
543- " $ref " : " #/components/requestBodies/3ac5de20e865f14a0346ef405d86aca7 "
585+ " $ref " : " #/components/requestBodies/6937948de9fee00ae4778aea1159f62d "
544586 responses :
545587 ' 201 ' :
546- " $ref " : " #/components/responses/e85a7efe856f3b4a33e16865be21f15d "
588+ " $ref " : " #/components/responses/fce2c5f59cd97181b0cb69aafab2022a "
547589 ' 400 ' :
548- " $ref " : " #/components/responses/6125a62221e212bb815526051661dbdc "
590+ " $ref " : " #/components/responses/0ea4ab356e2a8b5ccab72cf7a3ce02e1 "
549591 ' 422 ' :
550- " $ref " : " #/components/responses/2e75eacc71eb2f0502fa228d762d5a55"
592+ " $ref " : " #/components/responses/f1ce98ed91709726d022bca82c6ade1a"
593+ security :
594+ - hmac : []
551595 " /api/certifications/{id} " :
552596 get :
553597 tags :
@@ -559,9 +603,11 @@ paths:
559603 - " $ref " : " #/components/parameters/49e46dd8af57e26752938ebb0d0ec979"
560604 responses :
561605 ' 200 ' :
562- " $ref " : " #/components/responses/90dc71790b26f81c5e56146f6d9f5018 "
606+ " $ref " : " #/components/responses/3b0ea479d309b77a0516d51bce083571 "
563607 ' 404 ' :
564- " $ref " : " #/components/responses/f03eaaaf493bc30b5c43df958dbb7e8e"
608+ " $ref " : " #/components/responses/dfa2e176967676c731ccb4a96d74f8f6"
609+ security :
610+ - hmac : []
565611 " /api/health " :
566612 get :
567613 tags :
@@ -571,6 +617,10 @@ paths:
571617 operationId : GET__api_health
572618 responses :
573619 ' 200 ' :
574- " $ref " : " #/components/responses/d490eeb4ff1770bf36c95bf8931bb69e "
620+ " $ref " : " #/components/responses/d5f88820bbb77585eef9547c048da107 "
575621 ' 503 ' :
576- " $ref " : " #/components/responses/4a0c71781938225c26730e68f030c36c"
622+ " $ref " : " #/components/responses/8d921f7b0646bf9b04d277eae3a87fe1"
623+ security :
624+ - hmac : []
625+ security :
626+ - hmac : []
0 commit comments