Skip to main content

Respond to a presentation

Open a presentation request DIDComm message


import { isPresentationRequestJwm } from "wallet-sdk-react-native";
const openResult = await wallet.did.messaging.openDidCommMessage(message);

if (openResult.isErr() || !isPresentationRequestJwm(openResult.value)) {
return;
}

const presentationRequest = openResult.value;

Look up for matching credentials


const credentialData = [
{ id: "a", credential: credentialA },
{ id: "b", credential: credentialB },
];

const filterResult = await wallet.credential.webSemantic.filterCredentialsByQuery({ credentials: credentialData });

Create and send presentation


const createPresentationResult = await wallet.credential.webSemantic.createPresentation({
challenge: presentationRequest.body.challenge,
domain: presentationRequest.body.domain,
credentials,
holder: did,
});


if (createPresentationResult.isErr()) {
// Handle error from createPresentationResult.error
return;
}

const presentaiton = createPresentationResult.value;

const sendPresentationResult = await wallet.credential.webSemantic.sendPresentationResponse({
presentationRequest,
presentation,
});

tip

Find the comprehensive SDK interfaces for these examples and others in the documentation https://github.com/mattrglobal/docs-wallet-sdk. Get in touch if you wish to find out more about using the Wallet SDK in production.