decryptMessage function

Future<DidcommMessage> decryptMessage(
  1. Map<String, dynamic> encryptedMessage,
  2. WalletStore wallet
)

will decrypt a message and return the decrypted message

Implementation

Future<DidcommMessage> decryptMessage(
    Map<String, dynamic> encryptedMessage, WalletStore wallet) async {
  try {
    var encrypted = DidcommEncryptedMessage.fromJson(encryptedMessage);
    return await encrypted.decrypt(wallet);
  } on Exception catch (e) {
    throw DidcommServiceException(
        "Could not decrypt Didcomm message due to ${e.toString()}",
        baseException: e,
        code: 9823904);
  }
}