Dynamic custom secrets plugin implementation

I’m trying to implement a custom secrets plugin to store API credentials. The plugin needs to communicate with our API management platform and generate new keys after the expiration of existing ones.

I was able to create a simple plugin based on this tutorial that can create and update keys. Currently, the plugin stores them in a basic KV store as demonstrated in the tutorial. However, I would like to dynamically update the keys based on a TTL value rather than invoking a command.

Any suggestions or documentation on how to go about this would be helpful.