Skip to content

Commit

Permalink
Add challenge endpoint.
Browse files Browse the repository at this point in the history
- add challenge creation endpoint
- remove passing `options.challenge` and `options.domain` to incorrect endpoints
  • Loading branch information
wes-smith committed Feb 28, 2024
1 parent 8a94c1f commit 1eb33d6
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 15 deletions.
65 changes: 65 additions & 0 deletions components/Challenge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
openapi: 3.0.0
info:
version: "0.0.3-unstable"
title: VC API
description: This is an Experimental Open API Specification for the [VC Data Model](https://www.w3.org/TR/vc-data-model/).
license:
name: W3C Software and Document License
url: http://www.w3.org/Consortium/Legal/copyright-software.
contact:
name: GitHub Source Code
url: https://github.com/w3c-ccg/vc-api
paths:
components:
schemas:
CreateChallengeResult:
type: object
additionalProperties: false
description: Object containg a challenge
properties:
challenge:
type: string
description: The challenge value
ChallengeVerificationMetadata:
type: object
additionalProperties: false
description: Metadata about the verification of options.challenge.
properties:
verified:
type: string
description: Whether verification of the challenge was successful
uses:
type: string
description: The number of times options.challenge has been used
VerificationResultWithChallengeMetadata:
type: object
additionalProperties: false
description: Object summarizing a verification
properties:
checks:
type: array
description: The checks performed
items:
type: string
warnings:
type: array
description: Warnings
items:
type: string
errors:
type: array
description: Errors
items:
type: string
ChallengeVerificationMetadata:
type: object
additionalProperties: false
description: Metadata about the verification of options.challenge.
properties:
verified:
type: string
description: Whether verification of the challenge was successful
uses:
type: string
description: The number of times options.challenge has been used

6 changes: 0 additions & 6 deletions components/IssueCredentialOptions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ components:
created:
type: string
description: The date and time of the proof (with a maximum accuracy in seconds). Default current system time.
challenge:
type: string
description: A challenge provided by the requesting party of the proof. For example 6e62f66e-67de-11eb-b490-ef3eeefa55f2
domain:
type: string
description: The intended domain of validity for the proof. For example website.example
credentialStatus:
type: object
description: The method of credential status to issue the credential including. If omitted credential status will be included.
Expand Down
11 changes: 10 additions & 1 deletion holder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/ProvePresentationResponse"
oneOf:
- $ref: "#/components/schemas/ProvePresentationResponse"
- $ref: "#/components/schemas/ProvePresentationResponseWithChallengeVerificationMetadata"
"400":
description: invalid input!
"500":
Expand Down Expand Up @@ -501,6 +503,13 @@ components:
properties:
verifiablePresentation:
$ref: "./components/VerifiablePresentation.yml#/components/schemas/VerifiablePresentation"
ProvePresentationResponseWithChallengeVerificationMetadata:
type: object
properties:
verifiablePresentation:
$ref: "./components/VerifiablePresentation.yml#/components/schemas/VerifiablePresentation"
ChallengeVerificationMetadata:
$ref: "./components/Challenge.yml#/components/schemas/ChallengeVerificationMetadata"
NotifyPresentationAvailableRequest:
type: object
properties:
Expand Down
14 changes: 13 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ <h3>Verifying</h3>
</p>

<table class="simple api-summary-table"
data-api-path="/credentials/verify /presentations/verify"></table>
data-api-path="/credentials/verify /presentations/verify /challenges"></table>

<section>
<h4>Verify Credential</h4>
Expand All @@ -721,6 +721,18 @@ <h4>Verify Presentation</h4>
data-api-endpoint="post /presentations/verify"></div>
</section>

<section>
<h4>Create Challenge</h4>
<p>
</p>

<div class="api-detail"
data-api-endpoint="post /challenges"></div>
<p>
The issuer should track the number of times a challenge has been passed to an endpoint as `options.challenge`.
</p>
</section>

</section>

<section>
Expand Down
34 changes: 27 additions & 7 deletions verifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ paths:
description: Parameters for verifying a verifiablePresentation.
responses:
"200":
description: Verifiable Presentation successfully verified!
content:
application/json:
schema:
$ref: "#/components/schemas/VerifyPresentationResponse"
description: Verifiable Presentation successfully verified!
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/VerifyPresentationResponse"
- $ref: "#/components/schemas/VerifyPresentationResponseWithChallengeMetadata"
"400":
description: Invalid or malformed input
"413":
Expand All @@ -75,6 +77,22 @@ paths:
description: Request rate limit exceeded.
"500":
description: Internal Server Error
/challenges:
post:
summary: Passing an empty body to this endpoint creates and returns a challenge string in the response body.
operationId: challenge
description: Creates a challenge to be used as `options.challenge` in future requests.
responses:
"200":
description: Challenge created
content:
application/json:
schema:
$ref: "#/components/schemas/CreateChallengeResponse"
"400":
description: Invalid or malformed input
"500":
description: Internal server error
components:
securitySchemes:
$ref: "./components/SecuritySchemes.yml#/components/securitySchemes"
Expand All @@ -84,8 +102,6 @@ components:
properties:
verifiableCredential:
$ref: "./components/VerifiableCredential.yml#/components/schemas/VerifiableCredential"
options:
$ref: "./components/VerifyOptions.yml#/components/schemas/VerifyOptions"
VerifyCredentialResponse:
$ref: "./components/VerificationResult.yml#/components/schemas/VerificationResult"
VerifyPresentationRequest:
Expand All @@ -102,3 +118,7 @@ components:
$ref: "./components/Presentation.yml#/components/schemas/Presentation"
VerifyPresentationResponse:
$ref: "./components/VerificationResult.yml#/components/schemas/VerificationResult"
VerifyPresentationResponseWithChallengeMetadata:
$ref: "./components/Challenge.yml#/components/schemas/VerificationResultWithChallengeMetadata"
CreateChallengeResponse:
$ref: "./components/Challenge.yml#/components/schemas/CreateChallengeResult"

0 comments on commit 1eb33d6

Please sign in to comment.