-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libqaul
Service API
#247
libqaul
Service API
#247
Conversation
f58a2a2
to
df57527
Compare
Sync vs Async i feel waiting for Registering Services? So if i'm understanding this correctly services would be authorized per user? i'm wondering if there's a use for a more fine grained permission system, also in the OAuth direction, where for example you could authorize an application to view your profile but not delete it. That might add too much complexity though. HTTP API i'm presently structuring the api such that each service should be able to provide it's own section of it so i don't imagine this service api being exposed at all. |
On 19-06-26 07:47, Jess wrote:
**Registering Services?** So if i'm understanding this correctly services would be authorized per user? i'm wondering if there's a use for a more fine grained permission system, also in the OAuth direction, where for example you could authorize an application to view your profile but not delete it. That might add too much complexity though.
I actually kinda really like this idea. Especially when it comes to
dealing with potentially malicious services, this could also prevent
some damage. It's probably out of scope for now, but something we
should definitely have on the roadmap!
**HTTP API** i'm presently structuring the api such that each service should be able to provide it's own section of it so i don't imagine this service api being exposed at all.
Cool! We should sit down after this (or maybe at the same time), and
talk about what kind of API the actual `qaul.net` services should
have. Obviously messaging is pretty simple, then there's file sharing
(which is essentially messaging but with large attachments and
stuff. And then VoIP (which isn't really over IP at all but eh 🤷).
|
i'd prefer the former. Context structs are much more natural in rust and to a certain degree we'll need to build wrappers for the c api to deal with the regardless (for external structs like
Sure, yeah. i'm presently working on the few layers of middleware that sit above all incoming requests but once I'm done with that that will be an excellent discussion to have. |
- Moving `Error` to `qaul-common` - Switching to `qaul-common` "identity" added by #242 - Shuffling around `qaul-common` internals
On 19-06-27 06:43, Jess wrote:
Ah damn, yea I had completely missed that! There should be,
I was leaning that way too. I'll add a context struct at the root of An app initialises Oh and @NoraCodes, I'm realising that some of the code for working Also something else to consider: We have multiple layers of objects
We already discussed that in a message, the Next up, the messages: I think the biggest difference between a Realistically the signature should be replaced with an enum like: enum Signature
Valid(UserID), // Verified with this users pubkey
Unverified(UserID), // Unverified message from a user
Invalid, // Failed validity checking: danger!
} This way the cryptography is done inside At which point, the message layer is essentially the same from just ... anyway, sorry for rambling. Thoughts? (reposted from the web-view because github emails don't allow markdown :( ) |
Yes, please do that.
I think this is a good idea; unifying identity across as many levels as possible is certain to be beneficial to development speed and security. |
My big question here is, do we expect each qaul.net application to have it's own set of registered services, or do we want the user to run some kind of qaul.net daemon onto which services register? |
a daemon seems best but may require management overhead that renders the software less accessible |
It would probably be doable to make nice installers that install the daemon along with whatever client software; I think that would be optimal. Also, if the daemon is sufficient to do routing, people could put it on headless SBCs and the like |
On 19-06-27 10:59, Leonora Tindall wrote:
My big question here is, do we expect each qaul.net application to have it's own set of registered services, or do we want the user to run some kind of qaul.net daemon onto which services register?
This is something that @luxferresum and I had a conversation about and
figured out a cool idea: every service that wants to use a `qaul`
network is gonna bundle a copy of `libqaul` anyway, right? And there's
probably already a platform specific wrapper involved, like an android
shim or something that creates a linux daemon or whatever.
Then in this shim we can do one of two things:
1. If we are the only/only qaul service running on the device, we take
ownership of the network. This is essentially what `qaul.net` will
do.
2. If there is another service running on the system, we do some
$IPC_MAGIC to connect to it, so that it can then re-use the
registered users, etc.
On Android this can be done via intents, on Linux via checking if some
service is running (or checking some socket/env var/whatever.
|
This can be used for "internal" services or those exposed over some kind of network, or more exotic things. Service connectors that implement only the syncronous version are very easy to implement, but there is an extended trait that provides a polling method for async implementations.
A change I kinda wanna make is removing the I kinda wanna merge this PR soon, just so it doesn't get way too big. @NoraCodes you could then just add the digest stuff you wrote for a message to the |
eda85e1
to
cad4771
Compare
Initially I was a little eager to split lots of components into their own crates, to speed up compliation and add some separation. But realistically, none of that is really required. I removed the `routing-core` and `diagnostic` crates and moved them to their own modules instead. This way we don't run into problems with circular dependencies. This commit also changes the way that `Frames` work. First it re-adds the `trait` abstraction for an `Endpoint`, and also removes the `broadcast` function, instead relying on `Frame` to have a `None` `recipient`. The semantic separation between a `Message` and a `Frame` is that the latter has sequence numbers, and can thus compose a Message as a series of smaller chunks. How the signature should be handled in this case isn't really clear for now. I guess we might want to replace the `signature` on Frames alltogether and just have per-frame checksums to make sure that no delivery errors were introduced.
cad4771
to
1692060
Compare
Again, I've taken a very crate-happy approach in the beginning. I wasn't entirely sure how many cyclical dependencies we might end up with. Or what types needed to be exposed to what other The API is now using a struct and associated functions, all of them read-only. I sugest we use lots of internal mutability to make it all work. Anyway, I'll merge this PR after this then and we can move on from there. |
* Adding first draft of the service API * Refactoring proposed service structure - Moving `Error` to `qaul-common` - Switching to `qaul-common` "identity" added by #242 - Shuffling around `qaul-common` internals * Create trait for connections to services This can be used for "internal" services or those exposed over some kind of network, or more exotic things. Service connectors that implement only the syncronous version are very easy to implement, but there is an extended trait that provides a polling method for async implementations. * Restructuring `ratman` crate Initially I was a little eager to split lots of components into their own crates, to speed up compliation and add some separation. But realistically, none of that is really required. I removed the `routing-core` and `diagnostic` crates and moved them to their own modules instead. This way we don't run into problems with circular dependencies. This commit also changes the way that `Frames` work. First it re-adds the `trait` abstraction for an `Endpoint`, and also removes the `broadcast` function, instead relying on `Frame` to have a `None` `recipient`. The semantic separation between a `Message` and a `Frame` is that the latter has sequence numbers, and can thus compose a Message as a series of smaller chunks. How the signature should be handled in this case isn't really clear for now. I guess we might want to replace the `signature` on Frames alltogether and just have per-frame checksums to make sure that no delivery errors were introduced. * Refactoring service API and `libqaul` internals
Following is a draft PR for the
libqaul
service API. It is in no way representative of what the actual API will look like in the end, and is merely meant as a scope draft, i.e. what functions should be available, what type of interaction do we want to encourage, what data is available and how is data managed.Looking at the code, this will become very obvious. There are several
FIXME
blocks in comments above functions, but apart from that, I wanted to write down some questions that I asked myself when writing this PR.&self
in functions, associated to a context struct, or we can have external API functions that are handed a reference to some context object. The latter is more C-friendlyUserID
is just a type alias toString
. I assume we want to use some hash ID that was added by Building out the API #242.recv_hook
is synchronous. I guess we might want to wait for the stabilisation of async/await before we add async API functions. But synchronous functions should still be available.User
abstraction?libqaul
(and other dependencies such asRATMAN
expose, then usingfailure
to propagate up errors. The question is if a service creator might even care that much about it. Maybe we just want to expose a simple unified error for alllibqaul
service problems.libqaul
"instance" accepts a new service into usage. Services should also only be register able for single users. Ultimately, the service will then become advertised as that user (i.e. a node on the network).libqaul
Okay so that's a lot of open questions. I'm curious to hear your thoughts and feedback. The actual
qaul.net
usability (messaging, file sharing, VoIP, ...) would then be implemented as services, via this API.A note for Jess: this means that realistically the HTTP API interfaces need to be provided for the services that qaul.net exposes (messaging, file sharing, etc...), not this service API directly. (or rather, I don't think exposing the service API via HTTP is a very high priority, but could be done in the future).