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

update protos #535

Merged
merged 3 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/friendly-taxis-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@status-im/js': minor
---

update `protos`
2 changes: 1 addition & 1 deletion packages/status-js/src/client/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ export class Chat {
payload: {
case: 'image',
value: {
type: image.type,
format: image.format,
payload: image.payload,
},
},
Expand Down
7 changes: 5 additions & 2 deletions packages/status-js/src/protos/chat-identity.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
syntax = "proto3";

import "enums.proto";
import "profile-showcase.proto";

// ChatIdentity represents the user defined identity associated with their public chat key
message ChatIdentity {
Expand Down Expand Up @@ -29,6 +30,8 @@ message ChatIdentity {
// 0 - unknown
// 1 - no messages
uint32 first_message_timestamp = 9;

ProfileShowcase profile_showcase = 10;
}

// ProfileImage represents data associated with a user's profile image
Expand All @@ -41,8 +44,8 @@ message IdentityImage {
// source_type signals the image payload source
SourceType source_type = 2;

// image_type signals the image type and method of parsing the payload
ImageType image_type = 3;
// image_format signals the image format and method of parsing the payload
ImageFormat image_format = 3;

// encryption_keys is a list of encrypted keys that can be used to decrypted an encrypted payload
repeated bytes encryption_keys = 4;
Expand Down
19 changes: 13 additions & 6 deletions packages/status-js/src/protos/chat-identity_pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import type {
PlainMessage,
} from '@bufbuild/protobuf'
import { Message, proto3, protoInt64 } from '@bufbuild/protobuf'
import { ImageType } from './enums_pb.js'
import { ProfileShowcase } from './profile-showcase_pb.js'
import { ImageFormat } from './enums_pb.js'

/**
* ChatIdentity represents the user defined identity associated with their public chat key
Expand Down Expand Up @@ -79,6 +80,11 @@ export class ChatIdentity extends Message<ChatIdentity> {
*/
firstMessageTimestamp = 0

/**
* @generated from field: ProfileShowcase profile_showcase = 10;
*/
profileShowcase?: ProfileShowcase

constructor(data?: PartialMessage<ChatIdentity>) {
super()
proto3.util.initPartial(data, this)
Expand Down Expand Up @@ -123,6 +129,7 @@ export class ChatIdentity extends Message<ChatIdentity> {
kind: 'scalar',
T: 13 /* ScalarType.UINT32 */,
},
{ no: 10, name: 'profile_showcase', kind: 'message', T: ProfileShowcase },
])

static fromBinary(
Expand Down Expand Up @@ -176,11 +183,11 @@ export class IdentityImage extends Message<IdentityImage> {
sourceType = IdentityImage_SourceType.UNKNOWN_SOURCE_TYPE

/**
* image_type signals the image type and method of parsing the payload
* image_format signals the image format and method of parsing the payload
*
* @generated from field: ImageType image_type = 3;
* @generated from field: ImageFormat image_format = 3;
*/
imageType = ImageType.UNKNOWN_IMAGE_TYPE
imageFormat = ImageFormat.UNKNOWN_IMAGE_FORMAT

/**
* encryption_keys is a list of encrypted keys that can be used to decrypted an encrypted payload
Expand Down Expand Up @@ -213,9 +220,9 @@ export class IdentityImage extends Message<IdentityImage> {
},
{
no: 3,
name: 'image_type',
name: 'image_format',
kind: 'enum',
T: proto3.getEnumType(ImageType),
T: proto3.getEnumType(ImageFormat),
},
{
no: 4,
Expand Down
167 changes: 160 additions & 7 deletions packages/status-js/src/protos/chat-message.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
syntax = "proto3";

import "enums.proto";
import "contact.proto";
import "shard.proto";

message StickerMessage {
string hash = 1;
Expand All @@ -9,7 +11,11 @@ message StickerMessage {

message ImageMessage {
bytes payload = 1;
ImageType type = 2;
ImageFormat format = 2;
string album_id = 3;
uint32 width = 4;
uint32 height = 5;
uint32 album_images_count = 6;
}

message AudioMessage {
Expand All @@ -32,10 +38,14 @@ message EditMessage {
string message_id = 4;

// Grant for community edit messages
bytes grant = 5;
bytes grant = 5 [deprecated = true];

// The type of message (public/one-to-one/private-group-chat)
MessageType message_type = 6;

ChatMessage.ContentType content_type = 7;
repeated UnfurledLink unfurled_links = 8;
UnfurledStatusLinks unfurled_status_links = 9;
}

message DeleteMessage {
Expand All @@ -45,18 +55,138 @@ message DeleteMessage {
string message_id = 3;

// Grant for community delete messages
bytes grant = 4;
bytes grant = 4 [deprecated = true];

// The type of message (public/one-to-one/private-group-chat)
MessageType message_type = 5;

string deleted_by = 6;
}

message SyncDeleteForMeMessage {
uint64 clock = 1;
string message_id = 2;
}

message DiscordMessage {
string id = 1;
string type = 2;
string timestamp = 3;
string timestampEdited = 4;
string content = 5;
DiscordMessageAuthor author = 6;
DiscordMessageReference reference = 7;
repeated DiscordMessageAttachment attachments = 8;
}

message DiscordMessageAuthor {
string id = 1;
string name = 2;
string discriminator = 3;
string nickname = 4;
string avatarUrl = 5;
bytes avatarImagePayload = 6;
string localUrl = 7;
}

message DiscordMessageReference {
string messageId = 1;
string channelId = 2;
string guildId = 3;
}

message DiscordMessageAttachment {
string id = 1;
string messageId = 2;
string url = 3;
string fileName = 4;
uint64 fileSizeBytes = 5;
string contentType = 6;
bytes payload = 7;
string localUrl = 8;
}

message BridgeMessage {
string bridgeName = 1;
string userName = 2;
string userAvatar = 3;
string userID = 4;
string content = 5;
string messageID = 6;
string parentMessageID = 7;
}

message UnfurledLinkThumbnail {
bytes payload = 1;
uint32 width = 2;
uint32 height = 3;
}

message UnfurledLink {
// A valid URL which uniquely identifies this link.
string url = 1;
// Website's title.
string title = 2;
// Description is sometimes available, but can be empty. Most mainstream
// websites provide this information.
string description = 3;
bytes thumbnail_payload = 4;
uint32 thumbnail_width = 5;
uint32 thumbnail_height = 6;
LinkType type = 7;
bytes favicon_payload = 8;

enum LinkType {
LINK = 0;
IMAGE = 1;
}
}

message UnfurledStatusContactLink {
bytes public_key = 1;
string display_name = 2;
string description = 3;
UnfurledLinkThumbnail icon = 4;
}

message UnfurledStatusCommunityLink {
bytes community_id = 1;
string display_name = 2;
string description = 3;
uint32 members_count = 4;
string color = 5;
UnfurledLinkThumbnail icon = 7;
UnfurledLinkThumbnail banner = 8;
}

message UnfurledStatusChannelLink {
string channel_uuid = 1;
string emoji = 2;
string display_name = 3;
string description = 4;
string color = 5;
UnfurledStatusCommunityLink community = 6;
}

message UnfurledStatusLink {
string url = 1;
oneof payload {
UnfurledStatusContactLink contact = 2;
UnfurledStatusCommunityLink community = 3;
UnfurledStatusChannelLink channel = 4;
}
}

// Create a wrapper around repeated property for proper unmarshalling
message UnfurledStatusLinks {
repeated UnfurledStatusLink unfurled_status_links = 1;
}

message ChatMessage {
// Lamport timestamp of the chat message
uint64 clock = 1;
// Unix timestamps in milliseconds, currently not used as we use whisper as more reliable, but here
// so that we don't rely on it
// Unix timestamps in milliseconds, currently not used as we use whisper as
// more reliable, but here so that we don't rely on it
uint64 timestamp = 2;
// Text of the message
string text = 3;
Expand All @@ -67,7 +197,8 @@ message ChatMessage {
// Chat id, this field is symmetric for public-chats and private group chats,
// but asymmetric in case of one-to-ones, as the sender will use the chat-id
// of the received, while the receiver will use the chat-id of the sender.
// Probably should be the concatenation of sender-pk & receiver-pk in alphabetical order
// Probably should be the concatenation of sender-pk & receiver-pk in
// alphabetical order
string chat_id = 6;

// The type of message (public/one-to-one/private-group-chat)
Expand All @@ -80,14 +211,24 @@ message ChatMessage {
ImageMessage image = 10;
AudioMessage audio = 11;
bytes community = 12;
DiscordMessage discord_message = 99;
BridgeMessage bridge_message = 100;
}

// Grant for community chat messages
bytes grant = 13;
bytes grant = 13 [deprecated = true];

// Message author's display name, introduced in version 1
string display_name = 14;

ContactRequestPropagatedState contact_request_propagated_state = 15;

repeated UnfurledLink unfurled_links = 16;

Shard shard = 17;

UnfurledStatusLinks unfurled_status_links = 18;

enum ContentType {
UNKNOWN_CONTENT_TYPE = 0;
TEXT_PLAIN = 1;
Expand All @@ -102,5 +243,17 @@ message ChatMessage {
COMMUNITY = 9;
// Only local
SYSTEM_MESSAGE_GAP = 10;
CONTACT_REQUEST = 11;
DISCORD_MESSAGE = 12;
IDENTITY_VERIFICATION = 13;
// Only local
SYSTEM_MESSAGE_PINNED_MESSAGE = 14;
// Only local
SYSTEM_MESSAGE_MUTUAL_EVENT_SENT = 15;
// Only local
SYSTEM_MESSAGE_MUTUAL_EVENT_ACCEPTED = 16;
// Only local
SYSTEM_MESSAGE_MUTUAL_EVENT_REMOVED = 17;
BRIDGE_MESSAGE = 18;
}
}
Loading
Loading