From b832e86e0e264753ace5307596d4ce456f4d2c4c Mon Sep 17 00:00:00 2001 From: Rein Krul Date: Tue, 3 Sep 2024 14:12:01 +0200 Subject: [PATCH 1/2] Update web app to work on Nuts v6 APIs --- api/api.go | 14 +- api/api.yaml | 19 +- api/generated.go | 11 +- discovery/nuts_discovery_client.gen.go | 22 +- identity/model.go | 6 +- identity/service.go | 118 ++-- issuer/service.go | 5 +- nuts/generated.go | 64 ++- nuts/vcr/client.gen.go | 17 +- nuts/vdr/client.gen.go | 756 +++++++++++++++++-------- web/src/admin/Identities.vue | 8 +- web/src/admin/IdentityDetails.vue | 37 +- web/src/admin/IdentityForm.vue | 10 +- web/src/admin/NewIdentity.vue | 6 +- web/src/index.js | 2 +- 15 files changed, 711 insertions(+), 384 deletions(-) diff --git a/api/api.go b/api/api.go index ab59913..e86d720 100644 --- a/api/api.go +++ b/api/api.go @@ -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 { @@ -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) } diff --git a/api/api.yaml b/api/api.yaml index 45bceaa..0018ea6 100644 --- a/api/api.yaml +++ b/api/api.yaml @@ -24,10 +24,8 @@ paths: application/json: schema: type: object - required: - - did_qualifier properties: - did_qualifier: + subject: type: string responses: '200': @@ -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" diff --git a/api/generated.go b/api/generated.go index a7a96e8..8cd9c31 100644 --- a/api/generated.go +++ b/api/generated.go @@ -1,6 +1,6 @@ // Package api provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT. +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 DO NOT EDIT. package api import ( @@ -14,11 +14,10 @@ import ( // Identity An identity object type Identity struct { // Did The DID associated with this identity - Did string `json:"did"` + Did []string `json:"did"` - // Name 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. - Name string `json:"name"` + // Subject Identifier the Nuts node uses to refer to this identity. + Subject string `json:"subject"` } // IdentityDetails An identity object with additional details @@ -35,7 +34,7 @@ type IdentityDetails struct { // CreateIdentityJSONBody defines parameters for CreateIdentity. type CreateIdentityJSONBody struct { - DidQualifier string `json:"did_qualifier"` + Subject *string `json:"subject,omitempty"` } // GetIssuedCredentialsParams defines parameters for GetIssuedCredentials. diff --git a/discovery/nuts_discovery_client.gen.go b/discovery/nuts_discovery_client.gen.go index 946ed3f..b48d560 100644 --- a/discovery/nuts_discovery_client.gen.go +++ b/discovery/nuts_discovery_client.gen.go @@ -1,6 +1,6 @@ // Package discovery provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT. +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 DO NOT EDIT. package discovery import ( @@ -29,10 +29,8 @@ type SearchResult struct { Id string `json:"id"` // SubjectId The ID of the Verifiable Credential subject (holder), typically a DID. - SubjectId string `json:"subject_id"` - - // Vp Verifiable Presentation - Vp VerifiablePresentation `json:"vp"` + SubjectId string `json:"subject_id"` + Vp VerifiablePresentation `json:"vp"` } // ServiceDefinition defines model for ServiceDefinition. @@ -50,7 +48,7 @@ type ServiceDefinition struct { PresentationMaxValidity int `json:"presentation_max_validity"` } -// VerifiablePresentation Verifiable Presentation +// VerifiablePresentation defines model for VerifiablePresentation. type VerifiablePresentation = externalRef0.VerifiablePresentation // SearchPresentationsParams defines parameters for SearchPresentations. @@ -577,10 +575,8 @@ type GetServiceActivationResponse struct { HTTPResponse *http.Response JSON200 *struct { // Activated Whether the DID is activated on the Discovery Service. - Activated bool `json:"activated"` - - // Vp Verifiable Presentation - Vp *VerifiablePresentation `json:"vp,omitempty"` + Activated bool `json:"activated"` + Vp *VerifiablePresentation `json:"vp,omitempty"` } ApplicationproblemJSONDefault *struct { // Detail A human-readable explanation specific to this occurrence of the problem. @@ -862,10 +858,8 @@ func ParseGetServiceActivationResponse(rsp *http.Response) (*GetServiceActivatio case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest struct { // Activated Whether the DID is activated on the Discovery Service. - Activated bool `json:"activated"` - - // Vp Verifiable Presentation - Vp *VerifiablePresentation `json:"vp,omitempty"` + Activated bool `json:"activated"` + Vp *VerifiablePresentation `json:"vp,omitempty"` } if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err diff --git a/identity/model.go b/identity/model.go index 273fe85..aa8ca75 100644 --- a/identity/model.go +++ b/identity/model.go @@ -7,13 +7,13 @@ import ( ) type Identity struct { - Name string `json:"name"` - DID did.DID `json:"did"` + Subject string `json:"subject"` + DIDs []string `json:"dids"` } type IdentityDetails struct { Identity - DIDDocument did.Document `json:"did_document"` + DIDDocuments []did.Document `json:"did_documents"` DiscoveryServices []discovery.DIDStatus `json:"discovery_services"` WalletCredentials []vc.VerifiableCredential `json:"wallet_credentials"` } diff --git a/identity/service.go b/identity/service.go index b83d6d7..dbba570 100644 --- a/identity/service.go +++ b/identity/service.go @@ -3,7 +3,6 @@ package identity import ( "context" "errors" - "github.com/nuts-foundation/go-did/did" "github.com/nuts-foundation/go-did/vc" "github.com/nuts-foundation/nuts-admin/discovery" "github.com/nuts-foundation/nuts-admin/nuts" @@ -19,9 +18,12 @@ type Service struct { DiscoveryService discovery.Service } -func (i Service) Create(ctx context.Context, shortName string) (*Identity, error) { +func (i Service) Create(ctx context.Context, subject *string) (*Identity, error) { + if subject != nil && *subject == "" { + subject = nil + } httpResponse, err := i.VDRClient.CreateDID(ctx, vdr.CreateDIDJSONRequestBody{ - Tenant: &shortName, + Subject: subject, }) if err != nil { return nil, nuts.UnwrapAPIError(err) @@ -31,45 +33,68 @@ func (i Service) Create(ctx context.Context, shortName string) (*Identity, error return nil, err } if response.JSON200 == nil { - return nil, errors.New("unable to create new DID") + return nil, errors.New("unable to create new subject") + } + result := Identity{Subject: response.JSON200.Subject} + for _, didDocument := range response.JSON200.Documents { + result.DIDs = append(result.DIDs, didDocument.ID.String()) } - result := parseIdentity(response.JSON200.ID) return &result, nil } func (i Service) List(ctx context.Context) ([]Identity, error) { - httpResponse, err := i.VDRClient.ListDIDs(ctx) - if err != nil { - return nil, nuts.UnwrapAPIError(err) - } - response, err := vdr.ParseListDIDsResponse(httpResponse) - if err != nil { - return nil, err - } - if response.JSON200 == nil { - return nil, errors.New("unable to list DIDs") - } + //httpResponse, err := i.VDRClient.ListDIDs(ctx) + //if err != nil { + // return nil, nuts.UnwrapAPIError(err) + //} + //response, err := vdr.ParseListDIDsResponse(httpResponse) + //if err != nil { + // return nil, err + //} + //if response.JSON200 == nil { + // return nil, errors.New("unable to list DIDs") + //} + //identities := make([]Identity, 0) + //for _, did := range response.JSON200 { + // identities = append(identities, Identity{ + // Subject: did, + // DIDs: []string{did}, + // }) + //} + // TODO: Implement, waiting for https://github.com/nuts-foundation/nuts-node/pull/3336 identities := make([]Identity, 0) - for _, didStr := range *response.JSON200 { - curr, err := did.ParseDID(didStr) - if err != nil { - return nil, err - } - identities = append(identities, parseIdentity(*curr)) - } + identities = append(identities, Identity{ + Subject: "sub1", + }, Identity{ + Subject: "sub2", + }) return identities, nil } func (i Service) Get(ctx context.Context, subjectID string) (*IdentityDetails, error) { // Make sure it exists - didDocument, err := i.resolveDID(ctx, subjectID) + identity, err := i.getSubject(ctx, subjectID) if err != nil { return nil, err } + result := IdentityDetails{ - Identity: parseIdentity(didDocument.ID), - DIDDocument: *didDocument, + Identity: *identity, DiscoveryServices: make([]discovery.DIDStatus, 0), + WalletCredentials: make([]vc.VerifiableCredential, 0), + } + + // Get DIDDocuments + for _, currentDID := range identity.DIDs { + resp, err := i.VDRClient.ResolveDID(ctx, currentDID) + if err != nil { + return nil, err + } + didResponse, err := vdr.ParseResolveDIDResponse(resp) + if err != nil { + return nil, err + } + result.DIDDocuments = append(result.DIDDocuments, didResponse.JSON200.Document) } // Get DiscoveryService status @@ -90,34 +115,37 @@ func (i Service) Get(ctx context.Context, subjectID string) (*IdentityDetails, e }) // Get WalletCredentials - credentials, err := i.credentialsInWallet(ctx, didDocument.ID) - if err != nil { - return nil, err - } - if credentials == nil { - credentials = make([]vc.VerifiableCredential, 0) + for _, currentDID := range identity.DIDs { + credentials, err := i.credentialsInWallet(ctx, currentDID) + if err != nil { + return nil, err + } + result.WalletCredentials = append(result.WalletCredentials, credentials...) } - result.WalletCredentials = credentials + return &result, nil } -func (i Service) resolveDID(ctx context.Context, did string) (*did.Document, error) { - httpResponse, err := i.VDRClient.ResolveDID(ctx, did) +func (i Service) getSubject(ctx context.Context, subject string) (*Identity, error) { + httpResponse, err := i.VDRClient.SubjectDIDs(ctx, subject) if err != nil { return nil, nuts.UnwrapAPIError(err) } - response, err := vdr.ParseResolveDIDResponse(httpResponse) + response, err := vdr.ParseSubjectDIDsResponse(httpResponse) if err != nil { return nil, err } if response.JSON200 == nil { return nil, errors.New("unable to resolve DID") } - return &response.JSON200.Document, nil + return &Identity{ + Subject: subject, + DIDs: *response.JSON200, + }, nil } -func (i Service) credentialsInWallet(ctx context.Context, id did.DID) ([]vc.VerifiableCredential, error) { - httpResponse, err := i.VCRClient.GetCredentialsInWallet(ctx, id.String()) +func (i Service) credentialsInWallet(ctx context.Context, id string) ([]vc.VerifiableCredential, error) { + httpResponse, err := i.VCRClient.GetCredentialsInWallet(ctx, id) if err != nil { return nil, nuts.UnwrapAPIError(err) } @@ -130,15 +158,3 @@ func (i Service) credentialsInWallet(ctx context.Context, id did.DID) ([]vc.Veri } return *response.JSON200, nil } - -func parseIdentity(id did.DID) Identity { - result := Identity{ - DID: id, - } - if strings.Contains(id.ID, ":") { - result.Name = id.ID[strings.LastIndex(id.ID, ":")+1:] - } else { - result.Name = id.String() - } - return result -} diff --git a/issuer/service.go b/issuer/service.go index a092b0f..87cd09b 100644 --- a/issuer/service.go +++ b/issuer/service.go @@ -2,7 +2,6 @@ package issuer import ( "context" - "github.com/nuts-foundation/go-did/did" "github.com/nuts-foundation/go-did/vc" "github.com/nuts-foundation/nuts-admin/identity" "github.com/nuts-foundation/nuts-admin/nuts/vcr" @@ -14,7 +13,7 @@ type Service struct { VCRClient *vcr.Client } -func (s Service) GetIssuedCredentials(ctx context.Context, issuer did.DID, credentialTypes []string) ([]vc.VerifiableCredential, error) { +func (s Service) GetIssuedCredentials(ctx context.Context, issuer string, credentialTypes []string) ([]vc.VerifiableCredential, error) { var result []vc.VerifiableCredential for _, credentialType := range credentialTypes { credentialType = strings.TrimSpace(credentialType) @@ -23,7 +22,7 @@ func (s Service) GetIssuedCredentials(ctx context.Context, issuer did.DID, crede } searchHTTPResponse, err := s.VCRClient.SearchIssuedVCs(ctx, &vcr.SearchIssuedVCsParams{ CredentialType: credentialType, - Issuer: issuer.String(), + Issuer: issuer, }) if err != nil { return nil, err diff --git a/nuts/generated.go b/nuts/generated.go index ee5294b..9618eac 100644 --- a/nuts/generated.go +++ b/nuts/generated.go @@ -1,6 +1,6 @@ // Package nuts provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT. +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 DO NOT EDIT. package nuts // CredentialStatus Object enabling the discovery of information related to the status of a verifiable credential, such as whether it is suspended or revoked. @@ -69,6 +69,68 @@ type EmbeddedProof struct { VerificationMethod string `json:"verificationMethod"` } +// JSONVerifiableCredential Verifiable Credential in JSON-LD format. +type JSONVerifiableCredential struct { + // Context List of URIs of JSON-LD contexts of the VC. + Context interface{} `json:"@context"` + + // CredentialStatus Object enabling the discovery of information related to the status of a verifiable credential, such as whether it is suspended or revoked. + // Interpretation of the credentialStatus is defined by its 'type' property. + CredentialStatus *CredentialStatus `json:"credentialStatus,omitempty"` + + // CredentialSubject Subject of a Verifiable Credential identifying the holder and expressing claims. + CredentialSubject CredentialSubject `json:"credentialSubject"` + + // ExpirationDate rfc3339 time string until when the credential is valid. + ExpirationDate *string `json:"expirationDate,omitempty"` + + // Id Credential ID. An URI which uniquely identifies the credential e.g. the issuers DID concatenated with a UUID. + Id *string `json:"id,omitempty"` + + // IssuanceDate rfc3339 time string when the credential was issued. + IssuanceDate string `json:"issuanceDate"` + + // Issuer DID according to Nuts specification + Issuer DID `json:"issuer"` + + // Proof one or multiple cryptographic proofs + Proof interface{} `json:"proof"` + + // Type A single string or array of strings. The value(s) indicate the type of credential. It should contain `VerifiableCredential`. Each type should be defined in the @context. + Type []string `json:"type"` +} + +// JSONVerifiablePresentation Verifiable Presentation in JSON-LD format. +type JSONVerifiablePresentation struct { + // Context An ordered set where the first item is a URI https://www.w3.org/2018/credentials/v1. It is used to define + // terms and help to express specific identifiers in a compact manner. + Context interface{} `json:"@context"` + + // Holder URI of the entity that is generating the presentation. + Holder *string `json:"holder,omitempty"` + + // Id URI that is used to unambiguously refer to an object, such as a person, product, or organization. + Id *string `json:"id,omitempty"` + + // Proof Cryptographic proofs that can be used to detect tampering and verify the authorship of a + // credential or presentation. An embedded proof is a mechanism where the proof is included in + // the data, such as a Linked Data Signature. + Proof *interface{} `json:"proof,omitempty"` + + // Type A single string or array of strings. Values indicate the type of object. It should contain `VerifiablePresentation`. Each type must be defined in the @context. + Type interface{} `json:"type"` + + // VerifiableCredential VerifiableCredential is composed of a list containing one or more verifiable credentials, in a + // cryptographically verifiable format. + VerifiableCredential *interface{} `json:"verifiableCredential,omitempty"` +} + +// JWTCompactVerifiableCredential Verifiable Credential in JWT compact serialization format. +type JWTCompactVerifiableCredential = string + +// JWTCompactVerifiablePresentation Verifiable Presentation in JWT compact serialization format. +type JWTCompactVerifiablePresentation = string + // Revocation Credential revocation record type Revocation struct { // Date date is a rfc3339 formatted datetime. diff --git a/nuts/vcr/client.gen.go b/nuts/vcr/client.gen.go index 77ae6fe..96ffdf7 100644 --- a/nuts/vcr/client.gen.go +++ b/nuts/vcr/client.gen.go @@ -1,6 +1,6 @@ // Package vcr provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT. +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 DO NOT EDIT. package vcr import ( @@ -104,6 +104,7 @@ type CredentialSubject = externalRef0.CredentialSubject // IssueVCRequest A request for issuing a new Verifiable Credential. type IssueVCRequest struct { // Context The resolvable context of the credentialSubject as URI. If omitted, the "https://nuts.nl/credentials/v1" context is used. + // It always adds the "https://www.w3.org/2018/credentials/v1" context if not present. Context *IssueVCRequest_Context `json:"@context,omitempty"` // CredentialSubject Subject of a Verifiable Credential identifying the holder and expressing claims. @@ -150,6 +151,7 @@ type IssueVCRequestContext0 = string type IssueVCRequestContext1 = []string // IssueVCRequest_Context The resolvable context of the credentialSubject as URI. If omitted, the "https://nuts.nl/credentials/v1" context is used. +// It always adds the "https://www.w3.org/2018/credentials/v1" context if not present. type IssueVCRequest_Context struct { union json.RawMessage } @@ -194,9 +196,7 @@ type SearchVCRequest struct { // The absence of a the revocation property does not indicate a valid credential, use the /internal/vcr/v2/verifier/vc API for this. type SearchVCResult struct { // Revocation Credential revocation record - Revocation *Revocation `json:"revocation,omitempty"` - - // VerifiableCredential A credential according to the W3C and Nuts specs. + Revocation *Revocation `json:"revocation,omitempty"` VerifiableCredential VerifiableCredential `json:"verifiableCredential"` } @@ -214,7 +214,6 @@ type VCVerificationOptions struct { // VCVerificationRequest defines model for VCVerificationRequest. type VCVerificationRequest struct { - // VerifiableCredential A credential according to the W3C and Nuts specs. VerifiableCredential VerifiableCredential `json:"verifiableCredential"` VerificationOptions *VCVerificationOptions `json:"verificationOptions,omitempty"` } @@ -231,9 +230,7 @@ type VCVerificationResult struct { // VPVerificationRequest defines model for VPVerificationRequest. type VPVerificationRequest struct { // ValidAt Date and time at which the VP should be valid. If not supplied, the current date/time is used. - ValidAt *string `json:"validAt,omitempty"` - - // VerifiablePresentation Verifiable Presentation + ValidAt *string `json:"validAt,omitempty"` VerifiablePresentation VerifiablePresentation `json:"verifiablePresentation"` // VerifyCredentials Indicates whether the Verifiable Credentials within the VP must be verified, default true. @@ -252,10 +249,10 @@ type VPVerificationResult struct { Validity bool `json:"validity"` } -// VerifiableCredential A credential according to the W3C and Nuts specs. +// VerifiableCredential defines model for VerifiableCredential. type VerifiableCredential = externalRef0.VerifiableCredential -// VerifiablePresentation Verifiable Presentation +// VerifiablePresentation defines model for VerifiablePresentation. type VerifiablePresentation = externalRef0.VerifiablePresentation // SearchIssuedVCsParams defines parameters for SearchIssuedVCs. diff --git a/nuts/vdr/client.gen.go b/nuts/vdr/client.gen.go index fe08449..7b20f6d 100644 --- a/nuts/vdr/client.gen.go +++ b/nuts/vdr/client.gen.go @@ -1,6 +1,6 @@ // Package vdr provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT. +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 DO NOT EDIT. package vdr import ( @@ -21,25 +21,20 @@ const ( JwtBearerAuthScopes = "jwtBearerAuth.Scopes" ) -// Defines values for FilterServicesParamsEndpointType. +// Defines values for FindServicesParamsEndpointType. const ( - Array FilterServicesParamsEndpointType = "array" - Object FilterServicesParamsEndpointType = "object" - String FilterServicesParamsEndpointType = "string" + Array FindServicesParamsEndpointType = "array" + Object FindServicesParamsEndpointType = "object" + String FindServicesParamsEndpointType = "string" ) -// CreateDIDOptions Options for the DID creation. If neither `did` nor `tenant` is given, a random UUID is used as tenant. -// It's invalid to provide both `did` and `tenant` at the same time. +// CreateDIDOptions Options for the DID creation. type CreateDIDOptions struct { - // Did The DID of the DID document. If it's a did:web DID and it contains a path, it must follow the format `did:web:example.com:iam:1234`. - // It can be used, for instance, to create a root did:web DID (one without path). - // - // The DID to create must conform to the node's configured URL (e.g., `did:web:example.com` for `https://example.com`). - Did *string `json:"did,omitempty"` + // Keys Options for the key creation. + Keys *KeyCreationOptions `json:"keys,omitempty"` - // Tenant The tenant of the DID document. If this option is given, the did:web DID will contain a path that ends with the given tenant ID. - // It can be used, for instance, to serve multiple did:web DIDs from the same node. - Tenant *string `json:"tenant,omitempty"` + // Subject controls the DID subject to which all created DIDs are bound. If not given, a uuid is generated and returned. + Subject *string `json:"subject,omitempty"` } // DIDDocument A DID document according to the W3C spec following the Nuts Method rules as defined in [Nuts RFC006] @@ -57,14 +52,31 @@ type DIDResolutionResult struct { DocumentMetadata DIDDocumentMetadata `json:"documentMetadata"` } +// KeyCreationOptions Options for the key creation. +type KeyCreationOptions struct { + // AssertionKey If true, an EC keypair is generated and added to the DID Document as a assertion, authentication, capability invocation and capability delegation method. + AssertionKey bool `json:"assertionKey"` + + // EncryptionKey If true, an RSA keypair is generated and added to the DID Document as a key agreement method. + EncryptionKey bool `json:"encryptionKey"` +} + // Service A service supported by a DID subject. type Service = externalRef0.Service +// SubjectCreationResult Result of a DID creation request. Contains the subject and any created DID Documents. +type SubjectCreationResult struct { + Documents []DIDDocument `json:"documents"` + + // Subject The subject of the created DID Documents. + Subject string `json:"subject"` +} + // VerificationMethod A public key in JWK form. type VerificationMethod = externalRef0.VerificationMethod -// FilterServicesParams defines parameters for FilterServices. -type FilterServicesParams struct { +// FindServicesParams defines parameters for FindServices. +type FindServicesParams struct { // Type Type of the service to filter for. If specified, only services with the given service type are returned. Type *string `form:"type,omitempty" json:"type,omitempty"` @@ -76,11 +88,11 @@ type FilterServicesParams struct { // - object: serviceEndpoint contains a JSON object (key-value map) // // If not specified, services are not filtered on their endpoint data type. - EndpointType *FilterServicesParamsEndpointType `form:"endpointType,omitempty" json:"endpointType,omitempty"` + EndpointType *FindServicesParamsEndpointType `form:"endpointType,omitempty" json:"endpointType,omitempty"` } -// FilterServicesParamsEndpointType defines parameters for FilterServices. -type FilterServicesParamsEndpointType string +// FindServicesParamsEndpointType defines parameters for FindServices. +type FindServicesParamsEndpointType string // CreateDIDJSONRequestBody defines body for CreateDID for application/json ContentType. type CreateDIDJSONRequestBody = CreateDIDOptions @@ -91,6 +103,9 @@ type CreateServiceJSONRequestBody = Service // UpdateServiceJSONRequestBody defines body for UpdateService for application/json ContentType. type UpdateServiceJSONRequestBody = Service +// AddVerificationMethodJSONRequestBody defines body for AddVerificationMethod for application/json ContentType. +type AddVerificationMethodJSONRequestBody = KeyCreationOptions + // RequestEditorFn is the function signature for the RequestEditor callback function type RequestEditorFn func(ctx context.Context, req *http.Request) error @@ -164,41 +179,73 @@ func WithRequestEditorFn(fn RequestEditorFn) ClientOption { // The interface specification for the client above. type ClientInterface interface { + // GetRootWebDID request + GetRootWebDID(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetTenantWebDID request + GetTenantWebDID(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) + // ListDIDs request ListDIDs(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) + // ResolveDID request + ResolveDID(ctx context.Context, did string, reqEditors ...RequestEditorFn) (*http.Response, error) + // CreateDIDWithBody request with any body CreateDIDWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) CreateDID(ctx context.Context, body CreateDIDJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // DeleteDID request - DeleteDID(ctx context.Context, did string, reqEditors ...RequestEditorFn) (*http.Response, error) + // Deactivate request + Deactivate(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - // ResolveDID request - ResolveDID(ctx context.Context, did string, reqEditors ...RequestEditorFn) (*http.Response, error) + // SubjectDIDs request + SubjectDIDs(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - // FilterServices request - FilterServices(ctx context.Context, did string, params *FilterServicesParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // FindServices request + FindServices(ctx context.Context, id string, params *FindServicesParams, reqEditors ...RequestEditorFn) (*http.Response, error) // CreateServiceWithBody request with any body - CreateServiceWithBody(ctx context.Context, did string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + CreateServiceWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - CreateService(ctx context.Context, did string, body CreateServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + CreateService(ctx context.Context, id string, body CreateServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // DeleteService request - DeleteService(ctx context.Context, did string, serviceId string, reqEditors ...RequestEditorFn) (*http.Response, error) + DeleteService(ctx context.Context, id string, serviceId string, reqEditors ...RequestEditorFn) (*http.Response, error) // UpdateServiceWithBody request with any body - UpdateServiceWithBody(ctx context.Context, did string, serviceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + UpdateServiceWithBody(ctx context.Context, id string, serviceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - UpdateService(ctx context.Context, did string, serviceId string, body UpdateServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + UpdateService(ctx context.Context, id string, serviceId string, body UpdateServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // AddVerificationMethod request - AddVerificationMethod(ctx context.Context, did string, reqEditors ...RequestEditorFn) (*http.Response, error) + // AddVerificationMethodWithBody request with any body + AddVerificationMethodWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + AddVerificationMethod(ctx context.Context, id string, body AddVerificationMethodJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) +} + +func (c *Client) GetRootWebDID(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetRootWebDIDRequest(c.Server) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} - // DeleteVerificationMethod request - DeleteVerificationMethod(ctx context.Context, did string, id string, reqEditors ...RequestEditorFn) (*http.Response, error) +func (c *Client) GetTenantWebDID(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetTenantWebDIDRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) } func (c *Client) ListDIDs(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { @@ -213,6 +260,18 @@ func (c *Client) ListDIDs(ctx context.Context, reqEditors ...RequestEditorFn) (* return c.Client.Do(req) } +func (c *Client) ResolveDID(ctx context.Context, did string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewResolveDIDRequest(c.Server, did) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) CreateDIDWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewCreateDIDRequestWithBody(c.Server, contentType, body) if err != nil { @@ -237,8 +296,8 @@ func (c *Client) CreateDID(ctx context.Context, body CreateDIDJSONRequestBody, r return c.Client.Do(req) } -func (c *Client) DeleteDID(ctx context.Context, did string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDIDRequest(c.Server, did) +func (c *Client) Deactivate(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeactivateRequest(c.Server, id) if err != nil { return nil, err } @@ -249,8 +308,8 @@ func (c *Client) DeleteDID(ctx context.Context, did string, reqEditors ...Reques return c.Client.Do(req) } -func (c *Client) ResolveDID(ctx context.Context, did string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResolveDIDRequest(c.Server, did) +func (c *Client) SubjectDIDs(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewSubjectDIDsRequest(c.Server, id) if err != nil { return nil, err } @@ -261,8 +320,8 @@ func (c *Client) ResolveDID(ctx context.Context, did string, reqEditors ...Reque return c.Client.Do(req) } -func (c *Client) FilterServices(ctx context.Context, did string, params *FilterServicesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewFilterServicesRequest(c.Server, did, params) +func (c *Client) FindServices(ctx context.Context, id string, params *FindServicesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewFindServicesRequest(c.Server, id, params) if err != nil { return nil, err } @@ -273,8 +332,8 @@ func (c *Client) FilterServices(ctx context.Context, did string, params *FilterS return c.Client.Do(req) } -func (c *Client) CreateServiceWithBody(ctx context.Context, did string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateServiceRequestWithBody(c.Server, did, contentType, body) +func (c *Client) CreateServiceWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateServiceRequestWithBody(c.Server, id, contentType, body) if err != nil { return nil, err } @@ -285,8 +344,8 @@ func (c *Client) CreateServiceWithBody(ctx context.Context, did string, contentT return c.Client.Do(req) } -func (c *Client) CreateService(ctx context.Context, did string, body CreateServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateServiceRequest(c.Server, did, body) +func (c *Client) CreateService(ctx context.Context, id string, body CreateServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateServiceRequest(c.Server, id, body) if err != nil { return nil, err } @@ -297,8 +356,8 @@ func (c *Client) CreateService(ctx context.Context, did string, body CreateServi return c.Client.Do(req) } -func (c *Client) DeleteService(ctx context.Context, did string, serviceId string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteServiceRequest(c.Server, did, serviceId) +func (c *Client) DeleteService(ctx context.Context, id string, serviceId string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeleteServiceRequest(c.Server, id, serviceId) if err != nil { return nil, err } @@ -309,8 +368,8 @@ func (c *Client) DeleteService(ctx context.Context, did string, serviceId string return c.Client.Do(req) } -func (c *Client) UpdateServiceWithBody(ctx context.Context, did string, serviceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateServiceRequestWithBody(c.Server, did, serviceId, contentType, body) +func (c *Client) UpdateServiceWithBody(ctx context.Context, id string, serviceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateServiceRequestWithBody(c.Server, id, serviceId, contentType, body) if err != nil { return nil, err } @@ -321,8 +380,8 @@ func (c *Client) UpdateServiceWithBody(ctx context.Context, did string, serviceI return c.Client.Do(req) } -func (c *Client) UpdateService(ctx context.Context, did string, serviceId string, body UpdateServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateServiceRequest(c.Server, did, serviceId, body) +func (c *Client) UpdateService(ctx context.Context, id string, serviceId string, body UpdateServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateServiceRequest(c.Server, id, serviceId, body) if err != nil { return nil, err } @@ -333,8 +392,8 @@ func (c *Client) UpdateService(ctx context.Context, did string, serviceId string return c.Client.Do(req) } -func (c *Client) AddVerificationMethod(ctx context.Context, did string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAddVerificationMethodRequest(c.Server, did) +func (c *Client) AddVerificationMethodWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewAddVerificationMethodRequestWithBody(c.Server, id, contentType, body) if err != nil { return nil, err } @@ -345,8 +404,8 @@ func (c *Client) AddVerificationMethod(ctx context.Context, did string, reqEdito return c.Client.Do(req) } -func (c *Client) DeleteVerificationMethod(ctx context.Context, did string, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteVerificationMethodRequest(c.Server, did, id) +func (c *Client) AddVerificationMethod(ctx context.Context, id string, body AddVerificationMethodJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewAddVerificationMethodRequest(c.Server, id, body) if err != nil { return nil, err } @@ -357,6 +416,67 @@ func (c *Client) DeleteVerificationMethod(ctx context.Context, did string, id st return c.Client.Do(req) } +// NewGetRootWebDIDRequest generates requests for GetRootWebDID +func NewGetRootWebDIDRequest(server string) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/.well-known/did.json") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetTenantWebDIDRequest generates requests for GetTenantWebDID +func NewGetTenantWebDIDRequest(server string, id string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/iam/%s/did.json", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + // NewListDIDsRequest generates requests for ListDIDs func NewListDIDsRequest(server string) (*http.Request, error) { var err error @@ -384,6 +504,37 @@ func NewListDIDsRequest(server string) (*http.Request, error) { return req, nil } +// NewResolveDIDRequest generates requests for ResolveDID +func NewResolveDIDRequest(server string, did string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0 = did + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/internal/vdr/v2/did/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + // NewCreateDIDRequest calls the generic CreateDID builder with application/json body func NewCreateDIDRequest(server string, body CreateDIDJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader @@ -404,7 +555,7 @@ func NewCreateDIDRequestWithBody(server string, contentType string, body io.Read return nil, err } - operationPath := fmt.Sprintf("/internal/vdr/v2/did") + operationPath := fmt.Sprintf("/internal/vdr/v2/subject") if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -424,20 +575,20 @@ func NewCreateDIDRequestWithBody(server string, contentType string, body io.Read return req, nil } -// NewDeleteDIDRequest generates requests for DeleteDID -func NewDeleteDIDRequest(server string, did string) (*http.Request, error) { +// NewDeactivateRequest generates requests for Deactivate +func NewDeactivateRequest(server string, id string) (*http.Request, error) { var err error var pathParam0 string - pathParam0 = did + pathParam0 = id serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/internal/vdr/v2/did/%s", pathParam0) + operationPath := fmt.Sprintf("/internal/vdr/v2/subject/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -455,20 +606,20 @@ func NewDeleteDIDRequest(server string, did string) (*http.Request, error) { return req, nil } -// NewResolveDIDRequest generates requests for ResolveDID -func NewResolveDIDRequest(server string, did string) (*http.Request, error) { +// NewSubjectDIDsRequest generates requests for SubjectDIDs +func NewSubjectDIDsRequest(server string, id string) (*http.Request, error) { var err error var pathParam0 string - pathParam0 = did + pathParam0 = id serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/internal/vdr/v2/did/%s", pathParam0) + operationPath := fmt.Sprintf("/internal/vdr/v2/subject/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -486,20 +637,20 @@ func NewResolveDIDRequest(server string, did string) (*http.Request, error) { return req, nil } -// NewFilterServicesRequest generates requests for FilterServices -func NewFilterServicesRequest(server string, did string, params *FilterServicesParams) (*http.Request, error) { +// NewFindServicesRequest generates requests for FindServices +func NewFindServicesRequest(server string, id string, params *FindServicesParams) (*http.Request, error) { var err error var pathParam0 string - pathParam0 = did + pathParam0 = id serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/internal/vdr/v2/did/%s/service", pathParam0) + operationPath := fmt.Sprintf("/internal/vdr/v2/subject/%s/service", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -556,30 +707,30 @@ func NewFilterServicesRequest(server string, did string, params *FilterServicesP } // NewCreateServiceRequest calls the generic CreateService builder with application/json body -func NewCreateServiceRequest(server string, did string, body CreateServiceJSONRequestBody) (*http.Request, error) { +func NewCreateServiceRequest(server string, id string, body CreateServiceJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewCreateServiceRequestWithBody(server, did, "application/json", bodyReader) + return NewCreateServiceRequestWithBody(server, id, "application/json", bodyReader) } // NewCreateServiceRequestWithBody generates requests for CreateService with any type of body -func NewCreateServiceRequestWithBody(server string, did string, contentType string, body io.Reader) (*http.Request, error) { +func NewCreateServiceRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string - pathParam0 = did + pathParam0 = id serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/internal/vdr/v2/did/%s/service", pathParam0) + operationPath := fmt.Sprintf("/internal/vdr/v2/subject/%s/service", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -600,26 +751,23 @@ func NewCreateServiceRequestWithBody(server string, did string, contentType stri } // NewDeleteServiceRequest generates requests for DeleteService -func NewDeleteServiceRequest(server string, did string, serviceId string) (*http.Request, error) { +func NewDeleteServiceRequest(server string, id string, serviceId string) (*http.Request, error) { var err error var pathParam0 string - pathParam0 = did + pathParam0 = id var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "serviceId", runtime.ParamLocationPath, serviceId) - if err != nil { - return nil, err - } + pathParam1 = serviceId serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/internal/vdr/v2/did/%s/service/%s", pathParam0, pathParam1) + operationPath := fmt.Sprintf("/internal/vdr/v2/subject/%s/service/%s", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -638,37 +786,34 @@ func NewDeleteServiceRequest(server string, did string, serviceId string) (*http } // NewUpdateServiceRequest calls the generic UpdateService builder with application/json body -func NewUpdateServiceRequest(server string, did string, serviceId string, body UpdateServiceJSONRequestBody) (*http.Request, error) { +func NewUpdateServiceRequest(server string, id string, serviceId string, body UpdateServiceJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewUpdateServiceRequestWithBody(server, did, serviceId, "application/json", bodyReader) + return NewUpdateServiceRequestWithBody(server, id, serviceId, "application/json", bodyReader) } // NewUpdateServiceRequestWithBody generates requests for UpdateService with any type of body -func NewUpdateServiceRequestWithBody(server string, did string, serviceId string, contentType string, body io.Reader) (*http.Request, error) { +func NewUpdateServiceRequestWithBody(server string, id string, serviceId string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string - pathParam0 = did + pathParam0 = id var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "serviceId", runtime.ParamLocationPath, serviceId) - if err != nil { - return nil, err - } + pathParam1 = serviceId serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/internal/vdr/v2/did/%s/service/%s", pathParam0, pathParam1) + operationPath := fmt.Sprintf("/internal/vdr/v2/subject/%s/service/%s", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -688,58 +833,31 @@ func NewUpdateServiceRequestWithBody(server string, did string, serviceId string return req, nil } -// NewAddVerificationMethodRequest generates requests for AddVerificationMethod -func NewAddVerificationMethodRequest(server string, did string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0 = did - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/internal/vdr/v2/did/%s/verificationmethod", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), nil) +// NewAddVerificationMethodRequest calls the generic AddVerificationMethod builder with application/json body +func NewAddVerificationMethodRequest(server string, id string, body AddVerificationMethodJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) if err != nil { return nil, err } - - return req, nil + bodyReader = bytes.NewReader(buf) + return NewAddVerificationMethodRequestWithBody(server, id, "application/json", bodyReader) } -// NewDeleteVerificationMethodRequest generates requests for DeleteVerificationMethod -func NewDeleteVerificationMethodRequest(server string, did string, id string) (*http.Request, error) { +// NewAddVerificationMethodRequestWithBody generates requests for AddVerificationMethod with any type of body +func NewAddVerificationMethodRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string - pathParam0 = did - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } + pathParam0 = id serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/internal/vdr/v2/did/%s/verificationmethod/%s", pathParam0, pathParam1) + operationPath := fmt.Sprintf("/internal/vdr/v2/subject/%s/verificationmethod", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -749,11 +867,13 @@ func NewDeleteVerificationMethodRequest(server string, did string, id string) (* return nil, err } - req, err := http.NewRequest("DELETE", queryURL.String(), nil) + req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err } + req.Header.Add("Content-Type", contentType) + return req, nil } @@ -800,41 +920,93 @@ func WithBaseURL(baseURL string) ClientOption { // ClientWithResponsesInterface is the interface specification for the client with responses above. type ClientWithResponsesInterface interface { + // GetRootWebDIDWithResponse request + GetRootWebDIDWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetRootWebDIDResponse, error) + + // GetTenantWebDIDWithResponse request + GetTenantWebDIDWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetTenantWebDIDResponse, error) + // ListDIDsWithResponse request ListDIDsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListDIDsResponse, error) + // ResolveDIDWithResponse request + ResolveDIDWithResponse(ctx context.Context, did string, reqEditors ...RequestEditorFn) (*ResolveDIDResponse, error) + // CreateDIDWithBodyWithResponse request with any body CreateDIDWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDIDResponse, error) CreateDIDWithResponse(ctx context.Context, body CreateDIDJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDIDResponse, error) - // DeleteDIDWithResponse request - DeleteDIDWithResponse(ctx context.Context, did string, reqEditors ...RequestEditorFn) (*DeleteDIDResponse, error) + // DeactivateWithResponse request + DeactivateWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeactivateResponse, error) - // ResolveDIDWithResponse request - ResolveDIDWithResponse(ctx context.Context, did string, reqEditors ...RequestEditorFn) (*ResolveDIDResponse, error) + // SubjectDIDsWithResponse request + SubjectDIDsWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*SubjectDIDsResponse, error) - // FilterServicesWithResponse request - FilterServicesWithResponse(ctx context.Context, did string, params *FilterServicesParams, reqEditors ...RequestEditorFn) (*FilterServicesResponse, error) + // FindServicesWithResponse request + FindServicesWithResponse(ctx context.Context, id string, params *FindServicesParams, reqEditors ...RequestEditorFn) (*FindServicesResponse, error) // CreateServiceWithBodyWithResponse request with any body - CreateServiceWithBodyWithResponse(ctx context.Context, did string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateServiceResponse, error) + CreateServiceWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateServiceResponse, error) - CreateServiceWithResponse(ctx context.Context, did string, body CreateServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateServiceResponse, error) + CreateServiceWithResponse(ctx context.Context, id string, body CreateServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateServiceResponse, error) // DeleteServiceWithResponse request - DeleteServiceWithResponse(ctx context.Context, did string, serviceId string, reqEditors ...RequestEditorFn) (*DeleteServiceResponse, error) + DeleteServiceWithResponse(ctx context.Context, id string, serviceId string, reqEditors ...RequestEditorFn) (*DeleteServiceResponse, error) // UpdateServiceWithBodyWithResponse request with any body - UpdateServiceWithBodyWithResponse(ctx context.Context, did string, serviceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateServiceResponse, error) + UpdateServiceWithBodyWithResponse(ctx context.Context, id string, serviceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateServiceResponse, error) - UpdateServiceWithResponse(ctx context.Context, did string, serviceId string, body UpdateServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateServiceResponse, error) + UpdateServiceWithResponse(ctx context.Context, id string, serviceId string, body UpdateServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateServiceResponse, error) - // AddVerificationMethodWithResponse request - AddVerificationMethodWithResponse(ctx context.Context, did string, reqEditors ...RequestEditorFn) (*AddVerificationMethodResponse, error) + // AddVerificationMethodWithBodyWithResponse request with any body + AddVerificationMethodWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AddVerificationMethodResponse, error) - // DeleteVerificationMethodWithResponse request - DeleteVerificationMethodWithResponse(ctx context.Context, did string, id string, reqEditors ...RequestEditorFn) (*DeleteVerificationMethodResponse, error) + AddVerificationMethodWithResponse(ctx context.Context, id string, body AddVerificationMethodJSONRequestBody, reqEditors ...RequestEditorFn) (*AddVerificationMethodResponse, error) +} + +type GetRootWebDIDResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DIDDocument +} + +// Status returns HTTPResponse.Status +func (r GetRootWebDIDResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetRootWebDIDResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetTenantWebDIDResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DIDDocument +} + +// Status returns HTTPResponse.Status +func (r GetTenantWebDIDResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetTenantWebDIDResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 } type ListDIDsResponse struct { @@ -869,10 +1041,10 @@ func (r ListDIDsResponse) StatusCode() int { return 0 } -type CreateDIDResponse struct { +type ResolveDIDResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *DIDDocument + JSON200 *DIDResolutionResult ApplicationproblemJSONDefault *struct { // Detail A human-readable explanation specific to this occurrence of the problem. Detail string `json:"detail"` @@ -886,7 +1058,7 @@ type CreateDIDResponse struct { } // Status returns HTTPResponse.Status -func (r CreateDIDResponse) Status() string { +func (r ResolveDIDResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -894,16 +1066,17 @@ func (r CreateDIDResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r CreateDIDResponse) StatusCode() int { +func (r ResolveDIDResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type DeleteDIDResponse struct { +type CreateDIDResponse struct { Body []byte HTTPResponse *http.Response + JSON200 *SubjectCreationResult ApplicationproblemJSONDefault *struct { // Detail A human-readable explanation specific to this occurrence of the problem. Detail string `json:"detail"` @@ -917,7 +1090,7 @@ type DeleteDIDResponse struct { } // Status returns HTTPResponse.Status -func (r DeleteDIDResponse) Status() string { +func (r CreateDIDResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -925,17 +1098,16 @@ func (r DeleteDIDResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r DeleteDIDResponse) StatusCode() int { +func (r CreateDIDResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type ResolveDIDResponse struct { +type DeactivateResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *DIDResolutionResult ApplicationproblemJSONDefault *struct { // Detail A human-readable explanation specific to this occurrence of the problem. Detail string `json:"detail"` @@ -949,7 +1121,7 @@ type ResolveDIDResponse struct { } // Status returns HTTPResponse.Status -func (r ResolveDIDResponse) Status() string { +func (r DeactivateResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -957,17 +1129,17 @@ func (r ResolveDIDResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ResolveDIDResponse) StatusCode() int { +func (r DeactivateResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type FilterServicesResponse struct { +type SubjectDIDsResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *[]Service + JSON200 *[]string ApplicationproblemJSONDefault *struct { // Detail A human-readable explanation specific to this occurrence of the problem. Detail string `json:"detail"` @@ -981,7 +1153,7 @@ type FilterServicesResponse struct { } // Status returns HTTPResponse.Status -func (r FilterServicesResponse) Status() string { +func (r SubjectDIDsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -989,17 +1161,17 @@ func (r FilterServicesResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r FilterServicesResponse) StatusCode() int { +func (r SubjectDIDsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type CreateServiceResponse struct { +type FindServicesResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *Service + JSON200 *[]Service ApplicationproblemJSONDefault *struct { // Detail A human-readable explanation specific to this occurrence of the problem. Detail string `json:"detail"` @@ -1013,7 +1185,7 @@ type CreateServiceResponse struct { } // Status returns HTTPResponse.Status -func (r CreateServiceResponse) Status() string { +func (r FindServicesResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -1021,16 +1193,17 @@ func (r CreateServiceResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r CreateServiceResponse) StatusCode() int { +func (r FindServicesResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type DeleteServiceResponse struct { +type CreateServiceResponse struct { Body []byte HTTPResponse *http.Response + JSON200 *[]Service ApplicationproblemJSONDefault *struct { // Detail A human-readable explanation specific to this occurrence of the problem. Detail string `json:"detail"` @@ -1044,7 +1217,7 @@ type DeleteServiceResponse struct { } // Status returns HTTPResponse.Status -func (r DeleteServiceResponse) Status() string { +func (r CreateServiceResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -1052,17 +1225,16 @@ func (r DeleteServiceResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r DeleteServiceResponse) StatusCode() int { +func (r CreateServiceResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type UpdateServiceResponse struct { +type DeleteServiceResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *Service ApplicationproblemJSONDefault *struct { // Detail A human-readable explanation specific to this occurrence of the problem. Detail string `json:"detail"` @@ -1076,7 +1248,7 @@ type UpdateServiceResponse struct { } // Status returns HTTPResponse.Status -func (r UpdateServiceResponse) Status() string { +func (r DeleteServiceResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -1084,17 +1256,17 @@ func (r UpdateServiceResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r UpdateServiceResponse) StatusCode() int { +func (r DeleteServiceResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type AddVerificationMethodResponse struct { +type UpdateServiceResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *VerificationMethod + JSON200 *[]Service ApplicationproblemJSONDefault *struct { // Detail A human-readable explanation specific to this occurrence of the problem. Detail string `json:"detail"` @@ -1108,7 +1280,7 @@ type AddVerificationMethodResponse struct { } // Status returns HTTPResponse.Status -func (r AddVerificationMethodResponse) Status() string { +func (r UpdateServiceResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -1116,16 +1288,17 @@ func (r AddVerificationMethodResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r AddVerificationMethodResponse) StatusCode() int { +func (r UpdateServiceResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type DeleteVerificationMethodResponse struct { +type AddVerificationMethodResponse struct { Body []byte HTTPResponse *http.Response + JSON200 *[]VerificationMethod ApplicationproblemJSONDefault *struct { // Detail A human-readable explanation specific to this occurrence of the problem. Detail string `json:"detail"` @@ -1139,7 +1312,7 @@ type DeleteVerificationMethodResponse struct { } // Status returns HTTPResponse.Status -func (r DeleteVerificationMethodResponse) Status() string { +func (r AddVerificationMethodResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -1147,13 +1320,31 @@ func (r DeleteVerificationMethodResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r DeleteVerificationMethodResponse) StatusCode() int { +func (r AddVerificationMethodResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } +// GetRootWebDIDWithResponse request returning *GetRootWebDIDResponse +func (c *ClientWithResponses) GetRootWebDIDWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetRootWebDIDResponse, error) { + rsp, err := c.GetRootWebDID(ctx, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetRootWebDIDResponse(rsp) +} + +// GetTenantWebDIDWithResponse request returning *GetTenantWebDIDResponse +func (c *ClientWithResponses) GetTenantWebDIDWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetTenantWebDIDResponse, error) { + rsp, err := c.GetTenantWebDID(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetTenantWebDIDResponse(rsp) +} + // ListDIDsWithResponse request returning *ListDIDsResponse func (c *ClientWithResponses) ListDIDsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListDIDsResponse, error) { rsp, err := c.ListDIDs(ctx, reqEditors...) @@ -1163,6 +1354,15 @@ func (c *ClientWithResponses) ListDIDsWithResponse(ctx context.Context, reqEdito return ParseListDIDsResponse(rsp) } +// ResolveDIDWithResponse request returning *ResolveDIDResponse +func (c *ClientWithResponses) ResolveDIDWithResponse(ctx context.Context, did string, reqEditors ...RequestEditorFn) (*ResolveDIDResponse, error) { + rsp, err := c.ResolveDID(ctx, did, reqEditors...) + if err != nil { + return nil, err + } + return ParseResolveDIDResponse(rsp) +} + // CreateDIDWithBodyWithResponse request with arbitrary body returning *CreateDIDResponse func (c *ClientWithResponses) CreateDIDWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDIDResponse, error) { rsp, err := c.CreateDIDWithBody(ctx, contentType, body, reqEditors...) @@ -1180,44 +1380,44 @@ func (c *ClientWithResponses) CreateDIDWithResponse(ctx context.Context, body Cr return ParseCreateDIDResponse(rsp) } -// DeleteDIDWithResponse request returning *DeleteDIDResponse -func (c *ClientWithResponses) DeleteDIDWithResponse(ctx context.Context, did string, reqEditors ...RequestEditorFn) (*DeleteDIDResponse, error) { - rsp, err := c.DeleteDID(ctx, did, reqEditors...) +// DeactivateWithResponse request returning *DeactivateResponse +func (c *ClientWithResponses) DeactivateWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeactivateResponse, error) { + rsp, err := c.Deactivate(ctx, id, reqEditors...) if err != nil { return nil, err } - return ParseDeleteDIDResponse(rsp) + return ParseDeactivateResponse(rsp) } -// ResolveDIDWithResponse request returning *ResolveDIDResponse -func (c *ClientWithResponses) ResolveDIDWithResponse(ctx context.Context, did string, reqEditors ...RequestEditorFn) (*ResolveDIDResponse, error) { - rsp, err := c.ResolveDID(ctx, did, reqEditors...) +// SubjectDIDsWithResponse request returning *SubjectDIDsResponse +func (c *ClientWithResponses) SubjectDIDsWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*SubjectDIDsResponse, error) { + rsp, err := c.SubjectDIDs(ctx, id, reqEditors...) if err != nil { return nil, err } - return ParseResolveDIDResponse(rsp) + return ParseSubjectDIDsResponse(rsp) } -// FilterServicesWithResponse request returning *FilterServicesResponse -func (c *ClientWithResponses) FilterServicesWithResponse(ctx context.Context, did string, params *FilterServicesParams, reqEditors ...RequestEditorFn) (*FilterServicesResponse, error) { - rsp, err := c.FilterServices(ctx, did, params, reqEditors...) +// FindServicesWithResponse request returning *FindServicesResponse +func (c *ClientWithResponses) FindServicesWithResponse(ctx context.Context, id string, params *FindServicesParams, reqEditors ...RequestEditorFn) (*FindServicesResponse, error) { + rsp, err := c.FindServices(ctx, id, params, reqEditors...) if err != nil { return nil, err } - return ParseFilterServicesResponse(rsp) + return ParseFindServicesResponse(rsp) } // CreateServiceWithBodyWithResponse request with arbitrary body returning *CreateServiceResponse -func (c *ClientWithResponses) CreateServiceWithBodyWithResponse(ctx context.Context, did string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateServiceResponse, error) { - rsp, err := c.CreateServiceWithBody(ctx, did, contentType, body, reqEditors...) +func (c *ClientWithResponses) CreateServiceWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateServiceResponse, error) { + rsp, err := c.CreateServiceWithBody(ctx, id, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseCreateServiceResponse(rsp) } -func (c *ClientWithResponses) CreateServiceWithResponse(ctx context.Context, did string, body CreateServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateServiceResponse, error) { - rsp, err := c.CreateService(ctx, did, body, reqEditors...) +func (c *ClientWithResponses) CreateServiceWithResponse(ctx context.Context, id string, body CreateServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateServiceResponse, error) { + rsp, err := c.CreateService(ctx, id, body, reqEditors...) if err != nil { return nil, err } @@ -1225,8 +1425,8 @@ func (c *ClientWithResponses) CreateServiceWithResponse(ctx context.Context, did } // DeleteServiceWithResponse request returning *DeleteServiceResponse -func (c *ClientWithResponses) DeleteServiceWithResponse(ctx context.Context, did string, serviceId string, reqEditors ...RequestEditorFn) (*DeleteServiceResponse, error) { - rsp, err := c.DeleteService(ctx, did, serviceId, reqEditors...) +func (c *ClientWithResponses) DeleteServiceWithResponse(ctx context.Context, id string, serviceId string, reqEditors ...RequestEditorFn) (*DeleteServiceResponse, error) { + rsp, err := c.DeleteService(ctx, id, serviceId, reqEditors...) if err != nil { return nil, err } @@ -1234,38 +1434,89 @@ func (c *ClientWithResponses) DeleteServiceWithResponse(ctx context.Context, did } // UpdateServiceWithBodyWithResponse request with arbitrary body returning *UpdateServiceResponse -func (c *ClientWithResponses) UpdateServiceWithBodyWithResponse(ctx context.Context, did string, serviceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateServiceResponse, error) { - rsp, err := c.UpdateServiceWithBody(ctx, did, serviceId, contentType, body, reqEditors...) +func (c *ClientWithResponses) UpdateServiceWithBodyWithResponse(ctx context.Context, id string, serviceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateServiceResponse, error) { + rsp, err := c.UpdateServiceWithBody(ctx, id, serviceId, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseUpdateServiceResponse(rsp) } -func (c *ClientWithResponses) UpdateServiceWithResponse(ctx context.Context, did string, serviceId string, body UpdateServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateServiceResponse, error) { - rsp, err := c.UpdateService(ctx, did, serviceId, body, reqEditors...) +func (c *ClientWithResponses) UpdateServiceWithResponse(ctx context.Context, id string, serviceId string, body UpdateServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateServiceResponse, error) { + rsp, err := c.UpdateService(ctx, id, serviceId, body, reqEditors...) if err != nil { return nil, err } return ParseUpdateServiceResponse(rsp) } -// AddVerificationMethodWithResponse request returning *AddVerificationMethodResponse -func (c *ClientWithResponses) AddVerificationMethodWithResponse(ctx context.Context, did string, reqEditors ...RequestEditorFn) (*AddVerificationMethodResponse, error) { - rsp, err := c.AddVerificationMethod(ctx, did, reqEditors...) +// AddVerificationMethodWithBodyWithResponse request with arbitrary body returning *AddVerificationMethodResponse +func (c *ClientWithResponses) AddVerificationMethodWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AddVerificationMethodResponse, error) { + rsp, err := c.AddVerificationMethodWithBody(ctx, id, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseAddVerificationMethodResponse(rsp) +} + +func (c *ClientWithResponses) AddVerificationMethodWithResponse(ctx context.Context, id string, body AddVerificationMethodJSONRequestBody, reqEditors ...RequestEditorFn) (*AddVerificationMethodResponse, error) { + rsp, err := c.AddVerificationMethod(ctx, id, body, reqEditors...) if err != nil { return nil, err } return ParseAddVerificationMethodResponse(rsp) } -// DeleteVerificationMethodWithResponse request returning *DeleteVerificationMethodResponse -func (c *ClientWithResponses) DeleteVerificationMethodWithResponse(ctx context.Context, did string, id string, reqEditors ...RequestEditorFn) (*DeleteVerificationMethodResponse, error) { - rsp, err := c.DeleteVerificationMethod(ctx, did, id, reqEditors...) +// ParseGetRootWebDIDResponse parses an HTTP response from a GetRootWebDIDWithResponse call +func ParseGetRootWebDIDResponse(rsp *http.Response) (*GetRootWebDIDResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetRootWebDIDResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DIDDocument + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseGetTenantWebDIDResponse parses an HTTP response from a GetTenantWebDIDWithResponse call +func ParseGetTenantWebDIDResponse(rsp *http.Response) (*GetTenantWebDIDResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseDeleteVerificationMethodResponse(rsp) + + response := &GetTenantWebDIDResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DIDDocument + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil } // ParseListDIDsResponse parses an HTTP response from a ListDIDsWithResponse call @@ -1310,22 +1561,22 @@ func ParseListDIDsResponse(rsp *http.Response) (*ListDIDsResponse, error) { return response, nil } -// ParseCreateDIDResponse parses an HTTP response from a CreateDIDWithResponse call -func ParseCreateDIDResponse(rsp *http.Response) (*CreateDIDResponse, error) { +// ParseResolveDIDResponse parses an HTTP response from a ResolveDIDWithResponse call +func ParseResolveDIDResponse(rsp *http.Response) (*ResolveDIDResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &CreateDIDResponse{ + response := &ResolveDIDResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DIDDocument + var dest DIDResolutionResult if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -1352,20 +1603,27 @@ func ParseCreateDIDResponse(rsp *http.Response) (*CreateDIDResponse, error) { return response, nil } -// ParseDeleteDIDResponse parses an HTTP response from a DeleteDIDWithResponse call -func ParseDeleteDIDResponse(rsp *http.Response) (*DeleteDIDResponse, error) { +// ParseCreateDIDResponse parses an HTTP response from a CreateDIDWithResponse call +func ParseCreateDIDResponse(rsp *http.Response) (*CreateDIDResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &DeleteDIDResponse{ + response := &CreateDIDResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest SubjectCreationResult + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: var dest struct { // Detail A human-readable explanation specific to this occurrence of the problem. @@ -1387,27 +1645,20 @@ func ParseDeleteDIDResponse(rsp *http.Response) (*DeleteDIDResponse, error) { return response, nil } -// ParseResolveDIDResponse parses an HTTP response from a ResolveDIDWithResponse call -func ParseResolveDIDResponse(rsp *http.Response) (*ResolveDIDResponse, error) { +// ParseDeactivateResponse parses an HTTP response from a DeactivateWithResponse call +func ParseDeactivateResponse(rsp *http.Response) (*DeactivateResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ResolveDIDResponse{ + response := &DeactivateResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DIDResolutionResult - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: var dest struct { // Detail A human-readable explanation specific to this occurrence of the problem. @@ -1429,22 +1680,22 @@ func ParseResolveDIDResponse(rsp *http.Response) (*ResolveDIDResponse, error) { return response, nil } -// ParseFilterServicesResponse parses an HTTP response from a FilterServicesWithResponse call -func ParseFilterServicesResponse(rsp *http.Response) (*FilterServicesResponse, error) { +// ParseSubjectDIDsResponse parses an HTTP response from a SubjectDIDsWithResponse call +func ParseSubjectDIDsResponse(rsp *http.Response) (*SubjectDIDsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &FilterServicesResponse{ + response := &SubjectDIDsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest []Service + var dest []string if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -1471,22 +1722,22 @@ func ParseFilterServicesResponse(rsp *http.Response) (*FilterServicesResponse, e return response, nil } -// ParseCreateServiceResponse parses an HTTP response from a CreateServiceWithResponse call -func ParseCreateServiceResponse(rsp *http.Response) (*CreateServiceResponse, error) { +// ParseFindServicesResponse parses an HTTP response from a FindServicesWithResponse call +func ParseFindServicesResponse(rsp *http.Response) (*FindServicesResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &CreateServiceResponse{ + response := &FindServicesResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Service + var dest []Service if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -1513,20 +1764,27 @@ func ParseCreateServiceResponse(rsp *http.Response) (*CreateServiceResponse, err return response, nil } -// ParseDeleteServiceResponse parses an HTTP response from a DeleteServiceWithResponse call -func ParseDeleteServiceResponse(rsp *http.Response) (*DeleteServiceResponse, error) { +// ParseCreateServiceResponse parses an HTTP response from a CreateServiceWithResponse call +func ParseCreateServiceResponse(rsp *http.Response) (*CreateServiceResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &DeleteServiceResponse{ + response := &CreateServiceResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest []Service + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: var dest struct { // Detail A human-readable explanation specific to this occurrence of the problem. @@ -1548,27 +1806,20 @@ func ParseDeleteServiceResponse(rsp *http.Response) (*DeleteServiceResponse, err return response, nil } -// ParseUpdateServiceResponse parses an HTTP response from a UpdateServiceWithResponse call -func ParseUpdateServiceResponse(rsp *http.Response) (*UpdateServiceResponse, error) { +// ParseDeleteServiceResponse parses an HTTP response from a DeleteServiceWithResponse call +func ParseDeleteServiceResponse(rsp *http.Response) (*DeleteServiceResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &UpdateServiceResponse{ + response := &DeleteServiceResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Service - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: var dest struct { // Detail A human-readable explanation specific to this occurrence of the problem. @@ -1590,22 +1841,22 @@ func ParseUpdateServiceResponse(rsp *http.Response) (*UpdateServiceResponse, err return response, nil } -// ParseAddVerificationMethodResponse parses an HTTP response from a AddVerificationMethodWithResponse call -func ParseAddVerificationMethodResponse(rsp *http.Response) (*AddVerificationMethodResponse, error) { +// ParseUpdateServiceResponse parses an HTTP response from a UpdateServiceWithResponse call +func ParseUpdateServiceResponse(rsp *http.Response) (*UpdateServiceResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &AddVerificationMethodResponse{ + response := &UpdateServiceResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest VerificationMethod + var dest []Service if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -1632,20 +1883,27 @@ func ParseAddVerificationMethodResponse(rsp *http.Response) (*AddVerificationMet return response, nil } -// ParseDeleteVerificationMethodResponse parses an HTTP response from a DeleteVerificationMethodWithResponse call -func ParseDeleteVerificationMethodResponse(rsp *http.Response) (*DeleteVerificationMethodResponse, error) { +// ParseAddVerificationMethodResponse parses an HTTP response from a AddVerificationMethodWithResponse call +func ParseAddVerificationMethodResponse(rsp *http.Response) (*AddVerificationMethodResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &DeleteVerificationMethodResponse{ + response := &AddVerificationMethodResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest []VerificationMethod + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: var dest struct { // Detail A human-readable explanation specific to this occurrence of the problem. diff --git a/web/src/admin/Identities.vue b/web/src/admin/Identities.vue index 56b7f21..76ccf6d 100644 --- a/web/src/admin/Identities.vue +++ b/web/src/admin/Identities.vue @@ -23,13 +23,13 @@ Name - DID + DIDs - - {{ name }} + + {{ subject }} {{ did }} diff --git a/web/src/admin/IdentityDetails.vue b/web/src/admin/IdentityDetails.vue index 28ae80b..c56cdd4 100644 --- a/web/src/admin/IdentityDetails.vue +++ b/web/src/admin/IdentityDetails.vue @@ -1,24 +1,20 @@