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

Update web app to work on Nuts v6 APIs #103

Merged
merged 2 commits into from
Sep 5, 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
14 changes: 8 additions & 6 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ func (w Wrapper) CreateIdentity(ctx echo.Context) error {
if err := ctx.Bind(&identityRequest); err != nil {
return err
}
id, err := w.Identity.Create(ctx.Request().Context(), identityRequest.DidQualifier)
result, err := w.Identity.Create(ctx.Request().Context(), identityRequest.Subject)
if err != nil {
return err
}
return ctx.JSON(http.StatusOK, id)
return ctx.JSON(http.StatusOK, result)
}

func (w Wrapper) GetIdentity(ctx echo.Context, did string) error {
Expand All @@ -54,11 +54,13 @@ func (w Wrapper) GetIssuedCredentials(ctx echo.Context, params GetIssuedCredenti
}
result := make([]vc.VerifiableCredential, 0)
for _, currID := range identities {
credentials, err := w.IssuerService.GetIssuedCredentials(ctx.Request().Context(), currID.DID, strings.Split(params.CredentialTypes, ","))
if err != nil {
return err
for _, issuerDID := range currID.DIDs {
credentials, err := w.IssuerService.GetIssuedCredentials(ctx.Request().Context(), issuerDID, strings.Split(params.CredentialTypes, ","))
if err != nil {
return err
}
result = append(result, credentials...)
}
result = append(result, credentials...)
}
return ctx.JSON(http.StatusOK, result)
}
19 changes: 9 additions & 10 deletions api/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ paths:
application/json:
schema:
type: object
required:
- did_qualifier
properties:
did_qualifier:
subject:
type: string
responses:
'200':
Expand Down Expand Up @@ -113,16 +111,17 @@ components:
description: An identity object
required:
- did
- name
- subject
properties:
did:
type: string
description: The DID associated with this identity
type: array
items:
type: string
example:
"did:web:example.com:iam:user1"
name:
[did:web:example.com:iam:user1, did:tdw:1234]
subject:
type: string
description: |
The name of this identity, which is the last path part of a did:web DID.
If the DID does not contain paths, or it is not a did:web DID, it will be the same as the DID.
example: "user1"
Identifier the Nuts node uses to refer to this identity.
example: "hospital_x"
11 changes: 5 additions & 6 deletions api/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions api/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ var allowedProxyRoutes = []proxyRoute{
method: http.MethodDelete,
path: "/internal/discovery/v1/([a-z-A-Z0-9_\\-\\:\\.%]+)/([a-z-A-Z0-0_\\-\\:\\.%]+)",
},
// List owned DIDs
{
method: http.MethodGet,
path: "/internal/vdr/v2/did",
},
// Issue Verifiable Credentials
{
method: http.MethodPost,
Expand Down
15 changes: 0 additions & 15 deletions deploy/node.config.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions discovery/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "github.com/nuts-foundation/go-did/vc"

// DIDStatus represents the status of a DID in the discovery service
type DIDStatus struct {
ServiceID string `json:"id"`
Active bool `json:"active"`
Presentation *vc.VerifiablePresentation `json:"vp"`
ServiceID string `json:"id"`
Active bool `json:"active"`
Presentations []vc.VerifiablePresentation `json:"vps"`
}
Loading
Loading