-
Notifications
You must be signed in to change notification settings - Fork 94
Home
All text fields are UTF-8 and padded with " "
if shorter than the max length. All protocol data is always versioned, timestamped and signed in its entirety by your private key. For version 1, all data after the version byte is compressed with zlib before being sent over the wire.
All data packets follow this format:
[key=#bytes]
[[version=1][timestamp=8][sender_public_key=32][data=n]][signature=64]
signature = sign(version + timestamp + sender_public_key + data, sender_private_key)
There is a constant 105-byte overhead for each data packet comprised of version
, timestamp
, sender_public_key
and signature
.
-
version
: Spec version, 1 byte -
timestamp
: Current 64-bit Unix timestamp, 8 bytes -
signature
: 512-bit Ed25519 signature, 64 bytes -
sender_public_key
: Your 256-bit Ed25519 public key, 32 bytes -
sender_private_key
: Your 512-bit Ed25519 private key, 64 bytes
-
display_name
: desired nickname, 35 bytes
-
message
: UTF-8 message body, 140 bytes -
reply_signature
:signature
of message you're replying to, 64 bytes
-
mac
: message authentication code (crypto_box_MACBYTES
in libsodium), 32 bytes
Your identity is revealed on the first read to the identity characteristic. Your public key is your unique identifier, and the display name can be anything. Subsequent reads give other people's identities signed by your own.
data: [display_name=35]
full: [[version=1][timestamp=8][sender_public_key=32][display_name=35]][signature=64]
data: [others_identity=140]
full: [[version=1][timestamp=8][sender_public_key=32][others_identity=140]][signature=64]
All public messages flowing over the network will have the following format. They are uniquely identified by their signature.
data: [message=140][reply_signature=64]]
full: [[version=1][timestamp=8][sender_public_key=32][message=140][reply_signature=64]][signature=64]
Messages with valid message
but empty reply_signature
are considered general broadcast.
Messages with both message
and reply_signature
are considered replies to the original message.
Messages with an empty message
but still containing a valid reply_signature
are considered upvotes/reposts.
Convert Ed25519 keys to Curve25519 for authenticated asymmetric encryption.
{} denotes ciphertext encrypted to destination_public_key
data: [destination_public_key=32][mac=32]{[message=140][reply_signature=64]}
full: [[version=1][timestamp=8][sender_public_key=32][destination_public_key=32][mac=32]{[message=140][reply_signature=64]}][signature=64]
This example doesn't yet provide forward secrecy. The performance characteristics of a BLE-only mesh may prevent PFS from working reliably.