cmd/wallet-js-sdk/test/specs/mocks/adapters.js
/**
 * Extracts Presentation JSON object from Message map based on DIDComm V1 or V2 formats.
 *
 * @param Message map instance
 */
Extracts Presentation JSON object from Message map based on DIDComm V1 or V2 formats.
@param Message map instance
Extracts Presentation JSON object from Message map based on DIDComm V1 or V2 formats . @param Message map instance
function extractPresentation(Message) {
  let presentation;
  if (Message["presentations~attach"]) {
    presentation = Message["presentations~attach"][0].data.json;
    console.log("didcomm v1 found");
  } else if (Message["attachments"]) {
    presentation = Message["attachments"][0].data.json;
    console.log("didcomm v2 found");
  } else {
    console.error(
      "unrecognized presentation object: '" +
        JSON.stringify(Message, undefined, 2) +
        "'"
    );
  }
  return presentation;
}
function extractPresentation ( Message ) { let presentation ; if ( Message [ "presentations~attach" ] ) { presentation = Message [ "presentations~attach" ] [ 0 ] . data . json ; console . log ( "didcomm v1 found" ) ; } else if ( Message [ "attachments" ] ) { presentation = Message [ "attachments" ] [ 0 ] . data . json ; console . log ( "didcomm v2 found" ) ; } else { console . error ( "unrecognized presentation object: '" + JSON . stringify ( Message , undefined , 2 ) + "'" ) ; } return presentation ; }
Extracts Presentation JSON object from Message map based on DIDComm V1 or V2 formats.
Extracts Presentation JSON object from Message map based on DIDComm V1 or V2 formats .
// didcomm v1 // didcomm v2