Respond to a presentation

Open a presentation request DIDComm message 

typescript
Copy to clipboard.
1import { isPresentationRequestJwm } from "wallet-sdk-react-native";
2const openResult = await wallet.did.messaging.openDidCommMessage(message);
3
4if (openResult.isErr() || !isPresentationRequestJwm(openResult.value)) {
5    return;
6}
7
8const presentationRequest = openResult.value; 

Look up for matching credentials 

typescript
Copy to clipboard.
1const credentialData = [
2    { id: "a", credential: credentialA },
3    { id: "b", credential: credentialB },
4];
5
6const filterResult = await wallet.credential.webSemantic.filterCredentialsByQuery({ credentials: credentialData }); 

Create and send presentation 

typescript
Copy to clipboard.
1const createPresentationResult = await wallet.credential.webSemantic.createPresentation({
2    challenge: presentationRequest.body.challenge,
3    domain: presentationRequest.body.domain,
4    credentials,
5    holder: did,
6});
7
8
9if (createPresentationResult.isErr()) {
10    // Handle error from createPresentationResult.error 
11    return;
12}
13
14const presentaiton = createPresentationResult.value;
15
16const sendPresentationResult = await wallet.credential.webSemantic.sendPresentationResponse({
17    presentationRequest,
18    presentation,
19});

Find the comprehensive SDK interfaces for these examples and others in our Wallet SDK Docs.

Get in touch if you wish to find out more about using the Wallet SDK in production.