diff --git a/apps/easypid/index.ts b/apps/easypid/index.ts index 67000ccb..fc8a77fb 100644 --- a/apps/easypid/index.ts +++ b/apps/easypid/index.ts @@ -1 +1,2 @@ +import 'fast-text-encoding' import 'expo-router/entry' diff --git a/apps/easypid/package.json b/apps/easypid/package.json index 1dbca974..7b80551b 100644 --- a/apps/easypid/package.json +++ b/apps/easypid/package.json @@ -14,6 +14,7 @@ "@animo-id/expo-ausweis-sdk": "catalog:", "@animo-id/expo-mdoc-data-transfer": "catalog:", "@animo-id/expo-secure-environment": "catalog:", + "@animo-id/mdoc": "catalog:", "@credo-ts/core": "catalog:", "@expo-google-fonts/open-sans": "^0.2.3", "@expo-google-fonts/raleway": "^0.2.3", @@ -26,7 +27,6 @@ "@package/secure-store": "workspace:*", "@package/ui": "workspace:*", "@package/utils": "workspace:*", - "@animo-id/mdoc": "catalog:", "@react-native-community/blur": "^4.3.2", "@react-native-community/netinfo": "11.3.1", "@react-native-masked-view/masked-view": "0.3.1", @@ -51,6 +51,7 @@ "expo-system-ui": "~3.0.6", "expo-updates": "~0.25.16", "expo-web-browser": "~13.0.3", + "fast-text-encoding": "^1.0.6", "react": "catalog:", "react-native": "catalog:", "react-native-argon2": "^2.0.1", diff --git a/apps/easypid/src/app/+native-intent.tsx b/apps/easypid/src/app/+native-intent.tsx index 82366ec1..60e24862 100644 --- a/apps/easypid/src/app/+native-intent.tsx +++ b/apps/easypid/src/app/+native-intent.tsx @@ -1,3 +1,5 @@ +import 'fast-text-encoding' + import { parseInvitationUrl } from '@package/agent' import { deeplinkSchemes } from '@package/app' import * as Haptics from 'expo-haptics' diff --git a/apps/easypid/src/app/_layout.tsx b/apps/easypid/src/app/_layout.tsx index 68169ce7..0fcb2642 100644 --- a/apps/easypid/src/app/_layout.tsx +++ b/apps/easypid/src/app/_layout.tsx @@ -1,3 +1,5 @@ +import 'fast-text-encoding' + import { BackgroundLockProvider, NoInternetToastProvider, Provider, useTransparentNavigationBar } from '@package/app' import { SecureUnlockProvider } from '@package/secure-store/secureUnlock' import { DefaultTheme, ThemeProvider } from '@react-navigation/native' diff --git a/apps/easypid/src/features/proximity/mdocProximity.ts b/apps/easypid/src/features/proximity/mdocProximity.ts index 4d228e96..9a488ba8 100644 --- a/apps/easypid/src/features/proximity/mdocProximity.ts +++ b/apps/easypid/src/features/proximity/mdocProximity.ts @@ -47,6 +47,7 @@ export const checkMdocPermissions = async () => { export const getMdocQrCode = async () => { const mdt = requireMdocDataTransfer().mdocDataTransfer.instance() + mdt.enableNfc() const qrData = await mdt.startQrEngagement() return qrData } @@ -118,3 +119,8 @@ export const shareDeviceResponse = async (options: ShareDeviceResponseOptions) = await mdt.sendDeviceResponse(deviceResponse.encode()) } + +export const shutdownDataTransfer = () => { + const mdt = requireMdocDataTransfer().mdocDataTransfer.instance() + mdt.shutdown() +} diff --git a/apps/easypid/src/features/share/FunkeMdocOfflineSharingScreen.tsx b/apps/easypid/src/features/share/FunkeMdocOfflineSharingScreen.tsx index fd8ce879..002b52ff 100644 --- a/apps/easypid/src/features/share/FunkeMdocOfflineSharingScreen.tsx +++ b/apps/easypid/src/features/share/FunkeMdocOfflineSharingScreen.tsx @@ -4,7 +4,7 @@ import { usePushToWallet } from '@package/app/src/hooks/usePushToWallet' import { useToastController } from '@package/ui' import { useEffect, useState } from 'react' import { type ActivityStatus, addSharedActivityForCredentialsForRequest } from '../activity/activityRecord' -import { shareDeviceResponse } from '../proximity' +import { shareDeviceResponse, shutdownDataTransfer } from '../proximity' import { FunkeOfflineSharingScreen } from './FunkeOfflineSharingScreen' import type { PresentationRequestResult } from './components/utils' @@ -101,10 +101,16 @@ export function FunkeMdocOfflineSharingScreen({ setIsProcessing(false) + shutdownDataTransfer() pushToWallet() toast.show('Proof has been declined.', { customData: { preset: 'danger' } }) } + const onProofComplete = () => { + shutdownDataTransfer() + pushToWallet('replace') + } + const addActivity = async (status: ActivityStatus) => { if (!submission) return await addSharedActivityForCredentialsForRequest( @@ -129,7 +135,7 @@ export function FunkeMdocOfflineSharingScreen({ submission={submission} onAccept={onProofAccept} onDecline={onProofDecline} - onComplete={() => pushToWallet('replace')} + onComplete={onProofComplete} /> ) } diff --git a/packages/agent/src/index.ts b/packages/agent/src/index.ts index a9bc1c07..a025bbf9 100644 --- a/packages/agent/src/index.ts +++ b/packages/agent/src/index.ts @@ -1,5 +1,4 @@ import 'react-native-get-random-values' -import 'fast-text-encoding' import { Buffer } from '@credo-ts/core' export { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dcaad75a..1f7a5802 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,8 +10,8 @@ catalogs: specifier: 0.0.1-alpha.14 version: 0.0.1-alpha.14 '@animo-id/expo-mdoc-data-transfer': - specifier: 0.0.3-alpha.7 - version: 0.0.3-alpha.7 + specifier: 0.0.3-alpha.8 + version: 0.0.3-alpha.8 '@animo-id/expo-secure-environment': specifier: 0.1.0-alpha.11 version: 0.1.0-alpha.11 @@ -98,7 +98,7 @@ importers: version: 0.0.1-alpha.14(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0)))(react-native@0.74.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.2.79)(react@18.3.1))(react@18.3.1) '@animo-id/expo-mdoc-data-transfer': specifier: 'catalog:' - version: 0.0.3-alpha.7(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@13.6.9)(@types/react@18.2.79)(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0)))(react@18.3.1) + version: 0.0.3-alpha.8(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@13.6.9)(@types/react@18.2.79)(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0)))(react@18.3.1) '@animo-id/expo-secure-environment': specifier: 'catalog:' version: 0.1.0-alpha.11(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0)))(react-native@0.74.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.2.79)(react@18.3.1))(react@18.3.1) @@ -213,6 +213,9 @@ importers: expo-web-browser: specifier: ~13.0.3 version: 13.0.3(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))) + fast-text-encoding: + specifier: ^1.0.6 + version: 1.0.6 react: specifier: 'catalog:' version: 18.3.1 @@ -814,8 +817,8 @@ packages: react: '*' react-native: '*' - '@animo-id/expo-mdoc-data-transfer@0.0.3-alpha.7': - resolution: {integrity: sha512-owHGj02XzGeBsHLi8ZJyN8AiiS4rgO22oFlKuZPyrmylUemz15CzB2tnIa8W1KKM7MnCrWXENFV5a6VC/gLqag==} + '@animo-id/expo-mdoc-data-transfer@0.0.3-alpha.8': + resolution: {integrity: sha512-UmjgDagxpxcY+jeS2gHFEP5krKrgICx72WLzfSwsRIdDVXnPehKofjQegQ2IQ0rechrW+XgBxA1TEriXIbyy+g==} peerDependencies: expo: '>= 51' react: '*' @@ -9900,9 +9903,9 @@ snapshots: transitivePeerDependencies: - supports-color - '@animo-id/expo-mdoc-data-transfer@0.0.3-alpha.7(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@13.6.9)(@types/react@18.2.79)(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0)))(react@18.3.1)': + '@animo-id/expo-mdoc-data-transfer@0.0.3-alpha.8(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@13.6.9)(@types/react@18.2.79)(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0)))(react@18.3.1)': dependencies: - '@expo/config-plugins': 8.0.10 + '@expo/config-plugins': 8.0.11 expo: 51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0)) react: 18.3.1 react-native: 0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@13.6.9)(@types/react@18.2.79)(react@18.3.1) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 7c44fd7a..6fd53585 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -31,9 +31,9 @@ catalog: "@animo-id/oauth2": 0.1.4 "@animo-id/oauth2-utils": 0.1.4 "@animo-id/expo-secure-environment": 0.1.0-alpha.11 - "@animo-id/expo-mdoc-data-transfer": 0.0.3-alpha.7 + "@animo-id/expo-mdoc-data-transfer": 0.0.3-alpha.8 "@animo-id/mdoc": 0.2.39 "@unimodules/react-native-adapter": "./noop" "@unimodules/core": "./noop" expo: ~51.0.39 - "@sphereon/pex-models": 2.3.2 \ No newline at end of file + "@sphereon/pex-models": 2.3.2