Documentation and latest version of spark-protocol

Hi all,

I’m trying to implements the spark-protocol in another language thans node.js. I found the node.js version to help doing that.

I’m actually trying to figure out the handshake like explained here : https://github.com/spark/spark-protocol/blob/master/js/lib/Handshake.js#L29

But it is not working for the moment :confused:. So I was wondering if there another documentation more detailled about the protocol himself ?

Does the spark-protocol repo is up to date ?

Regards

Thanks

Nadley

I also find the C/C++ version of the protocol through the lib embedded in the firmware https://github.com/spark/core-communication-lib.

I’m starting to read it but not very familiar with C/C++.

One question which size for a local cloud key pair ?

Thanks for your help

Regards

The device keys are 1024 bit RSA keys, stored in PKCS#1.5 DER format, which means the private key is usually around 612 bytes. The cloud public key is 2048 bits, and is around 294 bytes.

@mdma Thank you very much. that is what I was thinking after digging more in the protocol.

I’m actually working on the handshake part between the device and the server. In the source code of the spark-protocol : https://github.com/spark/spark-protocol/blob/master/js/lib/Handshake.js#L60 there is a part 5, speaking about :

Core creates a protobufs Hello with counter set to the uint32 represented by the most significant 4 bytes of the IV, encrypts the protobufs Hello with AES, and sends the ciphertext to Server.

Is it protobuf like https://en.wikipedia.org/wiki/Protocol_Buffers ? I was thinking spark protocol is using CoAP, can someone explain me this part and how CoAP is used by the protocol.

Thanks

I think that comment may be obsolete. Way before I joined Particle, but I believe protobufs was considered at some point early on in development of the protocol.

What’s your target language ?

I’ve been organising my thoughts to start a python framework that would allow devices such as Raspberry Pi, and the upcoming rash of cheap SOC-based devices running linux (think Domino.io, CHIP, etc etc) to leverage the cloud infrastructure.

Ok so what is the protocol now ? Only CoAP ? Trying to achieve handshake is not easy if comments are not up-to-date :unamused:

By the way thanks for helping

Hi @AndyW

The target language is Python, so I think we have something to share. Could you give me more details about your framework project as I’m not able to understand the link between Particle and devices you’re talking about. May be I miss something.

On my side the main idea was to offers a python librairie for the spark protocol allow people to build their own software / cloud solution to manage their device.

But I’m not a big Python expert it is a way for me to learn it more :wink:

Regards

It sounds like we would be working different sides of the network connection between device and cloud. I think there is great potential value having additional options and code for both.

My goal is to create a python client (and hopefully do it in an extensible, if not pythonic, way) that can connect to the Particle cloud (and hence also your stuff) whilst running on generic Linux hardware (e.g. Raspberry Pi, the other platforms I mentioned.) I’m not personally interested in creating the IDE experience, but I’m sure others might do something creative in that department if the basic functionality of Spark.publish()/Spark.subscribe() and friends was available.

Note: Particle already has the concept of selling/licensing their scalable cloud infrastructure, so I’m not offering a back-door to leech off their cloud - just a way to include generic Linux platforms alongside compound devices, like the Bluz, and the DigiStump Oak.

Hello @AndyW,

I work with @nadley on the python server implementation. I’m very happy to see you’re working on the client side. That can be used in our project to manage tests! Have you started your work?

Not yet - been collecting my thoughts and researching the protocol so far.

Plus the day job and family/life have been busy recently, but hope springs eternal.

I understand so much…

If that can help: https://github.com/asyd/particle-protocol-python/blob/master/local/client.py

Sounds like I need to start to handle CoAP…

@AndyW

Ok now I’m understanding your purpose, nice idea to create a client :wink: this is fully complementary.

Note: Particle already has the concept of selling/licensing their scalable cloud infrastructure, so I’m not offering a back-door to leech off their cloud - just a way to include generic Linux platforms alongside compound devices, like the Bluz, and the DigiStump Oak.

I know that particle can sell/licensing their cloud infrastructure. They also release an open source version of a local cloud https://github.com/spark/spark-server/, but the project is not very active, but I understand this is not their priority they need to do business first :sunglasses:, everybody need to eat at the end of month. To be honest I can’t use a software which is not Open Source. That why I’m not using the actual Particle Cloud, or just to test if my device are OK.

I tried to run the local cloud which is working but not complet…