getConversationDid function
String?
getConversationDid(
- DidcommPlaintextMessage message,
- WalletStore wallet, {
- bool throwIfNotFound = false,
tries to load a conversation given the message
if not found, an DidcommServiceException is thrown if throwIfNotFound
Implementation
String? getConversationDid(DidcommPlaintextMessage message, WalletStore wallet,
{bool throwIfNotFound = false}) {
String threadId = message.threadId ?? message.id;
var conversation = wallet.getConversationEntry(threadId);
if (conversation == null) {
if (throwIfNotFound) {
throw DidcommServiceException(
"Could not find conversation for threadId `$threadId`",
code: 45093450);
}
return null;
}
return conversation.myDid;
}