Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Wallet part of the https deeplinking #82

Merged
merged 7 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions apps/expo/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const invitationSchemes = [
'didcomm',
]

const associatedDomains = ['paradym.id', 'dev.paradym.id']

/**
* @type {import('@expo/config-types').ExpoConfig}
*/
Expand Down Expand Up @@ -77,6 +79,7 @@ const config = {
},
],
},
associatedDomains: associatedDomains.map((host) => 'applinks:' + host),
},
android: {
adaptiveIcon: {
Expand All @@ -92,6 +95,16 @@ const config = {
scheme,
},
})),
...associatedDomains.map((host) => ({
action: 'VIEW',
category: ['DEFAULT', 'BROWSABLE'],
autoVerify: true,
data: {
scheme: 'https',
host,
pathPrefix: '/invitation',
},
})),
],
},
extra: {
Expand Down
16 changes: 13 additions & 3 deletions apps/expo/app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { AppAgent } from '@internal/agent'

import {
setupMediationWithDid,
AgentProvider,
hasMediationConfigured,
initializeAgent,
setupMediationWithDid,
useMessagePickup,
} from '@internal/agent'
import { config, Heading, Page, Paragraph, useToastController, XStack, YStack } from '@internal/ui'
Expand All @@ -15,7 +15,7 @@ import { Provider } from 'app/provider'
import { NoInternetToastProvider } from 'app/provider/NoInternetToastProvider'
import { isAndroid } from 'app/utils/platform'
import { useFonts } from 'expo-font'
import { Stack, SplashScreen } from 'expo-router'
import { SplashScreen, Stack } from 'expo-router'
import { useEffect, useState } from 'react'
import { useSafeAreaInsets } from 'react-native-safe-area-context'

Expand Down Expand Up @@ -64,8 +64,8 @@ export default function HomeLayout() {
if (!walletKey) return

const agent = await initializeAgent(walletKey).catch(() => {
toast.show('Could not initialize agent.')
setAgentInitializationFailed(true)
toast.show('Could not initialize agent.')
})
if (!agent) return

Expand Down Expand Up @@ -143,6 +143,16 @@ export default function HomeLayout() {
<NoInternetToastProvider>
<DeeplinkHandler>
<Stack screenOptions={{ headerShown: false }}>
{/**
* Workaround:
* The following screens are not rendered by the router.
* They are used to prevent the internal route to be executed.
* So now they are being redirected to the home screen. So the user will not see a 404.
**/}
<Stack.Screen name="invitation/[id]" redirect />
<Stack.Screen name="https/[...dummy]" redirect />
<Stack.Screen name="http/[...dummy]" redirect />

<Stack.Screen
options={{
presentation: 'modal',
Expand Down
5 changes: 5 additions & 0 deletions apps/expo/app/http/[...dummy].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Workaround: To prevent the routing of the deeplinks

export default function Screen() {
return <span></span>
}
5 changes: 5 additions & 0 deletions apps/expo/app/https/[...dummy].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Workaround: To prevent the routing of the deeplinks

export default function Screen() {
return <span></span>
}
5 changes: 5 additions & 0 deletions apps/expo/app/invitation/[id].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Workaround: To prevent the routing of the deeplinks

export default function Screen() {
return <span></span>
}
1 change: 1 addition & 0 deletions packages/agent/src/parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export enum QrTypes {
OPENID = 'openid://',
OPENID_VC = 'openid-vc://',
DIDCOMM = 'didcomm://',
HTTPS = 'https://',
janrtvld marked this conversation as resolved.
Show resolved Hide resolved
}

export const isOpenIdCredentialOffer = (url: string) => {
Expand Down