storeConversationEntry method

Future<void> storeConversationEntry(
  1. DidcommPlaintextMessage message,
  2. String myDid
)

Implementation

Future<void> storeConversationEntry(
    DidcommPlaintextMessage message, String myDid) async {
  String thid = message.threadId ?? message.id;

  DidcommProtocol protocol;
  if (message.type.contains('issue-credential')) {
    protocol = DidcommProtocol.issueCredential;
  } else if (message.type.contains('present-proof')) {
    protocol = DidcommProtocol.presentProof;
  } else if (message.type.contains('discover-features')) {
    protocol = DidcommProtocol.discoverFeature;
  } else if (message.type.contains('invitation')) {
    protocol = DidcommProtocol.invitation;
  } else if (message.type.contains('request-presentation')) {
    protocol = DidcommProtocol.requestPresentation;
  } else {
    throw Exception('unsupported Protocol');
  }

  await _didcommConversations!.put(
      thid, DidcommConversation(message.toString(), protocol.value, myDid));
}