Skip to content

Commit

Permalink
Update ssi-sdk version
Browse files Browse the repository at this point in the history
  • Loading branch information
andresuribe87 committed Jul 28, 2023
1 parent dc805c4 commit b41daa0
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/BurntSushi/toml v1.3.2
github.com/TBD54566975/ssi-sdk v0.0.4-alpha.0.20230711190054-bce640c9bf25
github.com/TBD54566975/ssi-sdk v0.0.4-alpha.0.20230728184551-8db407fb064a
github.com/alicebob/miniredis/v2 v2.30.4
github.com/ardanlabs/conf v1.5.0
github.com/benbjohnson/clock v1.3.5
Expand Down Expand Up @@ -143,7 +143,7 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pquerna/cachecontrol v0.2.0 // indirect
github.com/redis/go-redis/extra/rediscmd/v9 v9.0.5 // indirect
github.com/santhosh-tekuri/jsonschema/v5 v5.3.0 // indirect
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.9.5 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbi
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/TBD54566975/ssi-sdk v0.0.4-alpha.0.20230711190054-bce640c9bf25 h1:wW+49kQxN/BYcMkbDjQA9mkrUC9cYUV6HOFLP+JIx+E=
github.com/TBD54566975/ssi-sdk v0.0.4-alpha.0.20230711190054-bce640c9bf25/go.mod h1:lup1EqGAT730/c7dRF9Q8OvgsjWJewq4K2dFAyBV1vk=
github.com/TBD54566975/ssi-sdk v0.0.4-alpha.0.20230728184551-8db407fb064a h1:dyR/yGhyLl+GuwafcrbaaeGYYOaVzJpyUnxqy9CPZNE=
github.com/TBD54566975/ssi-sdk v0.0.4-alpha.0.20230728184551-8db407fb064a/go.mod h1:mVKRjfdpgmCxPwnfQluXGkgzsFyrPsjrCvHXCJ41avQ=
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302 h1:uvdUDbHQHO85qeSydJtItA4T55Pw6BtAejd0APRJOCE=
github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
Expand Down Expand Up @@ -437,8 +437,8 @@ github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/santhosh-tekuri/jsonschema/v5 v5.3.0 h1:uIkTLo0AGRc8l7h5l9r+GcYi9qfVPt6lD4/bhmzfiKo=
github.com/santhosh-tekuri/jsonschema/v5 v5.3.0/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H/cDPdvJ/SZJQLWWXWGrZ0=
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4=
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY=
github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys=
github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
Expand Down
6 changes: 3 additions & 3 deletions pkg/server/router/did_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@ func TestDIDRouter(t *testing.T) {
createOpts := did.CreateWebDIDOptions{DIDWebID: "did:web:example.com"}
_, err = didService.CreateDIDByMethod(context.Background(), did.CreateDIDRequest{Method: didsdk.WebMethod, KeyType: "bad", Options: createOpts})
assert.Error(tt, err)
assert.Contains(tt, err.Error(), "could not generate key for did:web")
assert.Contains(tt, err.Error(), "key type <bad> not supported")

gock.Off()
gock.New("https://example.com").
Get("/.well-known/did.json").
Reply(200).
BodyString("")
JSON("{}")
// good key type
createDIDResponse, err := didService.CreateDIDByMethod(context.Background(), did.CreateDIDRequest{Method: didsdk.WebMethod, KeyType: crypto.Ed25519, Options: createOpts})
assert.NoError(tt, err)
Expand All @@ -226,7 +226,7 @@ func TestDIDRouter(t *testing.T) {
gock.New("https://tbd.website").
Get("/.well-known/did.json").
Reply(200).
BodyString("")
JSON("{}")
// create a second DID
createOpts = did.CreateWebDIDOptions{DIDWebID: "did:web:tbd.website"}
createDIDResponse2, err := didService.CreateDIDByMethod(context.Background(), did.CreateDIDRequest{Method: didsdk.WebMethod, KeyType: crypto.Ed25519, Options: createOpts})
Expand Down
6 changes: 3 additions & 3 deletions pkg/server/server_did_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func TestDIDAPI(t *testing.T) {
gock.New("https://example.com").
Get("/.well-known/did.json").
Reply(200).
BodyString(`{"didDocument": {"id": "did:web:example.com"}}`)
JSON(`{"didDocument": {"id": "did:web:example.com"}}`)
defer gock.Off()

c = newRequestContextWithParams(w, req, params)
Expand Down Expand Up @@ -280,7 +280,7 @@ func TestDIDAPI(t *testing.T) {
gock.New("https://example.com").
Get("/.well-known/did.json").
Reply(200).
BodyString(`{"didDocument": {"id": "did:web:example.com"}}`)
JSON(`{"didDocument": {"id": "did:web:example.com"}}`)
defer gock.Off()

c := newRequestContextWithParams(w, req, params)
Expand All @@ -300,7 +300,7 @@ func TestDIDAPI(t *testing.T) {
gock.New("https://example.com").
Get("/.well-known/did.json").
Reply(200).
BodyString(`{"didDocument": {"id": "did:web:example.com"}}`)
JSON(`{"didDocument": {"id": "did:web:example.com"}}`)
defer gock.Off()

// Make sure it can't make another did:web of the same DIDWebID
Expand Down
4 changes: 2 additions & 2 deletions pkg/service/did/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ func (s *Service) ResolveDID(request ResolveDIDRequest) (*ResolveDIDResponse, er
return nil, err
}
return &ResolveDIDResponse{
ResolutionMetadata: &resolved.Metadata,
ResolutionMetadata: resolved.Metadata,
DIDDocument: &resolved.Document,
DIDDocumentMetadata: &resolved.DocumentMetadata,
DIDDocumentMetadata: resolved.DocumentMetadata,
}, nil
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/service/did/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func (h *webHandler) GetMethod() did.Method {
func (h *webHandler) CreateDID(ctx context.Context, request CreateDIDRequest) (*CreateDIDResponse, error) {
logrus.Debugf("creating DID: %+v", request)

if !crypto.IsSupportedKeyType(request.KeyType) {
return nil, errors.Errorf("key type <%s> not supported", request.KeyType)
}
// process options
if request.Options == nil {
return nil, errors.New("options cannot be empty")
Expand Down

0 comments on commit b41daa0

Please sign in to comment.