Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add /challenges endpoint. #373

Merged
merged 5 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions components/Challenge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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
firstVerifiedAt:
type: string
description: dateTimeStamp when the challenge was first verified.
uses:
wes-smith marked this conversation as resolved.
Show resolved Hide resolved
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). Defaults to current system time.
challenge:
type: string
description: A challenge provided by the party requesting 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
mandatoryPointers:
type: array
items:
Expand Down
14 changes: 13 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,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 @@ -755,6 +755,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 instance should create a challenge for use during verification, and track the number of times the challenge has been passed to verification endpoints as `options.challenge`.
</p>
</section>

</section>

<section>
Expand Down
25 changes: 23 additions & 2 deletions verifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/VerifyPresentationResponse"

"400":
description: Invalid or malformed input
"413":
Expand All @@ -75,6 +76,26 @@ 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.
security:
- networkAuth: []
- oAuth2: []
- zCap: []
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 +105,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 +121,5 @@ components:
$ref: "./components/Presentation.yml#/components/schemas/Presentation"
VerifyPresentationResponse:
$ref: "./components/VerificationResult.yml#/components/schemas/VerificationResult"
CreateChallengeResponse:
$ref: "./components/Challenge.yml#/components/schemas/CreateChallengeResult"