Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev-1074-did-resolver' into DEV-…
Browse files Browse the repository at this point in the history
…1074-dokerfile

Signed-off-by: Andrew Nikitin <andrew.nikitin@cheqd.io>
  • Loading branch information
Andrew Nikitin committed Apr 14, 2022
2 parents 074ffaf + dc4a663 commit ea088ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
15 changes: 2 additions & 13 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Config struct {
}

func main() {
didResolutionPath := flag.String("path", "/1.0/identifier/:did", "URL path with DID resolution endpoint")
didResolutionPath := flag.String("path", "/1.0/identifiers/:did", "URL path with DID resolution endpoint")
didResolutionPort := flag.String("port", ":1313", "The endpoint port with DID resolution")
flag.Parse()

Expand Down Expand Up @@ -47,11 +47,6 @@ func main() {
// Routes
e.GET(*didResolutionPath, func(c echo.Context) error {
did := c.Param("did")
// decode the paramater
// did, err := url.QueryUnescape(did1)
//if err != nil {
// return c.JSON(http.StatusBadRequest, map[string]string{})
//}
accept := strings.Split(c.Request().Header.Get("accept"), ";")[0]
if strings.Contains(accept, types.ResolutionJSONLDType) {
accept = types.ResolutionDIDJSONLDType
Expand All @@ -66,14 +61,8 @@ func main() {
// todo: defined a correct status
status = http.StatusBadRequest
}
c.Response().Header().Set(echo.HeaderContentType, accept)
return c.JSONBlob(status, []byte(responseBody))

//
//// track the resolution
//atomic.AddUint64(&rt.resolves, 1)
//c.Response().Header().Set(echo.HeaderContentType, didLDJson)
//
//return c.JSON(http.StatusOK, rr)
})

// Start server
Expand Down
5 changes: 4 additions & 1 deletion services/ledger_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ func (ls LedgerService) QueryDIDDoc(did string) (cheqd.Did, cheqd.Metadata, erro
defer conn.Close()

didDocResponse, err := qc.Did(context.Background(), &cheqd.QueryGetDidRequest{Id: did})

if err != nil {
return cheqd.Did{}, cheqd.Metadata{}, err
}
println("QueryDIDDoc: received response")
println(didDocResponse)
return *didDocResponse.Did, *didDocResponse.Metadata, err
}
Expand Down

0 comments on commit ea088ed

Please sign in to comment.