-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added VDR v2 spec, generated code and empty wrapper
- Loading branch information
1 parent
c0ec338
commit d952474
Showing
7 changed files
with
2,395 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package: v2 | ||
generate: | ||
echo-server: true | ||
client: true | ||
models: true | ||
strict-server: true | ||
output-options: | ||
skip-prune: true | ||
exclude-schemas: | ||
- DIDDocument | ||
- DIDDocumentMetadata | ||
- Service | ||
- VerificationMethod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,268 @@ | ||
openapi: "3.0.0" | ||
info: | ||
title: Nuts Verifiable Data Registry API spec | ||
description: API specification for the Verifiable Data Registry | ||
version: 2.0.0 | ||
license: | ||
name: GPLv3 | ||
servers: | ||
- url: http://localhost:1323 | ||
paths: | ||
/internal/vdr/v2/did: | ||
post: | ||
summary: Creates a new Web DID | ||
description: | | ||
A new web DID is created. Only the DID is returned. The DID document can be retrieved using the DID resolution endpoint. | ||
A single key pair is generated and added to the DID document. The key pair is used for all verificationMethods. | ||
No services are added. The PublicURL needs to be configured. | ||
error returns: | ||
* 412 - PublicURL is not configured | ||
* 500 - An error occurred while processing the request | ||
operationId: "createDID" | ||
tags: | ||
- DID | ||
responses: | ||
"200": | ||
description: "New DID has been created successfully. Returns the DID document." | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/DIDDocument' | ||
default: | ||
$ref: '../common/error_response.yaml' | ||
/internal/vdr/v2/did/{did}: | ||
parameters: | ||
- name: did | ||
in: path | ||
description: URL encoded DID. | ||
required: true | ||
example: did:web:example.com:iam:013c6fda-73e8-45ee-9220-48652dba854b | ||
schema: | ||
type: string | ||
get: | ||
summary: "Resolves a DID document" | ||
description: | | ||
Resolves a DID document. | ||
error returns: | ||
* 400 - Returned in case of malformed DID | ||
* 404 - Corresponding DID document could not be found | ||
* 500 - An error occurred while processing the request | ||
operationId: "resolveDID" | ||
tags: | ||
- DID | ||
responses: | ||
"200": | ||
description: DID document has been found and returned. | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/DIDResolutionResult' | ||
default: | ||
$ref: '../common/error_response.yaml' | ||
delete: | ||
summary: Deleted the web DID Document. | ||
description: | | ||
error returns: | ||
* 400 - the DID param was malformed | ||
* 404 - Corresponding DID document could not be found | ||
* 500 - An error occurred while processing the request | ||
operationId: "deleteDID" | ||
tags: | ||
- DID | ||
responses: | ||
"204": | ||
description: DID document has been deactivated. | ||
default: | ||
$ref: '../common/error_response.yaml' | ||
/internal/vdr/v2/did/{did}/service: | ||
parameters: | ||
- name: did | ||
in: path | ||
description: URL encoded DID. | ||
required: true | ||
example: did:web:example.com:iam:013c6fda-73e8-45ee-9220-48652dba854b | ||
schema: | ||
type: string | ||
post: | ||
summary: Adds a service to the DID document. | ||
description: | | ||
It adds the given service to the DID Document. The ID will be generated and replaced. | ||
error returns: | ||
* 400 - Returned in case of malformed DID or service | ||
* 404 - Corresponding DID document could not be found | ||
* 500 - An error occurred while processing the request | ||
parameters: | ||
- name: service | ||
in: body | ||
description: Service to be added to the DID document. | ||
required: true | ||
schema: | ||
$ref: '#/components/schemas/Service' | ||
operationId: addService | ||
tags: | ||
- DID | ||
responses: | ||
"200": | ||
description: "New verification method has been created and added successfully. Returns the verification method." | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/VerificationMethod' | ||
default: | ||
$ref: '../common/error_response.yaml' | ||
/internal/vdr/v2/did/{did}/service/{id}: | ||
parameters: | ||
- name: did | ||
in: path | ||
description: URL encoded DID. | ||
required: true | ||
example: did:web:example.com:iam:013c6fda-73e8-45ee-9220-48652dba854b | ||
schema: | ||
type: string | ||
- name: id | ||
in: path | ||
description: URL encoded id identifying the service. | ||
required: true | ||
example: "did:web:example.com:iam:013c6fda-73e8-45ee-9220-48652dba854b#3106f751-59e3-440f-b57b-39a96a2da6c6" | ||
schema: | ||
type: string | ||
delete: | ||
summary: Delete a specific service | ||
description: | | ||
Removes the service from the DID Document. | ||
No cascading will happen for references to the service. | ||
error returns: | ||
* 404 - Corresponding DID document or verification method could not be found | ||
* 500 - An error occurred while processing the request | ||
tags: | ||
- DID | ||
operationId: deleteService | ||
responses: | ||
"204": | ||
description: Verification Method was successfully deleted | ||
default: | ||
$ref: '../common/error_response.yaml' | ||
put: | ||
summary: Updates a service in the DID document. | ||
description: | | ||
It updates the given service in the DID Document. The ID will remain the same. | ||
error returns: | ||
* 400 - Returned in case of malformed DID or service | ||
* 404 - Corresponding DID document could not be found | ||
* 500 - An error occurred while processing the request | ||
tags: | ||
- DID | ||
operationId: updateService | ||
parameters: | ||
- name: service | ||
in: body | ||
description: Service to be added to the DID document. | ||
required: true | ||
schema: | ||
$ref: '#/components/schemas/Service' | ||
responses: | ||
"200": | ||
description: "Service has been updated successfully. Returns the service." | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Service' | ||
default: | ||
$ref: '../common/error_response.yaml' | ||
/internal/vdr/v2/did/{did}/verificationmethod: | ||
parameters: | ||
- name: did | ||
in: path | ||
description: URL encoded DID. | ||
required: true | ||
example: did:web:example.com:iam:013c6fda-73e8-45ee-9220-48652dba854b | ||
schema: | ||
type: string | ||
post: | ||
summary: Creates and adds a new verificationMethod to the DID document. | ||
description: | | ||
It creates a new private public keypair. The public key is wrapped in verificationMethod. This method is added to the DID Document. | ||
The key pair is used for all verificationMethods. | ||
error returns: | ||
* 404 - Corresponding DID document could not be found | ||
* 500 - An error occurred while processing the request | ||
operationId: addVerificationMethod | ||
tags: | ||
- DID | ||
responses: | ||
"200": | ||
description: "New verification method has been created and added successfully. Returns the verification method." | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/VerificationMethod' | ||
default: | ||
$ref: '../common/error_response.yaml' | ||
/internal/vdr/v2/did/{did}/verificationmethod/{kid}: | ||
parameters: | ||
- name: did | ||
in: path | ||
description: URL encoded DID. | ||
required: true | ||
example: did:web:example.com:iam:013c6fda-73e8-45ee-9220-48652dba854b | ||
schema: | ||
type: string | ||
- name: kid | ||
in: path | ||
description: URL encoded kid identifying the verification method. | ||
required: true | ||
example: "did:web:example.com:iam:013c6fda-73e8-45ee-9220-48652dba854b#3106f751-59e3-440f-b57b-39a96a2da6c6" | ||
schema: | ||
type: string | ||
delete: | ||
summary: Delete a specific verification method | ||
description: | | ||
Removes the verification method from the DID Document. | ||
Revokes the public key with the corresponding key-id. | ||
Note: Other verification methods with different key-ids with the same private key will still be valid. | ||
error returns: | ||
* 404 - Corresponding DID document or verification method could not be found | ||
* 500 - An error occurred while processing the request | ||
tags: | ||
- DID | ||
operationId: deleteVerificationMethod | ||
responses: | ||
"204": | ||
description: Verification Method was successfully deleted | ||
default: | ||
$ref: '../common/error_response.yaml' | ||
components: | ||
schemas: | ||
DIDDocument: | ||
$ref: '../common/ssi_types.yaml#/components/schemas/DIDDocument' | ||
DIDDocumentMetadata: | ||
$ref: '../common/ssi_types.yaml#/components/schemas/DIDDocumentMetadata' | ||
VerificationMethod: | ||
$ref: '../common/ssi_types.yaml#/components/schemas/VerificationMethod' | ||
Service: | ||
$ref: '../common/ssi_types.yaml#/components/schemas/Service' | ||
DIDResolutionResult: | ||
required: | ||
- document | ||
- documentMetadata | ||
properties: | ||
document: | ||
$ref: '#/components/schemas/DIDDocument' | ||
documentMetadata: | ||
$ref: '#/components/schemas/DIDDocumentMetadata' | ||
securitySchemes: | ||
jwtBearerAuth: | ||
type: http | ||
scheme: bearer | ||
|
||
security: | ||
- {} | ||
- jwtBearerAuth: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Nuts node | ||
* Copyright (C) 2021 Nuts community | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
package v2 | ||
|
||
import ( | ||
"context" | ||
"github.com/nuts-foundation/nuts-node/core" | ||
"github.com/nuts-foundation/nuts-node/vdr" | ||
) | ||
|
||
var _ StrictServerInterface = (*Wrapper)(nil) | ||
var _ core.ErrorStatusCodeResolver = (*Wrapper)(nil) | ||
|
||
// Wrapper is needed to connect the implementation to the echo ServiceWrapper | ||
type Wrapper struct { | ||
VDR vdr.VDR | ||
} | ||
|
||
func (w Wrapper) ResolveStatusCode(err error) int { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (w Wrapper) CreateDID(ctx context.Context, request CreateDIDRequestObject) (CreateDIDResponseObject, error) { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (w Wrapper) DeleteDID(ctx context.Context, request DeleteDIDRequestObject) (DeleteDIDResponseObject, error) { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (w Wrapper) ResolveDID(ctx context.Context, request ResolveDIDRequestObject) (ResolveDIDResponseObject, error) { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (w Wrapper) AddService(ctx context.Context, request AddServiceRequestObject) (AddServiceResponseObject, error) { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (w Wrapper) DeleteService(ctx context.Context, request DeleteServiceRequestObject) (DeleteServiceResponseObject, error) { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (w Wrapper) UpdateService(ctx context.Context, request UpdateServiceRequestObject) (UpdateServiceResponseObject, error) { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (w Wrapper) AddVerificationMethod(ctx context.Context, request AddVerificationMethodRequestObject) (AddVerificationMethodResponseObject, error) { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (w Wrapper) DeleteVerificationMethod(ctx context.Context, request DeleteVerificationMethodRequestObject) (DeleteVerificationMethodResponseObject, error) { | ||
//TODO implement me | ||
panic("implement me") | ||
} |
Oops, something went wrong.