-
Notifications
You must be signed in to change notification settings - Fork 27
Description
While trying to implement NIP-42, I noticed some limitations with the current code.
NIP-42 expects the client to reply with a signed auth event when receiving an AUTH-message from a relay. Currently, this takes place in the onAuth method here.
However, to sign the event, you need to have access to the private key, which is not available in that class at the moment.
I have therefore introduced the concept of Context classes, where I store contextual information, including the private key. The context is created in the api module when instantiating a client object, passed along to the other modules, and is now available in the OnAuth command handler.
Additional major changes (Branch 0.6-SNAPSHOT):
- I noticed that for every request to a relay, we would open a new connection. This is not good. I have now created a ConnectionPool to keep track of the connections, and ensure that we only have one connection per relay.
- One other change I have made is that I now have, for each relay command, e.g. Ok, Eose, Auth, Closed etc, a separate handler class, instead of a unique command handler class with a method for each command.
- You will notice I have also renamed, added, removed a few modules. Hopefully this is more intuitive and cleaner.
- etc.
I welcome your opinions and suggestions on this.
NOW, the Problem I am facing, is that the ServiceLoader is not instantiating the handler classes (See here).
I need a second pair of eyes to review and hopefully find what is missing, and why it's not working.
Could you please have a look when you have a moment?
Thanks!