diff --git a/packages/legacy/core/App/navigators/RootStack.tsx b/packages/legacy/core/App/navigators/RootStack.tsx index 96d884cae5..32471fcf05 100644 --- a/packages/legacy/core/App/navigators/RootStack.tsx +++ b/packages/legacy/core/App/navigators/RootStack.tsx @@ -75,7 +75,7 @@ const RootStack: React.FC = () => { const connectionRecord = await connectFromInvitation(deepLink, agent) navigation.navigate(Stacks.ConnectionStack as any, { screen: Screens.Connection, - params: { connectionId: connectionRecord.id }, + params: { connectionId: connectionRecord?.connectionRecord?.id }, }) } catch { try { diff --git a/packages/legacy/core/App/screens/Scan.tsx b/packages/legacy/core/App/screens/Scan.tsx index b61e894f7f..a04b04ecaf 100644 --- a/packages/legacy/core/App/screens/Scan.tsx +++ b/packages/legacy/core/App/screens/Scan.tsx @@ -36,11 +36,23 @@ const Scan: React.FC = ({ navigation, route }) => { const handleInvitation = async (value: string): Promise => { try { const connectionRecord = await connectFromInvitation(value, agent) - navigation.getParent()?.navigate(Stacks.ConnectionStack, { - screen: Screens.Connection, - params: { connectionId: connectionRecord.id }, - }) + if (connectionRecord?.connectionRecord?.id) { + // not connectionless + navigation.getParent()?.navigate(Stacks.ConnectionStack, { + screen: Screens.Connection, + params: { connectionId: connectionRecord.connectionRecord.id }, + }) + } else { + //connectionless + //const invitation = await agent?.oob.parseInvitation(value) + navigation.navigate(Stacks.ConnectionStack as any, { + screen: Screens.Connection, + params: { threadId: connectionRecord?.outOfBandRecord.outOfBandInvitation.threadId }, + }) + } } catch (err: unknown) { + // [Error: Connection does not have an ID] + // [AriesFrameworkError: An out of band record with invitation 05fe3693-2c12-4165-a3b6-370280ccd43b has already been received. Invitations should have a unique id.] try { // if scanned value is json -> pass into AFJ as is const json = getJson(value) diff --git a/packages/legacy/core/App/utils/helpers.ts b/packages/legacy/core/App/utils/helpers.ts index 98d894f75f..f32a2bb2fc 100644 --- a/packages/legacy/core/App/utils/helpers.ts +++ b/packages/legacy/core/App/utils/helpers.ts @@ -546,12 +546,8 @@ export const connectFromInvitation = async (uri: string, agent: Agent | undefine } const record = await agent?.oob.receiveInvitation(invitation) - const connectionRecord = record?.connectionRecord - if (!connectionRecord?.id) { - throw new Error('Connection does not have an ID') - } - return connectionRecord + return record } /**