Skip to content

Commit

Permalink
fix: use new oob instead of connections
Browse files Browse the repository at this point in the history
It fixes changes after rebase

Signed-off-by: Jakub Koci <[email protected]>
  • Loading branch information
jakubkoci committed Apr 21, 2022
1 parent 1a904f1 commit 3576024
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/agent/MessageReceiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class MessageReceiver {
if (this.isEncryptedMessage(inboundMessage)) {
await this.receiveEncryptedMessage(inboundMessage as EncryptedMessage, session)
} else if (this.isPlaintextMessage(inboundMessage)) {
await this.receivePlaintextMessage(inboundMessage)
await this.receivePlaintextMessage(inboundMessage, connection)
} else {
throw new AriesFrameworkError('Unable to parse incoming message: unrecognized format')
}
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import 'reflect-metadata'

export { Agent } from './agent/Agent'
export { BaseEvent } from './agent/Events'
export { EventEmitter } from './agent/EventEmitter'
export { Handler, HandlerInboundMessage } from './agent/Handler'
export { InboundMessageContext } from './agent/models/InboundMessageContext'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,10 @@ export class ConnectionService {
)
}

const theirDidRecord = await this.didRepository.findSingleByQuery({ did: connectionRecord.theirDid })
const theirDidRecord = connectionRecord.theirDid && (await this.didRepository.findById(connectionRecord.theirDid))
if (!theirDidRecord) {
throw new AriesFrameworkError(`Did record with id ${connectionRecord.theirDid} not found.`)
}

if (senderVerkey) {
if (!theirDidRecord?.getTags().recipientKeys?.includes(senderVerkey)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/modules/dids/DidsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ export class DidsModule {
}

public findByDid(did: string) {
return this.didRepository.findSingleByQuery({ did })
return this.didRepository.findById(did)
}
}
7 changes: 5 additions & 2 deletions samples/extension-module/requester.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { DummyRecord, DummyStateChangedEvent } from './dummy'

import { Agent, ConsoleLogger, LogLevel, WsOutboundTransport } from '@aries-framework/core'
import { Agent, AriesFrameworkError, ConsoleLogger, LogLevel, WsOutboundTransport } from '@aries-framework/core'
import { agentDependencies } from '@aries-framework/node'
import { filter, first, firstValueFrom, map, ReplaySubject, timeout } from 'rxjs'

Expand Down Expand Up @@ -38,7 +38,10 @@ const run = async () => {

// Connect to responder using its invitation endpoint
const invitationUrl = await (await agentDependencies.fetch(`http://localhost:${port}/invitation`)).text()
const connection = await agent.connections.receiveInvitationFromUrl(invitationUrl)
const { connectionRecord: connection } = await agent.oob.receiveInvitationFromUrl(invitationUrl)
if (!connection) {
throw new AriesFrameworkError('Connection record for out-of-band invitation was not created.')
}
await agent.connections.returnWhenIsConnected(connection.id)

// Create observable for Response Received event
Expand Down
4 changes: 2 additions & 2 deletions samples/extension-module/responder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ const run = async () => {

// Allow to create invitation, no other way to ask for invitation yet
app.get('/invitation', async (req, res) => {
const { invitation } = await agent.connections.createConnection()
res.send(invitation.toUrl({ domain: `http://localhost:${port}/invitation` }))
const { outOfBandMessage } = await agent.oob.createInvitation()
res.send(outOfBandMessage.toUrl({ domain: `http://localhost:${port}/invitation` }))
})

// Inject DummyModule
Expand Down

0 comments on commit 3576024

Please sign in to comment.