Generating and retrieving user API keys

Hi,

We’re rolling out an self-hosted Discourse server, using the frontend internally as a CMS and serving up various user features via the API. We’re a web3 company, so we are going to build a crypto-wallet authentication feature that provides similar functionality to the Sign-on with Ethereum.

Our current plan is to use a Keycloak Oath server to validate a user’s pubkey (unique ID) and map that to a non-routable email domain for the Discourse ID. I know we can create users via the API, and we don’t plan on letting the users ever login to the app directly, but I’m not sure if this is something that we can handle using DiscourseConnect or other plugins.

As far as user interactions, we had planned on setting and retrieving an API key on behalf of the user and storing it in their browser session, and passing the API key to the REST front end to post messages. One possible avenue we have is to interact with the backend DB directly through some middleware, but I’m hoping their might be a more idiomatic way of achieving this.

Thanks for any feedback!