Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
Remove dwn publish manifest code (#166)
Browse files Browse the repository at this point in the history
* Remove dwn publish manifest code as we will have this functionality in the generic webhooks code

* fixing lint error

* fixing linter

Co-authored-by: Gabe <[email protected]>
  • Loading branch information
nitro-neal and Gabe authored Nov 7, 2022
1 parent 0a78fce commit 9caf431
Show file tree
Hide file tree
Showing 15 changed files with 5 additions and 511 deletions.
6 changes: 1 addition & 5 deletions config/compose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,4 @@ name = "schema"
name = "credential"

[services.manifest]
name = "manifest"

[services.dwn]
name = "dwn"
dwn_endpoint = "http://localhost:4321"
name = "manifest"
17 changes: 0 additions & 17 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ type ServicesConfig struct {
SchemaConfig SchemaServiceConfig `toml:"schema,omitempty"`
CredentialConfig CredentialServiceConfig `toml:"credential,omitempty"`
ManifestConfig ManifestServiceConfig `toml:"manifest,omitempty"`
DWNConfig DWNServiceConfig `toml:"dwn,omitempty"`
}

// BaseServiceConfig represents configurable properties for a specific component of the SSI Service
Expand Down Expand Up @@ -123,18 +122,6 @@ func (m *ManifestServiceConfig) IsEmpty() bool {
return reflect.DeepEqual(m, &ManifestServiceConfig{})
}

type DWNServiceConfig struct {
*BaseServiceConfig
DWNEndpoint string `toml:"dwn_endpoint"`
}

func (d *DWNServiceConfig) IsEmpty() bool {
if d == nil {
return true
}
return reflect.DeepEqual(d, &DWNServiceConfig{})
}

// LoadConfig attempts to load a TOML config file from the given path, and coerce it into our object model.
// Before loading, defaults are applied on certain properties, which are overwritten if specified in the TOML file.
func LoadConfig(path string) (*SSIServiceConfig, error) {
Expand Down Expand Up @@ -196,10 +183,6 @@ func LoadConfig(path string) (*SSIServiceConfig, error) {
ManifestConfig: ManifestServiceConfig{
BaseServiceConfig: &BaseServiceConfig{Name: "manifest"},
},
DWNConfig: DWNServiceConfig{
BaseServiceConfig: &BaseServiceConfig{Name: "dwn"},
DWNEndpoint: "http://localhost:4321",
},
}
} else {
// load from TOML file
Expand Down
6 changes: 1 addition & 5 deletions config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,4 @@ name = "schema"
name = "credential"

[services.manifest]
name = "manifest"

[services.dwn]
name = "dwn"
dwn_endpoint = "http://localhost:4321"
name = "manifest"
56 changes: 0 additions & 56 deletions pkg/dwn/dwn.go

This file was deleted.

59 changes: 0 additions & 59 deletions pkg/dwn/dwn_test.go

This file was deleted.

98 changes: 0 additions & 98 deletions pkg/server/router/dwn.go

This file was deleted.

55 changes: 0 additions & 55 deletions pkg/server/router/dwn_test.go

This file was deleted.

4 changes: 1 addition & 3 deletions pkg/server/router/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/mr-tron/base58"
"github.com/stretchr/testify/assert"

"github.com/tbd54566975/ssi-service/config"
credmodel "github.com/tbd54566975/ssi-service/internal/credential"
"github.com/tbd54566975/ssi-service/internal/keyaccess"
"github.com/tbd54566975/ssi-service/pkg/service/credential"
Expand Down Expand Up @@ -48,12 +47,11 @@ func TestManifestRouter(t *testing.T) {
assert.NoError(tt, err)
assert.NotEmpty(tt, bolt)

serviceConfig := config.ManifestServiceConfig{BaseServiceConfig: &config.BaseServiceConfig{Name: "manifest"}}
keyStoreService := testKeyStoreService(tt, bolt)
didService := testDIDService(tt, bolt, keyStoreService)
schemaService := testSchemaService(tt, bolt, keyStoreService, didService)
credentialService := testCredentialService(tt, bolt, keyStoreService, didService, schemaService)
manifestService, err := manifest.NewManifestService(serviceConfig, bolt, keyStoreService, didService.GetResolver(), credentialService)
manifestService := testManifestService(tt, bolt, keyStoreService, didService, credentialService)
assert.NoError(tt, err)
assert.NotEmpty(tt, manifestService)

Expand Down
15 changes: 0 additions & 15 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const (
ApplicationsPrefix = "/applications"
ResponsesPrefix = "/responses"
KeyStorePrefix = "/keys"
DWNPrefix = "/dwn"
VerificationPath = "/verification"
)

Expand Down Expand Up @@ -98,8 +97,6 @@ func (s *SSIServer) instantiateRouter(service svcframework.Service) error {
return s.KeyStoreAPI(service)
case svcframework.Manifest:
return s.ManifestAPI(service)
case svcframework.DWN:
return s.DWNAPI(service)
default:
return fmt.Errorf("could not instantiate API for service: %s", serviceType)
}
Expand Down Expand Up @@ -193,15 +190,3 @@ func (s *SSIServer) ManifestAPI(service svcframework.Service) (err error) {
s.Handle(http.MethodDelete, path.Join(responsesHandlerPath, "/:id"), manifestRouter.DeleteResponse)
return
}

func (s *SSIServer) DWNAPI(service svcframework.Service) (err error) {
dwnRouter, err := router.NewDWNRouter(service)
if err != nil {
return util.LoggingErrorMsg(err, "could not create dwn router")
}

dwnPath := V1Prefix + DWNPrefix + ManifestsPrefix

s.Handle(http.MethodPut, dwnPath, dwnRouter.PublishManifest)
return
}
Loading

0 comments on commit 9caf431

Please sign in to comment.