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

fix: connection not deleted after connectionless proof #995

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
3 changes: 3 additions & 0 deletions packages/legacy/core/App/screens/ProofDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ const ProofDetails: React.FC<ProofDetailsProps> = ({ 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 ?? '')
}
}
}, [])

Expand Down
12 changes: 11 additions & 1 deletion packages/legacy/core/App/screens/ProofRequesting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -154,6 +161,9 @@ const ProofRequesting: React.FC<ProofRequestingProps> = ({ 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)
Expand Down
1 change: 1 addition & 0 deletions packages/legacy/core/verifier/types/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export enum ProofMetadata {
export interface ProofCustomMetadata {
details_seen?: boolean
proof_request_template_id?: string
delete_conn_after_seen?: boolean
}