This is up to app developers to implement themselves. The mechanism Apple provides for this is UNNotificationServiceExtension, which allows an app to step in before a notification is delivered so that it can do things like decrypt it.
https://developer.apple.com/documentation/usernotifications/...