Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DIDComm Connector
Manage
Activity
Members
Labels
Plan
Issues
29
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Projects
xfsc
Common Services
DIDComm Connector
Commits
768adcac
Commit
768adcac
authored
11 months ago
by
Steffen Schulze
Browse files
Options
Downloads
Patches
Plain Diff
connection details added
parent
50ca2894
No related branches found
Branches containing commit
No related tags found
1 merge request
!10
Refactoring
Pipeline
#41273
failed with stages
in 50 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmd/api/connection.go
+31
-2
31 additions, 2 deletions
cmd/api/connection.go
mediator/didcommResolver.go
+24
-0
24 additions, 0 deletions
mediator/didcommResolver.go
with
55 additions
and
2 deletions
cmd/api/connection.go
+
31
−
2
View file @
768adcac
...
...
@@ -16,6 +16,11 @@ import (
"gitlab.eclipse.org/eclipse/xfsc/common-services/didcomm-connector/protocol"
)
type
ConnectionResponse
struct
{
database
.
Mediatee
DidDoc
*
mediator
.
DidDocumentJSON
`json:"didDocument,omitempty"`
}
// @Summary Get connections
// @Schemes
// @Description Returns a list with the existing connections
...
...
@@ -41,8 +46,24 @@ func (app *application) GetConnections(context *gin.Context) {
config
.
Logger
.
Error
(
logTag
,
"Error"
,
err
)
context
.
Status
(
http
.
StatusInternalServerError
)
}
var
responseObjects
=
make
([]
ConnectionResponse
,
0
)
for
_
,
x
:=
range
connections
{
doc
,
_
:=
app
.
mediator
.
DidResolver
.
ResolveDidAsJson
(
x
.
RemoteDid
)
response
:=
ConnectionResponse
{
Mediatee
:
x
,
DidDoc
:
doc
,
}
responseObjects
=
append
(
responseObjects
,
response
)
}
config
.
Logger
.
Info
(
logTag
,
"End"
,
true
)
context
.
JSON
(
http
.
StatusOK
,
connections
)
context
.
JSON
(
http
.
StatusOK
,
responseObjects
)
}
...
...
@@ -67,8 +88,16 @@ func (app *application) GetConnection(context *gin.Context) {
context
.
Status
(
http
.
StatusInternalServerError
)
return
}
doc
,
_
:=
app
.
mediator
.
DidResolver
.
ResolveDidAsJson
(
did
)
response
:=
ConnectionResponse
{
Mediatee
:
*
connection
,
DidDoc
:
doc
,
}
config
.
Logger
.
Info
(
logTag
,
"End"
,
true
)
context
.
IndentedJSON
(
http
.
StatusOK
,
connection
)
context
.
IndentedJSON
(
http
.
StatusOK
,
response
)
}
// @Summary Create a new connection
...
...
This diff is collapsed.
Click to expand it.
mediator/didcommResolver.go
+
24
−
0
View file @
768adcac
...
...
@@ -68,6 +68,7 @@ type DidResolutionMetadataJSON struct {
type
DidResolver
interface
{
Resolve
(
did
string
,
cb
*
didcomm
.
OnDidResolverResult
)
didcomm
.
ErrorCode
ResolveDid
(
did
string
)
(
*
didcomm
.
DidDoc
,
error
)
ResolveDidAsJson
(
did
string
)
(
*
DidDocumentJSON
,
error
)
}
type
UniverseDidResolver
struct
{
...
...
@@ -121,6 +122,29 @@ func (u *UniverseDidResolver) ResolveDid(did string) (*didcomm.DidDoc, error) {
return
didDoc
,
nil
}
func
(
u
*
UniverseDidResolver
)
ResolveDidAsJson
(
did
string
)
(
*
DidDocumentJSON
,
error
)
{
queryUrl
,
err
:=
url
.
JoinPath
(
config
.
CurrentConfiguration
.
DidComm
.
ResolverUrl
,
"/1.0/identifiers/"
,
did
)
if
err
!=
nil
{
return
nil
,
err
}
resp
,
err
:=
http
.
Get
(
queryUrl
)
if
err
!=
nil
{
return
nil
,
err
}
defer
resp
.
Body
.
Close
()
body
,
err
:=
io
.
ReadAll
(
resp
.
Body
)
if
err
!=
nil
{
return
nil
,
err
}
var
didDocJSON
DidDocumentJSON
err
=
json
.
Unmarshal
(
body
,
&
didDocJSON
)
if
err
!=
nil
{
config
.
Logger
.
Error
(
"Unmarshaling has failed:"
,
"err"
,
err
)
return
nil
,
err
}
return
&
didDocJSON
,
nil
}
func
(
u
*
UniverseDidResolver
)
didDocJsonToDidDoc
(
ddJson
DidDocumentJSON
)
*
didcomm
.
DidDoc
{
// Convert VerificationMethods
var
VerificationMethods
[]
didcomm
.
VerificationMethod
=
make
([]
didcomm
.
VerificationMethod
,
len
(
ddJson
.
DidDocument
.
VerificationMethod
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment