Skip to content

Commit

Permalink
feat(prism-agent): ATL-3554 clean-up OAS and remove unused endpoints …
Browse files Browse the repository at this point in the history
…and definitions (#376)

* chore(prism-agent): remove 'awaitConfirmation' and 'publicationState' from OAS

* chore(prism-agent): remove 'offset', 'limit' and 'count' from issue credential collection OAS

* chore(prism-agent): rename 'items' to 'contents' in issue credential collection to stick with our OAS guidelines

* chore(prism-agent): remove all unused '/revocation-registry/xxx' endpoints and 'W3Cxxx' object definitions from OAS

* chore(prism-agent): expose 'role' attribute in connect OAS

* chore(prism-agent): fix megalinter errors
  • Loading branch information
bvoiturier committed Feb 16, 2023
1 parent 1305555 commit 146cd52
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 282 deletions.
9 changes: 8 additions & 1 deletion prism-agent/service/api/http/connect/schemas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ components:
- connectionId
- state
- createdAt
- role
- invitation
properties:
self:
Expand Down Expand Up @@ -87,7 +88,13 @@ components:
description: The date and time the connection record was last updated.
type: string
format: date-time
example: 2021-12-31T13:59:60Z
example: 2021-12-31T13:59:59Z
role:
description: The role played by the Prism agent in the connection flow.
type: string
enum:
- Inviter
- Invitee
invitation:
$ref: "#/components/schemas/ConnectionInvitation"

Expand Down
198 changes: 2 additions & 196 deletions prism-agent/service/api/http/pollux/schemas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,6 @@ components:
If set to `false`, a manual approval by the issuer via API call will be required for the VC to be issued.
type: boolean
default: true
awaitConfirmation:
type: boolean
default: true

CreateIssueCredentialRecordRequest:
description: A request to create a new "issue credential record".
Expand Down Expand Up @@ -324,12 +321,6 @@ components:
- CredentialPending
- CredentialSent
- CredentialReceived
publicationState:
type: string
enum:
- PublicationPending
- PublicationQueued
- Published
jwtCredential:
description: The base64-encoded JWT verifiable credential that has been sent by the issuer.
type: string
Expand All @@ -341,184 +332,13 @@ components:
IssueCredentialRecordCollection:
description: A collection of issue credential records.
required:
- items
- offset
- limit
- count
- contents
properties:
items:
contents:
description: The array containing the list of issue credential records.
type: array
items:
$ref: "#/components/schemas/IssueCredentialRecord"
offset:
type: integer
limit:
type: integer
count:
type: integer

#

W3CCredentialInput:
description: |-
Credential input object based on which the new instance of the verifiable credentials is created.
Object contains the minimal set of the fields required to create the credentials for the given subject.
All other required fields of the verifiable credential depend on the context of the cloud agent
required:
- subjectId
- claims
properties:
schemaId:
type: string
description: "Identity of the Verifiable Credentials Schema associated with this object"
example: "did:example:MDP8AsFhHzhwUvGNuYkX7T;id=06e126d1-fa44-4882-a243-1e326fbe21db;version=1.0"
subjectId:
type: string
description: "Subject DID of the verifiable credentials object"
example: "did:prism:subjectofverifiablecredentials"
validityPeriod:
type: number
description: "The validity period in seconds of the verifiable credential"
example: 3600
claims:
type: object
additionalProperties:
type: string
description: "Clams associated with given credentials object (for now it's just a key/value, later should be more complex"

W3CCredential:
description: "Verifiable Credential Object according to W3C specification"
required: ["id", "type", "issuer", "issuanceDate", "credentialSubject"]
properties:
id:
type: string
description: "Credential id or url that can be used to get the status of revoke the credential"
example: "http://example.edu/credentials/1872"
type:
type: string
description: "Credential type according to W3C specification. Must include VerifiableCredentials and type of concrete credentials"
example: '["VerifiableCredential", "AlumniCredential"]'
issuer:
type: string
description: "Issuer DID"
example: "did:prism:issuerdid"
issuanceDate:
type: string
description: "Datetime in ISO format that corresponds to the date of issuance"
example: "2010-01-01T19:23:24Z"
credentialSubject:
type: object
description: "Credentials subject DID and claims according to the schema object"
additionalProperties:
type: string
example:
id: "did:prism:subject12345"
alumni_of: "University"
degree: "master of openapi specification"
proof:
$ref: "#/components/schemas/W3CProof"

W3CCredentialsPaginated:
description: "Paginated response that contains an array of the credential objects"
properties:
data:
type: array
items:
$ref: "#/components/schemas/W3CCredential"
offset:
type: integer
limit:
type: integer
count:
type: integer

W3CIssuanceBatch:
description: "An issuance batch object that is associated with thelist of verifiable credentials"
properties:
id:
type: string
description: "Issuance batch id"
count:
type: integer
description: "Count of the verifiable credentials object in the batch"
actions:
type: array
items:
$ref: "#/components/schemas/W3CIssuanceBatchAction"

W3CIssuanceBatchAction:
description: "Action performed on the list of credentials associated with the issuance batch"
properties:
action:
description: "Action name"
type: string
enum: ["sign", "issue", "send"]
example: "issue"
id:
description: "Action id for tracking"
type: string
example: "uid"
status:
description: "Action status"
type: string
enum: ["scheduled", "pending", "completed", "failed"]

W3CIssuanceBatchPaginated:
description: "Paginated response that contains an array of the issuance-batch objects"
properties:
data:
type: array
items:
$ref: "#/components/schemas/W3CIssuanceBatch"
offset:
type: integer
limit:
type: integer
count:
type: integer

W3CCredentialStatus:
description: Verifiable Credential revocation status
required:
- status
properties:
status:
description: Status name
type: string
enum:
- issued
- revoked
example: "issued"
description:
type: string
description: Description about the status
example: "Issued by did:prism:issuer12354 on 2022-02-01"

W3CCredentialRevocationRequest:
description: Credential revocation request. Contain credential id and other information required for revocation
required:
- credentialId
additionalProperties: false
properties:
credentialId:
type: string
description: Credential identity
example: "abcde-12345"

W3CCredentialRevocationResponse:
description: Credential revocation response. Contain credential id and revocation operation for tracing the completion
required:
- credentialId
- operationId
- status
properties:
credentialId:
type: string
description: Credential identity
example: "abcde-12345"
operation:
$ref: "#/components/schemas/RevocationStatus"

RevocationStatus:
description: Revocation status record
Expand Down Expand Up @@ -623,20 +443,6 @@ components:
items:
type: string

W3CPresentationPaginated:
description: "Paginated response that contains an array of the presentation objects"
properties:
data:
type: array
items:
$ref: "#/components/schemas/W3CPresentation"
offset:
type: integer
limit:
type: integer
count:
type: integer

JWTCompactSerialisation:
description: "Verifiable Credentials or Presentation encoded as JWT token"
type: string
Expand Down
66 changes: 0 additions & 66 deletions prism-agent/service/api/http/prism-agent-openapi-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -659,72 +659,6 @@ paths:
schema:
$ref: "./pollux/schemas.yaml#/components/schemas/ErrorResponse"

/revocation-registry/credential-status/{id}:
get:
tags: ["Revocation Registry"]
operationId: getCredentialRevocationStatusById
summary: Get credentials revocation status by credential id
description: Get credentials revocation status by credential id
parameters:
- in: path
name: id
description: Verifiable Credential Id
schema:
type: string
required: true
example: "abcde12345"
responses:
"200":
description: Status request processed successfully
content:
application/json:
schema:
$ref: "./pollux/schemas.yaml#/components/schemas/W3CCredentialStatus"
/revocation-registry/revoke:
post:
tags: ["Revocation Registry"]
operationId: revokeCredentialById
summary: Revoke credential by id
description: Revoke credential by id
requestBody:
content:
application/json:
schema:
$ref: "./pollux/schemas.yaml#/components/schemas/W3CCredentialRevocationRequest"
required: true
responses:
"202":
description: Revocation request successfully submitted
content:
application/json:
schema:
$ref: "./pollux/schemas.yaml#/components/schemas/W3CCredentialRevocationResponse"
headers:
Location:
schema:
type: string
description: URL to access credential revocation status.

/revocation-registry/operations/{id}:
get:
tags: ["Revocation Registry"]
operationId: getRevocationOperationStatusById
summary: Get revocation operation status by id
description: Get revocation operation status by id
parameters:
- in: path
name: id
schema:
type: string
required: true
responses:
"200":
description: Success, operation status is returned
content:
application/json:
schema:
$ref: "./pollux/schemas.yaml#/components/schemas/RevocationStatus"

/present-proof/presentations:
post:
tags: ["Present Proof"]
Expand Down
1 change: 0 additions & 1 deletion prism-agent/service/issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ curl -X 'POST' \
"issuingDID": "{ISSUING_DID}",
"validityPeriod": 3600,
"automaticIssuance": false,
"awaitConfirmation": false,
"claims": {
"firstname": "Alice",
"lastname": "Wonderland",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,10 @@ trait JsonSupport extends SprayJsonSupport with DefaultJsonProtocol {
}
}
}
given RootJsonFormat[CreateIssueCredentialRecordRequest] = jsonFormat8(CreateIssueCredentialRecordRequest.apply)
given RootJsonFormat[IssueCredentialRecord] = jsonFormat14(IssueCredentialRecord.apply)
given RootJsonFormat[IssueCredentialRecordCollection] = jsonFormat4(IssueCredentialRecordCollection.apply)
//

