diff --git a/packages/legacy/core/App/screens/ProofDetails.tsx b/packages/legacy/core/App/screens/ProofDetails.tsx index 08ab19935e..d2109cbeb3 100644 --- a/packages/legacy/core/App/screens/ProofDetails.tsx +++ b/packages/legacy/core/App/screens/ProofDetails.tsx @@ -275,6 +275,9 @@ const ProofDetails: React.FC = ({ route, navigation }) => { if (!store.preferences.useDataRetention) { agent?.proofs.deleteById(recordId) } + if ((record?.metadata.get(ProofMetadata.customMetadata) as ProofCustomMetadata).delete_conn_after_seen) { + agent?.connections.deleteById(record?.connectionId ?? '') + } } }, []) diff --git a/packages/legacy/core/App/screens/ProofRequesting.tsx b/packages/legacy/core/App/screens/ProofRequesting.tsx index 9a672c2477..0736881c04 100644 --- a/packages/legacy/core/App/screens/ProofRequesting.tsx +++ b/packages/legacy/core/App/screens/ProofRequesting.tsx @@ -9,7 +9,14 @@ import { useTranslation } from 'react-i18next' import { BackHandler, DeviceEventEmitter, useWindowDimensions, ScrollView, StyleSheet, Text, View } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' -import { isPresentationFailed, isPresentationReceived, linkProofWithTemplate, sendProofRequest } from '../../verifier' +import { + ProofCustomMetadata, + ProofMetadata, + isPresentationFailed, + isPresentationReceived, + linkProofWithTemplate, + sendProofRequest, +} from '../../verifier' import LoadingIndicator from '../components/animated/LoadingIndicator' import Button, { ButtonType } from '../components/buttons/Button' import QRRenderer from '../components/misc/QRRenderer' @@ -154,6 +161,9 @@ const ProofRequesting: React.FC = ({ route, navigation }) // send proof logic const result = await sendProofRequest(agent, template, record.id, predicateValues) if (result?.proofRecord) { + // verifier side doesn't have access to the goal code so we need to add metadata here + const metadata = result.proofRecord.metadata.get(ProofMetadata.customMetadata) as ProofCustomMetadata + result.proofRecord.metadata.set(ProofMetadata.customMetadata, { ...metadata, delete_conn_after_seen: true }) linkProofWithTemplate(agent, result.proofRecord, templateId) } setProofRecordId(result?.proofRecord.id) diff --git a/packages/legacy/core/verifier/types/metadata.ts b/packages/legacy/core/verifier/types/metadata.ts index fce32e7d96..a37658055d 100644 --- a/packages/legacy/core/verifier/types/metadata.ts +++ b/packages/legacy/core/verifier/types/metadata.ts @@ -5,4 +5,5 @@ export enum ProofMetadata { export interface ProofCustomMetadata { details_seen?: boolean proof_request_template_id?: string + delete_conn_after_seen?: boolean }