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

feat(prism-agent): migrate did-registrar endpoint to tapir #517

Merged
merged 18 commits into from
May 3, 2023
5 changes: 5 additions & 0 deletions infrastructure/shared/apisix/conf/apisix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ routes:
plugins:
proxy-rewrite:
regex_uri: ["^/prism-agent/dids(/.*)?", "/dids$1"]
- uri: /prism-agent/did-registrar*
upstream_id: 4
plugins:
proxy-rewrite:
regex_uri: ["^/prism-agent/did-registrar(/.*)?", "/did-registrar$1"]
- uri: /prism-agent/connections*
upstream_id: 4
plugins:
Expand Down
11 changes: 0 additions & 11 deletions prism-agent/service/api/http/castor/parameters.yaml

This file was deleted.

182 changes: 0 additions & 182 deletions prism-agent/service/api/http/castor/schemas.yaml

This file was deleted.

134 changes: 5 additions & 129 deletions prism-agent/service/api/http/prism-agent-openapi-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,143 +43,19 @@ paths:
$ref: "./tapir-generated.yaml#/paths/~1dids~1{didRef}"

/did-registrar/dids:
get:
operationId: listManagedDid
tags: ["DID Registrar"]
summary: List all DIDs stored in Prism Agent's wallet
description: |
List all DIDs stored in Prism Agent's wallet.
Return a paginated items ordered by created timestamp.
If the `limit` parameter is not set, it defaults to 100 items per page.
parameters:
- $ref: "./shared/parameters.yaml#/components/parameters/offset"
- $ref: "./shared/parameters.yaml#/components/parameters/limit"
responses:
"200":
description: List Prism Agent managed DIDs
content:
application/json:
schema:
$ref: "./castor/schemas.yaml#/components/schemas/ManagedDIDPage"
"500":
$ref: "./shared/responses.yaml#/components/responses/InternalServerError"

post:
operationId: createManagedDid
tags: ["DID Registrar"]
summary: Create unpublished DID and store it in Prism Agent's wallet
description: |
Create unpublished DID and store it inside Prism Agent's wallet. The private keys of the DID is
managed by Prism Agent. The DID can later be published to the VDR using publications endpoint.
requestBody:
required: true
content:
application/json:
schema:
$ref: "./castor/schemas.yaml#/components/schemas/CreateManagedDidRequest"
responses:
"201":
description: Created unpublished DID.
content:
application/json:
schema:
$ref: "./castor/schemas.yaml#/components/schemas/CreateManagedDIDResponse"
"422":
$ref: "./shared/responses.yaml#/components/responses/UnprocessableEntity"
"500":
$ref: "./shared/responses.yaml#/components/responses/InternalServerError"
$ref: "./tapir-generated.yaml#/paths/~1did-registrar~1dids"

/did-registrar/dids/{didRef}:
get:
operationId: getManagedDid
tags: ["DID Registrar"]
summary: Get DID stored in Prism Agent's wallet
description: Get DID stored in Prism Agent's wallet
parameters:
- $ref: "./castor/parameters.yaml#/components/parameters/didRefInPath"
responses:
"200":
description: Get Prism Agent managed DID
content:
application/json:
schema:
$ref: "./castor/schemas.yaml#/components/schemas/ManagedDID"
"404":
$ref: "./shared/responses.yaml#/components/responses/NotFound"
"500":
$ref: "./shared/responses.yaml#/components/responses/InternalServerError"
$ref: "./tapir-generated.yaml#/paths/~1did-registrar~1dids~1{didRef}"

/did-registrar/dids/{didRef}/publications:
post:
operationId: publishManagedDid
tags: ["DID Registrar"]
summary: Publish the DID stored in Prism Agent's wallet to the VDR
description: |
Publish the DID stored in Prism Agent's wallet to the VDR.
parameters:
- $ref: "./castor/parameters.yaml#/components/parameters/didRefInPath"
responses:
"202":
description: Publishing DID to the VDR.
content:
application/json:
schema:
$ref: "./castor/schemas.yaml#/components/schemas/DIDOperationResponse"
"422":
$ref: "./shared/responses.yaml#/components/responses/UnprocessableEntity"
"500":
$ref: "./shared/responses.yaml#/components/responses/InternalServerError"
$ref: "./tapir-generated.yaml#/paths/~1did-registrar~1dids~1{didRef}~1publications"

/did-registrar/dids/{didRef}/updates:
post:
operationId: updateManagedDid
tags: ["DID Registrar"]
summary: Update DID in Prism Agent's wallet and post update operation to the VDR
description: |
Update DID in Prism Agent's wallet and post update operation to the VDR.
This endpoint updates the DID document from the last confirmed operation.
Submitting multiple update operations without waiting for confirmation will result in
some operations being rejected as only one operation is allowed to be appended to the last confirmed operation.
requestBody:
required: true
content:
application/json:
schema:
$ref: "./castor/schemas.yaml#/components/schemas/UpdateManagedDIDRequest"
parameters:
- $ref: "./castor/parameters.yaml#/components/parameters/didRefInPath"
responses:
"202":
description: Publishing DID to the VDR.
content:
application/json:
schema:
$ref: "./castor/schemas.yaml#/components/schemas/DIDOperationResponse"
"422":
$ref: "./shared/responses.yaml#/components/responses/UnprocessableEntity"
"500":
$ref: "./shared/responses.yaml#/components/responses/InternalServerError"
$ref: "./tapir-generated.yaml#/paths/~1did-registrar~1dids~1{didRef}~1updates"

/did-registrar/dids/{didRef}/deactivations:
post:
operationId: deactivateManagedDid
tags: ["DID Registrar"]
summary: Deactivate DID in Prism Agent's wallet and post deactivate operation to the VDR
description: |
Deactivate DID in Prism Agent's wallet and post deactivate operation to the VDR.
parameters:
- $ref: "./castor/parameters.yaml#/components/parameters/didRefInPath"
responses:
"202":
description: DID deactivation to VDR successfully queued.
content:
application/json:
schema:
$ref: "./castor/schemas.yaml#/components/schemas/DIDOperationResponse"
"422":
$ref: "./shared/responses.yaml#/components/responses/UnprocessableEntity"
"500":
$ref: "./shared/responses.yaml#/components/responses/InternalServerError"
$ref: "./tapir-generated.yaml#/paths/~1did-registrar~1dids~1{didRef}~1deactivations"

# ----------------------------------
# Pollux
Expand Down
36 changes: 1 addition & 35 deletions prism-agent/service/api/http/shared/schemas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,38 +26,4 @@ components:
type: string

ErrorResponse:
type: object
description: An RFC-7807 compliant data structure for reporting errors to the client
required:
- type
- title
- status
- instance
properties:
type:
type: string
description: A URI reference that identifies the problem type.
example: https://example.org/doc/#model-MalformedEmail/
title:
type: string
example: "Malformed email"
description: |-
A short, human-readable summary of the problem type. It does not
change from occurrence to occurrence of the problem.
status:
type: integer
format: int32
example: 400
description: |-
The HTTP status code for this occurrence of the problem.
detail:
type: string
description: |-
A human-readable explanation specific to this occurrence of the problem.
example: "The received '{}à!è@!.b}' email does not conform to the email format"
instance:
type: string
example: "/problems/d914e"
description: |-
A URI reference that identifies the specific occurrence of the problem.
It may or may not yield further information if dereferenced.
$ref: "../tapir-generated.yaml#/components/schemas/ErrorResponse"
Loading