Skip to content
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

Building out the API #242

Merged
merged 7 commits into from Jun 18, 2019

Conversation

@NoraCodes
Copy link
Contributor

commented Jun 11, 2019

I'm using this PR as a place to build out the API and the testing infrastructure. Here, I've defined the basic structure of the user-to-user message API and a way to detect errors in those messages.

This uses the BLAKE2 algorithm, which is of similar strength to SHA-3 (Keccak) but much faster to compute.

NoraCodes added 2 commits Jun 3, 2019
Add skeleton types for Message and its parts.
These types are needed for the simulator but will probably change a lot.
Basic implementation and tests for message payload
Allows detection of errors in the payload. These messages can be
exchanged by any protocol, so it's possible there may not be reliable
transmission.
@spacekookie
Copy link
Member

left a comment

This looks really good :) I've added a few comments with my thoughts

libqaul/common/src/message.rs Outdated Show resolved Hide resolved
libqaul/common/Cargo.toml Outdated Show resolved Hide resolved
libqaul/common/src/lib.rs Outdated Show resolved Hide resolved
libqaul/common/src/payload.rs Outdated Show resolved Hide resolved
NoraCodes added 3 commits Jun 17, 2019
Switch to 64-byte digests for message payloads
This requires using the GenericArray type. Unfortunately the BLAKE2
crate is one version behind on the GenericArray crate so we're stuck
with version 0.12 until they update.
pub struct Message {
sender: UserID,
recipient: UserID,
// TODO: Add some kind of cryptographic signing here

This comment has been minimized.

Copy link
@spacekookie

spacekookie Jun 18, 2019

Member

I suggest we just add a new type for now, called MsgSignature (name up for 🚲🏠), that contains a u32 for a unix timestamp. We can later amend it with whatever format our signatures will have.

It's a bit of an open question. The old codebases used mbedtls but I haven't looked at the Rust crate for it yet and don't know how nice it is to work with. There's also a bunch of alternatives to work with. Plus, I kinda got it into my head that maybe we could implement the Axolotl ratchet.

TLDR: Maybe add that MsgSignature type into that file, add it as a field, just to make sure we don't forget it. The rest can be seen later and we an merge this :)

This comment has been minimized.

Copy link
@NoraCodes

NoraCodes Jun 18, 2019

Author Contributor

Will do!

libqaul/common/src/payload.rs Outdated Show resolved Hide resolved
NoraCodes added 2 commits Jun 18, 2019

@NoraCodes NoraCodes changed the title WIP: Building out the API Building out the API Jun 18, 2019

@spacekookie spacekookie merged commit c2ed5a0 into qaul:master Jun 18, 2019

@spacekookie spacekookie referenced this pull request Jun 26, 2019
spacekookie added a commit that referenced this pull request Jun 27, 2019
Refactoring proposed service structure
- Moving `Error` to `qaul-common`
- Switching to `qaul-common` "identity" added by #242
- Shuffling around `qaul-common` internals
spacekookie added a commit that referenced this pull request Jun 28, 2019
`libqaul` Service API (#247)
* 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
spacekookie added a commit that referenced this pull request Aug 9, 2019
spacekookie added a commit that referenced this pull request Aug 9, 2019
`libqaul` Service API (#247)
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.