Skip to content

Commit

Permalink
Remove POST connection (#74)
Browse files Browse the repository at this point in the history
* remove post connections

* use post connections instead of impl inv
  • Loading branch information
jonmattgray authored May 23, 2024
1 parent 86613f9 commit 5ef8244
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 180 deletions.
2 changes: 1 addition & 1 deletion backend-peer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@digicatapult/nice-agent-portal-backend-peer",
"version": "0.2.5",
"version": "0.3.0",
"description": "OpenAPI service to manage profiles for the NICE agent and communication with veritable-cloudagent",
"main": "src/index.ts",
"type": "module",
Expand Down
42 changes: 0 additions & 42 deletions backend-peer/src/controllers/connection/index.ts

This file was deleted.

5 changes: 1 addition & 4 deletions backend-peer/src/controllers/messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ export class MessagesController extends Controller {

if (connectionId === undefined) {
//create a connection if one does not exist
const connectionRecord = await this.cloudagent.receiveImplicitInvitation(
did,
true
)
const connectionRecord = await this.cloudagent.createConnection(did, true)
if (!connectionRecord) {
throw new Error('Failed to create connection record.') // Handle the case where connectionRecord is undefined
}
Expand Down
21 changes: 6 additions & 15 deletions backend-peer/src/lib/services/cloudagent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,15 @@ export class CloudagentManager {
return agentInfo as AgentInfo
}

receiveImplicitInvitation = async (
createConnection = async (
did: string,
waitUntilCompleted: boolean = false
) => {
const requestBody = {
did,
handshakeProtocols: ['https://didcomm.org/connections/1.x'],
autoAcceptConnection: true,
}

const res = await wrappedFetch(
`${this.url_prefix}/oob/receive-implicit-invitation`,
{
headers: { 'Content-Type': 'application/json' },
body: requestBody,
method: 'POST',
}
)
const res = await wrappedFetch(`${this.url_prefix}/connections`, {
headers: { 'Content-Type': 'application/json' },
body: { did },
method: 'POST',
})

const responseBody = await res.json()

Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@digicatapult/nice-agent-portal",
"version": "0.2.8",
"version": "0.3.0",
"description": "NICE agent portal",
"homepage": "https://github.com/digicatapult/nice-agent-portal",
"type": "module",
Expand Down
114 changes: 0 additions & 114 deletions test/e2e/connection.test.ts

This file was deleted.

0 comments on commit 5ef8244

Please sign in to comment.