// Pollux
given RootJsonFormat[RevocationStatus] = jsonFormat2(RevocationStatus.apply)
given RootJsonFormat[W3CCredentialRevocationRequest] = jsonFormat1(W3CCredentialRevocationRequest.apply)
given RootJsonFormat[W3CCredentialRevocationResponse] = jsonFormat2(W3CCredentialRevocationResponse.apply)
given RootJsonFormat[W3CCredentialStatus] = jsonFormat2(W3CCredentialStatus.apply)
// Issue
given RootJsonFormat[CreateIssueCredentialRecordRequest] = jsonFormat7(CreateIssueCredentialRecordRequest.apply)
given RootJsonFormat[IssueCredentialRecord] = jsonFormat12(IssueCredentialRecord.apply)
given RootJsonFormat[IssueCredentialRecordCollection] = jsonFormat1(IssueCredentialRecordCollection.apply)

// Presentation
given RootJsonFormat[Options] = jsonFormat2(Options.apply)
Expand All @@ -90,7 +84,7 @@ trait JsonSupport extends SprayJsonSupport with DefaultJsonProtocol {
given RootJsonFormat[CreateConnectionRequest] = jsonFormat1(CreateConnectionRequest.apply)
given RootJsonFormat[AcceptConnectionInvitationRequest] = jsonFormat1(AcceptConnectionInvitationRequest.apply)
given RootJsonFormat[ConnectionCollection] = jsonFormat3(ConnectionCollection.apply)
given RootJsonFormat[Connection] = jsonFormat10(Connection.apply)
given RootJsonFormat[Connection] = jsonFormat11(Connection.apply)
given RootJsonFormat[ConnectionInvitation] = jsonFormat4(ConnectionInvitation.apply)

}
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ trait OASDomainModelHelper {
schemaId = domain.schemaId,
validityPeriod = domain.validityPeriod,
automaticIssuance = domain.automaticIssuance,
awaitConfirmation = domain.awaitConfirmation,
protocolState = domain.protocolState.toString(),
publicationState = domain.publicationState.map(_.toString),
jwtCredential = domain.issueCredentialData.flatMap(issueCredential => {
issueCredential.attachments.collectFirst { case AttachmentDescriptor(_, _, Base64(jwt), _, _, _, _) =>
jwt
Expand Down Expand Up @@ -189,6 +187,7 @@ trait OASDomainModelHelper {
state = domain.protocolState.toString,
createdAt = domain.createdAt.atOffset(ZoneOffset.UTC),
updatedAt = domain.updatedAt.map(_.atOffset(ZoneOffset.UTC)),
role = domain.role.toString,
invitation = ConnectionInvitation(
id = UUID.fromString(domain.invitation.id),
`type` = domain.invitation.`type`,
Expand Down

0 comments on commit 146cd52

Please sign in to comment.