Responded to @kasparsd:
Here is a good example of such an API in the AI Services plugin by Felix Arntz https://github.com/felixarntz/ai-services/blob/main/includes/Services/Options/Option_Encrypter.php
One major challange is how to store the secrets without asking users to modify files on the server to add the private keys as constants.