feat: add protobuf definitions

This commit is contained in:
kaichaosun 2026-01-06 14:38:56 +08:00
parent c883557b8b
commit 4d1c32a5e2
No known key found for this signature in database
GPG Key ID: 223E0F992F4F03BF
7 changed files with 143 additions and 0 deletions

View File

@ -0,0 +1,28 @@
syntax = "proto3";
package wap.convos.group_v1;
import "base.proto";
import "common_frames.proto";
message ConversationInvite_GroupV1 {
repeated string participants = 1;
}
message GroupV1Frame {
// SDS like information: Message ID and channel_id extracted for utility
string message_id = 2;
string channel_id = 3; // Channel_id is associated with a set of participants
// This conflicts with conversation based encryption,
// need to ensure the derived sender is a valid participant
base.ReliabilityInfo reliability_info = 10;
oneof frame_type {
common_frames.ContentFrame content = 100;
// ...
}
}

26
protos/encryption.proto Normal file
View File

@ -0,0 +1,26 @@
syntax = "proto3";
package wap.encryption;
// TODO: This also encompasses plaintexts, is there a better name?
// Alternatives: ???
message EncryptedPayload {
oneof encryption {
encryption.Plaintext plaintext = 1;
encryption.Doubleratchet doubleratchet = 2;
}
}
message Plaintext {
bytes payload=1;
}
message Doubleratchet {
bytes dh = 1; // 32 byte array
uint32 msgNum = 2;
uint32 prevChainLen = 3;
bytes ciphertext = 4;
string aux = 5;
}

16
protos/envelope.proto Normal file
View File

@ -0,0 +1,16 @@
syntax = "proto3";
package wap.envelope;
///////////////////////////////////////////////////////////////////////////////
// Payload Framing Messages
///////////////////////////////////////////////////////////////////////////////
message WapEnvelopeV1 {
string conversation_hint = 1;
uint64 salt = 2;
bytes payload = 5;
}

17
protos/inbox.proto Normal file
View File

@ -0,0 +1,17 @@
syntax = "proto3";
package wap.inbox;
import "invite.proto";
message Note{
string text = 1;
}
message InboxV1Frame {
string recipient = 1;
oneof frame_type {
invite.InvitePrivateV1 invite_private_v1 = 10;
Note note = 11;
}
}

14
protos/invite.proto Normal file
View File

@ -0,0 +1,14 @@
syntax = "proto3";
package wap.invite;
import "encryption.proto";
message InvitePrivateV1 {
bytes initiator = 1;
bytes initiator_ephemeral = 2;
bytes participant = 3;
int32 participant_ephemeral_id= 4;
string discriminator = 5;
encryption.EncryptedPayload initial_message = 6;
}

19
protos/private_v1.proto Normal file
View File

@ -0,0 +1,19 @@
syntax = "proto3";
package wap.convos.private_v1;
message Placeholder {
uint32 counter = 1;
}
message PrivateV1Frame {
string conversation_id = 1;
bytes sender = 2;
int64 timestamp = 3; // Sender reported timestamp
oneof frame_type {
bytes content = 10;
Placeholder placeholder = 11;
// ....
}
}

23
protos/reliability.proto Normal file
View File

@ -0,0 +1,23 @@
syntax = "proto3";
package wap.reliability;
///////////////////////////////////////////////////////////////////////////////
// SDS Payloads
///////////////////////////////////////////////////////////////////////////////
message HistoryEntry {
string message_id = 1; // Unique identifier of the SDS message, as defined in `Message`
bytes retrieval_hint = 2; // Optional information to help remote parties retrieve this SDS
// message; For example, A Waku deterministic message hash or routing payload hash
}
message ReliablePayload {
string message_id = 2;
string channel_id = 3;
int32 lamport_timestamp = 10;
repeated HistoryEntry causal_history = 11;
bytes bloom_filter = 12;
// Optional field causes errors in nim protobuf generation. Removing for now as optional is implied anways.
bytes content = 20;
}