execute method
Implementation
Future<DidcommMessage?> execute(DidcommMessage message) {
var plainTextMessage = message as DidcommPlaintextMessage;
if (needsConnectionDid && connectionDid == null) {
throw DidcommServiceException(
"Handler for ${plainTextMessage.type} needs a connection did.",
code: 3249823);
}
if (needsCredentialDid && credentialDid == null) {
throw DidcommServiceException(
"Handler for ${plainTextMessage.type} needs a credential did.",
code: 23498239402);
}
if (needsWallet && wallet == null) {
throw DidcommServiceException(
"Handler for ${plainTextMessage.type} needs a wallet.",
code: 823490835);
}
if (needsReplyTo && (replyTo == null || replyTo!.isEmpty)) {
throw DidcommServiceException(
"Handler for ${plainTextMessage.type} needs a replyTo.",
code: 9583490);
}
if (!supportedTypes.contains(plainTextMessage.type)) {
throw DidcommServiceException(
"Handler cannot handle ${plainTextMessage.type} messages.",
code: 234238920);
}
return handle(message);
}