Use `@bufbuild` (#337)
* remove old `communities.proto` * fix `protos` npm script * apply `protos` changes overwriting `Record<>` patches * update proto files * regenerate files * update `protons*` packages * regen files * use `protons` generate communities * add `@bufbuild*` packages * update `buf` yaml files * generate `@bufbuild` files * use `@bufbuild` files * format * remove `protobufjs` * remove `protons` * resolve build errors * fix image content type
This commit is contained in:
parent
72c58aacfc
commit
effd3eaacb
|
@ -1,6 +1,6 @@
|
|||
version: v1beta1
|
||||
|
||||
version: v1
|
||||
plugins:
|
||||
- name: ts_proto
|
||||
out: ./src/proto
|
||||
opt: grpc_js,esModuleInterop=true
|
||||
- name: es
|
||||
path: ./node_modules/.bin/protoc-gen-es
|
||||
opt: target=ts
|
||||
out: ./src/protos
|
||||
|
|
|
@ -27,18 +27,19 @@
|
|||
"typegen": "tsc --noEmit false --emitDeclarationOnly || true",
|
||||
"lint": "eslint src",
|
||||
"format": "prettier --write src",
|
||||
"protos": "protons protos/*.proto",
|
||||
"protos:list": "buf ls-files src/protos",
|
||||
"protos:lint": "buf lint src/protos",
|
||||
"protos": "buf generate src/protos",
|
||||
"clean": "rm -rf dist node_modules .turbo"
|
||||
},
|
||||
"dependencies": {
|
||||
"@bufbuild/protobuf": "^1.0.0",
|
||||
"ethereum-cryptography": "^1.0.3",
|
||||
"js-waku": "^0.30.0",
|
||||
"long": "^5.2.0",
|
||||
"protobufjs": "^6.11.3",
|
||||
"protons-runtime": "^1.0.4"
|
||||
"long": "^5.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"protons": "^3.0.4"
|
||||
"@bufbuild/protoc-gen-es": "^1.0.0"
|
||||
},
|
||||
"files": [
|
||||
"dist/",
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package communities.v1;
|
||||
|
||||
import "communities/v1/chat_identity.proto";
|
||||
|
||||
message Grant {
|
||||
bytes community_id = 1;
|
||||
bytes member_id = 2;
|
||||
string chat_id = 3;
|
||||
uint64 clock = 4;
|
||||
}
|
||||
|
||||
message CommunityMember {
|
||||
enum Roles {
|
||||
UNKNOWN_ROLE = 0;
|
||||
ROLE_ALL = 1;
|
||||
ROLE_MANAGE_USERS = 2;
|
||||
}
|
||||
repeated Roles roles = 1;
|
||||
}
|
||||
|
||||
message CommunityPermissions {
|
||||
enum Access {
|
||||
UNKNOWN_ACCESS = 0;
|
||||
NO_MEMBERSHIP = 1;
|
||||
INVITATION_ONLY = 2;
|
||||
ON_REQUEST = 3;
|
||||
}
|
||||
|
||||
bool ens_only = 1;
|
||||
// https://gitlab.matrix.org/matrix-org/olm/blob/master/docs/megolm.md is a candidate for the algorithm to be used in case we want to have private communityal chats, lighter than pairwise encryption using the DR, less secure, but more efficient for large number of participants
|
||||
bool private = 2;
|
||||
Access access = 3;
|
||||
}
|
||||
|
||||
message CommunityDescription {
|
||||
uint64 clock = 1;
|
||||
map<string,CommunityMember> members = 2;
|
||||
CommunityPermissions permissions = 3;
|
||||
ChatIdentity identity = 5;
|
||||
map<string,CommunityChat> chats = 6;
|
||||
repeated string ban_list = 7;
|
||||
map<string,CommunityCategory> categories = 8;
|
||||
}
|
||||
|
||||
message CommunityChat {
|
||||
map<string,CommunityMember> members = 1;
|
||||
CommunityPermissions permissions = 2;
|
||||
ChatIdentity identity = 3;
|
||||
string category_id = 4;
|
||||
int32 position = 5;
|
||||
}
|
||||
|
||||
message CommunityCategory {
|
||||
string category_id = 1;
|
||||
string name = 2;
|
||||
int32 position = 3;
|
||||
}
|
||||
|
||||
message CommunityInvitation {
|
||||
bytes community_description = 1;
|
||||
bytes grant = 2;
|
||||
string chat_id = 3;
|
||||
bytes public_key = 4;
|
||||
}
|
||||
|
||||
message CommunityRequestToJoin {
|
||||
uint64 clock = 1;
|
||||
string ens_name = 2;
|
||||
string chat_id = 3;
|
||||
bytes community_id = 4;
|
||||
}
|
||||
|
||||
message CommunityRequestToJoinResponse {
|
||||
uint64 clock = 1;
|
||||
CommunityDescription community = 2;
|
||||
bool accepted = 3;
|
||||
bytes grant = 4;
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
syntax = "proto3";
|
||||
|
||||
message SignedPreKey {
|
||||
bytes signed_pre_key = 1;
|
||||
uint32 version = 2;
|
||||
uint32 protocol_version = 3;
|
||||
}
|
||||
|
||||
// X3DH prekey bundle
|
||||
message Bundle {
|
||||
// Identity key
|
||||
bytes identity = 1;
|
||||
// Installation id
|
||||
map<string,SignedPreKey> signed_pre_keys = 2;
|
||||
// Prekey signature
|
||||
bytes signature = 4;
|
||||
|
||||
// When the bundle was created locally
|
||||
int64 timestamp = 5;
|
||||
}
|
||||
|
||||
message BundleContainer {
|
||||
reserved 3;
|
||||
// X3DH prekey bundle
|
||||
Bundle bundle = 1;
|
||||
// Private signed prekey
|
||||
bytes private_signed_pre_key = 2;
|
||||
}
|
||||
|
||||
message DRHeader {
|
||||
// Current ratchet public key
|
||||
bytes key = 1;
|
||||
// Number of the message in the sending chain
|
||||
uint32 n = 2;
|
||||
// Length of the previous sending chain
|
||||
uint32 pn = 3;
|
||||
// Bundle ID
|
||||
bytes id = 4;
|
||||
}
|
||||
|
||||
message DHHeader {
|
||||
// Compressed ephemeral public key
|
||||
bytes key = 1;
|
||||
}
|
||||
|
||||
message X3DHHeader {
|
||||
reserved 3;
|
||||
// Ephemeral key used
|
||||
bytes key = 1;
|
||||
// Used bundle's signed prekey
|
||||
bytes id = 4;
|
||||
}
|
||||
|
||||
// Hash Ratchet Header
|
||||
message HRHeader {
|
||||
// community key ID
|
||||
uint32 key_id = 1;
|
||||
// Community message number for this key_id
|
||||
uint32 seq_no = 2;
|
||||
// Community ID
|
||||
string group_id = 3;
|
||||
}
|
||||
|
||||
// Direct message value
|
||||
message EncryptedMessageProtocol {
|
||||
X3DHHeader x3dh_header = 1;
|
||||
DRHeader dr_header = 2;
|
||||
DHHeader dh_header = 101;
|
||||
HRHeader hr_header = 102;
|
||||
// Encrypted payload
|
||||
bytes payload = 3;
|
||||
}
|
||||
|
||||
// Top-level protocol message
|
||||
message ProtocolMessage {
|
||||
// The device id of the sender
|
||||
string installation_id = 2;
|
||||
|
||||
// List of bundles
|
||||
repeated Bundle bundles = 3;
|
||||
|
||||
// One to one message, encrypted, indexed by installation_id
|
||||
// TODO map here is redundant in case of community messages
|
||||
map<string,EncryptedMessageProtocol> encrypted_message = 101;
|
||||
|
||||
// Public chats, not encrypted
|
||||
bytes public_message = 102;
|
||||
}
|
|
@ -2,28 +2,33 @@ import { PageDirection } from 'js-waku'
|
|||
import { SymDecoder } from 'js-waku/lib/waku_message/version_1'
|
||||
|
||||
import { containsOnlyEmoji } from '../helpers/contains-only-emoji'
|
||||
import { ApplicationMetadataMessage_Type } from '../protos/application-metadata-message_pb'
|
||||
import {
|
||||
AudioMessage,
|
||||
ChatMessage as ChatMessageProto,
|
||||
ChatMessage_ContentType,
|
||||
DeleteMessage,
|
||||
EditMessage,
|
||||
ImageType,
|
||||
} from '../protos/chat-message'
|
||||
import { EmojiReaction } from '../protos/emoji-reaction'
|
||||
} from '../protos/chat-message_pb'
|
||||
import { EmojiReaction, EmojiReaction_Type } from '../protos/emoji-reaction_pb'
|
||||
import { MessageType } from '../protos/enums_pb'
|
||||
import { generateKeyFromPassword } from '../utils/generate-key-from-password'
|
||||
import { getNextClock } from '../utils/get-next-clock'
|
||||
import { idToContentTopic } from '../utils/id-to-content-topic'
|
||||
import { getReactions } from './community/get-reactions'
|
||||
|
||||
import type { CommunityChat } from '../proto/communities/v1/communities'
|
||||
import type { ImageMessage } from '../protos/chat-message'
|
||||
import type { MessageType } from '../protos/enums'
|
||||
import type { ImageMessage } from '../protos/chat-message_pb'
|
||||
import type { CommunityChat as CommunityChatProto } from '../protos/communities_pb'
|
||||
import type { Client } from './client'
|
||||
import type { Community } from './community/community'
|
||||
import type { Reactions } from './community/get-reactions'
|
||||
import type { Member } from './member'
|
||||
import type { PlainMessage } from '@bufbuild/protobuf'
|
||||
|
||||
export type ChatMessage = ChatMessageProto & {
|
||||
export { ChatMessage_ContentType as ChatMessageContentType } from '../protos/chat-message_pb'
|
||||
|
||||
export type CommunityChat = PlainMessage<CommunityChatProto>
|
||||
|
||||
export type ChatMessage = PlainMessage<ChatMessageProto> & {
|
||||
messageId: string
|
||||
pinned: boolean
|
||||
reactions: Reactions
|
||||
|
@ -453,11 +458,11 @@ export class Chat {
|
|||
}
|
||||
|
||||
const type = containsOnlyEmoji(text)
|
||||
? ChatMessageProto.ContentType.EMOJI
|
||||
: ChatMessageProto.ContentType.TEXT_PLAIN
|
||||
? ChatMessage_ContentType.EMOJI
|
||||
: ChatMessage_ContentType.TEXT_PLAIN
|
||||
|
||||
// TODO: protos does not support optional fields :-(
|
||||
const payload = ChatMessageProto.encode({
|
||||
const payload = new ChatMessageProto({
|
||||
clock: this.setClock(this.#clock),
|
||||
timestamp: BigInt(Date.now()),
|
||||
text,
|
||||
|
@ -465,24 +470,13 @@ export class Chat {
|
|||
ensName: '',
|
||||
chatId: this.id,
|
||||
contentType: type,
|
||||
messageType: 'COMMUNITY_CHAT' as MessageType,
|
||||
sticker: { hash: '', pack: 0 },
|
||||
image: {
|
||||
type: ImageType.JPEG,
|
||||
payload: new Uint8Array([]),
|
||||
},
|
||||
audio: {
|
||||
type: AudioMessage.AudioType.AAC,
|
||||
payload: new Uint8Array([]),
|
||||
durationMs: BigInt(0),
|
||||
},
|
||||
community: new Uint8Array([]),
|
||||
messageType: MessageType.COMMUNITY_CHAT,
|
||||
grant: new Uint8Array([]),
|
||||
displayName: '',
|
||||
})
|
||||
}).toBinary()
|
||||
|
||||
await this.client.sendWakuMessage(
|
||||
'TYPE_CHAT_MESSAGE',
|
||||
ApplicationMetadataMessage_Type.CHAT_MESSAGE,
|
||||
payload,
|
||||
this.contentTopic,
|
||||
this.symmetricKey
|
||||
|
@ -490,32 +484,28 @@ export class Chat {
|
|||
}
|
||||
|
||||
public sendImageMessage = async (image: ImageMessage) => {
|
||||
const payload = ChatMessageProto.encode({
|
||||
const payload = new ChatMessageProto({
|
||||
clock: this.setClock(this.#clock),
|
||||
timestamp: BigInt(Date.now()),
|
||||
text: '',
|
||||
responseTo: '',
|
||||
ensName: '',
|
||||
chatId: this.id,
|
||||
messageType: 'COMMUNITY_CHAT' as MessageType,
|
||||
contentType: ChatMessageProto.ContentType.TEXT_PLAIN,
|
||||
sticker: { hash: '', pack: 0 },
|
||||
image: {
|
||||
messageType: MessageType.COMMUNITY_CHAT,
|
||||
contentType: ChatMessage_ContentType.IMAGE,
|
||||
payload: {
|
||||
case: 'image',
|
||||
value: {
|
||||
type: image.type,
|
||||
payload: image.payload,
|
||||
},
|
||||
audio: {
|
||||
type: AudioMessage.AudioType.AAC,
|
||||
payload: new Uint8Array([]),
|
||||
durationMs: BigInt(0),
|
||||
},
|
||||
community: new Uint8Array([]),
|
||||
grant: new Uint8Array([]),
|
||||
displayName: '',
|
||||
})
|
||||
}).toBinary()
|
||||
|
||||
await this.client.sendWakuMessage(
|
||||
'TYPE_CHAT_MESSAGE',
|
||||
ApplicationMetadataMessage_Type.CHAT_MESSAGE,
|
||||
payload,
|
||||
this.contentTopic,
|
||||
this.symmetricKey
|
||||
|
@ -541,17 +531,17 @@ export class Chat {
|
|||
throw new Error('Text message cannot be empty')
|
||||
}
|
||||
|
||||
const payload = EditMessage.encode({
|
||||
const payload = new EditMessage({
|
||||
clock: this.setClock(this.#clock),
|
||||
text,
|
||||
messageId,
|
||||
chatId: this.id,
|
||||
grant: new Uint8Array([]),
|
||||
messageType: 'COMMUNITY_CHAT' as MessageType,
|
||||
})
|
||||
messageType: MessageType.COMMUNITY_CHAT,
|
||||
}).toBinary()
|
||||
|
||||
await this.client.sendWakuMessage(
|
||||
'TYPE_EDIT_MESSAGE',
|
||||
ApplicationMetadataMessage_Type.EDIT_MESSAGE,
|
||||
payload,
|
||||
this.contentTopic,
|
||||
this.symmetricKey
|
||||
|
@ -575,16 +565,16 @@ export class Chat {
|
|||
throw new Error('Text message can only be deleted by its author')
|
||||
}
|
||||
|
||||
const payload = DeleteMessage.encode({
|
||||
const payload = new DeleteMessage({
|
||||
clock: this.setClock(this.#clock),
|
||||
messageId,
|
||||
chatId: this.id,
|
||||
grant: new Uint8Array([]),
|
||||
messageType: 'COMMUNITY_CHAT' as MessageType,
|
||||
})
|
||||
messageType: MessageType.COMMUNITY_CHAT,
|
||||
}).toBinary()
|
||||
|
||||
await this.client.sendWakuMessage(
|
||||
'TYPE_DELETE_MESSAGE',
|
||||
ApplicationMetadataMessage_Type.DELETE_MESSAGE,
|
||||
payload,
|
||||
this.contentTopic,
|
||||
this.symmetricKey
|
||||
|
@ -609,18 +599,18 @@ export class Chat {
|
|||
`0x${this.client.account.publicKey}`
|
||||
)
|
||||
|
||||
const payload = EmojiReaction.encode({
|
||||
const payload = new EmojiReaction({
|
||||
clock: this.setClock(this.#clock),
|
||||
chatId: this.id,
|
||||
messageType: 'COMMUNITY_CHAT' as MessageType,
|
||||
messageType: MessageType.COMMUNITY_CHAT,
|
||||
messageId,
|
||||
type: reaction as EmojiReaction.Type,
|
||||
type: EmojiReaction_Type[reaction],
|
||||
retracted,
|
||||
grant: new Uint8Array([]),
|
||||
})
|
||||
}).toBinary()
|
||||
|
||||
await this.client.sendWakuMessage(
|
||||
'TYPE_EMOJI_REACTION',
|
||||
ApplicationMetadataMessage_Type.EMOJI_REACTION,
|
||||
payload,
|
||||
this.contentTopic,
|
||||
this.symmetricKey
|
||||
|
|
|
@ -10,13 +10,14 @@ import { waitForRemotePeer } from 'js-waku/lib/wait_for_remote_peer'
|
|||
import { SymEncoder } from 'js-waku/lib/waku_message/version_1'
|
||||
|
||||
import { peers } from '../consts/peers'
|
||||
import { ApplicationMetadataMessage } from '../protos/application-metadata-message'
|
||||
import { ApplicationMetadataMessage } from '../protos/application-metadata-message_pb'
|
||||
import { Account } from './account'
|
||||
import { ActivityCenter } from './activityCenter'
|
||||
import { Community } from './community/community'
|
||||
import { handleWakuMessage } from './community/handle-waku-message'
|
||||
import { LocalStorage } from './storage'
|
||||
|
||||
import type { ApplicationMetadataMessage_Type } from '../protos/application-metadata-message_pb'
|
||||
import type { Storage } from './storage'
|
||||
import type { WakuLight } from 'js-waku/lib/interfaces'
|
||||
import type { MessageV1 as WakuMessage } from 'js-waku/lib/waku_message/version_1'
|
||||
|
@ -238,7 +239,7 @@ class Client {
|
|||
}
|
||||
|
||||
public sendWakuMessage = async (
|
||||
type: keyof typeof ApplicationMetadataMessage.Type,
|
||||
type: ApplicationMetadataMessage_Type,
|
||||
payload: Uint8Array,
|
||||
contentTopic: string,
|
||||
symKey: Uint8Array
|
||||
|
@ -253,11 +254,11 @@ class Client {
|
|||
|
||||
const signature = await this.#account.sign(payload)
|
||||
|
||||
const message = ApplicationMetadataMessage.encode({
|
||||
type: type as ApplicationMetadataMessage.Type,
|
||||
const message = new ApplicationMetadataMessage({
|
||||
type: type,
|
||||
signature,
|
||||
payload,
|
||||
})
|
||||
}).toBinary()
|
||||
|
||||
await this.waku.lightPush.push(
|
||||
new SymEncoder(
|
||||
|
|
|
@ -3,8 +3,9 @@ import { SymDecoder } from 'js-waku/lib/waku_message/version_1'
|
|||
|
||||
import { getDifferenceByKeys } from '../../helpers/get-difference-by-keys'
|
||||
import { getObjectsDifference } from '../../helpers/get-objects-difference'
|
||||
import { CommunityRequestToJoin } from '../../protos/communities'
|
||||
import { MessageType } from '../../protos/enums'
|
||||
import { ApplicationMetadataMessage_Type } from '../../protos/application-metadata-message_pb'
|
||||
import { CommunityRequestToJoin } from '../../protos/communities_pb'
|
||||
import { MessageType } from '../../protos/enums_pb'
|
||||
import { compressPublicKey } from '../../utils/compress-public-key'
|
||||
import { generateKeyFromPassword } from '../../utils/generate-key-from-password'
|
||||
import { getNextClock } from '../../utils/get-next-clock'
|
||||
|
@ -12,11 +13,12 @@ import { idToContentTopic } from '../../utils/id-to-content-topic'
|
|||
import { Chat } from '../chat'
|
||||
import { Member } from '../member'
|
||||
|
||||
import type {
|
||||
CommunityChat,
|
||||
CommunityDescription,
|
||||
} from '../../proto/communities/v1/communities'
|
||||
import type { CommunityDescription as CommunityDescriptionProto } from '../../protos/communities_pb'
|
||||
import type { CommunityChat } from '../chat'
|
||||
import type { Client } from '../client'
|
||||
import type { PlainMessage } from '@bufbuild/protobuf'
|
||||
|
||||
type CommunityDescription = PlainMessage<CommunityDescriptionProto>
|
||||
|
||||
export class Community {
|
||||
private client: Client
|
||||
|
@ -239,15 +241,15 @@ export class Community {
|
|||
}
|
||||
|
||||
public requestToJoin = async (chatId = '') => {
|
||||
const payload = CommunityRequestToJoin.encode({
|
||||
const payload = new CommunityRequestToJoin({
|
||||
clock: this.setClock(this.#clock),
|
||||
chatId,
|
||||
communityId: hexToBytes(this.id),
|
||||
ensName: '',
|
||||
})
|
||||
}).toBinary()
|
||||
|
||||
await this.client.sendWakuMessage(
|
||||
'TYPE_COMMUNITY_REQUEST_TO_JOIN',
|
||||
ApplicationMetadataMessage_Type.COMMUNITY_REQUEST_TO_JOIN,
|
||||
payload,
|
||||
this.contentTopic,
|
||||
this.symmetricKey
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import type { EmojiReaction } from '../../protos/emoji-reaction'
|
||||
import { EmojiReaction_Type } from '../../protos/emoji-reaction_pb'
|
||||
|
||||
type Reaction = Exclude<`${EmojiReaction.Type}`, 'UNKNOWN_EMOJI_REACTION_TYPE'>
|
||||
import type { EmojiReaction } from '../../protos/emoji-reaction_pb'
|
||||
|
||||
export type Reaction = Exclude<
|
||||
keyof typeof EmojiReaction_Type,
|
||||
'UNKNOWN_EMOJI_REACTION_TYPE'
|
||||
>
|
||||
|
||||
export type Reactions = {
|
||||
[key in Reaction]: Set<string>
|
||||
|
@ -13,15 +18,17 @@ export function getReactions(
|
|||
): Reactions {
|
||||
const { type, retracted } = reaction
|
||||
|
||||
if (type === 'UNKNOWN_EMOJI_REACTION_TYPE') {
|
||||
if (type === EmojiReaction_Type.UNKNOWN_EMOJI_REACTION_TYPE) {
|
||||
return reactions
|
||||
}
|
||||
|
||||
const reactionName = EmojiReaction_Type[type] as Reaction
|
||||
|
||||
if (retracted) {
|
||||
reactions[type].delete(publicKey)
|
||||
reactions[reactionName].delete(publicKey)
|
||||
} else {
|
||||
// Set handles that potentially multiple same reactions count as one
|
||||
reactions[type].add(publicKey)
|
||||
reactions[reactionName].add(publicKey)
|
||||
}
|
||||
|
||||
return reactions
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
import { bytesToHex } from 'ethereum-cryptography/utils'
|
||||
|
||||
import { CommunityDescription } from '../../proto/communities/v1/communities'
|
||||
import { ApplicationMetadataMessage } from '../../protos/application-metadata-message'
|
||||
import {
|
||||
ApplicationMetadataMessage,
|
||||
ApplicationMetadataMessage_Type,
|
||||
} from '../../protos/application-metadata-message_pb'
|
||||
import {
|
||||
ChatMessage,
|
||||
DeleteMessage,
|
||||
EditMessage,
|
||||
MessageType,
|
||||
} from '../../protos/chat-message'
|
||||
import { EmojiReaction } from '../../protos/emoji-reaction'
|
||||
import { PinMessage } from '../../protos/pin-message'
|
||||
import { ProtocolMessage } from '../../protos/protocol-message'
|
||||
} from '../../protos/chat-message_pb'
|
||||
import { CommunityDescription } from '../../protos/communities_pb'
|
||||
import { EmojiReaction } from '../../protos/emoji-reaction_pb'
|
||||
import { MessageType } from '../../protos/enums_pb'
|
||||
import { PinMessage } from '../../protos/pin-message_pb'
|
||||
import { ProtocolMessage } from '../../protos/protocol-message_pb'
|
||||
import { isClockValid } from '../../utils/is-clock-valid'
|
||||
import { payloadToId } from '../../utils/payload-to-id'
|
||||
import { recoverPublicKey } from '../../utils/recover-public-key'
|
||||
|
@ -46,7 +49,7 @@ export function handleWakuMessage(
|
|||
let messageToDecode = wakuMessage.payload
|
||||
let decodedProtocol
|
||||
try {
|
||||
decodedProtocol = ProtocolMessage.decode(messageToDecode)
|
||||
decodedProtocol = ProtocolMessage.fromBinary(messageToDecode)
|
||||
if (decodedProtocol) {
|
||||
messageToDecode = decodedProtocol.publicMessage
|
||||
}
|
||||
|
@ -54,7 +57,7 @@ export function handleWakuMessage(
|
|||
// eslint-disable-next-line no-empty
|
||||
}
|
||||
|
||||
const decodedMetadata = ApplicationMetadataMessage.decode(messageToDecode)
|
||||
const decodedMetadata = ApplicationMetadataMessage.fromBinary(messageToDecode)
|
||||
if (!decodedMetadata.payload) {
|
||||
return
|
||||
}
|
||||
|
@ -82,9 +85,9 @@ export function handleWakuMessage(
|
|||
try {
|
||||
// decode, map and handle (events)
|
||||
switch (decodedMetadata.type) {
|
||||
case ApplicationMetadataMessage.Type.TYPE_COMMUNITY_DESCRIPTION: {
|
||||
case ApplicationMetadataMessage_Type.COMMUNITY_DESCRIPTION: {
|
||||
// decode
|
||||
const decodedPayload = CommunityDescription.decode(messageToDecode)
|
||||
const decodedPayload = CommunityDescription.fromBinary(messageToDecode)
|
||||
|
||||
// validate
|
||||
if (!isClockValid(BigInt(decodedPayload.clock), messageTimestamp)) {
|
||||
|
@ -104,9 +107,9 @@ export function handleWakuMessage(
|
|||
break
|
||||
}
|
||||
|
||||
case ApplicationMetadataMessage.Type.TYPE_CHAT_MESSAGE: {
|
||||
case ApplicationMetadataMessage_Type.CHAT_MESSAGE: {
|
||||
// decode
|
||||
const decodedPayload = ChatMessage.decode(messageToDecode)
|
||||
const decodedPayload = ChatMessage.fromBinary(messageToDecode)
|
||||
|
||||
if (!isClockValid(BigInt(decodedPayload.clock), messageTimestamp)) {
|
||||
return
|
||||
|
@ -149,8 +152,8 @@ export function handleWakuMessage(
|
|||
break
|
||||
}
|
||||
|
||||
case ApplicationMetadataMessage.Type.TYPE_EDIT_MESSAGE: {
|
||||
const decodedPayload = EditMessage.decode(messageToDecode)
|
||||
case ApplicationMetadataMessage_Type.EDIT_MESSAGE: {
|
||||
const decodedPayload = EditMessage.fromBinary(messageToDecode)
|
||||
|
||||
if (!isClockValid(BigInt(decodedPayload.clock), messageTimestamp)) {
|
||||
return
|
||||
|
@ -189,8 +192,8 @@ export function handleWakuMessage(
|
|||
break
|
||||
}
|
||||
|
||||
case ApplicationMetadataMessage.Type.TYPE_DELETE_MESSAGE: {
|
||||
const decodedPayload = DeleteMessage.decode(messageToDecode)
|
||||
case ApplicationMetadataMessage_Type.DELETE_MESSAGE: {
|
||||
const decodedPayload = DeleteMessage.fromBinary(messageToDecode)
|
||||
|
||||
if (!isClockValid(BigInt(decodedPayload.clock), messageTimestamp)) {
|
||||
return
|
||||
|
@ -228,8 +231,8 @@ export function handleWakuMessage(
|
|||
break
|
||||
}
|
||||
|
||||
case ApplicationMetadataMessage.Type.TYPE_PIN_MESSAGE: {
|
||||
const decodedPayload = PinMessage.decode(messageToDecode)
|
||||
case ApplicationMetadataMessage_Type.PIN_MESSAGE: {
|
||||
const decodedPayload = PinMessage.fromBinary(messageToDecode)
|
||||
|
||||
if (!isClockValid(BigInt(decodedPayload.clock), messageTimestamp)) {
|
||||
return
|
||||
|
@ -267,8 +270,8 @@ export function handleWakuMessage(
|
|||
break
|
||||
}
|
||||
|
||||
case ApplicationMetadataMessage.Type.TYPE_EMOJI_REACTION: {
|
||||
const decodedPayload = EmojiReaction.decode(messageToDecode)
|
||||
case ApplicationMetadataMessage_Type.EMOJI_REACTION: {
|
||||
const decodedPayload = EmojiReaction.fromBinary(messageToDecode)
|
||||
|
||||
if (!isClockValid(BigInt(decodedPayload.clock), messageTimestamp)) {
|
||||
return
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { ChatMessage as ChatMessageProto } from '../../protos/chat-message'
|
||||
import type { ChatMessage as ChatMessageProto } from '../../protos/chat-message_pb'
|
||||
import type { Chat, ChatMessage } from '../chat'
|
||||
import type { Community } from './community'
|
||||
|
||||
|
|
|
@ -5,8 +5,9 @@ export type {
|
|||
Notification,
|
||||
} from './client/activityCenter'
|
||||
export type { ChatMessage as Message } from './client/chat'
|
||||
export { ChatMessageContentType as MessageContentType } from './client/chat'
|
||||
export type { Client, ClientOptions } from './client/client'
|
||||
export { createClient } from './client/client'
|
||||
export type { Community } from './client/community/community'
|
||||
export type { Reactions } from './client/community/get-reactions'
|
||||
export type { Reaction, Reactions } from './client/community/get-reactions'
|
||||
export type { Member } from './client/member'
|
||||
|
|
|
@ -1,526 +0,0 @@
|
|||
/* eslint-disable */
|
||||
import Long from 'long'
|
||||
import _m0 from 'protobufjs/minimal'
|
||||
import { ImageType, imageTypeFromJSON, imageTypeToJSON } from './enums'
|
||||
|
||||
export const protobufPackage = 'communities.v1'
|
||||
|
||||
/** ChatIdentity represents the user defined identity associated with their public chat key */
|
||||
export interface ChatIdentity {
|
||||
/** Lamport timestamp of the message */
|
||||
clock: number
|
||||
/** ens_name is the valid ENS name associated with the chat key */
|
||||
ensName: string
|
||||
/** images is a string indexed mapping of images associated with an identity */
|
||||
images: { [key: string]: IdentityImage }
|
||||
/** display name is the user set identity, valid only for organisations */
|
||||
displayName: string
|
||||
/** description is the user set description, valid only for organisations */
|
||||
description: string
|
||||
color: string
|
||||
emoji: string
|
||||
}
|
||||
|
||||
export interface ChatIdentity_ImagesEntry {
|
||||
key: string
|
||||
value: IdentityImage | undefined
|
||||
}
|
||||
|
||||
/** ProfileImage represents data associated with a user's profile image */
|
||||
export interface IdentityImage {
|
||||
/**
|
||||
* payload is a context based payload for the profile image data,
|
||||
* context is determined by the `source_type`
|
||||
*/
|
||||
payload: Uint8Array
|
||||
/** source_type signals the image payload source */
|
||||
sourceType: IdentityImage_SourceType
|
||||
/** image_type signals the image type and method of parsing the payload */
|
||||
imageType: ImageType
|
||||
}
|
||||
|
||||
/** SourceType are the predefined types of image source allowed */
|
||||
export enum IdentityImage_SourceType {
|
||||
UNKNOWN_SOURCE_TYPE = 0,
|
||||
/** RAW_PAYLOAD - RAW_PAYLOAD image byte data */
|
||||
RAW_PAYLOAD = 1,
|
||||
/**
|
||||
* ENS_AVATAR - ENS_AVATAR uses the ENS record's resolver get-text-data.avatar data
|
||||
* The `payload` field will be ignored if ENS_AVATAR is selected
|
||||
* The application will read and parse the ENS avatar data as image payload data, URLs will be ignored
|
||||
* The parent `ChatMessageIdentity` must have a valid `ens_name` set
|
||||
*/
|
||||
ENS_AVATAR = 2,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
|
||||
export function identityImage_SourceTypeFromJSON(
|
||||
object: any
|
||||
): IdentityImage_SourceType {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case 'UNKNOWN_SOURCE_TYPE':
|
||||
return IdentityImage_SourceType.UNKNOWN_SOURCE_TYPE
|
||||
case 1:
|
||||
case 'RAW_PAYLOAD':
|
||||
return IdentityImage_SourceType.RAW_PAYLOAD
|
||||
case 2:
|
||||
case 'ENS_AVATAR':
|
||||
return IdentityImage_SourceType.ENS_AVATAR
|
||||
case -1:
|
||||
case 'UNRECOGNIZED':
|
||||
default:
|
||||
return IdentityImage_SourceType.UNRECOGNIZED
|
||||
}
|
||||
}
|
||||
|
||||
export function identityImage_SourceTypeToJSON(
|
||||
object: IdentityImage_SourceType
|
||||
): string {
|
||||
switch (object) {
|
||||
case IdentityImage_SourceType.UNKNOWN_SOURCE_TYPE:
|
||||
return 'UNKNOWN_SOURCE_TYPE'
|
||||
case IdentityImage_SourceType.RAW_PAYLOAD:
|
||||
return 'RAW_PAYLOAD'
|
||||
case IdentityImage_SourceType.ENS_AVATAR:
|
||||
return 'ENS_AVATAR'
|
||||
default:
|
||||
return 'UNKNOWN'
|
||||
}
|
||||
}
|
||||
|
||||
const baseChatIdentity: object = {
|
||||
clock: 0,
|
||||
ensName: '',
|
||||
displayName: '',
|
||||
description: '',
|
||||
color: '',
|
||||
emoji: '',
|
||||
}
|
||||
|
||||
export const ChatIdentity = {
|
||||
encode(
|
||||
message: ChatIdentity,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.clock !== 0) {
|
||||
writer.uint32(8).uint64(message.clock)
|
||||
}
|
||||
if (message.ensName !== '') {
|
||||
writer.uint32(18).string(message.ensName)
|
||||
}
|
||||
Object.entries(message.images).forEach(([key, value]) => {
|
||||
ChatIdentity_ImagesEntry.encode(
|
||||
{ key: key as any, value },
|
||||
writer.uint32(26).fork()
|
||||
).ldelim()
|
||||
})
|
||||
if (message.displayName !== '') {
|
||||
writer.uint32(34).string(message.displayName)
|
||||
}
|
||||
if (message.description !== '') {
|
||||
writer.uint32(42).string(message.description)
|
||||
}
|
||||
if (message.color !== '') {
|
||||
writer.uint32(50).string(message.color)
|
||||
}
|
||||
if (message.emoji !== '') {
|
||||
writer.uint32(58).string(message.emoji)
|
||||
}
|
||||
return writer
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): ChatIdentity {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input)
|
||||
let end = length === undefined ? reader.len : reader.pos + length
|
||||
const message = { ...baseChatIdentity } as ChatIdentity
|
||||
message.images = {}
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32()
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.clock = longToNumber(reader.uint64() as Long)
|
||||
break
|
||||
case 2:
|
||||
message.ensName = reader.string()
|
||||
break
|
||||
case 3:
|
||||
const entry3 = ChatIdentity_ImagesEntry.decode(
|
||||
reader,
|
||||
reader.uint32()
|
||||
)
|
||||
if (entry3.value !== undefined) {
|
||||
message.images[entry3.key] = entry3.value
|
||||
}
|
||||
break
|
||||
case 4:
|
||||
message.displayName = reader.string()
|
||||
break
|
||||
case 5:
|
||||
message.description = reader.string()
|
||||
break
|
||||
case 6:
|
||||
message.color = reader.string()
|
||||
break
|
||||
case 7:
|
||||
message.emoji = reader.string()
|
||||
break
|
||||
default:
|
||||
reader.skipType(tag & 7)
|
||||
break
|
||||
}
|
||||
}
|
||||
return message
|
||||
},
|
||||
|
||||
fromJSON(object: any): ChatIdentity {
|
||||
const message = { ...baseChatIdentity } as ChatIdentity
|
||||
message.images = {}
|
||||
if (object.clock !== undefined && object.clock !== null) {
|
||||
message.clock = Number(object.clock)
|
||||
} else {
|
||||
message.clock = 0
|
||||
}
|
||||
if (object.ensName !== undefined && object.ensName !== null) {
|
||||
message.ensName = String(object.ensName)
|
||||
} else {
|
||||
message.ensName = ''
|
||||
}
|
||||
if (object.images !== undefined && object.images !== null) {
|
||||
Object.entries(object.images).forEach(([key, value]) => {
|
||||
message.images[key] = IdentityImage.fromJSON(value)
|
||||
})
|
||||
}
|
||||
if (object.displayName !== undefined && object.displayName !== null) {
|
||||
message.displayName = String(object.displayName)
|
||||
} else {
|
||||
message.displayName = ''
|
||||
}
|
||||
if (object.description !== undefined && object.description !== null) {
|
||||
message.description = String(object.description)
|
||||
} else {
|
||||
message.description = ''
|
||||
}
|
||||
if (object.color !== undefined && object.color !== null) {
|
||||
message.color = String(object.color)
|
||||
} else {
|
||||
message.color = ''
|
||||
}
|
||||
if (object.emoji !== undefined && object.emoji !== null) {
|
||||
message.emoji = String(object.emoji)
|
||||
} else {
|
||||
message.emoji = ''
|
||||
}
|
||||
return message
|
||||
},
|
||||
|
||||
toJSON(message: ChatIdentity): unknown {
|
||||
const obj: any = {}
|
||||
message.clock !== undefined && (obj.clock = message.clock)
|
||||
message.ensName !== undefined && (obj.ensName = message.ensName)
|
||||
obj.images = {}
|
||||
if (message.images) {
|
||||
Object.entries(message.images).forEach(([k, v]) => {
|
||||
obj.images[k] = IdentityImage.toJSON(v)
|
||||
})
|
||||
}
|
||||
message.displayName !== undefined && (obj.displayName = message.displayName)
|
||||
message.description !== undefined && (obj.description = message.description)
|
||||
message.color !== undefined && (obj.color = message.color)
|
||||
message.emoji !== undefined && (obj.emoji = message.emoji)
|
||||
return obj
|
||||
},
|
||||
|
||||
fromPartial(object: DeepPartial<ChatIdentity>): ChatIdentity {
|
||||
const message = { ...baseChatIdentity } as ChatIdentity
|
||||
message.images = {}
|
||||
if (object.clock !== undefined && object.clock !== null) {
|
||||
message.clock = object.clock
|
||||
} else {
|
||||
message.clock = 0
|
||||
}
|
||||
if (object.ensName !== undefined && object.ensName !== null) {
|
||||
message.ensName = object.ensName
|
||||
} else {
|
||||
message.ensName = ''
|
||||
}
|
||||
if (object.images !== undefined && object.images !== null) {
|
||||
Object.entries(object.images).forEach(([key, value]) => {
|
||||
if (value !== undefined) {
|
||||
message.images[key] = IdentityImage.fromPartial(value)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (object.displayName !== undefined && object.displayName !== null) {
|
||||
message.displayName = object.displayName
|
||||
} else {
|
||||
message.displayName = ''
|
||||
}
|
||||
if (object.description !== undefined && object.description !== null) {
|
||||
message.description = object.description
|
||||
} else {
|
||||
message.description = ''
|
||||
}
|
||||
if (object.color !== undefined && object.color !== null) {
|
||||
message.color = object.color
|
||||
} else {
|
||||
message.color = ''
|
||||
}
|
||||
if (object.emoji !== undefined && object.emoji !== null) {
|
||||
message.emoji = object.emoji
|
||||
} else {
|
||||
message.emoji = ''
|
||||
}
|
||||
return message
|
||||
},
|
||||
}
|
||||
|
||||
const baseChatIdentity_ImagesEntry: object = { key: '' }
|
||||
|
||||
export const ChatIdentity_ImagesEntry = {
|
||||
encode(
|
||||
message: ChatIdentity_ImagesEntry,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.key !== '') {
|
||||
writer.uint32(10).string(message.key)
|
||||
}
|
||||
if (message.value !== undefined) {
|
||||
IdentityImage.encode(message.value, writer.uint32(18).fork()).ldelim()
|
||||
}
|
||||
return writer
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): ChatIdentity_ImagesEntry {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input)
|
||||
let end = length === undefined ? reader.len : reader.pos + length
|
||||
const message = {
|
||||
...baseChatIdentity_ImagesEntry,
|
||||
} as ChatIdentity_ImagesEntry
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32()
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.key = reader.string()
|
||||
break
|
||||
case 2:
|
||||
message.value = IdentityImage.decode(reader, reader.uint32())
|
||||
break
|
||||
default:
|
||||
reader.skipType(tag & 7)
|
||||
break
|
||||
}
|
||||
}
|
||||
return message
|
||||
},
|
||||
|
||||
fromJSON(object: any): ChatIdentity_ImagesEntry {
|
||||
const message = {
|
||||
...baseChatIdentity_ImagesEntry,
|
||||
} as ChatIdentity_ImagesEntry
|
||||
if (object.key !== undefined && object.key !== null) {
|
||||
message.key = String(object.key)
|
||||
} else {
|
||||
message.key = ''
|
||||
}
|
||||
if (object.value !== undefined && object.value !== null) {
|
||||
message.value = IdentityImage.fromJSON(object.value)
|
||||
} else {
|
||||
message.value = undefined
|
||||
}
|
||||
return message
|
||||
},
|
||||
|
||||
toJSON(message: ChatIdentity_ImagesEntry): unknown {
|
||||
const obj: any = {}
|
||||
message.key !== undefined && (obj.key = message.key)
|
||||
message.value !== undefined &&
|
||||
(obj.value = message.value
|
||||
? IdentityImage.toJSON(message.value)
|
||||
: undefined)
|
||||
return obj
|
||||
},
|
||||
|
||||
fromPartial(
|
||||
object: DeepPartial<ChatIdentity_ImagesEntry>
|
||||
): ChatIdentity_ImagesEntry {
|
||||
const message = {
|
||||
...baseChatIdentity_ImagesEntry,
|
||||
} as ChatIdentity_ImagesEntry
|
||||
if (object.key !== undefined && object.key !== null) {
|
||||
message.key = object.key
|
||||
} else {
|
||||
message.key = ''
|
||||
}
|
||||
if (object.value !== undefined && object.value !== null) {
|
||||
message.value = IdentityImage.fromPartial(object.value)
|
||||
} else {
|
||||
message.value = undefined
|
||||
}
|
||||
return message
|
||||
},
|
||||
}
|
||||
|
||||
const baseIdentityImage: object = { sourceType: 0, imageType: 0 }
|
||||
|
||||
export const IdentityImage = {
|
||||
encode(
|
||||
message: IdentityImage,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.payload.length !== 0) {
|
||||
writer.uint32(10).bytes(message.payload)
|
||||
}
|
||||
if (message.sourceType !== 0) {
|
||||
writer.uint32(16).int32(message.sourceType)
|
||||
}
|
||||
if (message.imageType !== 0) {
|
||||
writer.uint32(24).int32(message.imageType)
|
||||
}
|
||||
return writer
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): IdentityImage {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input)
|
||||
let end = length === undefined ? reader.len : reader.pos + length
|
||||
const message = { ...baseIdentityImage } as IdentityImage
|
||||
message.payload = new Uint8Array()
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32()
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.payload = reader.bytes()
|
||||
break
|
||||
case 2:
|
||||
message.sourceType = reader.int32() as any
|
||||
break
|
||||
case 3:
|
||||
message.imageType = reader.int32() as any
|
||||
break
|
||||
default:
|
||||
reader.skipType(tag & 7)
|
||||
break
|
||||
}
|
||||
}
|
||||
return message
|
||||
},
|
||||
|
||||
fromJSON(object: any): IdentityImage {
|
||||
const message = { ...baseIdentityImage } as IdentityImage
|
||||
message.payload = new Uint8Array()
|
||||
if (object.payload !== undefined && object.payload !== null) {
|
||||
message.payload = bytesFromBase64(object.payload)
|
||||
}
|
||||
if (object.sourceType !== undefined && object.sourceType !== null) {
|
||||
message.sourceType = identityImage_SourceTypeFromJSON(object.sourceType)
|
||||
} else {
|
||||
message.sourceType = 0
|
||||
}
|
||||
if (object.imageType !== undefined && object.imageType !== null) {
|
||||
message.imageType = imageTypeFromJSON(object.imageType)
|
||||
} else {
|
||||
message.imageType = 0
|
||||
}
|
||||
return message
|
||||
},
|
||||
|
||||
toJSON(message: IdentityImage): unknown {
|
||||
const obj: any = {}
|
||||
message.payload !== undefined &&
|
||||
(obj.payload = base64FromBytes(
|
||||
message.payload !== undefined ? message.payload : new Uint8Array()
|
||||
))
|
||||
message.sourceType !== undefined &&
|
||||
(obj.sourceType = identityImage_SourceTypeToJSON(message.sourceType))
|
||||
message.imageType !== undefined &&
|
||||
(obj.imageType = imageTypeToJSON(message.imageType))
|
||||
return obj
|
||||
},
|
||||
|
||||
fromPartial(object: DeepPartial<IdentityImage>): IdentityImage {
|
||||
const message = { ...baseIdentityImage } as IdentityImage
|
||||
if (object.payload !== undefined && object.payload !== null) {
|
||||
message.payload = object.payload
|
||||
} else {
|
||||
message.payload = new Uint8Array()
|
||||
}
|
||||
if (object.sourceType !== undefined && object.sourceType !== null) {
|
||||
message.sourceType = object.sourceType
|
||||
} else {
|
||||
message.sourceType = 0
|
||||
}
|
||||
if (object.imageType !== undefined && object.imageType !== null) {
|
||||
message.imageType = object.imageType
|
||||
} else {
|
||||
message.imageType = 0
|
||||
}
|
||||
return message
|
||||
},
|
||||
}
|
||||
|
||||
declare var self: any | undefined
|
||||
declare var window: any | undefined
|
||||
declare var global: any | undefined
|
||||
var globalThis: any = (() => {
|
||||
if (typeof globalThis !== 'undefined') return globalThis
|
||||
if (typeof self !== 'undefined') return self
|
||||
if (typeof window !== 'undefined') return window
|
||||
if (typeof global !== 'undefined') return global
|
||||
throw 'Unable to locate global object'
|
||||
})()
|
||||
|
||||
const atob: (b64: string) => string =
|
||||
globalThis.atob ||
|
||||
(b64 => globalThis.Buffer.from(b64, 'base64').toString('binary'))
|
||||
function bytesFromBase64(b64: string): Uint8Array {
|
||||
const bin = atob(b64)
|
||||
const arr = new Uint8Array(bin.length)
|
||||
for (let i = 0; i < bin.length; ++i) {
|
||||
arr[i] = bin.charCodeAt(i)
|
||||
}
|
||||
return arr
|
||||
}
|
||||
|
||||
const btoa: (bin: string) => string =
|
||||
globalThis.btoa ||
|
||||
(bin => globalThis.Buffer.from(bin, 'binary').toString('base64'))
|
||||
function base64FromBytes(arr: Uint8Array): string {
|
||||
const bin: string[] = []
|
||||
for (const byte of arr) {
|
||||
bin.push(String.fromCharCode(byte))
|
||||
}
|
||||
return btoa(bin.join(''))
|
||||
}
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Array<infer U>
|
||||
? Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U>
|
||||
? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {}
|
||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>
|
||||
|
||||
function longToNumber(long: Long): number {
|
||||
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
||||
throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER')
|
||||
}
|
||||
return long.toNumber()
|
||||
}
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any
|
||||
_m0.configure()
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,324 +0,0 @@
|
|||
/* eslint-disable */
|
||||
import Long from 'long'
|
||||
import _m0 from 'protobufjs/minimal'
|
||||
import { MessageType, messageTypeFromJSON, messageTypeToJSON } from './enums'
|
||||
|
||||
export const protobufPackage = 'communities.v1'
|
||||
|
||||
export interface EmojiReaction {
|
||||
/** clock Lamport timestamp of the chat message */
|
||||
clock: number
|
||||
/**
|
||||
* chat_id the ID of the chat the message belongs to, for query efficiency the chat_id is stored in the db even though the
|
||||
* target message also stores the chat_id
|
||||
*/
|
||||
chatId: string
|
||||
/** message_id the ID of the target message that the user wishes to react to */
|
||||
messageId: string
|
||||
/** message_type is (somewhat confusingly) the ID of the type of chat the message belongs to */
|
||||
messageType: MessageType
|
||||
/** type the ID of the emoji the user wishes to react with */
|
||||
type: EmojiReaction_Type
|
||||
/** whether this is a rectraction of a previously sent emoji */
|
||||
retracted: boolean
|
||||
/** Grant for organisation chat messages */
|
||||
grant: Uint8Array
|
||||
}
|
||||
|
||||
export enum EmojiReaction_Type {
|
||||
UNKNOWN_EMOJI_REACTION_TYPE = 0,
|
||||
LOVE = 1,
|
||||
THUMBS_UP = 2,
|
||||
THUMBS_DOWN = 3,
|
||||
LAUGH = 4,
|
||||
SAD = 5,
|
||||
ANGRY = 6,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
|
||||
export function emojiReaction_TypeFromJSON(object: any): EmojiReaction_Type {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case 'UNKNOWN_EMOJI_REACTION_TYPE':
|
||||
return EmojiReaction_Type.UNKNOWN_EMOJI_REACTION_TYPE
|
||||
case 1:
|
||||
case 'LOVE':
|
||||
return EmojiReaction_Type.LOVE
|
||||
case 2:
|
||||
case 'THUMBS_UP':
|
||||
return EmojiReaction_Type.THUMBS_UP
|
||||
case 3:
|
||||
case 'THUMBS_DOWN':
|
||||
return EmojiReaction_Type.THUMBS_DOWN
|
||||
case 4:
|
||||
case 'LAUGH':
|
||||
return EmojiReaction_Type.LAUGH
|
||||
case 5:
|
||||
case 'SAD':
|
||||
return EmojiReaction_Type.SAD
|
||||
case 6:
|
||||
case 'ANGRY':
|
||||
return EmojiReaction_Type.ANGRY
|
||||
case -1:
|
||||
case 'UNRECOGNIZED':
|
||||
default:
|
||||
return EmojiReaction_Type.UNRECOGNIZED
|
||||
}
|
||||
}
|
||||
|
||||
export function emojiReaction_TypeToJSON(object: EmojiReaction_Type): string {
|
||||
switch (object) {
|
||||
case EmojiReaction_Type.UNKNOWN_EMOJI_REACTION_TYPE:
|
||||
return 'UNKNOWN_EMOJI_REACTION_TYPE'
|
||||
case EmojiReaction_Type.LOVE:
|
||||
return 'LOVE'
|
||||
case EmojiReaction_Type.THUMBS_UP:
|
||||
return 'THUMBS_UP'
|
||||
case EmojiReaction_Type.THUMBS_DOWN:
|
||||
return 'THUMBS_DOWN'
|
||||
case EmojiReaction_Type.LAUGH:
|
||||
return 'LAUGH'
|
||||
case EmojiReaction_Type.SAD:
|
||||
return 'SAD'
|
||||
case EmojiReaction_Type.ANGRY:
|
||||
return 'ANGRY'
|
||||
default:
|
||||
return 'UNKNOWN'
|
||||
}
|
||||
}
|
||||
|
||||
const baseEmojiReaction: object = {
|
||||
clock: 0,
|
||||
chatId: '',
|
||||
messageId: '',
|
||||
messageType: 0,
|
||||
type: 0,
|
||||
retracted: false,
|
||||
}
|
||||
|
||||
export const EmojiReaction = {
|
||||
encode(
|
||||
message: EmojiReaction,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.clock !== 0) {
|
||||
writer.uint32(8).uint64(message.clock)
|
||||
}
|
||||
if (message.chatId !== '') {
|
||||
writer.uint32(18).string(message.chatId)
|
||||
}
|
||||
if (message.messageId !== '') {
|
||||
writer.uint32(26).string(message.messageId)
|
||||
}
|
||||
if (message.messageType !== 0) {
|
||||
writer.uint32(32).int32(message.messageType)
|
||||
}
|
||||
if (message.type !== 0) {
|
||||
writer.uint32(40).int32(message.type)
|
||||
}
|
||||
if (message.retracted === true) {
|
||||
writer.uint32(48).bool(message.retracted)
|
||||
}
|
||||
if (message.grant.length !== 0) {
|
||||
writer.uint32(58).bytes(message.grant)
|
||||
}
|
||||
return writer
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): EmojiReaction {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input)
|
||||
let end = length === undefined ? reader.len : reader.pos + length
|
||||
const message = { ...baseEmojiReaction } as EmojiReaction
|
||||
message.grant = new Uint8Array()
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32()
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.clock = longToNumber(reader.uint64() as Long)
|
||||
break
|
||||
case 2:
|
||||
message.chatId = reader.string()
|
||||
break
|
||||
case 3:
|
||||
message.messageId = reader.string()
|
||||
break
|
||||
case 4:
|
||||
message.messageType = reader.int32() as any
|
||||
break
|
||||
case 5:
|
||||
message.type = reader.int32() as any
|
||||
break
|
||||
case 6:
|
||||
message.retracted = reader.bool()
|
||||
break
|
||||
case 7:
|
||||
message.grant = reader.bytes()
|
||||
break
|
||||
default:
|
||||
reader.skipType(tag & 7)
|
||||
break
|
||||
}
|
||||
}
|
||||
return message
|
||||
},
|
||||
|
||||
fromJSON(object: any): EmojiReaction {
|
||||
const message = { ...baseEmojiReaction } as EmojiReaction
|
||||
message.grant = new Uint8Array()
|
||||
if (object.clock !== undefined && object.clock !== null) {
|
||||
message.clock = Number(object.clock)
|
||||
} else {
|
||||
message.clock = 0
|
||||
}
|
||||
if (object.chatId !== undefined && object.chatId !== null) {
|
||||
message.chatId = String(object.chatId)
|
||||
} else {
|
||||
message.chatId = ''
|
||||
}
|
||||
if (object.messageId !== undefined && object.messageId !== null) {
|
||||
message.messageId = String(object.messageId)
|
||||
} else {
|
||||
message.messageId = ''
|
||||
}
|
||||
if (object.messageType !== undefined && object.messageType !== null) {
|
||||
message.messageType = messageTypeFromJSON(object.messageType)
|
||||
} else {
|
||||
message.messageType = 0
|
||||
}
|
||||
if (object.type !== undefined && object.type !== null) {
|
||||
message.type = emojiReaction_TypeFromJSON(object.type)
|
||||
} else {
|
||||
message.type = 0
|
||||
}
|
||||
if (object.retracted !== undefined && object.retracted !== null) {
|
||||
message.retracted = Boolean(object.retracted)
|
||||
} else {
|
||||
message.retracted = false
|
||||
}
|
||||
if (object.grant !== undefined && object.grant !== null) {
|
||||
message.grant = bytesFromBase64(object.grant)
|
||||
}
|
||||
return message
|
||||
},
|
||||
|
||||
toJSON(message: EmojiReaction): unknown {
|
||||
const obj: any = {}
|
||||
message.clock !== undefined && (obj.clock = message.clock)
|
||||
message.chatId !== undefined && (obj.chatId = message.chatId)
|
||||
message.messageId !== undefined && (obj.messageId = message.messageId)
|
||||
message.messageType !== undefined &&
|
||||
(obj.messageType = messageTypeToJSON(message.messageType))
|
||||
message.type !== undefined &&
|
||||
(obj.type = emojiReaction_TypeToJSON(message.type))
|
||||
message.retracted !== undefined && (obj.retracted = message.retracted)
|
||||
message.grant !== undefined &&
|
||||
(obj.grant = base64FromBytes(
|
||||
message.grant !== undefined ? message.grant : new Uint8Array()
|
||||
))
|
||||
return obj
|
||||
},
|
||||
|
||||
fromPartial(object: DeepPartial<EmojiReaction>): EmojiReaction {
|
||||
const message = { ...baseEmojiReaction } as EmojiReaction
|
||||
if (object.clock !== undefined && object.clock !== null) {
|
||||
message.clock = object.clock
|
||||
} else {
|
||||
message.clock = 0
|
||||
}
|
||||
if (object.chatId !== undefined && object.chatId !== null) {
|
||||
message.chatId = object.chatId
|
||||
} else {
|
||||
message.chatId = ''
|
||||
}
|
||||
if (object.messageId !== undefined && object.messageId !== null) {
|
||||
message.messageId = object.messageId
|
||||
} else {
|
||||
message.messageId = ''
|
||||
}
|
||||
if (object.messageType !== undefined && object.messageType !== null) {
|
||||
message.messageType = object.messageType
|
||||
} else {
|
||||
message.messageType = 0
|
||||
}
|
||||
if (object.type !== undefined && object.type !== null) {
|
||||
message.type = object.type
|
||||
} else {
|
||||
message.type = 0
|
||||
}
|
||||
if (object.retracted !== undefined && object.retracted !== null) {
|
||||
message.retracted = object.retracted
|
||||
} else {
|
||||
message.retracted = false
|
||||
}
|
||||
if (object.grant !== undefined && object.grant !== null) {
|
||||
message.grant = object.grant
|
||||
} else {
|
||||
message.grant = new Uint8Array()
|
||||
}
|
||||
return message
|
||||
},
|
||||
}
|
||||
|
||||
declare var self: any | undefined
|
||||
declare var window: any | undefined
|
||||
declare var global: any | undefined
|
||||
var globalThis: any = (() => {
|
||||
if (typeof globalThis !== 'undefined') return globalThis
|
||||
if (typeof self !== 'undefined') return self
|
||||
if (typeof window !== 'undefined') return window
|
||||
if (typeof global !== 'undefined') return global
|
||||
throw 'Unable to locate global object'
|
||||
})()
|
||||
|
||||
const atob: (b64: string) => string =
|
||||
globalThis.atob ||
|
||||
(b64 => globalThis.Buffer.from(b64, 'base64').toString('binary'))
|
||||
function bytesFromBase64(b64: string): Uint8Array {
|
||||
const bin = atob(b64)
|
||||
const arr = new Uint8Array(bin.length)
|
||||
for (let i = 0; i < bin.length; ++i) {
|
||||
arr[i] = bin.charCodeAt(i)
|
||||
}
|
||||
return arr
|
||||
}
|
||||
|
||||
const btoa: (bin: string) => string =
|
||||
globalThis.btoa ||
|
||||
(bin => globalThis.Buffer.from(bin, 'binary').toString('base64'))
|
||||
function base64FromBytes(arr: Uint8Array): string {
|
||||
const bin: string[] = []
|
||||
for (const byte of arr) {
|
||||
bin.push(String.fromCharCode(byte))
|
||||
}
|
||||
return btoa(bin.join(''))
|
||||
}
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Array<infer U>
|
||||
? Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U>
|
||||
? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {}
|
||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>
|
||||
|
||||
function longToNumber(long: Long): number {
|
||||
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
||||
throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER')
|
||||
}
|
||||
return long.toNumber()
|
||||
}
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any
|
||||
_m0.configure()
|
||||
}
|
|
@ -1,125 +0,0 @@
|
|||
/* eslint-disable */
|
||||
import Long from 'long'
|
||||
import _m0 from 'protobufjs/minimal'
|
||||
|
||||
export const protobufPackage = 'communities.v1'
|
||||
|
||||
export enum MessageType {
|
||||
MESSAGE_TYPE_UNKNOWN_UNSPECIFIED = 0,
|
||||
MESSAGE_TYPE_ONE_TO_ONE = 1,
|
||||
MESSAGE_TYPE_MESSAGE_TYPE_PUBLIC_GROUP = 2,
|
||||
MESSAGE_TYPE_PRIVATE_GROUP = 3,
|
||||
/** MESSAGE_TYPE_SYSTEM_MESSAGE_PRIVATE_GROUP - Only local */
|
||||
MESSAGE_TYPE_SYSTEM_MESSAGE_PRIVATE_GROUP = 4,
|
||||
MESSAGE_TYPE_COMMUNITY_CHAT = 5,
|
||||
/** MESSAGE_TYPE_SYSTEM_MESSAGE_GAP - Only local */
|
||||
MESSAGE_TYPE_SYSTEM_MESSAGE_GAP = 6,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
|
||||
export function messageTypeFromJSON(object: any): MessageType {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case 'MESSAGE_TYPE_UNKNOWN_UNSPECIFIED':
|
||||
return MessageType.MESSAGE_TYPE_UNKNOWN_UNSPECIFIED
|
||||
case 1:
|
||||
case 'MESSAGE_TYPE_ONE_TO_ONE':
|
||||
return MessageType.MESSAGE_TYPE_ONE_TO_ONE
|
||||
case 2:
|
||||
case 'MESSAGE_TYPE_MESSAGE_TYPE_PUBLIC_GROUP':
|
||||
return MessageType.MESSAGE_TYPE_MESSAGE_TYPE_PUBLIC_GROUP
|
||||
case 3:
|
||||
case 'MESSAGE_TYPE_PRIVATE_GROUP':
|
||||
return MessageType.MESSAGE_TYPE_PRIVATE_GROUP
|
||||
case 4:
|
||||
case 'MESSAGE_TYPE_SYSTEM_MESSAGE_PRIVATE_GROUP':
|
||||
return MessageType.MESSAGE_TYPE_SYSTEM_MESSAGE_PRIVATE_GROUP
|
||||
case 5:
|
||||
case 'MESSAGE_TYPE_COMMUNITY_CHAT':
|
||||
return MessageType.MESSAGE_TYPE_COMMUNITY_CHAT
|
||||
case 6:
|
||||
case 'MESSAGE_TYPE_SYSTEM_MESSAGE_GAP':
|
||||
return MessageType.MESSAGE_TYPE_SYSTEM_MESSAGE_GAP
|
||||
case -1:
|
||||
case 'UNRECOGNIZED':
|
||||
default:
|
||||
return MessageType.UNRECOGNIZED
|
||||
}
|
||||
}
|
||||
|
||||
export function messageTypeToJSON(object: MessageType): string {
|
||||
switch (object) {
|
||||
case MessageType.MESSAGE_TYPE_UNKNOWN_UNSPECIFIED:
|
||||
return 'MESSAGE_TYPE_UNKNOWN_UNSPECIFIED'
|
||||
case MessageType.MESSAGE_TYPE_ONE_TO_ONE:
|
||||
return 'MESSAGE_TYPE_ONE_TO_ONE'
|
||||
case MessageType.MESSAGE_TYPE_MESSAGE_TYPE_PUBLIC_GROUP:
|
||||
return 'MESSAGE_TYPE_MESSAGE_TYPE_PUBLIC_GROUP'
|
||||
case MessageType.MESSAGE_TYPE_PRIVATE_GROUP:
|
||||
return 'MESSAGE_TYPE_PRIVATE_GROUP'
|
||||
case MessageType.MESSAGE_TYPE_SYSTEM_MESSAGE_PRIVATE_GROUP:
|
||||
return 'MESSAGE_TYPE_SYSTEM_MESSAGE_PRIVATE_GROUP'
|
||||
case MessageType.MESSAGE_TYPE_COMMUNITY_CHAT:
|
||||
return 'MESSAGE_TYPE_COMMUNITY_CHAT'
|
||||
case MessageType.MESSAGE_TYPE_SYSTEM_MESSAGE_GAP:
|
||||
return 'MESSAGE_TYPE_SYSTEM_MESSAGE_GAP'
|
||||
default:
|
||||
return 'UNKNOWN'
|
||||
}
|
||||
}
|
||||
|
||||
export enum ImageType {
|
||||
IMAGE_TYPE_UNKNOWN_UNSPECIFIED = 0,
|
||||
/** IMAGE_TYPE_PNG - Raster image files is payload data that can be read as a raster image */
|
||||
IMAGE_TYPE_PNG = 1,
|
||||
IMAGE_TYPE_JPEG = 2,
|
||||
IMAGE_TYPE_WEBP = 3,
|
||||
IMAGE_TYPE_GIF = 4,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
|
||||
export function imageTypeFromJSON(object: any): ImageType {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case 'IMAGE_TYPE_UNKNOWN_UNSPECIFIED':
|
||||
return ImageType.IMAGE_TYPE_UNKNOWN_UNSPECIFIED
|
||||
case 1:
|
||||
case 'IMAGE_TYPE_PNG':
|
||||
return ImageType.IMAGE_TYPE_PNG
|
||||
case 2:
|
||||
case 'IMAGE_TYPE_JPEG':
|
||||
return ImageType.IMAGE_TYPE_JPEG
|
||||
case 3:
|
||||
case 'IMAGE_TYPE_WEBP':
|
||||
return ImageType.IMAGE_TYPE_WEBP
|
||||
case 4:
|
||||
case 'IMAGE_TYPE_GIF':
|
||||
return ImageType.IMAGE_TYPE_GIF
|
||||
case -1:
|
||||
case 'UNRECOGNIZED':
|
||||
default:
|
||||
return ImageType.UNRECOGNIZED
|
||||
}
|
||||
}
|
||||
|
||||
export function imageTypeToJSON(object: ImageType): string {
|
||||
switch (object) {
|
||||
case ImageType.IMAGE_TYPE_UNKNOWN_UNSPECIFIED:
|
||||
return 'IMAGE_TYPE_UNKNOWN_UNSPECIFIED'
|
||||
case ImageType.IMAGE_TYPE_PNG:
|
||||
return 'IMAGE_TYPE_PNG'
|
||||
case ImageType.IMAGE_TYPE_JPEG:
|
||||
return 'IMAGE_TYPE_JPEG'
|
||||
case ImageType.IMAGE_TYPE_WEBP:
|
||||
return 'IMAGE_TYPE_WEBP'
|
||||
case ImageType.IMAGE_TYPE_GIF:
|
||||
return 'IMAGE_TYPE_GIF'
|
||||
default:
|
||||
return 'UNKNOWN'
|
||||
}
|
||||
}
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any
|
||||
_m0.configure()
|
||||
}
|
|
@ -1,436 +0,0 @@
|
|||
/* eslint-disable */
|
||||
import Long from 'long'
|
||||
import _m0 from 'protobufjs/minimal'
|
||||
import { ChatMessage } from './chat_message'
|
||||
import { EmojiReaction } from './emoji_reaction'
|
||||
|
||||
export const protobufPackage = 'communities.v1'
|
||||
|
||||
export interface MembershipUpdateEvent {
|
||||
/** Lamport timestamp of the event */
|
||||
clock: number
|
||||
/** List of public keys of objects of the action */
|
||||
members: string[]
|
||||
/** Name of the chat for the CHAT_CREATED/NAME_CHANGED event types */
|
||||
name: string
|
||||
/** The type of the event */
|
||||
type: MembershipUpdateEvent_EventType
|
||||
}
|
||||
|
||||
export enum MembershipUpdateEvent_EventType {
|
||||
UNKNOWN = 0,
|
||||
CHAT_CREATED = 1,
|
||||
NAME_CHANGED = 2,
|
||||
MEMBERS_ADDED = 3,
|
||||
MEMBER_JOINED = 4,
|
||||
MEMBER_REMOVED = 5,
|
||||
ADMINS_ADDED = 6,
|
||||
ADMIN_REMOVED = 7,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
|
||||
export function membershipUpdateEvent_EventTypeFromJSON(
|
||||
object: any
|
||||
): MembershipUpdateEvent_EventType {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case 'UNKNOWN':
|
||||
return MembershipUpdateEvent_EventType.UNKNOWN
|
||||
case 1:
|
||||
case 'CHAT_CREATED':
|
||||
return MembershipUpdateEvent_EventType.CHAT_CREATED
|
||||
case 2:
|
||||
case 'NAME_CHANGED':
|
||||
return MembershipUpdateEvent_EventType.NAME_CHANGED
|
||||
case 3:
|
||||
case 'MEMBERS_ADDED':
|
||||
return MembershipUpdateEvent_EventType.MEMBERS_ADDED
|
||||
case 4:
|
||||
case 'MEMBER_JOINED':
|
||||
return MembershipUpdateEvent_EventType.MEMBER_JOINED
|
||||
case 5:
|
||||
case 'MEMBER_REMOVED':
|
||||
return MembershipUpdateEvent_EventType.MEMBER_REMOVED
|
||||
case 6:
|
||||
case 'ADMINS_ADDED':
|
||||
return MembershipUpdateEvent_EventType.ADMINS_ADDED
|
||||
case 7:
|
||||
case 'ADMIN_REMOVED':
|
||||
return MembershipUpdateEvent_EventType.ADMIN_REMOVED
|
||||
case -1:
|
||||
case 'UNRECOGNIZED':
|
||||
default:
|
||||
return MembershipUpdateEvent_EventType.UNRECOGNIZED
|
||||
}
|
||||
}
|
||||
|
||||
export function membershipUpdateEvent_EventTypeToJSON(
|
||||
object: MembershipUpdateEvent_EventType
|
||||
): string {
|
||||
switch (object) {
|
||||
case MembershipUpdateEvent_EventType.UNKNOWN:
|
||||
return 'UNKNOWN'
|
||||
case MembershipUpdateEvent_EventType.CHAT_CREATED:
|
||||
return 'CHAT_CREATED'
|
||||
case MembershipUpdateEvent_EventType.NAME_CHANGED:
|
||||
return 'NAME_CHANGED'
|
||||
case MembershipUpdateEvent_EventType.MEMBERS_ADDED:
|
||||
return 'MEMBERS_ADDED'
|
||||
case MembershipUpdateEvent_EventType.MEMBER_JOINED:
|
||||
return 'MEMBER_JOINED'
|
||||
case MembershipUpdateEvent_EventType.MEMBER_REMOVED:
|
||||
return 'MEMBER_REMOVED'
|
||||
case MembershipUpdateEvent_EventType.ADMINS_ADDED:
|
||||
return 'ADMINS_ADDED'
|
||||
case MembershipUpdateEvent_EventType.ADMIN_REMOVED:
|
||||
return 'ADMIN_REMOVED'
|
||||
default:
|
||||
return 'UNKNOWN'
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* MembershipUpdateMessage is a message used to propagate information
|
||||
* about group membership changes.
|
||||
* For more information, see https://github.com/status-im/specs/blob/master/status-group-chats-spec.md.
|
||||
*/
|
||||
export interface MembershipUpdateMessage {
|
||||
/** The chat id of the private group chat */
|
||||
chatId: string
|
||||
/**
|
||||
* A list of events for this group chat, first x bytes are the signature, then is a
|
||||
* protobuf encoded MembershipUpdateEvent
|
||||
*/
|
||||
events: Uint8Array[]
|
||||
message: ChatMessage | undefined
|
||||
emojiReaction: EmojiReaction | undefined
|
||||
}
|
||||
|
||||
const baseMembershipUpdateEvent: object = {
|
||||
clock: 0,
|
||||
members: '',
|
||||
name: '',
|
||||
type: 0,
|
||||
}
|
||||
|
||||
export const MembershipUpdateEvent = {
|
||||
encode(
|
||||
message: MembershipUpdateEvent,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.clock !== 0) {
|
||||
writer.uint32(8).uint64(message.clock)
|
||||
}
|
||||
for (const v of message.members) {
|
||||
writer.uint32(18).string(v!)
|
||||
}
|
||||
if (message.name !== '') {
|
||||
writer.uint32(26).string(message.name)
|
||||
}
|
||||
if (message.type !== 0) {
|
||||
writer.uint32(32).int32(message.type)
|
||||
}
|
||||
return writer
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): MembershipUpdateEvent {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input)
|
||||
let end = length === undefined ? reader.len : reader.pos + length
|
||||
const message = { ...baseMembershipUpdateEvent } as MembershipUpdateEvent
|
||||
message.members = []
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32()
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.clock = longToNumber(reader.uint64() as Long)
|
||||
break
|
||||
case 2:
|
||||
message.members.push(reader.string())
|
||||
break
|
||||
case 3:
|
||||
message.name = reader.string()
|
||||
break
|
||||
case 4:
|
||||
message.type = reader.int32() as any
|
||||
break
|
||||
default:
|
||||
reader.skipType(tag & 7)
|
||||
break
|
||||
}
|
||||
}
|
||||
return message
|
||||
},
|
||||
|
||||
fromJSON(object: any): MembershipUpdateEvent {
|
||||
const message = { ...baseMembershipUpdateEvent } as MembershipUpdateEvent
|
||||
message.members = []
|
||||
if (object.clock !== undefined && object.clock !== null) {
|
||||
message.clock = Number(object.clock)
|
||||
} else {
|
||||
message.clock = 0
|
||||
}
|
||||
if (object.members !== undefined && object.members !== null) {
|
||||
for (const e of object.members) {
|
||||
message.members.push(String(e))
|
||||
}
|
||||
}
|
||||
if (object.name !== undefined && object.name !== null) {
|
||||
message.name = String(object.name)
|
||||
} else {
|
||||
message.name = ''
|
||||
}
|
||||
if (object.type !== undefined && object.type !== null) {
|
||||
message.type = membershipUpdateEvent_EventTypeFromJSON(object.type)
|
||||
} else {
|
||||
message.type = 0
|
||||
}
|
||||
return message
|
||||
},
|
||||
|
||||
toJSON(message: MembershipUpdateEvent): unknown {
|
||||
const obj: any = {}
|
||||
message.clock !== undefined && (obj.clock = message.clock)
|
||||
if (message.members) {
|
||||
obj.members = message.members.map(e => e)
|
||||
} else {
|
||||
obj.members = []
|
||||
}
|
||||
message.name !== undefined && (obj.name = message.name)
|
||||
message.type !== undefined &&
|
||||
(obj.type = membershipUpdateEvent_EventTypeToJSON(message.type))
|
||||
return obj
|
||||
},
|
||||
|
||||
fromPartial(
|
||||
object: DeepPartial<MembershipUpdateEvent>
|
||||
): MembershipUpdateEvent {
|
||||
const message = { ...baseMembershipUpdateEvent } as MembershipUpdateEvent
|
||||
message.members = []
|
||||
if (object.clock !== undefined && object.clock !== null) {
|
||||
message.clock = object.clock
|
||||
} else {
|
||||
message.clock = 0
|
||||
}
|
||||
if (object.members !== undefined && object.members !== null) {
|
||||
for (const e of object.members) {
|
||||
message.members.push(e)
|
||||
}
|
||||
}
|
||||
if (object.name !== undefined && object.name !== null) {
|
||||
message.name = object.name
|
||||
} else {
|
||||
message.name = ''
|
||||
}
|
||||
if (object.type !== undefined && object.type !== null) {
|
||||
message.type = object.type
|
||||
} else {
|
||||
message.type = 0
|
||||
}
|
||||
return message
|
||||
},
|
||||
}
|
||||
|
||||
const baseMembershipUpdateMessage: object = { chatId: '' }
|
||||
|
||||
export const MembershipUpdateMessage = {
|
||||
encode(
|
||||
message: MembershipUpdateMessage,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.chatId !== '') {
|
||||
writer.uint32(10).string(message.chatId)
|
||||
}
|
||||
for (const v of message.events) {
|
||||
writer.uint32(18).bytes(v!)
|
||||
}
|
||||
if (message.message !== undefined) {
|
||||
ChatMessage.encode(message.message, writer.uint32(26).fork()).ldelim()
|
||||
}
|
||||
if (message.emojiReaction !== undefined) {
|
||||
EmojiReaction.encode(
|
||||
message.emojiReaction,
|
||||
writer.uint32(34).fork()
|
||||
).ldelim()
|
||||
}
|
||||
return writer
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): MembershipUpdateMessage {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input)
|
||||
let end = length === undefined ? reader.len : reader.pos + length
|
||||
const message = {
|
||||
...baseMembershipUpdateMessage,
|
||||
} as MembershipUpdateMessage
|
||||
message.events = []
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32()
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.chatId = reader.string()
|
||||
break
|
||||
case 2:
|
||||
message.events.push(reader.bytes())
|
||||
break
|
||||
case 3:
|
||||
message.message = ChatMessage.decode(reader, reader.uint32())
|
||||
break
|
||||
case 4:
|
||||
message.emojiReaction = EmojiReaction.decode(reader, reader.uint32())
|
||||
break
|
||||
default:
|
||||
reader.skipType(tag & 7)
|
||||
break
|
||||
}
|
||||
}
|
||||
return message
|
||||
},
|
||||
|
||||
fromJSON(object: any): MembershipUpdateMessage {
|
||||
const message = {
|
||||
...baseMembershipUpdateMessage,
|
||||
} as MembershipUpdateMessage
|
||||
message.events = []
|
||||
if (object.chatId !== undefined && object.chatId !== null) {
|
||||
message.chatId = String(object.chatId)
|
||||
} else {
|
||||
message.chatId = ''
|
||||
}
|
||||
if (object.events !== undefined && object.events !== null) {
|
||||
for (const e of object.events) {
|
||||
message.events.push(bytesFromBase64(e))
|
||||
}
|
||||
}
|
||||
if (object.message !== undefined && object.message !== null) {
|
||||
message.message = ChatMessage.fromJSON(object.message)
|
||||
} else {
|
||||
message.message = undefined
|
||||
}
|
||||
if (object.emojiReaction !== undefined && object.emojiReaction !== null) {
|
||||
message.emojiReaction = EmojiReaction.fromJSON(object.emojiReaction)
|
||||
} else {
|
||||
message.emojiReaction = undefined
|
||||
}
|
||||
return message
|
||||
},
|
||||
|
||||
toJSON(message: MembershipUpdateMessage): unknown {
|
||||
const obj: any = {}
|
||||
message.chatId !== undefined && (obj.chatId = message.chatId)
|
||||
if (message.events) {
|
||||
obj.events = message.events.map(e =>
|
||||
base64FromBytes(e !== undefined ? e : new Uint8Array())
|
||||
)
|
||||
} else {
|
||||
obj.events = []
|
||||
}
|
||||
message.message !== undefined &&
|
||||
(obj.message = message.message
|
||||
? ChatMessage.toJSON(message.message)
|
||||
: undefined)
|
||||
message.emojiReaction !== undefined &&
|
||||
(obj.emojiReaction = message.emojiReaction
|
||||
? EmojiReaction.toJSON(message.emojiReaction)
|
||||
: undefined)
|
||||
return obj
|
||||
},
|
||||
|
||||
fromPartial(
|
||||
object: DeepPartial<MembershipUpdateMessage>
|
||||
): MembershipUpdateMessage {
|
||||
const message = {
|
||||
...baseMembershipUpdateMessage,
|
||||
} as MembershipUpdateMessage
|
||||
message.events = []
|
||||
if (object.chatId !== undefined && object.chatId !== null) {
|
||||
message.chatId = object.chatId
|
||||
} else {
|
||||
message.chatId = ''
|
||||
}
|
||||
if (object.events !== undefined && object.events !== null) {
|
||||
for (const e of object.events) {
|
||||
message.events.push(e)
|
||||
}
|
||||
}
|
||||
if (object.message !== undefined && object.message !== null) {
|
||||
message.message = ChatMessage.fromPartial(object.message)
|
||||
} else {
|
||||
message.message = undefined
|
||||
}
|
||||
if (object.emojiReaction !== undefined && object.emojiReaction !== null) {
|
||||
message.emojiReaction = EmojiReaction.fromPartial(object.emojiReaction)
|
||||
} else {
|
||||
message.emojiReaction = undefined
|
||||
}
|
||||
return message
|
||||
},
|
||||
}
|
||||
|
||||
declare var self: any | undefined
|
||||
declare var window: any | undefined
|
||||
declare var global: any | undefined
|
||||
var globalThis: any = (() => {
|
||||
if (typeof globalThis !== 'undefined') return globalThis
|
||||
if (typeof self !== 'undefined') return self
|
||||
if (typeof window !== 'undefined') return window
|
||||
if (typeof global !== 'undefined') return global
|
||||
throw 'Unable to locate global object'
|
||||
})()
|
||||
|
||||
const atob: (b64: string) => string =
|
||||
globalThis.atob ||
|
||||
(b64 => globalThis.Buffer.from(b64, 'base64').toString('binary'))
|
||||
function bytesFromBase64(b64: string): Uint8Array {
|
||||
const bin = atob(b64)
|
||||
const arr = new Uint8Array(bin.length)
|
||||
for (let i = 0; i < bin.length; ++i) {
|
||||
arr[i] = bin.charCodeAt(i)
|
||||
}
|
||||
return arr
|
||||
}
|
||||
|
||||
const btoa: (bin: string) => string =
|
||||
globalThis.btoa ||
|
||||
(bin => globalThis.Buffer.from(bin, 'binary').toString('base64'))
|
||||
function base64FromBytes(arr: Uint8Array): string {
|
||||
const bin: string[] = []
|
||||
for (const byte of arr) {
|
||||
bin.push(String.fromCharCode(byte))
|
||||
}
|
||||
return btoa(bin.join(''))
|
||||
}
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Array<infer U>
|
||||
? Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U>
|
||||
? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {}
|
||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>
|
||||
|
||||
function longToNumber(long: Long): number {
|
||||
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
||||
throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER')
|
||||
}
|
||||
return long.toNumber()
|
||||
}
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any
|
||||
_m0.configure()
|
||||
}
|
|
@ -1,409 +0,0 @@
|
|||
/* eslint-disable */
|
||||
import Long from 'long'
|
||||
import _m0 from 'protobufjs/minimal'
|
||||
|
||||
export const protobufPackage = 'status.v1'
|
||||
|
||||
export interface ApplicationMetadataMessage {
|
||||
/** Signature of the payload field */
|
||||
signature: Uint8Array
|
||||
/** This is the encoded protobuf of the application level message, i.e ChatMessage */
|
||||
payload: Uint8Array
|
||||
/** The type of protobuf message sent */
|
||||
type: ApplicationMetadataMessage_Type
|
||||
}
|
||||
|
||||
export enum ApplicationMetadataMessage_Type {
|
||||
TYPE_UNKNOWN_UNSPECIFIED = 0,
|
||||
TYPE_CHAT_MESSAGE = 1,
|
||||
TYPE_CONTACT_UPDATE = 2,
|
||||
TYPE_MEMBERSHIP_UPDATE_MESSAGE = 3,
|
||||
TYPE_PAIR_INSTALLATION = 4,
|
||||
TYPE_SYNC_INSTALLATION = 5,
|
||||
TYPE_REQUEST_ADDRESS_FOR_TRANSACTION = 6,
|
||||
TYPE_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION = 7,
|
||||
TYPE_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION = 8,
|
||||
TYPE_REQUEST_TRANSACTION = 9,
|
||||
TYPE_SEND_TRANSACTION = 10,
|
||||
TYPE_DECLINE_REQUEST_TRANSACTION = 11,
|
||||
TYPE_SYNC_INSTALLATION_CONTACT = 12,
|
||||
TYPE_SYNC_INSTALLATION_ACCOUNT = 13,
|
||||
TYPE_SYNC_INSTALLATION_PUBLIC_CHAT = 14,
|
||||
TYPE_CONTACT_CODE_ADVERTISEMENT = 15,
|
||||
TYPE_PUSH_NOTIFICATION_REGISTRATION = 16,
|
||||
TYPE_PUSH_NOTIFICATION_REGISTRATION_RESPONSE = 17,
|
||||
TYPE_PUSH_NOTIFICATION_QUERY = 18,
|
||||
TYPE_PUSH_NOTIFICATION_QUERY_RESPONSE = 19,
|
||||
TYPE_PUSH_NOTIFICATION_REQUEST = 20,
|
||||
TYPE_PUSH_NOTIFICATION_RESPONSE = 21,
|
||||
TYPE_EMOJI_REACTION = 22,
|
||||
TYPE_GROUP_CHAT_INVITATION = 23,
|
||||
TYPE_CHAT_IDENTITY = 24,
|
||||
TYPE_COMMUNITY_DESCRIPTION = 25,
|
||||
TYPE_COMMUNITY_INVITATION = 26,
|
||||
TYPE_COMMUNITY_REQUEST_TO_JOIN = 27,
|
||||
TYPE_PIN_MESSAGE = 28,
|
||||
TYPE_EDIT_MESSAGE = 29,
|
||||
TYPE_STATUS_UPDATE = 30,
|
||||
TYPE_DELETE_MESSAGE = 31,
|
||||
TYPE_SYNC_INSTALLATION_COMMUNITY = 32,
|
||||
TYPE_ANONYMOUS_METRIC_BATCH = 33,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
|
||||
export function applicationMetadataMessage_TypeFromJSON(
|
||||
object: any
|
||||
): ApplicationMetadataMessage_Type {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case 'TYPE_UNKNOWN_UNSPECIFIED':
|
||||
return ApplicationMetadataMessage_Type.TYPE_UNKNOWN_UNSPECIFIED
|
||||
case 1:
|
||||
case 'TYPE_CHAT_MESSAGE':
|
||||
return ApplicationMetadataMessage_Type.TYPE_CHAT_MESSAGE
|
||||
case 2:
|
||||
case 'TYPE_CONTACT_UPDATE':
|
||||
return ApplicationMetadataMessage_Type.TYPE_CONTACT_UPDATE
|
||||
case 3:
|
||||
case 'TYPE_MEMBERSHIP_UPDATE_MESSAGE':
|
||||
return ApplicationMetadataMessage_Type.TYPE_MEMBERSHIP_UPDATE_MESSAGE
|
||||
case 4:
|
||||
case 'TYPE_PAIR_INSTALLATION':
|
||||
return ApplicationMetadataMessage_Type.TYPE_PAIR_INSTALLATION
|
||||
case 5:
|
||||
case 'TYPE_SYNC_INSTALLATION':
|
||||
return ApplicationMetadataMessage_Type.TYPE_SYNC_INSTALLATION
|
||||
case 6:
|
||||
case 'TYPE_REQUEST_ADDRESS_FOR_TRANSACTION':
|
||||
return ApplicationMetadataMessage_Type.TYPE_REQUEST_ADDRESS_FOR_TRANSACTION
|
||||
case 7:
|
||||
case 'TYPE_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION':
|
||||
return ApplicationMetadataMessage_Type.TYPE_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION
|
||||
case 8:
|
||||
case 'TYPE_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION':
|
||||
return ApplicationMetadataMessage_Type.TYPE_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION
|
||||
case 9:
|
||||
case 'TYPE_REQUEST_TRANSACTION':
|
||||
return ApplicationMetadataMessage_Type.TYPE_REQUEST_TRANSACTION
|
||||
case 10:
|
||||
case 'TYPE_SEND_TRANSACTION':
|
||||
return ApplicationMetadataMessage_Type.TYPE_SEND_TRANSACTION
|
||||
case 11:
|
||||
case 'TYPE_DECLINE_REQUEST_TRANSACTION':
|
||||
return ApplicationMetadataMessage_Type.TYPE_DECLINE_REQUEST_TRANSACTION
|
||||
case 12:
|
||||
case 'TYPE_SYNC_INSTALLATION_CONTACT':
|
||||
return ApplicationMetadataMessage_Type.TYPE_SYNC_INSTALLATION_CONTACT
|
||||
case 13:
|
||||
case 'TYPE_SYNC_INSTALLATION_ACCOUNT':
|
||||
return ApplicationMetadataMessage_Type.TYPE_SYNC_INSTALLATION_ACCOUNT
|
||||
case 14:
|
||||
case 'TYPE_SYNC_INSTALLATION_PUBLIC_CHAT':
|
||||
return ApplicationMetadataMessage_Type.TYPE_SYNC_INSTALLATION_PUBLIC_CHAT
|
||||
case 15:
|
||||
case 'TYPE_CONTACT_CODE_ADVERTISEMENT':
|
||||
return ApplicationMetadataMessage_Type.TYPE_CONTACT_CODE_ADVERTISEMENT
|
||||
case 16:
|
||||
case 'TYPE_PUSH_NOTIFICATION_REGISTRATION':
|
||||
return ApplicationMetadataMessage_Type.TYPE_PUSH_NOTIFICATION_REGISTRATION
|
||||
case 17:
|
||||
case 'TYPE_PUSH_NOTIFICATION_REGISTRATION_RESPONSE':
|
||||
return ApplicationMetadataMessage_Type.TYPE_PUSH_NOTIFICATION_REGISTRATION_RESPONSE
|
||||
case 18:
|
||||
case 'TYPE_PUSH_NOTIFICATION_QUERY':
|
||||
return ApplicationMetadataMessage_Type.TYPE_PUSH_NOTIFICATION_QUERY
|
||||
case 19:
|
||||
case 'TYPE_PUSH_NOTIFICATION_QUERY_RESPONSE':
|
||||
return ApplicationMetadataMessage_Type.TYPE_PUSH_NOTIFICATION_QUERY_RESPONSE
|
||||
case 20:
|
||||
case 'TYPE_PUSH_NOTIFICATION_REQUEST':
|
||||
return ApplicationMetadataMessage_Type.TYPE_PUSH_NOTIFICATION_REQUEST
|
||||
case 21:
|
||||
case 'TYPE_PUSH_NOTIFICATION_RESPONSE':
|
||||
return ApplicationMetadataMessage_Type.TYPE_PUSH_NOTIFICATION_RESPONSE
|
||||
case 22:
|
||||
case 'TYPE_EMOJI_REACTION':
|
||||
return ApplicationMetadataMessage_Type.TYPE_EMOJI_REACTION
|
||||
case 23:
|
||||
case 'TYPE_GROUP_CHAT_INVITATION':
|
||||
return ApplicationMetadataMessage_Type.TYPE_GROUP_CHAT_INVITATION
|
||||
case 24:
|
||||
case 'TYPE_CHAT_IDENTITY':
|
||||
return ApplicationMetadataMessage_Type.TYPE_CHAT_IDENTITY
|
||||
case 25:
|
||||
case 'TYPE_COMMUNITY_DESCRIPTION':
|
||||
return ApplicationMetadataMessage_Type.TYPE_COMMUNITY_DESCRIPTION
|
||||
case 26:
|
||||
case 'TYPE_COMMUNITY_INVITATION':
|
||||
return ApplicationMetadataMessage_Type.TYPE_COMMUNITY_INVITATION
|
||||
case 27:
|
||||
case 'TYPE_COMMUNITY_REQUEST_TO_JOIN':
|
||||
return ApplicationMetadataMessage_Type.TYPE_COMMUNITY_REQUEST_TO_JOIN
|
||||
case 28:
|
||||
case 'TYPE_PIN_MESSAGE':
|
||||
return ApplicationMetadataMessage_Type.TYPE_PIN_MESSAGE
|
||||
case 29:
|
||||
case 'TYPE_EDIT_MESSAGE':
|
||||
return ApplicationMetadataMessage_Type.TYPE_EDIT_MESSAGE
|
||||
case 30:
|
||||
case 'TYPE_STATUS_UPDATE':
|
||||
return ApplicationMetadataMessage_Type.TYPE_STATUS_UPDATE
|
||||
case 31:
|
||||
case 'TYPE_DELETE_MESSAGE':
|
||||
return ApplicationMetadataMessage_Type.TYPE_DELETE_MESSAGE
|
||||
case 32:
|
||||
case 'TYPE_SYNC_INSTALLATION_COMMUNITY':
|
||||
return ApplicationMetadataMessage_Type.TYPE_SYNC_INSTALLATION_COMMUNITY
|
||||
case 33:
|
||||
case 'TYPE_ANONYMOUS_METRIC_BATCH':
|
||||
return ApplicationMetadataMessage_Type.TYPE_ANONYMOUS_METRIC_BATCH
|
||||
case -1:
|
||||
case 'UNRECOGNIZED':
|
||||
default:
|
||||
return ApplicationMetadataMessage_Type.UNRECOGNIZED
|
||||
}
|
||||
}
|
||||
|
||||
export function applicationMetadataMessage_TypeToJSON(
|
||||
object: ApplicationMetadataMessage_Type
|
||||
): string {
|
||||
switch (object) {
|
||||
case ApplicationMetadataMessage_Type.TYPE_UNKNOWN_UNSPECIFIED:
|
||||
return 'TYPE_UNKNOWN_UNSPECIFIED'
|
||||
case ApplicationMetadataMessage_Type.TYPE_CHAT_MESSAGE:
|
||||
return 'TYPE_CHAT_MESSAGE'
|
||||
case ApplicationMetadataMessage_Type.TYPE_CONTACT_UPDATE:
|
||||
return 'TYPE_CONTACT_UPDATE'
|
||||
case ApplicationMetadataMessage_Type.TYPE_MEMBERSHIP_UPDATE_MESSAGE:
|
||||
return 'TYPE_MEMBERSHIP_UPDATE_MESSAGE'
|
||||
case ApplicationMetadataMessage_Type.TYPE_PAIR_INSTALLATION:
|
||||
return 'TYPE_PAIR_INSTALLATION'
|
||||
case ApplicationMetadataMessage_Type.TYPE_SYNC_INSTALLATION:
|
||||
return 'TYPE_SYNC_INSTALLATION'
|
||||
case ApplicationMetadataMessage_Type.TYPE_REQUEST_ADDRESS_FOR_TRANSACTION:
|
||||
return 'TYPE_REQUEST_ADDRESS_FOR_TRANSACTION'
|
||||
case ApplicationMetadataMessage_Type.TYPE_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION:
|
||||
return 'TYPE_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION'
|
||||
case ApplicationMetadataMessage_Type.TYPE_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION:
|
||||
return 'TYPE_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION'
|
||||
case ApplicationMetadataMessage_Type.TYPE_REQUEST_TRANSACTION:
|
||||
return 'TYPE_REQUEST_TRANSACTION'
|
||||
case ApplicationMetadataMessage_Type.TYPE_SEND_TRANSACTION:
|
||||
return 'TYPE_SEND_TRANSACTION'
|
||||
case ApplicationMetadataMessage_Type.TYPE_DECLINE_REQUEST_TRANSACTION:
|
||||
return 'TYPE_DECLINE_REQUEST_TRANSACTION'
|
||||
case ApplicationMetadataMessage_Type.TYPE_SYNC_INSTALLATION_CONTACT:
|
||||
return 'TYPE_SYNC_INSTALLATION_CONTACT'
|
||||
case ApplicationMetadataMessage_Type.TYPE_SYNC_INSTALLATION_ACCOUNT:
|
||||
return 'TYPE_SYNC_INSTALLATION_ACCOUNT'
|
||||
case ApplicationMetadataMessage_Type.TYPE_SYNC_INSTALLATION_PUBLIC_CHAT:
|
||||
return 'TYPE_SYNC_INSTALLATION_PUBLIC_CHAT'
|
||||
case ApplicationMetadataMessage_Type.TYPE_CONTACT_CODE_ADVERTISEMENT:
|
||||
return 'TYPE_CONTACT_CODE_ADVERTISEMENT'
|
||||
case ApplicationMetadataMessage_Type.TYPE_PUSH_NOTIFICATION_REGISTRATION:
|
||||
return 'TYPE_PUSH_NOTIFICATION_REGISTRATION'
|
||||
case ApplicationMetadataMessage_Type.TYPE_PUSH_NOTIFICATION_REGISTRATION_RESPONSE:
|
||||
return 'TYPE_PUSH_NOTIFICATION_REGISTRATION_RESPONSE'
|
||||
case ApplicationMetadataMessage_Type.TYPE_PUSH_NOTIFICATION_QUERY:
|
||||
return 'TYPE_PUSH_NOTIFICATION_QUERY'
|
||||
case ApplicationMetadataMessage_Type.TYPE_PUSH_NOTIFICATION_QUERY_RESPONSE:
|
||||
return 'TYPE_PUSH_NOTIFICATION_QUERY_RESPONSE'
|
||||
case ApplicationMetadataMessage_Type.TYPE_PUSH_NOTIFICATION_REQUEST:
|
||||
return 'TYPE_PUSH_NOTIFICATION_REQUEST'
|
||||
case ApplicationMetadataMessage_Type.TYPE_PUSH_NOTIFICATION_RESPONSE:
|
||||
return 'TYPE_PUSH_NOTIFICATION_RESPONSE'
|
||||
case ApplicationMetadataMessage_Type.TYPE_EMOJI_REACTION:
|
||||
return 'TYPE_EMOJI_REACTION'
|
||||
case ApplicationMetadataMessage_Type.TYPE_GROUP_CHAT_INVITATION:
|
||||
return 'TYPE_GROUP_CHAT_INVITATION'
|
||||
case ApplicationMetadataMessage_Type.TYPE_CHAT_IDENTITY:
|
||||
return 'TYPE_CHAT_IDENTITY'
|
||||
case ApplicationMetadataMessage_Type.TYPE_COMMUNITY_DESCRIPTION:
|
||||
return 'TYPE_COMMUNITY_DESCRIPTION'
|
||||
case ApplicationMetadataMessage_Type.TYPE_COMMUNITY_INVITATION:
|
||||
return 'TYPE_COMMUNITY_INVITATION'
|
||||
case ApplicationMetadataMessage_Type.TYPE_COMMUNITY_REQUEST_TO_JOIN:
|
||||
return 'TYPE_COMMUNITY_REQUEST_TO_JOIN'
|
||||
case ApplicationMetadataMessage_Type.TYPE_PIN_MESSAGE:
|
||||
return 'TYPE_PIN_MESSAGE'
|
||||
case ApplicationMetadataMessage_Type.TYPE_EDIT_MESSAGE:
|
||||
return 'TYPE_EDIT_MESSAGE'
|
||||
case ApplicationMetadataMessage_Type.TYPE_STATUS_UPDATE:
|
||||
return 'TYPE_STATUS_UPDATE'
|
||||
case ApplicationMetadataMessage_Type.TYPE_DELETE_MESSAGE:
|
||||
return 'TYPE_DELETE_MESSAGE'
|
||||
case ApplicationMetadataMessage_Type.TYPE_SYNC_INSTALLATION_COMMUNITY:
|
||||
return 'TYPE_SYNC_INSTALLATION_COMMUNITY'
|
||||
case ApplicationMetadataMessage_Type.TYPE_ANONYMOUS_METRIC_BATCH:
|
||||
return 'TYPE_ANONYMOUS_METRIC_BATCH'
|
||||
default:
|
||||
return 'UNKNOWN'
|
||||
}
|
||||
}
|
||||
|
||||
const baseApplicationMetadataMessage: object = { type: 0 }
|
||||
|
||||
export const ApplicationMetadataMessage = {
|
||||
encode(
|
||||
message: ApplicationMetadataMessage,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.signature.length !== 0) {
|
||||
writer.uint32(10).bytes(message.signature)
|
||||
}
|
||||
if (message.payload.length !== 0) {
|
||||
writer.uint32(18).bytes(message.payload)
|
||||
}
|
||||
if (message.type !== 0) {
|
||||
writer.uint32(24).int32(message.type)
|
||||
}
|
||||
return writer
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): ApplicationMetadataMessage {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input)
|
||||
let end = length === undefined ? reader.len : reader.pos + length
|
||||
const message = {
|
||||
...baseApplicationMetadataMessage,
|
||||
} as ApplicationMetadataMessage
|
||||
message.signature = new Uint8Array()
|
||||
message.payload = new Uint8Array()
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32()
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.signature = reader.bytes()
|
||||
break
|
||||
case 2:
|
||||
message.payload = reader.bytes()
|
||||
break
|
||||
case 3:
|
||||
message.type = reader.int32() as any
|
||||
break
|
||||
default:
|
||||
reader.skipType(tag & 7)
|
||||
break
|
||||
}
|
||||
}
|
||||
return message
|
||||
},
|
||||
|
||||
fromJSON(object: any): ApplicationMetadataMessage {
|
||||
const message = {
|
||||
...baseApplicationMetadataMessage,
|
||||
} as ApplicationMetadataMessage
|
||||
message.signature = new Uint8Array()
|
||||
message.payload = new Uint8Array()
|
||||
if (object.signature !== undefined && object.signature !== null) {
|
||||
message.signature = bytesFromBase64(object.signature)
|
||||
}
|
||||
if (object.payload !== undefined && object.payload !== null) {
|
||||
message.payload = bytesFromBase64(object.payload)
|
||||
}
|
||||
if (object.type !== undefined && object.type !== null) {
|
||||
message.type = applicationMetadataMessage_TypeFromJSON(object.type)
|
||||
} else {
|
||||
message.type = 0
|
||||
}
|
||||
return message
|
||||
},
|
||||
|
||||
toJSON(message: ApplicationMetadataMessage): unknown {
|
||||
const obj: any = {}
|
||||
message.signature !== undefined &&
|
||||
(obj.signature = base64FromBytes(
|
||||
message.signature !== undefined ? message.signature : new Uint8Array()
|
||||
))
|
||||
message.payload !== undefined &&
|
||||
(obj.payload = base64FromBytes(
|
||||
message.payload !== undefined ? message.payload : new Uint8Array()
|
||||
))
|
||||
message.type !== undefined &&
|
||||
(obj.type = applicationMetadataMessage_TypeToJSON(message.type))
|
||||
return obj
|
||||
},
|
||||
|
||||
fromPartial(
|
||||
object: DeepPartial<ApplicationMetadataMessage>
|
||||
): ApplicationMetadataMessage {
|
||||
const message = {
|
||||
...baseApplicationMetadataMessage,
|
||||
} as ApplicationMetadataMessage
|
||||
if (object.signature !== undefined && object.signature !== null) {
|
||||
message.signature = object.signature
|
||||
} else {
|
||||
message.signature = new Uint8Array()
|
||||
}
|
||||
if (object.payload !== undefined && object.payload !== null) {
|
||||
message.payload = object.payload
|
||||
} else {
|
||||
message.payload = new Uint8Array()
|
||||
}
|
||||
if (object.type !== undefined && object.type !== null) {
|
||||
message.type = object.type
|
||||
} else {
|
||||
message.type = 0
|
||||
}
|
||||
return message
|
||||
},
|
||||
}
|
||||
|
||||
declare var self: any | undefined
|
||||
declare var window: any | undefined
|
||||
declare var global: any | undefined
|
||||
var globalThis: any = (() => {
|
||||
if (typeof globalThis !== 'undefined') return globalThis
|
||||
if (typeof self !== 'undefined') return self
|
||||
if (typeof window !== 'undefined') return window
|
||||
if (typeof global !== 'undefined') return global
|
||||
throw 'Unable to locate global object'
|
||||
})()
|
||||
|
||||
const atob: (b64: string) => string =
|
||||
globalThis.atob ||
|
||||
(b64 => globalThis.Buffer.from(b64, 'base64').toString('binary'))
|
||||
function bytesFromBase64(b64: string): Uint8Array {
|
||||
const bin = atob(b64)
|
||||
const arr = new Uint8Array(bin.length)
|
||||
for (let i = 0; i < bin.length; ++i) {
|
||||
arr[i] = bin.charCodeAt(i)
|
||||
}
|
||||
return arr
|
||||
}
|
||||
|
||||
const btoa: (bin: string) => string =
|
||||
globalThis.btoa ||
|
||||
(bin => globalThis.Buffer.from(bin, 'binary').toString('base64'))
|
||||
function base64FromBytes(arr: Uint8Array): string {
|
||||
const bin: string[] = []
|
||||
for (const byte of arr) {
|
||||
bin.push(String.fromCharCode(byte))
|
||||
}
|
||||
return btoa(bin.join(''))
|
||||
}
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Array<infer U>
|
||||
? Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U>
|
||||
? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {}
|
||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any
|
||||
_m0.configure()
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,109 +0,0 @@
|
|||
/* eslint-disable import/export */
|
||||
/* eslint-disable @typescript-eslint/no-namespace */
|
||||
|
||||
import { enumeration, encodeMessage, decodeMessage, message, bytes } from 'protons-runtime'
|
||||
import type { Codec } from 'protons-runtime'
|
||||
|
||||
export interface ApplicationMetadataMessage {
|
||||
signature: Uint8Array
|
||||
payload: Uint8Array
|
||||
type: ApplicationMetadataMessage.Type
|
||||
}
|
||||
|
||||
export namespace ApplicationMetadataMessage {
|
||||
export enum Type {
|
||||
TYPE_UNKNOWN_UNSPECIFIED = 'TYPE_UNKNOWN_UNSPECIFIED',
|
||||
TYPE_CHAT_MESSAGE = 'TYPE_CHAT_MESSAGE',
|
||||
TYPE_CONTACT_UPDATE = 'TYPE_CONTACT_UPDATE',
|
||||
TYPE_MEMBERSHIP_UPDATE_MESSAGE = 'TYPE_MEMBERSHIP_UPDATE_MESSAGE',
|
||||
TYPE_PAIR_INSTALLATION = 'TYPE_PAIR_INSTALLATION',
|
||||
TYPE_SYNC_INSTALLATION = 'TYPE_SYNC_INSTALLATION',
|
||||
TYPE_REQUEST_ADDRESS_FOR_TRANSACTION = 'TYPE_REQUEST_ADDRESS_FOR_TRANSACTION',
|
||||
TYPE_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION = 'TYPE_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION',
|
||||
TYPE_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION = 'TYPE_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION',
|
||||
TYPE_REQUEST_TRANSACTION = 'TYPE_REQUEST_TRANSACTION',
|
||||
TYPE_SEND_TRANSACTION = 'TYPE_SEND_TRANSACTION',
|
||||
TYPE_DECLINE_REQUEST_TRANSACTION = 'TYPE_DECLINE_REQUEST_TRANSACTION',
|
||||
TYPE_SYNC_INSTALLATION_CONTACT = 'TYPE_SYNC_INSTALLATION_CONTACT',
|
||||
TYPE_SYNC_INSTALLATION_ACCOUNT = 'TYPE_SYNC_INSTALLATION_ACCOUNT',
|
||||
TYPE_SYNC_INSTALLATION_PUBLIC_CHAT = 'TYPE_SYNC_INSTALLATION_PUBLIC_CHAT',
|
||||
TYPE_CONTACT_CODE_ADVERTISEMENT = 'TYPE_CONTACT_CODE_ADVERTISEMENT',
|
||||
TYPE_PUSH_NOTIFICATION_REGISTRATION = 'TYPE_PUSH_NOTIFICATION_REGISTRATION',
|
||||
TYPE_PUSH_NOTIFICATION_REGISTRATION_RESPONSE = 'TYPE_PUSH_NOTIFICATION_REGISTRATION_RESPONSE',
|
||||
TYPE_PUSH_NOTIFICATION_QUERY = 'TYPE_PUSH_NOTIFICATION_QUERY',
|
||||
TYPE_PUSH_NOTIFICATION_QUERY_RESPONSE = 'TYPE_PUSH_NOTIFICATION_QUERY_RESPONSE',
|
||||
TYPE_PUSH_NOTIFICATION_REQUEST = 'TYPE_PUSH_NOTIFICATION_REQUEST',
|
||||
TYPE_PUSH_NOTIFICATION_RESPONSE = 'TYPE_PUSH_NOTIFICATION_RESPONSE',
|
||||
TYPE_EMOJI_REACTION = 'TYPE_EMOJI_REACTION',
|
||||
TYPE_GROUP_CHAT_INVITATION = 'TYPE_GROUP_CHAT_INVITATION',
|
||||
TYPE_CHAT_IDENTITY = 'TYPE_CHAT_IDENTITY',
|
||||
TYPE_COMMUNITY_DESCRIPTION = 'TYPE_COMMUNITY_DESCRIPTION',
|
||||
TYPE_COMMUNITY_INVITATION = 'TYPE_COMMUNITY_INVITATION',
|
||||
TYPE_COMMUNITY_REQUEST_TO_JOIN = 'TYPE_COMMUNITY_REQUEST_TO_JOIN',
|
||||
TYPE_PIN_MESSAGE = 'TYPE_PIN_MESSAGE',
|
||||
TYPE_EDIT_MESSAGE = 'TYPE_EDIT_MESSAGE',
|
||||
TYPE_STATUS_UPDATE = 'TYPE_STATUS_UPDATE',
|
||||
TYPE_DELETE_MESSAGE = 'TYPE_DELETE_MESSAGE',
|
||||
TYPE_SYNC_INSTALLATION_COMMUNITY = 'TYPE_SYNC_INSTALLATION_COMMUNITY',
|
||||
TYPE_ANONYMOUS_METRIC_BATCH = 'TYPE_ANONYMOUS_METRIC_BATCH'
|
||||
}
|
||||
|
||||
enum __TypeValues {
|
||||
TYPE_UNKNOWN_UNSPECIFIED = 0,
|
||||
TYPE_CHAT_MESSAGE = 1,
|
||||
TYPE_CONTACT_UPDATE = 2,
|
||||
TYPE_MEMBERSHIP_UPDATE_MESSAGE = 3,
|
||||
TYPE_PAIR_INSTALLATION = 4,
|
||||
TYPE_SYNC_INSTALLATION = 5,
|
||||
TYPE_REQUEST_ADDRESS_FOR_TRANSACTION = 6,
|
||||
TYPE_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION = 7,
|
||||
TYPE_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION = 8,
|
||||
TYPE_REQUEST_TRANSACTION = 9,
|
||||
TYPE_SEND_TRANSACTION = 10,
|
||||
TYPE_DECLINE_REQUEST_TRANSACTION = 11,
|
||||
TYPE_SYNC_INSTALLATION_CONTACT = 12,
|
||||
TYPE_SYNC_INSTALLATION_ACCOUNT = 13,
|
||||
TYPE_SYNC_INSTALLATION_PUBLIC_CHAT = 14,
|
||||
TYPE_CONTACT_CODE_ADVERTISEMENT = 15,
|
||||
TYPE_PUSH_NOTIFICATION_REGISTRATION = 16,
|
||||
TYPE_PUSH_NOTIFICATION_REGISTRATION_RESPONSE = 17,
|
||||
TYPE_PUSH_NOTIFICATION_QUERY = 18,
|
||||
TYPE_PUSH_NOTIFICATION_QUERY_RESPONSE = 19,
|
||||
TYPE_PUSH_NOTIFICATION_REQUEST = 20,
|
||||
TYPE_PUSH_NOTIFICATION_RESPONSE = 21,
|
||||
TYPE_EMOJI_REACTION = 22,
|
||||
TYPE_GROUP_CHAT_INVITATION = 23,
|
||||
TYPE_CHAT_IDENTITY = 24,
|
||||
TYPE_COMMUNITY_DESCRIPTION = 25,
|
||||
TYPE_COMMUNITY_INVITATION = 26,
|
||||
TYPE_COMMUNITY_REQUEST_TO_JOIN = 27,
|
||||
TYPE_PIN_MESSAGE = 28,
|
||||
TYPE_EDIT_MESSAGE = 29,
|
||||
TYPE_STATUS_UPDATE = 30,
|
||||
TYPE_DELETE_MESSAGE = 31,
|
||||
TYPE_SYNC_INSTALLATION_COMMUNITY = 32,
|
||||
TYPE_ANONYMOUS_METRIC_BATCH = 33
|
||||
}
|
||||
|
||||
export namespace Type {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof Type>(__TypeValues)
|
||||
}
|
||||
}
|
||||
|
||||
export const codec = (): Codec<ApplicationMetadataMessage> => {
|
||||
return message<ApplicationMetadataMessage>({
|
||||
1: { name: 'signature', codec: bytes },
|
||||
2: { name: 'payload', codec: bytes },
|
||||
3: { name: 'type', codec: ApplicationMetadataMessage.Type.codec() }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: ApplicationMetadataMessage): Uint8Array => {
|
||||
return encodeMessage(obj, ApplicationMetadataMessage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): ApplicationMetadataMessage => {
|
||||
return decodeMessage(buf, ApplicationMetadataMessage.codec())
|
||||
}
|
||||
}
|
|
@ -0,0 +1,275 @@
|
|||
// @generated by protoc-gen-es v1.0.0 with parameter "target=ts"
|
||||
// @generated from file application-metadata-message.proto (syntax proto3)
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
|
||||
import { Message, proto3 } from "@bufbuild/protobuf";
|
||||
|
||||
/**
|
||||
* @generated from message ApplicationMetadataMessage
|
||||
*/
|
||||
export class ApplicationMetadataMessage extends Message<ApplicationMetadataMessage> {
|
||||
/**
|
||||
* Signature of the payload field
|
||||
*
|
||||
* @generated from field: bytes signature = 1;
|
||||
*/
|
||||
signature = new Uint8Array(0);
|
||||
|
||||
/**
|
||||
* This is the encoded protobuf of the application level message, i.e ChatMessage
|
||||
*
|
||||
* @generated from field: bytes payload = 2;
|
||||
*/
|
||||
payload = new Uint8Array(0);
|
||||
|
||||
/**
|
||||
* The type of protobuf message sent
|
||||
*
|
||||
* @generated from field: ApplicationMetadataMessage.Type type = 3;
|
||||
*/
|
||||
type = ApplicationMetadataMessage_Type.UNKNOWN_UNSPECIFIED;
|
||||
|
||||
constructor(data?: PartialMessage<ApplicationMetadataMessage>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "ApplicationMetadataMessage";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "signature", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
{ no: 2, name: "payload", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
{ no: 3, name: "type", kind: "enum", T: proto3.getEnumType(ApplicationMetadataMessage_Type) },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ApplicationMetadataMessage {
|
||||
return new ApplicationMetadataMessage().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ApplicationMetadataMessage {
|
||||
return new ApplicationMetadataMessage().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ApplicationMetadataMessage {
|
||||
return new ApplicationMetadataMessage().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: ApplicationMetadataMessage | PlainMessage<ApplicationMetadataMessage> | undefined, b: ApplicationMetadataMessage | PlainMessage<ApplicationMetadataMessage> | undefined): boolean {
|
||||
return proto3.util.equals(ApplicationMetadataMessage, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from enum ApplicationMetadataMessage.Type
|
||||
*/
|
||||
export enum ApplicationMetadataMessage_Type {
|
||||
/**
|
||||
* @generated from enum value: TYPE_UNKNOWN_UNSPECIFIED = 0;
|
||||
*/
|
||||
UNKNOWN_UNSPECIFIED = 0,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_CHAT_MESSAGE = 1;
|
||||
*/
|
||||
CHAT_MESSAGE = 1,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_CONTACT_UPDATE = 2;
|
||||
*/
|
||||
CONTACT_UPDATE = 2,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_MEMBERSHIP_UPDATE_MESSAGE = 3;
|
||||
*/
|
||||
MEMBERSHIP_UPDATE_MESSAGE = 3,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_PAIR_INSTALLATION = 4;
|
||||
*/
|
||||
PAIR_INSTALLATION = 4,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_SYNC_INSTALLATION = 5;
|
||||
*/
|
||||
SYNC_INSTALLATION = 5,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_REQUEST_ADDRESS_FOR_TRANSACTION = 6;
|
||||
*/
|
||||
REQUEST_ADDRESS_FOR_TRANSACTION = 6,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION = 7;
|
||||
*/
|
||||
ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION = 7,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION = 8;
|
||||
*/
|
||||
DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION = 8,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_REQUEST_TRANSACTION = 9;
|
||||
*/
|
||||
REQUEST_TRANSACTION = 9,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_SEND_TRANSACTION = 10;
|
||||
*/
|
||||
SEND_TRANSACTION = 10,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_DECLINE_REQUEST_TRANSACTION = 11;
|
||||
*/
|
||||
DECLINE_REQUEST_TRANSACTION = 11,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_SYNC_INSTALLATION_CONTACT = 12;
|
||||
*/
|
||||
SYNC_INSTALLATION_CONTACT = 12,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_SYNC_INSTALLATION_ACCOUNT = 13;
|
||||
*/
|
||||
SYNC_INSTALLATION_ACCOUNT = 13,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_SYNC_INSTALLATION_PUBLIC_CHAT = 14;
|
||||
*/
|
||||
SYNC_INSTALLATION_PUBLIC_CHAT = 14,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_CONTACT_CODE_ADVERTISEMENT = 15;
|
||||
*/
|
||||
CONTACT_CODE_ADVERTISEMENT = 15,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_PUSH_NOTIFICATION_REGISTRATION = 16;
|
||||
*/
|
||||
PUSH_NOTIFICATION_REGISTRATION = 16,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_PUSH_NOTIFICATION_REGISTRATION_RESPONSE = 17;
|
||||
*/
|
||||
PUSH_NOTIFICATION_REGISTRATION_RESPONSE = 17,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_PUSH_NOTIFICATION_QUERY = 18;
|
||||
*/
|
||||
PUSH_NOTIFICATION_QUERY = 18,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_PUSH_NOTIFICATION_QUERY_RESPONSE = 19;
|
||||
*/
|
||||
PUSH_NOTIFICATION_QUERY_RESPONSE = 19,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_PUSH_NOTIFICATION_REQUEST = 20;
|
||||
*/
|
||||
PUSH_NOTIFICATION_REQUEST = 20,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_PUSH_NOTIFICATION_RESPONSE = 21;
|
||||
*/
|
||||
PUSH_NOTIFICATION_RESPONSE = 21,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_EMOJI_REACTION = 22;
|
||||
*/
|
||||
EMOJI_REACTION = 22,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_GROUP_CHAT_INVITATION = 23;
|
||||
*/
|
||||
GROUP_CHAT_INVITATION = 23,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_CHAT_IDENTITY = 24;
|
||||
*/
|
||||
CHAT_IDENTITY = 24,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_COMMUNITY_DESCRIPTION = 25;
|
||||
*/
|
||||
COMMUNITY_DESCRIPTION = 25,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_COMMUNITY_INVITATION = 26;
|
||||
*/
|
||||
COMMUNITY_INVITATION = 26,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_COMMUNITY_REQUEST_TO_JOIN = 27;
|
||||
*/
|
||||
COMMUNITY_REQUEST_TO_JOIN = 27,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_PIN_MESSAGE = 28;
|
||||
*/
|
||||
PIN_MESSAGE = 28,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_EDIT_MESSAGE = 29;
|
||||
*/
|
||||
EDIT_MESSAGE = 29,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_STATUS_UPDATE = 30;
|
||||
*/
|
||||
STATUS_UPDATE = 30,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_DELETE_MESSAGE = 31;
|
||||
*/
|
||||
DELETE_MESSAGE = 31,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_SYNC_INSTALLATION_COMMUNITY = 32;
|
||||
*/
|
||||
SYNC_INSTALLATION_COMMUNITY = 32,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TYPE_ANONYMOUS_METRIC_BATCH = 33;
|
||||
*/
|
||||
ANONYMOUS_METRIC_BATCH = 33,
|
||||
}
|
||||
// Retrieve enum metadata with: proto3.getEnumType(ApplicationMetadataMessage_Type)
|
||||
proto3.util.setEnumType(ApplicationMetadataMessage_Type, "ApplicationMetadataMessage.Type", [
|
||||
{ no: 0, name: "TYPE_UNKNOWN_UNSPECIFIED" },
|
||||
{ no: 1, name: "TYPE_CHAT_MESSAGE" },
|
||||
{ no: 2, name: "TYPE_CONTACT_UPDATE" },
|
||||
{ no: 3, name: "TYPE_MEMBERSHIP_UPDATE_MESSAGE" },
|
||||
{ no: 4, name: "TYPE_PAIR_INSTALLATION" },
|
||||
{ no: 5, name: "TYPE_SYNC_INSTALLATION" },
|
||||
{ no: 6, name: "TYPE_REQUEST_ADDRESS_FOR_TRANSACTION" },
|
||||
{ no: 7, name: "TYPE_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION" },
|
||||
{ no: 8, name: "TYPE_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION" },
|
||||
{ no: 9, name: "TYPE_REQUEST_TRANSACTION" },
|
||||
{ no: 10, name: "TYPE_SEND_TRANSACTION" },
|
||||
{ no: 11, name: "TYPE_DECLINE_REQUEST_TRANSACTION" },
|
||||
{ no: 12, name: "TYPE_SYNC_INSTALLATION_CONTACT" },
|
||||
{ no: 13, name: "TYPE_SYNC_INSTALLATION_ACCOUNT" },
|
||||
{ no: 14, name: "TYPE_SYNC_INSTALLATION_PUBLIC_CHAT" },
|
||||
{ no: 15, name: "TYPE_CONTACT_CODE_ADVERTISEMENT" },
|
||||
{ no: 16, name: "TYPE_PUSH_NOTIFICATION_REGISTRATION" },
|
||||
{ no: 17, name: "TYPE_PUSH_NOTIFICATION_REGISTRATION_RESPONSE" },
|
||||
{ no: 18, name: "TYPE_PUSH_NOTIFICATION_QUERY" },
|
||||
{ no: 19, name: "TYPE_PUSH_NOTIFICATION_QUERY_RESPONSE" },
|
||||
{ no: 20, name: "TYPE_PUSH_NOTIFICATION_REQUEST" },
|
||||
{ no: 21, name: "TYPE_PUSH_NOTIFICATION_RESPONSE" },
|
||||
{ no: 22, name: "TYPE_EMOJI_REACTION" },
|
||||
{ no: 23, name: "TYPE_GROUP_CHAT_INVITATION" },
|
||||
{ no: 24, name: "TYPE_CHAT_IDENTITY" },
|
||||
{ no: 25, name: "TYPE_COMMUNITY_DESCRIPTION" },
|
||||
{ no: 26, name: "TYPE_COMMUNITY_INVITATION" },
|
||||
{ no: 27, name: "TYPE_COMMUNITY_REQUEST_TO_JOIN" },
|
||||
{ no: 28, name: "TYPE_PIN_MESSAGE" },
|
||||
{ no: 29, name: "TYPE_EDIT_MESSAGE" },
|
||||
{ no: 30, name: "TYPE_STATUS_UPDATE" },
|
||||
{ no: 31, name: "TYPE_DELETE_MESSAGE" },
|
||||
{ no: 32, name: "TYPE_SYNC_INSTALLATION_COMMUNITY" },
|
||||
{ no: 33, name: "TYPE_ANONYMOUS_METRIC_BATCH" },
|
||||
]);
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
version: v1beta1
|
||||
|
||||
build:
|
||||
roots:
|
||||
- ./proto
|
||||
version: v1
|
||||
breaking:
|
||||
use:
|
||||
- FILE
|
||||
lint:
|
||||
use:
|
||||
- DEFAULT
|
||||
except:
|
||||
- ENUM_ZERO_VALUE_SUFFIX
|
||||
- ENUM_VALUE_PREFIX
|
|
@ -16,12 +16,19 @@ message ChatIdentity {
|
|||
// display name is the user set identity
|
||||
string display_name = 4;
|
||||
|
||||
// description is the user set description, valid only for organisations
|
||||
// description is the user set description
|
||||
string description = 5;
|
||||
|
||||
string color = 6;
|
||||
|
||||
string emoji = 7;
|
||||
|
||||
repeated SocialLink social_links = 8;
|
||||
|
||||
// first known message timestamp in seconds (valid only for community chats for now)
|
||||
// 0 - unknown
|
||||
// 1 - no messages
|
||||
uint32 first_message_timestamp = 9;
|
||||
}
|
||||
|
||||
// ProfileImage represents data associated with a user's profile image
|
||||
|
@ -57,3 +64,9 @@ message IdentityImage {
|
|||
ENS_AVATAR = 2;
|
||||
}
|
||||
}
|
||||
|
||||
// SocialLinks represents social link assosiated with given chat identity (personal/community)
|
||||
message SocialLink {
|
||||
string text = 1;
|
||||
string url = 2;
|
||||
}
|
||||
|
|
|
@ -1,130 +0,0 @@
|
|||
/* eslint-disable import/export */
|
||||
/* eslint-disable @typescript-eslint/no-namespace */
|
||||
|
||||
import { encodeMessage, decodeMessage, message, uint64, string, enumeration, bytes, bool } from 'protons-runtime'
|
||||
import type { Codec } from 'protons-runtime'
|
||||
|
||||
export interface ChatIdentity {
|
||||
clock: bigint
|
||||
ensName: string
|
||||
images: IdentityImage
|
||||
displayName: string
|
||||
description: string
|
||||
color: string
|
||||
emoji: string
|
||||
}
|
||||
|
||||
export namespace ChatIdentity {
|
||||
export const codec = (): Codec<ChatIdentity> => {
|
||||
return message<ChatIdentity>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'ensName', codec: string },
|
||||
3: { name: 'images', codec: IdentityImage.codec() },
|
||||
4: { name: 'displayName', codec: string },
|
||||
5: { name: 'description', codec: string },
|
||||
6: { name: 'color', codec: string },
|
||||
7: { name: 'emoji', codec: string }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: ChatIdentity): Uint8Array => {
|
||||
return encodeMessage(obj, ChatIdentity.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): ChatIdentity => {
|
||||
return decodeMessage(buf, ChatIdentity.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface IdentityImage {
|
||||
payload: Uint8Array
|
||||
sourceType: IdentityImage.SourceType
|
||||
imageType: ImageType
|
||||
encryptionKeys: Uint8Array[]
|
||||
encrypted: boolean
|
||||
}
|
||||
|
||||
export namespace IdentityImage {
|
||||
export enum SourceType {
|
||||
UNKNOWN_SOURCE_TYPE = 'UNKNOWN_SOURCE_TYPE',
|
||||
RAW_PAYLOAD = 'RAW_PAYLOAD',
|
||||
ENS_AVATAR = 'ENS_AVATAR'
|
||||
}
|
||||
|
||||
enum __SourceTypeValues {
|
||||
UNKNOWN_SOURCE_TYPE = 0,
|
||||
RAW_PAYLOAD = 1,
|
||||
ENS_AVATAR = 2
|
||||
}
|
||||
|
||||
export namespace SourceType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof SourceType>(__SourceTypeValues)
|
||||
}
|
||||
}
|
||||
|
||||
export const codec = (): Codec<IdentityImage> => {
|
||||
return message<IdentityImage>({
|
||||
1: { name: 'payload', codec: bytes },
|
||||
2: { name: 'sourceType', codec: IdentityImage.SourceType.codec() },
|
||||
3: { name: 'imageType', codec: ImageType.codec() },
|
||||
4: { name: 'encryptionKeys', codec: bytes, repeats: true },
|
||||
5: { name: 'encrypted', codec: bool }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: IdentityImage): Uint8Array => {
|
||||
return encodeMessage(obj, IdentityImage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): IdentityImage => {
|
||||
return decodeMessage(buf, IdentityImage.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export enum MessageType {
|
||||
UNKNOWN_MESSAGE_TYPE = 'UNKNOWN_MESSAGE_TYPE',
|
||||
ONE_TO_ONE = 'ONE_TO_ONE',
|
||||
PUBLIC_GROUP = 'PUBLIC_GROUP',
|
||||
PRIVATE_GROUP = 'PRIVATE_GROUP',
|
||||
SYSTEM_MESSAGE_PRIVATE_GROUP = 'SYSTEM_MESSAGE_PRIVATE_GROUP',
|
||||
COMMUNITY_CHAT = 'COMMUNITY_CHAT',
|
||||
SYSTEM_MESSAGE_GAP = 'SYSTEM_MESSAGE_GAP'
|
||||
}
|
||||
|
||||
enum __MessageTypeValues {
|
||||
UNKNOWN_MESSAGE_TYPE = 0,
|
||||
ONE_TO_ONE = 1,
|
||||
PUBLIC_GROUP = 2,
|
||||
PRIVATE_GROUP = 3,
|
||||
SYSTEM_MESSAGE_PRIVATE_GROUP = 4,
|
||||
COMMUNITY_CHAT = 5,
|
||||
SYSTEM_MESSAGE_GAP = 6
|
||||
}
|
||||
|
||||
export namespace MessageType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof MessageType>(__MessageTypeValues)
|
||||
}
|
||||
}
|
||||
export enum ImageType {
|
||||
UNKNOWN_IMAGE_TYPE = 'UNKNOWN_IMAGE_TYPE',
|
||||
PNG = 'PNG',
|
||||
JPEG = 'JPEG',
|
||||
WEBP = 'WEBP',
|
||||
GIF = 'GIF'
|
||||
}
|
||||
|
||||
enum __ImageTypeValues {
|
||||
UNKNOWN_IMAGE_TYPE = 0,
|
||||
PNG = 1,
|
||||
JPEG = 2,
|
||||
WEBP = 3,
|
||||
GIF = 4
|
||||
}
|
||||
|
||||
export namespace ImageType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof ImageType>(__ImageTypeValues)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,264 @@
|
|||
// @generated by protoc-gen-es v1.0.0 with parameter "target=ts"
|
||||
// @generated from file chat-identity.proto (syntax proto3)
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
|
||||
import { Message, proto3, protoInt64 } from "@bufbuild/protobuf";
|
||||
import { ImageType } from "./enums_pb.js";
|
||||
|
||||
/**
|
||||
* ChatIdentity represents the user defined identity associated with their public chat key
|
||||
*
|
||||
* @generated from message ChatIdentity
|
||||
*/
|
||||
export class ChatIdentity extends Message<ChatIdentity> {
|
||||
/**
|
||||
* Lamport timestamp of the message
|
||||
*
|
||||
* @generated from field: uint64 clock = 1;
|
||||
*/
|
||||
clock = protoInt64.zero;
|
||||
|
||||
/**
|
||||
* ens_name is the valid ENS name associated with the chat key
|
||||
*
|
||||
* @generated from field: string ens_name = 2;
|
||||
*/
|
||||
ensName = "";
|
||||
|
||||
/**
|
||||
* images is a string indexed mapping of images associated with an identity
|
||||
*
|
||||
* @generated from field: map<string, IdentityImage> images = 3;
|
||||
*/
|
||||
images: { [key: string]: IdentityImage } = {};
|
||||
|
||||
/**
|
||||
* display name is the user set identity
|
||||
*
|
||||
* @generated from field: string display_name = 4;
|
||||
*/
|
||||
displayName = "";
|
||||
|
||||
/**
|
||||
* description is the user set description
|
||||
*
|
||||
* @generated from field: string description = 5;
|
||||
*/
|
||||
description = "";
|
||||
|
||||
/**
|
||||
* @generated from field: string color = 6;
|
||||
*/
|
||||
color = "";
|
||||
|
||||
/**
|
||||
* @generated from field: string emoji = 7;
|
||||
*/
|
||||
emoji = "";
|
||||
|
||||
/**
|
||||
* @generated from field: repeated SocialLink social_links = 8;
|
||||
*/
|
||||
socialLinks: SocialLink[] = [];
|
||||
|
||||
/**
|
||||
* first known message timestamp in seconds (valid only for community chats for now)
|
||||
* 0 - unknown
|
||||
* 1 - no messages
|
||||
*
|
||||
* @generated from field: uint32 first_message_timestamp = 9;
|
||||
*/
|
||||
firstMessageTimestamp = 0;
|
||||
|
||||
constructor(data?: PartialMessage<ChatIdentity>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "ChatIdentity";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "clock", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
|
||||
{ no: 2, name: "ens_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 3, name: "images", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: IdentityImage} },
|
||||
{ no: 4, name: "display_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 5, name: "description", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 6, name: "color", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 7, name: "emoji", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 8, name: "social_links", kind: "message", T: SocialLink, repeated: true },
|
||||
{ no: 9, name: "first_message_timestamp", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ChatIdentity {
|
||||
return new ChatIdentity().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ChatIdentity {
|
||||
return new ChatIdentity().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ChatIdentity {
|
||||
return new ChatIdentity().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: ChatIdentity | PlainMessage<ChatIdentity> | undefined, b: ChatIdentity | PlainMessage<ChatIdentity> | undefined): boolean {
|
||||
return proto3.util.equals(ChatIdentity, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ProfileImage represents data associated with a user's profile image
|
||||
*
|
||||
* @generated from message IdentityImage
|
||||
*/
|
||||
export class IdentityImage extends Message<IdentityImage> {
|
||||
/**
|
||||
* payload is a context based payload for the profile image data,
|
||||
* context is determined by the `source_type`
|
||||
*
|
||||
* @generated from field: bytes payload = 1;
|
||||
*/
|
||||
payload = new Uint8Array(0);
|
||||
|
||||
/**
|
||||
* source_type signals the image payload source
|
||||
*
|
||||
* @generated from field: IdentityImage.SourceType source_type = 2;
|
||||
*/
|
||||
sourceType = IdentityImage_SourceType.UNKNOWN_SOURCE_TYPE;
|
||||
|
||||
/**
|
||||
* image_type signals the image type and method of parsing the payload
|
||||
*
|
||||
* @generated from field: ImageType image_type = 3;
|
||||
*/
|
||||
imageType = ImageType.UNKNOWN_IMAGE_TYPE;
|
||||
|
||||
/**
|
||||
* encryption_keys is a list of encrypted keys that can be used to decrypted an encrypted payload
|
||||
*
|
||||
* @generated from field: repeated bytes encryption_keys = 4;
|
||||
*/
|
||||
encryptionKeys: Uint8Array[] = [];
|
||||
|
||||
/**
|
||||
* encrypted signals the encryption state of the payload, default is false.
|
||||
*
|
||||
* @generated from field: bool encrypted = 5;
|
||||
*/
|
||||
encrypted = false;
|
||||
|
||||
constructor(data?: PartialMessage<IdentityImage>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "IdentityImage";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "payload", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
{ no: 2, name: "source_type", kind: "enum", T: proto3.getEnumType(IdentityImage_SourceType) },
|
||||
{ no: 3, name: "image_type", kind: "enum", T: proto3.getEnumType(ImageType) },
|
||||
{ no: 4, name: "encryption_keys", kind: "scalar", T: 12 /* ScalarType.BYTES */, repeated: true },
|
||||
{ no: 5, name: "encrypted", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): IdentityImage {
|
||||
return new IdentityImage().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): IdentityImage {
|
||||
return new IdentityImage().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): IdentityImage {
|
||||
return new IdentityImage().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: IdentityImage | PlainMessage<IdentityImage> | undefined, b: IdentityImage | PlainMessage<IdentityImage> | undefined): boolean {
|
||||
return proto3.util.equals(IdentityImage, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* SourceType are the predefined types of image source allowed
|
||||
*
|
||||
* @generated from enum IdentityImage.SourceType
|
||||
*/
|
||||
export enum IdentityImage_SourceType {
|
||||
/**
|
||||
* @generated from enum value: UNKNOWN_SOURCE_TYPE = 0;
|
||||
*/
|
||||
UNKNOWN_SOURCE_TYPE = 0,
|
||||
|
||||
/**
|
||||
* RAW_PAYLOAD image byte data
|
||||
*
|
||||
* @generated from enum value: RAW_PAYLOAD = 1;
|
||||
*/
|
||||
RAW_PAYLOAD = 1,
|
||||
|
||||
/**
|
||||
* ENS_AVATAR uses the ENS record's resolver get-text-data.avatar data
|
||||
* The `payload` field will be ignored if ENS_AVATAR is selected
|
||||
* The application will read and parse the ENS avatar data as image payload data, URLs will be ignored
|
||||
* The parent `ChatMessageIdentity` must have a valid `ens_name` set
|
||||
*
|
||||
* @generated from enum value: ENS_AVATAR = 2;
|
||||
*/
|
||||
ENS_AVATAR = 2,
|
||||
}
|
||||
// Retrieve enum metadata with: proto3.getEnumType(IdentityImage_SourceType)
|
||||
proto3.util.setEnumType(IdentityImage_SourceType, "IdentityImage.SourceType", [
|
||||
{ no: 0, name: "UNKNOWN_SOURCE_TYPE" },
|
||||
{ no: 1, name: "RAW_PAYLOAD" },
|
||||
{ no: 2, name: "ENS_AVATAR" },
|
||||
]);
|
||||
|
||||
/**
|
||||
* SocialLinks represents social link assosiated with given chat identity (personal/community)
|
||||
*
|
||||
* @generated from message SocialLink
|
||||
*/
|
||||
export class SocialLink extends Message<SocialLink> {
|
||||
/**
|
||||
* @generated from field: string text = 1;
|
||||
*/
|
||||
text = "";
|
||||
|
||||
/**
|
||||
* @generated from field: string url = 2;
|
||||
*/
|
||||
url = "";
|
||||
|
||||
constructor(data?: PartialMessage<SocialLink>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "SocialLink";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "text", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 2, name: "url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): SocialLink {
|
||||
return new SocialLink().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): SocialLink {
|
||||
return new SocialLink().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): SocialLink {
|
||||
return new SocialLink().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: SocialLink | PlainMessage<SocialLink> | undefined, b: SocialLink | PlainMessage<SocialLink> | undefined): boolean {
|
||||
return proto3.util.equals(SocialLink, a, b);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,276 +0,0 @@
|
|||
/* eslint-disable import/export */
|
||||
/* eslint-disable @typescript-eslint/no-namespace */
|
||||
|
||||
import { encodeMessage, decodeMessage, message, string, int32, bytes, enumeration, uint64 } from 'protons-runtime'
|
||||
import type { Codec } from 'protons-runtime'
|
||||
|
||||
export interface StickerMessage {
|
||||
hash: string
|
||||
pack: number
|
||||
}
|
||||
|
||||
export namespace StickerMessage {
|
||||
export const codec = (): Codec<StickerMessage> => {
|
||||
return message<StickerMessage>({
|
||||
1: { name: 'hash', codec: string },
|
||||
2: { name: 'pack', codec: int32 }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: StickerMessage): Uint8Array => {
|
||||
return encodeMessage(obj, StickerMessage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): StickerMessage => {
|
||||
return decodeMessage(buf, StickerMessage.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface ImageMessage {
|
||||
payload: Uint8Array
|
||||
type: ImageType
|
||||
}
|
||||
|
||||
export namespace ImageMessage {
|
||||
export const codec = (): Codec<ImageMessage> => {
|
||||
return message<ImageMessage>({
|
||||
1: { name: 'payload', codec: bytes },
|
||||
2: { name: 'type', codec: ImageType.codec() }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: ImageMessage): Uint8Array => {
|
||||
return encodeMessage(obj, ImageMessage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): ImageMessage => {
|
||||
return decodeMessage(buf, ImageMessage.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface AudioMessage {
|
||||
payload: Uint8Array
|
||||
type: AudioMessage.AudioType
|
||||
durationMs: bigint
|
||||
}
|
||||
|
||||
export namespace AudioMessage {
|
||||
export enum AudioType {
|
||||
UNKNOWN_AUDIO_TYPE = 'UNKNOWN_AUDIO_TYPE',
|
||||
AAC = 'AAC',
|
||||
AMR = 'AMR'
|
||||
}
|
||||
|
||||
enum __AudioTypeValues {
|
||||
UNKNOWN_AUDIO_TYPE = 0,
|
||||
AAC = 1,
|
||||
AMR = 2
|
||||
}
|
||||
|
||||
export namespace AudioType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof AudioType>(__AudioTypeValues)
|
||||
}
|
||||
}
|
||||
|
||||
export const codec = (): Codec<AudioMessage> => {
|
||||
return message<AudioMessage>({
|
||||
1: { name: 'payload', codec: bytes },
|
||||
2: { name: 'type', codec: AudioMessage.AudioType.codec() },
|
||||
3: { name: 'durationMs', codec: uint64 }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: AudioMessage): Uint8Array => {
|
||||
return encodeMessage(obj, AudioMessage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): AudioMessage => {
|
||||
return decodeMessage(buf, AudioMessage.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface EditMessage {
|
||||
clock: bigint
|
||||
text: string
|
||||
chatId: string
|
||||
messageId: string
|
||||
grant: Uint8Array
|
||||
messageType: MessageType
|
||||
}
|
||||
|
||||
export namespace EditMessage {
|
||||
export const codec = (): Codec<EditMessage> => {
|
||||
return message<EditMessage>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'text', codec: string },
|
||||
3: { name: 'chatId', codec: string },
|
||||
4: { name: 'messageId', codec: string },
|
||||
5: { name: 'grant', codec: bytes },
|
||||
6: { name: 'messageType', codec: MessageType.codec() }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: EditMessage): Uint8Array => {
|
||||
return encodeMessage(obj, EditMessage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): EditMessage => {
|
||||
return decodeMessage(buf, EditMessage.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface DeleteMessage {
|
||||
clock: bigint
|
||||
chatId: string
|
||||
messageId: string
|
||||
grant: Uint8Array
|
||||
messageType: MessageType
|
||||
}
|
||||
|
||||
export namespace DeleteMessage {
|
||||
export const codec = (): Codec<DeleteMessage> => {
|
||||
return message<DeleteMessage>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'chatId', codec: string },
|
||||
3: { name: 'messageId', codec: string },
|
||||
4: { name: 'grant', codec: bytes },
|
||||
5: { name: 'messageType', codec: MessageType.codec() }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: DeleteMessage): Uint8Array => {
|
||||
return encodeMessage(obj, DeleteMessage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): DeleteMessage => {
|
||||
return decodeMessage(buf, DeleteMessage.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface ChatMessage {
|
||||
clock: bigint
|
||||
timestamp: bigint
|
||||
text: string
|
||||
responseTo: string
|
||||
ensName: string
|
||||
chatId: string
|
||||
messageType: MessageType
|
||||
contentType: ChatMessage.ContentType
|
||||
sticker: StickerMessage
|
||||
image: ImageMessage
|
||||
audio: AudioMessage
|
||||
community: Uint8Array
|
||||
grant: Uint8Array
|
||||
displayName: string
|
||||
}
|
||||
|
||||
export namespace ChatMessage {
|
||||
export enum ContentType {
|
||||
UNKNOWN_CONTENT_TYPE = 'UNKNOWN_CONTENT_TYPE',
|
||||
TEXT_PLAIN = 'TEXT_PLAIN',
|
||||
STICKER = 'STICKER',
|
||||
STATUS = 'STATUS',
|
||||
EMOJI = 'EMOJI',
|
||||
TRANSACTION_COMMAND = 'TRANSACTION_COMMAND',
|
||||
SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP = 'SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP',
|
||||
IMAGE = 'IMAGE',
|
||||
AUDIO = 'AUDIO',
|
||||
COMMUNITY = 'COMMUNITY',
|
||||
SYSTEM_MESSAGE_GAP = 'SYSTEM_MESSAGE_GAP'
|
||||
}
|
||||
|
||||
enum __ContentTypeValues {
|
||||
UNKNOWN_CONTENT_TYPE = 0,
|
||||
TEXT_PLAIN = 1,
|
||||
STICKER = 2,
|
||||
STATUS = 3,
|
||||
EMOJI = 4,
|
||||
TRANSACTION_COMMAND = 5,
|
||||
SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP = 6,
|
||||
IMAGE = 7,
|
||||
AUDIO = 8,
|
||||
COMMUNITY = 9,
|
||||
SYSTEM_MESSAGE_GAP = 10
|
||||
}
|
||||
|
||||
export namespace ContentType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof ContentType>(__ContentTypeValues)
|
||||
}
|
||||
}
|
||||
|
||||
export const codec = (): Codec<ChatMessage> => {
|
||||
return message<ChatMessage>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'timestamp', codec: uint64 },
|
||||
3: { name: 'text', codec: string },
|
||||
4: { name: 'responseTo', codec: string },
|
||||
5: { name: 'ensName', codec: string },
|
||||
6: { name: 'chatId', codec: string },
|
||||
7: { name: 'messageType', codec: MessageType.codec() },
|
||||
8: { name: 'contentType', codec: ChatMessage.ContentType.codec() },
|
||||
9: { name: 'sticker', codec: StickerMessage.codec() },
|
||||
10: { name: 'image', codec: ImageMessage.codec() },
|
||||
11: { name: 'audio', codec: AudioMessage.codec() },
|
||||
12: { name: 'community', codec: bytes },
|
||||
13: { name: 'grant', codec: bytes },
|
||||
14: { name: 'displayName', codec: string }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: ChatMessage): Uint8Array => {
|
||||
return encodeMessage(obj, ChatMessage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): ChatMessage => {
|
||||
return decodeMessage(buf, ChatMessage.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export enum MessageType {
|
||||
UNKNOWN_MESSAGE_TYPE = 'UNKNOWN_MESSAGE_TYPE',
|
||||
ONE_TO_ONE = 'ONE_TO_ONE',
|
||||
PUBLIC_GROUP = 'PUBLIC_GROUP',
|
||||
PRIVATE_GROUP = 'PRIVATE_GROUP',
|
||||
SYSTEM_MESSAGE_PRIVATE_GROUP = 'SYSTEM_MESSAGE_PRIVATE_GROUP',
|
||||
COMMUNITY_CHAT = 'COMMUNITY_CHAT',
|
||||
SYSTEM_MESSAGE_GAP = 'SYSTEM_MESSAGE_GAP'
|
||||
}
|
||||
|
||||
enum __MessageTypeValues {
|
||||
UNKNOWN_MESSAGE_TYPE = 0,
|
||||
ONE_TO_ONE = 1,
|
||||
PUBLIC_GROUP = 2,
|
||||
PRIVATE_GROUP = 3,
|
||||
SYSTEM_MESSAGE_PRIVATE_GROUP = 4,
|
||||
COMMUNITY_CHAT = 5,
|
||||
SYSTEM_MESSAGE_GAP = 6
|
||||
}
|
||||
|
||||
export namespace MessageType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof MessageType>(__MessageTypeValues)
|
||||
}
|
||||
}
|
||||
export enum ImageType {
|
||||
UNKNOWN_IMAGE_TYPE = 'UNKNOWN_IMAGE_TYPE',
|
||||
PNG = 'PNG',
|
||||
JPEG = 'JPEG',
|
||||
WEBP = 'WEBP',
|
||||
GIF = 'GIF'
|
||||
}
|
||||
|
||||
enum __ImageTypeValues {
|
||||
UNKNOWN_IMAGE_TYPE = 0,
|
||||
PNG = 1,
|
||||
JPEG = 2,
|
||||
WEBP = 3,
|
||||
GIF = 4
|
||||
}
|
||||
|
||||
export namespace ImageType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof ImageType>(__ImageTypeValues)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,534 @@
|
|||
// @generated by protoc-gen-es v1.0.0 with parameter "target=ts"
|
||||
// @generated from file chat-message.proto (syntax proto3)
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
|
||||
import { Message, proto3, protoInt64 } from "@bufbuild/protobuf";
|
||||
import { ImageType, MessageType } from "./enums_pb.js";
|
||||
|
||||
/**
|
||||
* @generated from message StickerMessage
|
||||
*/
|
||||
export class StickerMessage extends Message<StickerMessage> {
|
||||
/**
|
||||
* @generated from field: string hash = 1;
|
||||
*/
|
||||
hash = "";
|
||||
|
||||
/**
|
||||
* @generated from field: int32 pack = 2;
|
||||
*/
|
||||
pack = 0;
|
||||
|
||||
constructor(data?: PartialMessage<StickerMessage>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "StickerMessage";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "hash", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 2, name: "pack", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): StickerMessage {
|
||||
return new StickerMessage().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): StickerMessage {
|
||||
return new StickerMessage().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): StickerMessage {
|
||||
return new StickerMessage().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: StickerMessage | PlainMessage<StickerMessage> | undefined, b: StickerMessage | PlainMessage<StickerMessage> | undefined): boolean {
|
||||
return proto3.util.equals(StickerMessage, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message ImageMessage
|
||||
*/
|
||||
export class ImageMessage extends Message<ImageMessage> {
|
||||
/**
|
||||
* @generated from field: bytes payload = 1;
|
||||
*/
|
||||
payload = new Uint8Array(0);
|
||||
|
||||
/**
|
||||
* @generated from field: ImageType type = 2;
|
||||
*/
|
||||
type = ImageType.UNKNOWN_IMAGE_TYPE;
|
||||
|
||||
constructor(data?: PartialMessage<ImageMessage>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "ImageMessage";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "payload", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
{ no: 2, name: "type", kind: "enum", T: proto3.getEnumType(ImageType) },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ImageMessage {
|
||||
return new ImageMessage().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ImageMessage {
|
||||
return new ImageMessage().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ImageMessage {
|
||||
return new ImageMessage().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: ImageMessage | PlainMessage<ImageMessage> | undefined, b: ImageMessage | PlainMessage<ImageMessage> | undefined): boolean {
|
||||
return proto3.util.equals(ImageMessage, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message AudioMessage
|
||||
*/
|
||||
export class AudioMessage extends Message<AudioMessage> {
|
||||
/**
|
||||
* @generated from field: bytes payload = 1;
|
||||
*/
|
||||
payload = new Uint8Array(0);
|
||||
|
||||
/**
|
||||
* @generated from field: AudioMessage.AudioType type = 2;
|
||||
*/
|
||||
type = AudioMessage_AudioType.UNKNOWN_AUDIO_TYPE;
|
||||
|
||||
/**
|
||||
* @generated from field: uint64 duration_ms = 3;
|
||||
*/
|
||||
durationMs = protoInt64.zero;
|
||||
|
||||
constructor(data?: PartialMessage<AudioMessage>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "AudioMessage";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "payload", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
{ no: 2, name: "type", kind: "enum", T: proto3.getEnumType(AudioMessage_AudioType) },
|
||||
{ no: 3, name: "duration_ms", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): AudioMessage {
|
||||
return new AudioMessage().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): AudioMessage {
|
||||
return new AudioMessage().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): AudioMessage {
|
||||
return new AudioMessage().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: AudioMessage | PlainMessage<AudioMessage> | undefined, b: AudioMessage | PlainMessage<AudioMessage> | undefined): boolean {
|
||||
return proto3.util.equals(AudioMessage, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from enum AudioMessage.AudioType
|
||||
*/
|
||||
export enum AudioMessage_AudioType {
|
||||
/**
|
||||
* @generated from enum value: UNKNOWN_AUDIO_TYPE = 0;
|
||||
*/
|
||||
UNKNOWN_AUDIO_TYPE = 0,
|
||||
|
||||
/**
|
||||
* @generated from enum value: AAC = 1;
|
||||
*/
|
||||
AAC = 1,
|
||||
|
||||
/**
|
||||
* @generated from enum value: AMR = 2;
|
||||
*/
|
||||
AMR = 2,
|
||||
}
|
||||
// Retrieve enum metadata with: proto3.getEnumType(AudioMessage_AudioType)
|
||||
proto3.util.setEnumType(AudioMessage_AudioType, "AudioMessage.AudioType", [
|
||||
{ no: 0, name: "UNKNOWN_AUDIO_TYPE" },
|
||||
{ no: 1, name: "AAC" },
|
||||
{ no: 2, name: "AMR" },
|
||||
]);
|
||||
|
||||
/**
|
||||
* @generated from message EditMessage
|
||||
*/
|
||||
export class EditMessage extends Message<EditMessage> {
|
||||
/**
|
||||
* @generated from field: uint64 clock = 1;
|
||||
*/
|
||||
clock = protoInt64.zero;
|
||||
|
||||
/**
|
||||
* Text of the message
|
||||
*
|
||||
* @generated from field: string text = 2;
|
||||
*/
|
||||
text = "";
|
||||
|
||||
/**
|
||||
* @generated from field: string chat_id = 3;
|
||||
*/
|
||||
chatId = "";
|
||||
|
||||
/**
|
||||
* @generated from field: string message_id = 4;
|
||||
*/
|
||||
messageId = "";
|
||||
|
||||
/**
|
||||
* Grant for community edit messages
|
||||
*
|
||||
* @generated from field: bytes grant = 5;
|
||||
*/
|
||||
grant = new Uint8Array(0);
|
||||
|
||||
/**
|
||||
* The type of message (public/one-to-one/private-group-chat)
|
||||
*
|
||||
* @generated from field: MessageType message_type = 6;
|
||||
*/
|
||||
messageType = MessageType.UNKNOWN_MESSAGE_TYPE;
|
||||
|
||||
constructor(data?: PartialMessage<EditMessage>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "EditMessage";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "clock", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
|
||||
{ no: 2, name: "text", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 3, name: "chat_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 4, name: "message_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 5, name: "grant", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
{ no: 6, name: "message_type", kind: "enum", T: proto3.getEnumType(MessageType) },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): EditMessage {
|
||||
return new EditMessage().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): EditMessage {
|
||||
return new EditMessage().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): EditMessage {
|
||||
return new EditMessage().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: EditMessage | PlainMessage<EditMessage> | undefined, b: EditMessage | PlainMessage<EditMessage> | undefined): boolean {
|
||||
return proto3.util.equals(EditMessage, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message DeleteMessage
|
||||
*/
|
||||
export class DeleteMessage extends Message<DeleteMessage> {
|
||||
/**
|
||||
* @generated from field: uint64 clock = 1;
|
||||
*/
|
||||
clock = protoInt64.zero;
|
||||
|
||||
/**
|
||||
* @generated from field: string chat_id = 2;
|
||||
*/
|
||||
chatId = "";
|
||||
|
||||
/**
|
||||
* @generated from field: string message_id = 3;
|
||||
*/
|
||||
messageId = "";
|
||||
|
||||
/**
|
||||
* Grant for community delete messages
|
||||
*
|
||||
* @generated from field: bytes grant = 4;
|
||||
*/
|
||||
grant = new Uint8Array(0);
|
||||
|
||||
/**
|
||||
* The type of message (public/one-to-one/private-group-chat)
|
||||
*
|
||||
* @generated from field: MessageType message_type = 5;
|
||||
*/
|
||||
messageType = MessageType.UNKNOWN_MESSAGE_TYPE;
|
||||
|
||||
constructor(data?: PartialMessage<DeleteMessage>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "DeleteMessage";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "clock", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
|
||||
{ no: 2, name: "chat_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 3, name: "message_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 4, name: "grant", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
{ no: 5, name: "message_type", kind: "enum", T: proto3.getEnumType(MessageType) },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DeleteMessage {
|
||||
return new DeleteMessage().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DeleteMessage {
|
||||
return new DeleteMessage().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DeleteMessage {
|
||||
return new DeleteMessage().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: DeleteMessage | PlainMessage<DeleteMessage> | undefined, b: DeleteMessage | PlainMessage<DeleteMessage> | undefined): boolean {
|
||||
return proto3.util.equals(DeleteMessage, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message ChatMessage
|
||||
*/
|
||||
export class ChatMessage extends Message<ChatMessage> {
|
||||
/**
|
||||
* Lamport timestamp of the chat message
|
||||
*
|
||||
* @generated from field: uint64 clock = 1;
|
||||
*/
|
||||
clock = protoInt64.zero;
|
||||
|
||||
/**
|
||||
* Unix timestamps in milliseconds, currently not used as we use whisper as more reliable, but here
|
||||
* so that we don't rely on it
|
||||
*
|
||||
* @generated from field: uint64 timestamp = 2;
|
||||
*/
|
||||
timestamp = protoInt64.zero;
|
||||
|
||||
/**
|
||||
* Text of the message
|
||||
*
|
||||
* @generated from field: string text = 3;
|
||||
*/
|
||||
text = "";
|
||||
|
||||
/**
|
||||
* Id of the message that we are replying to
|
||||
*
|
||||
* @generated from field: string response_to = 4;
|
||||
*/
|
||||
responseTo = "";
|
||||
|
||||
/**
|
||||
* Ens name of the sender
|
||||
*
|
||||
* @generated from field: string ens_name = 5;
|
||||
*/
|
||||
ensName = "";
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @generated from field: string chat_id = 6;
|
||||
*/
|
||||
chatId = "";
|
||||
|
||||
/**
|
||||
* The type of message (public/one-to-one/private-group-chat)
|
||||
*
|
||||
* @generated from field: MessageType message_type = 7;
|
||||
*/
|
||||
messageType = MessageType.UNKNOWN_MESSAGE_TYPE;
|
||||
|
||||
/**
|
||||
* The type of the content of the message
|
||||
*
|
||||
* @generated from field: ChatMessage.ContentType content_type = 8;
|
||||
*/
|
||||
contentType = ChatMessage_ContentType.UNKNOWN_CONTENT_TYPE;
|
||||
|
||||
/**
|
||||
* @generated from oneof ChatMessage.payload
|
||||
*/
|
||||
payload: {
|
||||
/**
|
||||
* @generated from field: StickerMessage sticker = 9;
|
||||
*/
|
||||
value: StickerMessage;
|
||||
case: "sticker";
|
||||
} | {
|
||||
/**
|
||||
* @generated from field: ImageMessage image = 10;
|
||||
*/
|
||||
value: ImageMessage;
|
||||
case: "image";
|
||||
} | {
|
||||
/**
|
||||
* @generated from field: AudioMessage audio = 11;
|
||||
*/
|
||||
value: AudioMessage;
|
||||
case: "audio";
|
||||
} | {
|
||||
/**
|
||||
* @generated from field: bytes community = 12;
|
||||
*/
|
||||
value: Uint8Array;
|
||||
case: "community";
|
||||
} | { case: undefined; value?: undefined } = { case: undefined };
|
||||
|
||||
/**
|
||||
* Grant for community chat messages
|
||||
*
|
||||
* @generated from field: bytes grant = 13;
|
||||
*/
|
||||
grant = new Uint8Array(0);
|
||||
|
||||
/**
|
||||
* Message author's display name, introduced in version 1
|
||||
*
|
||||
* @generated from field: string display_name = 14;
|
||||
*/
|
||||
displayName = "";
|
||||
|
||||
constructor(data?: PartialMessage<ChatMessage>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "ChatMessage";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "clock", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
|
||||
{ no: 2, name: "timestamp", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
|
||||
{ no: 3, name: "text", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 4, name: "response_to", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 5, name: "ens_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 6, name: "chat_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 7, name: "message_type", kind: "enum", T: proto3.getEnumType(MessageType) },
|
||||
{ no: 8, name: "content_type", kind: "enum", T: proto3.getEnumType(ChatMessage_ContentType) },
|
||||
{ no: 9, name: "sticker", kind: "message", T: StickerMessage, oneof: "payload" },
|
||||
{ no: 10, name: "image", kind: "message", T: ImageMessage, oneof: "payload" },
|
||||
{ no: 11, name: "audio", kind: "message", T: AudioMessage, oneof: "payload" },
|
||||
{ no: 12, name: "community", kind: "scalar", T: 12 /* ScalarType.BYTES */, oneof: "payload" },
|
||||
{ no: 13, name: "grant", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
{ no: 14, name: "display_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ChatMessage {
|
||||
return new ChatMessage().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ChatMessage {
|
||||
return new ChatMessage().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ChatMessage {
|
||||
return new ChatMessage().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: ChatMessage | PlainMessage<ChatMessage> | undefined, b: ChatMessage | PlainMessage<ChatMessage> | undefined): boolean {
|
||||
return proto3.util.equals(ChatMessage, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from enum ChatMessage.ContentType
|
||||
*/
|
||||
export enum ChatMessage_ContentType {
|
||||
/**
|
||||
* @generated from enum value: UNKNOWN_CONTENT_TYPE = 0;
|
||||
*/
|
||||
UNKNOWN_CONTENT_TYPE = 0,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TEXT_PLAIN = 1;
|
||||
*/
|
||||
TEXT_PLAIN = 1,
|
||||
|
||||
/**
|
||||
* @generated from enum value: STICKER = 2;
|
||||
*/
|
||||
STICKER = 2,
|
||||
|
||||
/**
|
||||
* @generated from enum value: STATUS = 3;
|
||||
*/
|
||||
STATUS = 3,
|
||||
|
||||
/**
|
||||
* @generated from enum value: EMOJI = 4;
|
||||
*/
|
||||
EMOJI = 4,
|
||||
|
||||
/**
|
||||
* @generated from enum value: TRANSACTION_COMMAND = 5;
|
||||
*/
|
||||
TRANSACTION_COMMAND = 5,
|
||||
|
||||
/**
|
||||
* Only local
|
||||
*
|
||||
* @generated from enum value: SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP = 6;
|
||||
*/
|
||||
SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP = 6,
|
||||
|
||||
/**
|
||||
* @generated from enum value: IMAGE = 7;
|
||||
*/
|
||||
IMAGE = 7,
|
||||
|
||||
/**
|
||||
* @generated from enum value: AUDIO = 8;
|
||||
*/
|
||||
AUDIO = 8,
|
||||
|
||||
/**
|
||||
* @generated from enum value: COMMUNITY = 9;
|
||||
*/
|
||||
COMMUNITY = 9,
|
||||
|
||||
/**
|
||||
* Only local
|
||||
*
|
||||
* @generated from enum value: SYSTEM_MESSAGE_GAP = 10;
|
||||
*/
|
||||
SYSTEM_MESSAGE_GAP = 10,
|
||||
}
|
||||
// Retrieve enum metadata with: proto3.getEnumType(ChatMessage_ContentType)
|
||||
proto3.util.setEnumType(ChatMessage_ContentType, "ChatMessage.ContentType", [
|
||||
{ no: 0, name: "UNKNOWN_CONTENT_TYPE" },
|
||||
{ no: 1, name: "TEXT_PLAIN" },
|
||||
{ no: 2, name: "STICKER" },
|
||||
{ no: 3, name: "STATUS" },
|
||||
{ no: 4, name: "EMOJI" },
|
||||
{ no: 5, name: "TRANSACTION_COMMAND" },
|
||||
{ no: 6, name: "SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP" },
|
||||
{ no: 7, name: "IMAGE" },
|
||||
{ no: 8, name: "AUDIO" },
|
||||
{ no: 9, name: "COMMUNITY" },
|
||||
{ no: 10, name: "SYSTEM_MESSAGE_GAP" },
|
||||
]);
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
syntax = "proto3";
|
||||
|
||||
import "chat-identity.proto";
|
||||
|
||||
message Grant {
|
||||
bytes community_id = 1;
|
||||
bytes member_id = 2;
|
||||
string chat_id = 3;
|
||||
uint64 clock = 4;
|
||||
}
|
||||
|
||||
message CommunityMember {
|
||||
enum Roles {
|
||||
UNKNOWN_ROLE = 0;
|
||||
ROLE_ALL = 1;
|
||||
ROLE_MANAGE_USERS = 2;
|
||||
}
|
||||
repeated Roles roles = 1;
|
||||
}
|
||||
|
||||
message CommunityPermissions {
|
||||
enum Access {
|
||||
UNKNOWN_ACCESS = 0;
|
||||
NO_MEMBERSHIP = 1;
|
||||
INVITATION_ONLY = 2;
|
||||
ON_REQUEST = 3;
|
||||
}
|
||||
|
||||
bool ens_only = 1;
|
||||
// https://gitlab.matrix.org/matrix-org/olm/blob/master/docs/megolm.md is a candidate for the algorithm to be used in case we want to have private communityal chats, lighter than pairwise encryption using the DR, less secure, but more efficient for large number of participants
|
||||
bool private = 2;
|
||||
Access access = 3;
|
||||
}
|
||||
|
||||
message CommunityDescription {
|
||||
uint64 clock = 1;
|
||||
map<string,CommunityMember> members = 2;
|
||||
CommunityPermissions permissions = 3;
|
||||
ChatIdentity identity = 5;
|
||||
map<string,CommunityChat> chats = 6;
|
||||
repeated string ban_list = 7;
|
||||
map<string,CommunityCategory> categories = 8;
|
||||
}
|
||||
|
||||
message CommunityChat {
|
||||
map<string,CommunityMember> members = 1;
|
||||
CommunityPermissions permissions = 2;
|
||||
ChatIdentity identity = 3;
|
||||
string category_id = 4;
|
||||
int32 position = 5;
|
||||
}
|
||||
|
||||
message CommunityCategory {
|
||||
string category_id = 1;
|
||||
string name = 2;
|
||||
int32 position = 3;
|
||||
}
|
||||
|
||||
message CommunityInvitation {
|
||||
bytes community_description = 1;
|
||||
bytes grant = 2;
|
||||
string chat_id = 3;
|
||||
bytes public_key = 4;
|
||||
}
|
||||
|
||||
message CommunityRequestToJoin {
|
||||
uint64 clock = 1;
|
||||
string ens_name = 2;
|
||||
string chat_id = 3;
|
||||
bytes community_id = 4;
|
||||
}
|
||||
|
||||
message CommunityRequestToJoinResponse {
|
||||
uint64 clock = 1;
|
||||
CommunityDescription community = 2;
|
||||
bool accepted = 3;
|
||||
bytes grant = 4;
|
||||
}
|
|
@ -1,400 +0,0 @@
|
|||
/* eslint-disable import/export */
|
||||
/* eslint-disable @typescript-eslint/no-namespace */
|
||||
|
||||
import { encodeMessage, decodeMessage, message, bytes, string, uint64, enumeration, bool, int32 } from 'protons-runtime'
|
||||
import type { Codec } from 'protons-runtime'
|
||||
|
||||
export interface Grant {
|
||||
communityId: Uint8Array
|
||||
memberId: Uint8Array
|
||||
chatId: string
|
||||
clock: bigint
|
||||
}
|
||||
|
||||
export namespace Grant {
|
||||
export const codec = (): Codec<Grant> => {
|
||||
return message<Grant>({
|
||||
1: { name: 'communityId', codec: bytes },
|
||||
2: { name: 'memberId', codec: bytes },
|
||||
3: { name: 'chatId', codec: string },
|
||||
4: { name: 'clock', codec: uint64 }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: Grant): Uint8Array => {
|
||||
return encodeMessage(obj, Grant.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): Grant => {
|
||||
return decodeMessage(buf, Grant.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommunityMember {
|
||||
roles: CommunityMember.Roles[]
|
||||
}
|
||||
|
||||
export namespace CommunityMember {
|
||||
export enum Roles {
|
||||
UNKNOWN_ROLE = 'UNKNOWN_ROLE',
|
||||
ROLE_ALL = 'ROLE_ALL',
|
||||
ROLE_MANAGE_USERS = 'ROLE_MANAGE_USERS'
|
||||
}
|
||||
|
||||
enum __RolesValues {
|
||||
UNKNOWN_ROLE = 0,
|
||||
ROLE_ALL = 1,
|
||||
ROLE_MANAGE_USERS = 2
|
||||
}
|
||||
|
||||
export namespace Roles {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof Roles>(__RolesValues)
|
||||
}
|
||||
}
|
||||
|
||||
export const codec = (): Codec<CommunityMember> => {
|
||||
return message<CommunityMember>({
|
||||
1: { name: 'roles', codec: CommunityMember.Roles.codec() }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: CommunityMember): Uint8Array => {
|
||||
return encodeMessage(obj, CommunityMember.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): CommunityMember => {
|
||||
return decodeMessage(buf, CommunityMember.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommunityPermissions {
|
||||
ensOnly: boolean
|
||||
private: boolean
|
||||
access: CommunityPermissions.Access
|
||||
}
|
||||
|
||||
export namespace CommunityPermissions {
|
||||
export enum Access {
|
||||
UNKNOWN_ACCESS = 'UNKNOWN_ACCESS',
|
||||
NO_MEMBERSHIP = 'NO_MEMBERSHIP',
|
||||
INVITATION_ONLY = 'INVITATION_ONLY',
|
||||
ON_REQUEST = 'ON_REQUEST'
|
||||
}
|
||||
|
||||
enum __AccessValues {
|
||||
UNKNOWN_ACCESS = 0,
|
||||
NO_MEMBERSHIP = 1,
|
||||
INVITATION_ONLY = 2,
|
||||
ON_REQUEST = 3
|
||||
}
|
||||
|
||||
export namespace Access {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof Access>(__AccessValues)
|
||||
}
|
||||
}
|
||||
|
||||
export const codec = (): Codec<CommunityPermissions> => {
|
||||
return message<CommunityPermissions>({
|
||||
1: { name: 'ensOnly', codec: bool },
|
||||
2: { name: 'private', codec: bool },
|
||||
3: { name: 'access', codec: CommunityPermissions.Access.codec() }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: CommunityPermissions): Uint8Array => {
|
||||
return encodeMessage(obj, CommunityPermissions.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): CommunityPermissions => {
|
||||
return decodeMessage(buf, CommunityPermissions.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommunityDescription {
|
||||
clock: bigint
|
||||
members: CommunityMember
|
||||
permissions: CommunityPermissions
|
||||
identity: ChatIdentity
|
||||
chats: CommunityChat
|
||||
banList: string[]
|
||||
categories: CommunityCategory
|
||||
}
|
||||
|
||||
export namespace CommunityDescription {
|
||||
export const codec = (): Codec<CommunityDescription> => {
|
||||
return message<CommunityDescription>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'members', codec: CommunityMember.codec() },
|
||||
3: { name: 'permissions', codec: CommunityPermissions.codec() },
|
||||
5: { name: 'identity', codec: ChatIdentity.codec() },
|
||||
6: { name: 'chats', codec: CommunityChat.codec() },
|
||||
7: { name: 'banList', codec: string, repeats: true },
|
||||
8: { name: 'categories', codec: CommunityCategory.codec() }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: CommunityDescription): Uint8Array => {
|
||||
return encodeMessage(obj, CommunityDescription.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): CommunityDescription => {
|
||||
return decodeMessage(buf, CommunityDescription.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommunityChat {
|
||||
members: CommunityMember
|
||||
permissions: CommunityPermissions
|
||||
identity: ChatIdentity
|
||||
categoryId: string
|
||||
position: number
|
||||
}
|
||||
|
||||
export namespace CommunityChat {
|
||||
export const codec = (): Codec<CommunityChat> => {
|
||||
return message<CommunityChat>({
|
||||
1: { name: 'members', codec: CommunityMember.codec() },
|
||||
2: { name: 'permissions', codec: CommunityPermissions.codec() },
|
||||
3: { name: 'identity', codec: ChatIdentity.codec() },
|
||||
4: { name: 'categoryId', codec: string },
|
||||
5: { name: 'position', codec: int32 }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: CommunityChat): Uint8Array => {
|
||||
return encodeMessage(obj, CommunityChat.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): CommunityChat => {
|
||||
return decodeMessage(buf, CommunityChat.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommunityCategory {
|
||||
categoryId: string
|
||||
name: string
|
||||
position: number
|
||||
}
|
||||
|
||||
export namespace CommunityCategory {
|
||||
export const codec = (): Codec<CommunityCategory> => {
|
||||
return message<CommunityCategory>({
|
||||
1: { name: 'categoryId', codec: string },
|
||||
2: { name: 'name', codec: string },
|
||||
3: { name: 'position', codec: int32 }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: CommunityCategory): Uint8Array => {
|
||||
return encodeMessage(obj, CommunityCategory.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): CommunityCategory => {
|
||||
return decodeMessage(buf, CommunityCategory.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommunityInvitation {
|
||||
communityDescription: Uint8Array
|
||||
grant: Uint8Array
|
||||
chatId: string
|
||||
publicKey: Uint8Array
|
||||
}
|
||||
|
||||
export namespace CommunityInvitation {
|
||||
export const codec = (): Codec<CommunityInvitation> => {
|
||||
return message<CommunityInvitation>({
|
||||
1: { name: 'communityDescription', codec: bytes },
|
||||
2: { name: 'grant', codec: bytes },
|
||||
3: { name: 'chatId', codec: string },
|
||||
4: { name: 'publicKey', codec: bytes }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: CommunityInvitation): Uint8Array => {
|
||||
return encodeMessage(obj, CommunityInvitation.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): CommunityInvitation => {
|
||||
return decodeMessage(buf, CommunityInvitation.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommunityRequestToJoin {
|
||||
clock: bigint
|
||||
ensName: string
|
||||
chatId: string
|
||||
communityId: Uint8Array
|
||||
}
|
||||
|
||||
export namespace CommunityRequestToJoin {
|
||||
export const codec = (): Codec<CommunityRequestToJoin> => {
|
||||
return message<CommunityRequestToJoin>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'ensName', codec: string },
|
||||
3: { name: 'chatId', codec: string },
|
||||
4: { name: 'communityId', codec: bytes }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: CommunityRequestToJoin): Uint8Array => {
|
||||
return encodeMessage(obj, CommunityRequestToJoin.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): CommunityRequestToJoin => {
|
||||
return decodeMessage(buf, CommunityRequestToJoin.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommunityRequestToJoinResponse {
|
||||
clock: bigint
|
||||
community: CommunityDescription
|
||||
accepted: boolean
|
||||
grant: Uint8Array
|
||||
}
|
||||
|
||||
export namespace CommunityRequestToJoinResponse {
|
||||
export const codec = (): Codec<CommunityRequestToJoinResponse> => {
|
||||
return message<CommunityRequestToJoinResponse>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'community', codec: CommunityDescription.codec() },
|
||||
3: { name: 'accepted', codec: bool },
|
||||
4: { name: 'grant', codec: bytes }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: CommunityRequestToJoinResponse): Uint8Array => {
|
||||
return encodeMessage(obj, CommunityRequestToJoinResponse.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): CommunityRequestToJoinResponse => {
|
||||
return decodeMessage(buf, CommunityRequestToJoinResponse.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface ChatIdentity {
|
||||
clock: bigint
|
||||
ensName: string
|
||||
images: IdentityImage
|
||||
displayName: string
|
||||
description: string
|
||||
color: string
|
||||
emoji: string
|
||||
}
|
||||
|
||||
export namespace ChatIdentity {
|
||||
export const codec = (): Codec<ChatIdentity> => {
|
||||
return message<ChatIdentity>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'ensName', codec: string },
|
||||
3: { name: 'images', codec: IdentityImage.codec() },
|
||||
4: { name: 'displayName', codec: string },
|
||||
5: { name: 'description', codec: string },
|
||||
6: { name: 'color', codec: string },
|
||||
7: { name: 'emoji', codec: string }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: ChatIdentity): Uint8Array => {
|
||||
return encodeMessage(obj, ChatIdentity.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): ChatIdentity => {
|
||||
return decodeMessage(buf, ChatIdentity.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface IdentityImage {
|
||||
payload: Uint8Array
|
||||
sourceType: IdentityImage.SourceType
|
||||
imageType: ImageType
|
||||
encryptionKeys: Uint8Array[]
|
||||
encrypted: boolean
|
||||
}
|
||||
|
||||
export namespace IdentityImage {
|
||||
export enum SourceType {
|
||||
UNKNOWN_SOURCE_TYPE = 'UNKNOWN_SOURCE_TYPE',
|
||||
RAW_PAYLOAD = 'RAW_PAYLOAD',
|
||||
ENS_AVATAR = 'ENS_AVATAR'
|
||||
}
|
||||
|
||||
enum __SourceTypeValues {
|
||||
UNKNOWN_SOURCE_TYPE = 0,
|
||||
RAW_PAYLOAD = 1,
|
||||
ENS_AVATAR = 2
|
||||
}
|
||||
|
||||
export namespace SourceType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof SourceType>(__SourceTypeValues)
|
||||
}
|
||||
}
|
||||
|
||||
export const codec = (): Codec<IdentityImage> => {
|
||||
return message<IdentityImage>({
|
||||
1: { name: 'payload', codec: bytes },
|
||||
2: { name: 'sourceType', codec: IdentityImage.SourceType.codec() },
|
||||
3: { name: 'imageType', codec: ImageType.codec() },
|
||||
4: { name: 'encryptionKeys', codec: bytes, repeats: true },
|
||||
5: { name: 'encrypted', codec: bool }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: IdentityImage): Uint8Array => {
|
||||
return encodeMessage(obj, IdentityImage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): IdentityImage => {
|
||||
return decodeMessage(buf, IdentityImage.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export enum MessageType {
|
||||
UNKNOWN_MESSAGE_TYPE = 'UNKNOWN_MESSAGE_TYPE',
|
||||
ONE_TO_ONE = 'ONE_TO_ONE',
|
||||
PUBLIC_GROUP = 'PUBLIC_GROUP',
|
||||
PRIVATE_GROUP = 'PRIVATE_GROUP',
|
||||
SYSTEM_MESSAGE_PRIVATE_GROUP = 'SYSTEM_MESSAGE_PRIVATE_GROUP',
|
||||
COMMUNITY_CHAT = 'COMMUNITY_CHAT',
|
||||
SYSTEM_MESSAGE_GAP = 'SYSTEM_MESSAGE_GAP'
|
||||
}
|
||||
|
||||
enum __MessageTypeValues {
|
||||
UNKNOWN_MESSAGE_TYPE = 0,
|
||||
ONE_TO_ONE = 1,
|
||||
PUBLIC_GROUP = 2,
|
||||
PRIVATE_GROUP = 3,
|
||||
SYSTEM_MESSAGE_PRIVATE_GROUP = 4,
|
||||
COMMUNITY_CHAT = 5,
|
||||
SYSTEM_MESSAGE_GAP = 6
|
||||
}
|
||||
|
||||
export namespace MessageType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof MessageType>(__MessageTypeValues)
|
||||
}
|
||||
}
|
||||
export enum ImageType {
|
||||
UNKNOWN_IMAGE_TYPE = 'UNKNOWN_IMAGE_TYPE',
|
||||
PNG = 'PNG',
|
||||
JPEG = 'JPEG',
|
||||
WEBP = 'WEBP',
|
||||
GIF = 'GIF'
|
||||
}
|
||||
|
||||
enum __ImageTypeValues {
|
||||
UNKNOWN_IMAGE_TYPE = 0,
|
||||
PNG = 1,
|
||||
JPEG = 2,
|
||||
WEBP = 3,
|
||||
GIF = 4
|
||||
}
|
||||
|
||||
export namespace ImageType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof ImageType>(__ImageTypeValues)
|
||||
}
|
||||
}
|
|
@ -14,6 +14,7 @@ message CommunityMember {
|
|||
UNKNOWN_ROLE = 0;
|
||||
ROLE_ALL = 1;
|
||||
ROLE_MANAGE_USERS = 2;
|
||||
ROLE_MODERATE_CONTENT = 3;
|
||||
}
|
||||
repeated Roles roles = 1;
|
||||
}
|
||||
|
@ -42,6 +43,10 @@ message CommunityDescription {
|
|||
map<string,CommunityCategory> categories = 8;
|
||||
uint64 archive_magnetlink_clock = 9;
|
||||
CommunityAdminSettings admin_settings = 10;
|
||||
string intro_message = 11;
|
||||
string outro_message = 12;
|
||||
bool encrypted = 13;
|
||||
repeated string tags = 14;
|
||||
}
|
||||
|
||||
message CommunityAdminSettings {
|
||||
|
@ -74,6 +79,15 @@ message CommunityRequestToJoin {
|
|||
string ens_name = 2;
|
||||
string chat_id = 3;
|
||||
bytes community_id = 4;
|
||||
string display_name = 5;
|
||||
}
|
||||
|
||||
message CommunityCancelRequestToJoin {
|
||||
uint64 clock = 1;
|
||||
string ens_name = 2;
|
||||
string chat_id = 3;
|
||||
bytes community_id = 4;
|
||||
string display_name = 5;
|
||||
}
|
||||
|
||||
message CommunityRequestToJoinResponse {
|
||||
|
@ -81,6 +95,13 @@ message CommunityRequestToJoinResponse {
|
|||
CommunityDescription community = 2;
|
||||
bool accepted = 3;
|
||||
bytes grant = 4;
|
||||
bytes community_id = 5;
|
||||
string magnet_uri = 6;
|
||||
}
|
||||
|
||||
message CommunityRequestToLeave {
|
||||
uint64 clock = 1;
|
||||
bytes community_id = 2;
|
||||
}
|
||||
|
||||
message CommunityMessageArchiveMagnetlink {
|
||||
|
@ -95,6 +116,7 @@ message WakuMessage {
|
|||
bytes payload = 4;
|
||||
bytes padding = 5;
|
||||
bytes hash = 6;
|
||||
string thirdPartyId = 7;
|
||||
}
|
||||
|
||||
message WakuMessageArchiveMetadata {
|
||||
|
|
|
@ -1,574 +0,0 @@
|
|||
/* eslint-disable import/export */
|
||||
/* eslint-disable @typescript-eslint/no-namespace */
|
||||
|
||||
import { encodeMessage, decodeMessage, message, bytes, string, uint64, enumeration, bool, int32, uint32 } from 'protons-runtime'
|
||||
import type { Codec } from 'protons-runtime'
|
||||
|
||||
export interface Grant {
|
||||
communityId: Uint8Array
|
||||
memberId: Uint8Array
|
||||
chatId: string
|
||||
clock: bigint
|
||||
}
|
||||
|
||||
export namespace Grant {
|
||||
export const codec = (): Codec<Grant> => {
|
||||
return message<Grant>({
|
||||
1: { name: 'communityId', codec: bytes },
|
||||
2: { name: 'memberId', codec: bytes },
|
||||
3: { name: 'chatId', codec: string },
|
||||
4: { name: 'clock', codec: uint64 }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: Grant): Uint8Array => {
|
||||
return encodeMessage(obj, Grant.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): Grant => {
|
||||
return decodeMessage(buf, Grant.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommunityMember {
|
||||
roles: CommunityMember.Roles[]
|
||||
}
|
||||
|
||||
export namespace CommunityMember {
|
||||
export enum Roles {
|
||||
UNKNOWN_ROLE = 'UNKNOWN_ROLE',
|
||||
ROLE_ALL = 'ROLE_ALL',
|
||||
ROLE_MANAGE_USERS = 'ROLE_MANAGE_USERS'
|
||||
}
|
||||
|
||||
enum __RolesValues {
|
||||
UNKNOWN_ROLE = 0,
|
||||
ROLE_ALL = 1,
|
||||
ROLE_MANAGE_USERS = 2
|
||||
}
|
||||
|
||||
export namespace Roles {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof Roles>(__RolesValues)
|
||||
}
|
||||
}
|
||||
|
||||
export const codec = (): Codec<CommunityMember> => {
|
||||
return message<CommunityMember>({
|
||||
1: { name: 'roles', codec: CommunityMember.Roles.codec(), repeats: true }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: CommunityMember): Uint8Array => {
|
||||
return encodeMessage(obj, CommunityMember.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): CommunityMember => {
|
||||
return decodeMessage(buf, CommunityMember.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommunityPermissions {
|
||||
ensOnly: boolean
|
||||
private: boolean
|
||||
access: CommunityPermissions.Access
|
||||
}
|
||||
|
||||
export namespace CommunityPermissions {
|
||||
export enum Access {
|
||||
UNKNOWN_ACCESS = 'UNKNOWN_ACCESS',
|
||||
NO_MEMBERSHIP = 'NO_MEMBERSHIP',
|
||||
INVITATION_ONLY = 'INVITATION_ONLY',
|
||||
ON_REQUEST = 'ON_REQUEST'
|
||||
}
|
||||
|
||||
enum __AccessValues {
|
||||
UNKNOWN_ACCESS = 0,
|
||||
NO_MEMBERSHIP = 1,
|
||||
INVITATION_ONLY = 2,
|
||||
ON_REQUEST = 3
|
||||
}
|
||||
|
||||
export namespace Access {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof Access>(__AccessValues)
|
||||
}
|
||||
}
|
||||
|
||||
export const codec = (): Codec<CommunityPermissions> => {
|
||||
return message<CommunityPermissions>({
|
||||
1: { name: 'ensOnly', codec: bool },
|
||||
2: { name: 'private', codec: bool },
|
||||
3: { name: 'access', codec: CommunityPermissions.Access.codec() }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: CommunityPermissions): Uint8Array => {
|
||||
return encodeMessage(obj, CommunityPermissions.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): CommunityPermissions => {
|
||||
return decodeMessage(buf, CommunityPermissions.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommunityDescription {
|
||||
clock: bigint
|
||||
members: Record<string, CommunityMember>
|
||||
permissions: CommunityPermissions
|
||||
identity: ChatIdentity
|
||||
chats: Record<string, CommunityChat>
|
||||
banList: string[]
|
||||
categories: Record<string, CommunityCategory>
|
||||
archiveMagnetlinkClock: bigint
|
||||
adminSettings: CommunityAdminSettings
|
||||
}
|
||||
|
||||
export namespace CommunityDescription {
|
||||
export const codec = (): Codec<CommunityDescription> => {
|
||||
return message<CommunityDescription>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'members', codec: CommunityMember.codec() },
|
||||
3: { name: 'permissions', codec: CommunityPermissions.codec() },
|
||||
5: { name: 'identity', codec: ChatIdentity.codec() },
|
||||
6: { name: 'chats', codec: CommunityChat.codec() },
|
||||
7: { name: 'banList', codec: string, repeats: true },
|
||||
8: { name: 'categories', codec: CommunityCategory.codec() },
|
||||
9: { name: 'archiveMagnetlinkClock', codec: uint64 },
|
||||
10: { name: 'adminSettings', codec: CommunityAdminSettings.codec() }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: CommunityDescription): Uint8Array => {
|
||||
return encodeMessage(obj, CommunityDescription.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): CommunityDescription => {
|
||||
return decodeMessage(buf, CommunityDescription.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommunityAdminSettings {
|
||||
pinMessageAllMembersEnabled: boolean
|
||||
}
|
||||
|
||||
export namespace CommunityAdminSettings {
|
||||
export const codec = (): Codec<CommunityAdminSettings> => {
|
||||
return message<CommunityAdminSettings>({
|
||||
1: { name: 'pinMessageAllMembersEnabled', codec: bool }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: CommunityAdminSettings): Uint8Array => {
|
||||
return encodeMessage(obj, CommunityAdminSettings.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): CommunityAdminSettings => {
|
||||
return decodeMessage(buf, CommunityAdminSettings.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommunityChat {
|
||||
members: CommunityMember
|
||||
permissions: CommunityPermissions
|
||||
identity: ChatIdentity
|
||||
categoryId: string
|
||||
position: number
|
||||
}
|
||||
|
||||
export namespace CommunityChat {
|
||||
export const codec = (): Codec<CommunityChat> => {
|
||||
return message<CommunityChat>({
|
||||
1: { name: 'members', codec: CommunityMember.codec() },
|
||||
2: { name: 'permissions', codec: CommunityPermissions.codec() },
|
||||
3: { name: 'identity', codec: ChatIdentity.codec() },
|
||||
4: { name: 'categoryId', codec: string },
|
||||
5: { name: 'position', codec: int32 }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: CommunityChat): Uint8Array => {
|
||||
return encodeMessage(obj, CommunityChat.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): CommunityChat => {
|
||||
return decodeMessage(buf, CommunityChat.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommunityCategory {
|
||||
categoryId: string
|
||||
name: string
|
||||
position: number
|
||||
}
|
||||
|
||||
export namespace CommunityCategory {
|
||||
export const codec = (): Codec<CommunityCategory> => {
|
||||
return message<CommunityCategory>({
|
||||
1: { name: 'categoryId', codec: string },
|
||||
2: { name: 'name', codec: string },
|
||||
3: { name: 'position', codec: int32 }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: CommunityCategory): Uint8Array => {
|
||||
return encodeMessage(obj, CommunityCategory.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): CommunityCategory => {
|
||||
return decodeMessage(buf, CommunityCategory.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommunityInvitation {
|
||||
communityDescription: Uint8Array
|
||||
grant: Uint8Array
|
||||
chatId: string
|
||||
publicKey: Uint8Array
|
||||
}
|
||||
|
||||
export namespace CommunityInvitation {
|
||||
export const codec = (): Codec<CommunityInvitation> => {
|
||||
return message<CommunityInvitation>({
|
||||
1: { name: 'communityDescription', codec: bytes },
|
||||
2: { name: 'grant', codec: bytes },
|
||||
3: { name: 'chatId', codec: string },
|
||||
4: { name: 'publicKey', codec: bytes }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: CommunityInvitation): Uint8Array => {
|
||||
return encodeMessage(obj, CommunityInvitation.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): CommunityInvitation => {
|
||||
return decodeMessage(buf, CommunityInvitation.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommunityRequestToJoin {
|
||||
clock: bigint
|
||||
ensName: string
|
||||
chatId: string
|
||||
communityId: Uint8Array
|
||||
}
|
||||
|
||||
export namespace CommunityRequestToJoin {
|
||||
export const codec = (): Codec<CommunityRequestToJoin> => {
|
||||
return message<CommunityRequestToJoin>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'ensName', codec: string },
|
||||
3: { name: 'chatId', codec: string },
|
||||
4: { name: 'communityId', codec: bytes }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: CommunityRequestToJoin): Uint8Array => {
|
||||
return encodeMessage(obj, CommunityRequestToJoin.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): CommunityRequestToJoin => {
|
||||
return decodeMessage(buf, CommunityRequestToJoin.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommunityRequestToJoinResponse {
|
||||
clock: bigint
|
||||
community: CommunityDescription
|
||||
accepted: boolean
|
||||
grant: Uint8Array
|
||||
}
|
||||
|
||||
export namespace CommunityRequestToJoinResponse {
|
||||
export const codec = (): Codec<CommunityRequestToJoinResponse> => {
|
||||
return message<CommunityRequestToJoinResponse>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'community', codec: CommunityDescription.codec() },
|
||||
3: { name: 'accepted', codec: bool },
|
||||
4: { name: 'grant', codec: bytes }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: CommunityRequestToJoinResponse): Uint8Array => {
|
||||
return encodeMessage(obj, CommunityRequestToJoinResponse.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): CommunityRequestToJoinResponse => {
|
||||
return decodeMessage(buf, CommunityRequestToJoinResponse.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommunityMessageArchiveMagnetlink {
|
||||
clock: bigint
|
||||
magnetUri: string
|
||||
}
|
||||
|
||||
export namespace CommunityMessageArchiveMagnetlink {
|
||||
export const codec = (): Codec<CommunityMessageArchiveMagnetlink> => {
|
||||
return message<CommunityMessageArchiveMagnetlink>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'magnetUri', codec: string }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: CommunityMessageArchiveMagnetlink): Uint8Array => {
|
||||
return encodeMessage(obj, CommunityMessageArchiveMagnetlink.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): CommunityMessageArchiveMagnetlink => {
|
||||
return decodeMessage(buf, CommunityMessageArchiveMagnetlink.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface WakuMessage {
|
||||
sig: Uint8Array
|
||||
timestamp: bigint
|
||||
topic: Uint8Array
|
||||
payload: Uint8Array
|
||||
padding: Uint8Array
|
||||
hash: Uint8Array
|
||||
}
|
||||
|
||||
export namespace WakuMessage {
|
||||
export const codec = (): Codec<WakuMessage> => {
|
||||
return message<WakuMessage>({
|
||||
1: { name: 'sig', codec: bytes },
|
||||
2: { name: 'timestamp', codec: uint64 },
|
||||
3: { name: 'topic', codec: bytes },
|
||||
4: { name: 'payload', codec: bytes },
|
||||
5: { name: 'padding', codec: bytes },
|
||||
6: { name: 'hash', codec: bytes }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: WakuMessage): Uint8Array => {
|
||||
return encodeMessage(obj, WakuMessage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): WakuMessage => {
|
||||
return decodeMessage(buf, WakuMessage.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface WakuMessageArchiveMetadata {
|
||||
version: number
|
||||
from: bigint
|
||||
to: bigint
|
||||
contentTopic: Uint8Array[]
|
||||
}
|
||||
|
||||
export namespace WakuMessageArchiveMetadata {
|
||||
export const codec = (): Codec<WakuMessageArchiveMetadata> => {
|
||||
return message<WakuMessageArchiveMetadata>({
|
||||
1: { name: 'version', codec: uint32 },
|
||||
2: { name: 'from', codec: uint64 },
|
||||
3: { name: 'to', codec: uint64 },
|
||||
4: { name: 'contentTopic', codec: bytes, repeats: true }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: WakuMessageArchiveMetadata): Uint8Array => {
|
||||
return encodeMessage(obj, WakuMessageArchiveMetadata.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): WakuMessageArchiveMetadata => {
|
||||
return decodeMessage(buf, WakuMessageArchiveMetadata.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface WakuMessageArchive {
|
||||
version: number
|
||||
metadata: WakuMessageArchiveMetadata
|
||||
messages: WakuMessage[]
|
||||
}
|
||||
|
||||
export namespace WakuMessageArchive {
|
||||
export const codec = (): Codec<WakuMessageArchive> => {
|
||||
return message<WakuMessageArchive>({
|
||||
1: { name: 'version', codec: uint32 },
|
||||
2: { name: 'metadata', codec: WakuMessageArchiveMetadata.codec() },
|
||||
3: { name: 'messages', codec: WakuMessage.codec(), repeats: true }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: WakuMessageArchive): Uint8Array => {
|
||||
return encodeMessage(obj, WakuMessageArchive.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): WakuMessageArchive => {
|
||||
return decodeMessage(buf, WakuMessageArchive.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface WakuMessageArchiveIndexMetadata {
|
||||
version: number
|
||||
metadata: WakuMessageArchiveMetadata
|
||||
offset: bigint
|
||||
size: bigint
|
||||
padding: bigint
|
||||
}
|
||||
|
||||
export namespace WakuMessageArchiveIndexMetadata {
|
||||
export const codec = (): Codec<WakuMessageArchiveIndexMetadata> => {
|
||||
return message<WakuMessageArchiveIndexMetadata>({
|
||||
1: { name: 'version', codec: uint32 },
|
||||
2: { name: 'metadata', codec: WakuMessageArchiveMetadata.codec() },
|
||||
3: { name: 'offset', codec: uint64 },
|
||||
4: { name: 'size', codec: uint64 },
|
||||
5: { name: 'padding', codec: uint64 }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: WakuMessageArchiveIndexMetadata): Uint8Array => {
|
||||
return encodeMessage(obj, WakuMessageArchiveIndexMetadata.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): WakuMessageArchiveIndexMetadata => {
|
||||
return decodeMessage(buf, WakuMessageArchiveIndexMetadata.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface WakuMessageArchiveIndex {
|
||||
archives: WakuMessageArchiveIndexMetadata
|
||||
}
|
||||
|
||||
export namespace WakuMessageArchiveIndex {
|
||||
export const codec = (): Codec<WakuMessageArchiveIndex> => {
|
||||
return message<WakuMessageArchiveIndex>({
|
||||
1: { name: 'archives', codec: WakuMessageArchiveIndexMetadata.codec() }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: WakuMessageArchiveIndex): Uint8Array => {
|
||||
return encodeMessage(obj, WakuMessageArchiveIndex.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): WakuMessageArchiveIndex => {
|
||||
return decodeMessage(buf, WakuMessageArchiveIndex.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface ChatIdentity {
|
||||
clock: bigint
|
||||
ensName: string
|
||||
images: IdentityImage
|
||||
displayName: string
|
||||
description: string
|
||||
color: string
|
||||
emoji: string
|
||||
}
|
||||
|
||||
export namespace ChatIdentity {
|
||||
export const codec = (): Codec<ChatIdentity> => {
|
||||
return message<ChatIdentity>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'ensName', codec: string },
|
||||
3: { name: 'images', codec: IdentityImage.codec() },
|
||||
4: { name: 'displayName', codec: string },
|
||||
5: { name: 'description', codec: string },
|
||||
6: { name: 'color', codec: string },
|
||||
7: { name: 'emoji', codec: string }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: ChatIdentity): Uint8Array => {
|
||||
return encodeMessage(obj, ChatIdentity.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): ChatIdentity => {
|
||||
return decodeMessage(buf, ChatIdentity.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface IdentityImage {
|
||||
payload: Uint8Array
|
||||
sourceType: IdentityImage.SourceType
|
||||
imageType: ImageType
|
||||
encryptionKeys: Uint8Array[]
|
||||
encrypted: boolean
|
||||
}
|
||||
|
||||
export namespace IdentityImage {
|
||||
export enum SourceType {
|
||||
UNKNOWN_SOURCE_TYPE = 'UNKNOWN_SOURCE_TYPE',
|
||||
RAW_PAYLOAD = 'RAW_PAYLOAD',
|
||||
ENS_AVATAR = 'ENS_AVATAR'
|
||||
}
|
||||
|
||||
enum __SourceTypeValues {
|
||||
UNKNOWN_SOURCE_TYPE = 0,
|
||||
RAW_PAYLOAD = 1,
|
||||
ENS_AVATAR = 2
|
||||
}
|
||||
|
||||
export namespace SourceType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof SourceType>(__SourceTypeValues)
|
||||
}
|
||||
}
|
||||
|
||||
export const codec = (): Codec<IdentityImage> => {
|
||||
return message<IdentityImage>({
|
||||
1: { name: 'payload', codec: bytes },
|
||||
2: { name: 'sourceType', codec: IdentityImage.SourceType.codec() },
|
||||
3: { name: 'imageType', codec: ImageType.codec() },
|
||||
4: { name: 'encryptionKeys', codec: bytes, repeats: true },
|
||||
5: { name: 'encrypted', codec: bool }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: IdentityImage): Uint8Array => {
|
||||
return encodeMessage(obj, IdentityImage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): IdentityImage => {
|
||||
return decodeMessage(buf, IdentityImage.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export enum MessageType {
|
||||
UNKNOWN_MESSAGE_TYPE = 'UNKNOWN_MESSAGE_TYPE',
|
||||
ONE_TO_ONE = 'ONE_TO_ONE',
|
||||
PUBLIC_GROUP = 'PUBLIC_GROUP',
|
||||
PRIVATE_GROUP = 'PRIVATE_GROUP',
|
||||
SYSTEM_MESSAGE_PRIVATE_GROUP = 'SYSTEM_MESSAGE_PRIVATE_GROUP',
|
||||
COMMUNITY_CHAT = 'COMMUNITY_CHAT',
|
||||
SYSTEM_MESSAGE_GAP = 'SYSTEM_MESSAGE_GAP'
|
||||
}
|
||||
|
||||
enum __MessageTypeValues {
|
||||
UNKNOWN_MESSAGE_TYPE = 0,
|
||||
ONE_TO_ONE = 1,
|
||||
PUBLIC_GROUP = 2,
|
||||
PRIVATE_GROUP = 3,
|
||||
SYSTEM_MESSAGE_PRIVATE_GROUP = 4,
|
||||
COMMUNITY_CHAT = 5,
|
||||
SYSTEM_MESSAGE_GAP = 6
|
||||
}
|
||||
|
||||
export namespace MessageType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof MessageType>(__MessageTypeValues)
|
||||
}
|
||||
}
|
||||
export enum ImageType {
|
||||
UNKNOWN_IMAGE_TYPE = 'UNKNOWN_IMAGE_TYPE',
|
||||
PNG = 'PNG',
|
||||
JPEG = 'JPEG',
|
||||
WEBP = 'WEBP',
|
||||
GIF = 'GIF'
|
||||
}
|
||||
|
||||
enum __ImageTypeValues {
|
||||
UNKNOWN_IMAGE_TYPE = 0,
|
||||
PNG = 1,
|
||||
JPEG = 2,
|
||||
WEBP = 3,
|
||||
GIF = 4
|
||||
}
|
||||
|
||||
export namespace ImageType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof ImageType>(__ImageTypeValues)
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,110 +0,0 @@
|
|||
/* eslint-disable import/export */
|
||||
/* eslint-disable @typescript-eslint/no-namespace */
|
||||
|
||||
import { enumeration, encodeMessage, decodeMessage, message, uint64, string, bool, bytes } from 'protons-runtime'
|
||||
import type { Codec } from 'protons-runtime'
|
||||
|
||||
export interface EmojiReaction {
|
||||
clock: bigint
|
||||
chatId: string
|
||||
messageId: string
|
||||
messageType: MessageType
|
||||
type: EmojiReaction.Type
|
||||
retracted: boolean
|
||||
grant: Uint8Array
|
||||
}
|
||||
|
||||
export namespace EmojiReaction {
|
||||
export enum Type {
|
||||
UNKNOWN_EMOJI_REACTION_TYPE = 'UNKNOWN_EMOJI_REACTION_TYPE',
|
||||
LOVE = 'LOVE',
|
||||
THUMBS_UP = 'THUMBS_UP',
|
||||
THUMBS_DOWN = 'THUMBS_DOWN',
|
||||
LAUGH = 'LAUGH',
|
||||
SAD = 'SAD',
|
||||
ANGRY = 'ANGRY'
|
||||
}
|
||||
|
||||
enum __TypeValues {
|
||||
UNKNOWN_EMOJI_REACTION_TYPE = 0,
|
||||
LOVE = 1,
|
||||
THUMBS_UP = 2,
|
||||
THUMBS_DOWN = 3,
|
||||
LAUGH = 4,
|
||||
SAD = 5,
|
||||
ANGRY = 6
|
||||
}
|
||||
|
||||
export namespace Type {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof Type>(__TypeValues)
|
||||
}
|
||||
}
|
||||
|
||||
export const codec = (): Codec<EmojiReaction> => {
|
||||
return message<EmojiReaction>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'chatId', codec: string },
|
||||
3: { name: 'messageId', codec: string },
|
||||
4: { name: 'messageType', codec: MessageType.codec() },
|
||||
5: { name: 'type', codec: EmojiReaction.Type.codec() },
|
||||
6: { name: 'retracted', codec: bool },
|
||||
7: { name: 'grant', codec: bytes }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: EmojiReaction): Uint8Array => {
|
||||
return encodeMessage(obj, EmojiReaction.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): EmojiReaction => {
|
||||
return decodeMessage(buf, EmojiReaction.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export enum MessageType {
|
||||
UNKNOWN_MESSAGE_TYPE = 'UNKNOWN_MESSAGE_TYPE',
|
||||
ONE_TO_ONE = 'ONE_TO_ONE',
|
||||
PUBLIC_GROUP = 'PUBLIC_GROUP',
|
||||
PRIVATE_GROUP = 'PRIVATE_GROUP',
|
||||
SYSTEM_MESSAGE_PRIVATE_GROUP = 'SYSTEM_MESSAGE_PRIVATE_GROUP',
|
||||
COMMUNITY_CHAT = 'COMMUNITY_CHAT',
|
||||
SYSTEM_MESSAGE_GAP = 'SYSTEM_MESSAGE_GAP'
|
||||
}
|
||||
|
||||
enum __MessageTypeValues {
|
||||
UNKNOWN_MESSAGE_TYPE = 0,
|
||||
ONE_TO_ONE = 1,
|
||||
PUBLIC_GROUP = 2,
|
||||
PRIVATE_GROUP = 3,
|
||||
SYSTEM_MESSAGE_PRIVATE_GROUP = 4,
|
||||
COMMUNITY_CHAT = 5,
|
||||
SYSTEM_MESSAGE_GAP = 6
|
||||
}
|
||||
|
||||
export namespace MessageType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof MessageType>(__MessageTypeValues)
|
||||
}
|
||||
}
|
||||
export enum ImageType {
|
||||
UNKNOWN_IMAGE_TYPE = 'UNKNOWN_IMAGE_TYPE',
|
||||
PNG = 'PNG',
|
||||
JPEG = 'JPEG',
|
||||
WEBP = 'WEBP',
|
||||
GIF = 'GIF'
|
||||
}
|
||||
|
||||
enum __ImageTypeValues {
|
||||
UNKNOWN_IMAGE_TYPE = 0,
|
||||
PNG = 1,
|
||||
JPEG = 2,
|
||||
WEBP = 3,
|
||||
GIF = 4
|
||||
}
|
||||
|
||||
export namespace ImageType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof ImageType>(__ImageTypeValues)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,147 @@
|
|||
// @generated by protoc-gen-es v1.0.0 with parameter "target=ts"
|
||||
// @generated from file emoji-reaction.proto (syntax proto3)
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
|
||||
import { Message, proto3, protoInt64 } from "@bufbuild/protobuf";
|
||||
import { MessageType } from "./enums_pb.js";
|
||||
|
||||
/**
|
||||
* @generated from message EmojiReaction
|
||||
*/
|
||||
export class EmojiReaction extends Message<EmojiReaction> {
|
||||
/**
|
||||
* clock Lamport timestamp of the chat message
|
||||
*
|
||||
* @generated from field: uint64 clock = 1;
|
||||
*/
|
||||
clock = protoInt64.zero;
|
||||
|
||||
/**
|
||||
* chat_id the ID of the chat the message belongs to, for query efficiency the chat_id is stored in the db even though the
|
||||
* target message also stores the chat_id
|
||||
*
|
||||
* @generated from field: string chat_id = 2;
|
||||
*/
|
||||
chatId = "";
|
||||
|
||||
/**
|
||||
* message_id the ID of the target message that the user wishes to react to
|
||||
*
|
||||
* @generated from field: string message_id = 3;
|
||||
*/
|
||||
messageId = "";
|
||||
|
||||
/**
|
||||
* message_type is (somewhat confusingly) the ID of the type of chat the message belongs to
|
||||
*
|
||||
* @generated from field: MessageType message_type = 4;
|
||||
*/
|
||||
messageType = MessageType.UNKNOWN_MESSAGE_TYPE;
|
||||
|
||||
/**
|
||||
* type the ID of the emoji the user wishes to react with
|
||||
*
|
||||
* @generated from field: EmojiReaction.Type type = 5;
|
||||
*/
|
||||
type = EmojiReaction_Type.UNKNOWN_EMOJI_REACTION_TYPE;
|
||||
|
||||
/**
|
||||
* whether this is a rectraction of a previously sent emoji
|
||||
*
|
||||
* @generated from field: bool retracted = 6;
|
||||
*/
|
||||
retracted = false;
|
||||
|
||||
/**
|
||||
* Grant for organisation chat messages
|
||||
*
|
||||
* @generated from field: bytes grant = 7;
|
||||
*/
|
||||
grant = new Uint8Array(0);
|
||||
|
||||
constructor(data?: PartialMessage<EmojiReaction>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "EmojiReaction";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "clock", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
|
||||
{ no: 2, name: "chat_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 3, name: "message_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 4, name: "message_type", kind: "enum", T: proto3.getEnumType(MessageType) },
|
||||
{ no: 5, name: "type", kind: "enum", T: proto3.getEnumType(EmojiReaction_Type) },
|
||||
{ no: 6, name: "retracted", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
|
||||
{ no: 7, name: "grant", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): EmojiReaction {
|
||||
return new EmojiReaction().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): EmojiReaction {
|
||||
return new EmojiReaction().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): EmojiReaction {
|
||||
return new EmojiReaction().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: EmojiReaction | PlainMessage<EmojiReaction> | undefined, b: EmojiReaction | PlainMessage<EmojiReaction> | undefined): boolean {
|
||||
return proto3.util.equals(EmojiReaction, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from enum EmojiReaction.Type
|
||||
*/
|
||||
export enum EmojiReaction_Type {
|
||||
/**
|
||||
* @generated from enum value: UNKNOWN_EMOJI_REACTION_TYPE = 0;
|
||||
*/
|
||||
UNKNOWN_EMOJI_REACTION_TYPE = 0,
|
||||
|
||||
/**
|
||||
* @generated from enum value: LOVE = 1;
|
||||
*/
|
||||
LOVE = 1,
|
||||
|
||||
/**
|
||||
* @generated from enum value: THUMBS_UP = 2;
|
||||
*/
|
||||
THUMBS_UP = 2,
|
||||
|
||||
/**
|
||||
* @generated from enum value: THUMBS_DOWN = 3;
|
||||
*/
|
||||
THUMBS_DOWN = 3,
|
||||
|
||||
/**
|
||||
* @generated from enum value: LAUGH = 4;
|
||||
*/
|
||||
LAUGH = 4,
|
||||
|
||||
/**
|
||||
* @generated from enum value: SAD = 5;
|
||||
*/
|
||||
SAD = 5,
|
||||
|
||||
/**
|
||||
* @generated from enum value: ANGRY = 6;
|
||||
*/
|
||||
ANGRY = 6,
|
||||
}
|
||||
// Retrieve enum metadata with: proto3.getEnumType(EmojiReaction_Type)
|
||||
proto3.util.setEnumType(EmojiReaction_Type, "EmojiReaction.Type", [
|
||||
{ no: 0, name: "UNKNOWN_EMOJI_REACTION_TYPE" },
|
||||
{ no: 1, name: "LOVE" },
|
||||
{ no: 2, name: "THUMBS_UP" },
|
||||
{ no: 3, name: "THUMBS_DOWN" },
|
||||
{ no: 4, name: "LAUGH" },
|
||||
{ no: 5, name: "SAD" },
|
||||
{ no: 6, name: "ANGRY" },
|
||||
]);
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/* eslint-disable import/export */
|
||||
/* eslint-disable @typescript-eslint/no-namespace */
|
||||
|
||||
import { enumeration } from 'protons-runtime'
|
||||
|
||||
export enum MessageType {
|
||||
UNKNOWN_MESSAGE_TYPE = 'UNKNOWN_MESSAGE_TYPE',
|
||||
ONE_TO_ONE = 'ONE_TO_ONE',
|
||||
PUBLIC_GROUP = 'PUBLIC_GROUP',
|
||||
PRIVATE_GROUP = 'PRIVATE_GROUP',
|
||||
SYSTEM_MESSAGE_PRIVATE_GROUP = 'SYSTEM_MESSAGE_PRIVATE_GROUP',
|
||||
COMMUNITY_CHAT = 'COMMUNITY_CHAT',
|
||||
SYSTEM_MESSAGE_GAP = 'SYSTEM_MESSAGE_GAP'
|
||||
}
|
||||
|
||||
enum __MessageTypeValues {
|
||||
UNKNOWN_MESSAGE_TYPE = 0,
|
||||
ONE_TO_ONE = 1,
|
||||
PUBLIC_GROUP = 2,
|
||||
PRIVATE_GROUP = 3,
|
||||
SYSTEM_MESSAGE_PRIVATE_GROUP = 4,
|
||||
COMMUNITY_CHAT = 5,
|
||||
SYSTEM_MESSAGE_GAP = 6
|
||||
}
|
||||
|
||||
export namespace MessageType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof MessageType>(__MessageTypeValues)
|
||||
}
|
||||
}
|
||||
export enum ImageType {
|
||||
UNKNOWN_IMAGE_TYPE = 'UNKNOWN_IMAGE_TYPE',
|
||||
PNG = 'PNG',
|
||||
JPEG = 'JPEG',
|
||||
WEBP = 'WEBP',
|
||||
GIF = 'GIF'
|
||||
}
|
||||
|
||||
enum __ImageTypeValues {
|
||||
UNKNOWN_IMAGE_TYPE = 0,
|
||||
PNG = 1,
|
||||
JPEG = 2,
|
||||
WEBP = 3,
|
||||
GIF = 4
|
||||
}
|
||||
|
||||
export namespace ImageType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof ImageType>(__ImageTypeValues)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
// @generated by protoc-gen-es v1.0.0 with parameter "target=ts"
|
||||
// @generated from file enums.proto (syntax proto3)
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { proto3 } from "@bufbuild/protobuf";
|
||||
|
||||
/**
|
||||
* @generated from enum MessageType
|
||||
*/
|
||||
export enum MessageType {
|
||||
/**
|
||||
* @generated from enum value: UNKNOWN_MESSAGE_TYPE = 0;
|
||||
*/
|
||||
UNKNOWN_MESSAGE_TYPE = 0,
|
||||
|
||||
/**
|
||||
* @generated from enum value: ONE_TO_ONE = 1;
|
||||
*/
|
||||
ONE_TO_ONE = 1,
|
||||
|
||||
/**
|
||||
* @generated from enum value: PUBLIC_GROUP = 2;
|
||||
*/
|
||||
PUBLIC_GROUP = 2,
|
||||
|
||||
/**
|
||||
* @generated from enum value: PRIVATE_GROUP = 3;
|
||||
*/
|
||||
PRIVATE_GROUP = 3,
|
||||
|
||||
/**
|
||||
* Only local
|
||||
*
|
||||
* @generated from enum value: SYSTEM_MESSAGE_PRIVATE_GROUP = 4;
|
||||
*/
|
||||
SYSTEM_MESSAGE_PRIVATE_GROUP = 4,
|
||||
|
||||
/**
|
||||
* @generated from enum value: COMMUNITY_CHAT = 5;
|
||||
*/
|
||||
COMMUNITY_CHAT = 5,
|
||||
|
||||
/**
|
||||
* Only local
|
||||
*
|
||||
* @generated from enum value: SYSTEM_MESSAGE_GAP = 6;
|
||||
*/
|
||||
SYSTEM_MESSAGE_GAP = 6,
|
||||
}
|
||||
// Retrieve enum metadata with: proto3.getEnumType(MessageType)
|
||||
proto3.util.setEnumType(MessageType, "MessageType", [
|
||||
{ no: 0, name: "UNKNOWN_MESSAGE_TYPE" },
|
||||
{ no: 1, name: "ONE_TO_ONE" },
|
||||
{ no: 2, name: "PUBLIC_GROUP" },
|
||||
{ no: 3, name: "PRIVATE_GROUP" },
|
||||
{ no: 4, name: "SYSTEM_MESSAGE_PRIVATE_GROUP" },
|
||||
{ no: 5, name: "COMMUNITY_CHAT" },
|
||||
{ no: 6, name: "SYSTEM_MESSAGE_GAP" },
|
||||
]);
|
||||
|
||||
/**
|
||||
* @generated from enum ImageType
|
||||
*/
|
||||
export enum ImageType {
|
||||
/**
|
||||
* @generated from enum value: UNKNOWN_IMAGE_TYPE = 0;
|
||||
*/
|
||||
UNKNOWN_IMAGE_TYPE = 0,
|
||||
|
||||
/**
|
||||
* Raster image files is payload data that can be read as a raster image
|
||||
*
|
||||
* @generated from enum value: PNG = 1;
|
||||
*/
|
||||
PNG = 1,
|
||||
|
||||
/**
|
||||
* @generated from enum value: JPEG = 2;
|
||||
*/
|
||||
JPEG = 2,
|
||||
|
||||
/**
|
||||
* @generated from enum value: WEBP = 3;
|
||||
*/
|
||||
WEBP = 3,
|
||||
|
||||
/**
|
||||
* @generated from enum value: GIF = 4;
|
||||
*/
|
||||
GIF = 4,
|
||||
}
|
||||
// Retrieve enum metadata with: proto3.getEnumType(ImageType)
|
||||
proto3.util.setEnumType(ImageType, "ImageType", [
|
||||
{ no: 0, name: "UNKNOWN_IMAGE_TYPE" },
|
||||
{ no: 1, name: "PNG" },
|
||||
{ no: 2, name: "JPEG" },
|
||||
{ no: 3, name: "WEBP" },
|
||||
{ no: 4, name: "GIF" },
|
||||
]);
|
||||
|
|
@ -1,413 +0,0 @@
|
|||
/* eslint-disable import/export */
|
||||
/* eslint-disable @typescript-eslint/no-namespace */
|
||||
|
||||
import { enumeration, encodeMessage, decodeMessage, message, uint64, string, bytes, int32, bool } from 'protons-runtime'
|
||||
import type { Codec } from 'protons-runtime'
|
||||
|
||||
export interface MembershipUpdateEvent {
|
||||
clock: bigint
|
||||
members: string[]
|
||||
name: string
|
||||
type: MembershipUpdateEvent.EventType
|
||||
}
|
||||
|
||||
export namespace MembershipUpdateEvent {
|
||||
export enum EventType {
|
||||
UNKNOWN = 'UNKNOWN',
|
||||
CHAT_CREATED = 'CHAT_CREATED',
|
||||
NAME_CHANGED = 'NAME_CHANGED',
|
||||
MEMBERS_ADDED = 'MEMBERS_ADDED',
|
||||
MEMBER_JOINED = 'MEMBER_JOINED',
|
||||
MEMBER_REMOVED = 'MEMBER_REMOVED',
|
||||
ADMINS_ADDED = 'ADMINS_ADDED',
|
||||
ADMIN_REMOVED = 'ADMIN_REMOVED'
|
||||
}
|
||||
|
||||
enum __EventTypeValues {
|
||||
UNKNOWN = 0,
|
||||
CHAT_CREATED = 1,
|
||||
NAME_CHANGED = 2,
|
||||
MEMBERS_ADDED = 3,
|
||||
MEMBER_JOINED = 4,
|
||||
MEMBER_REMOVED = 5,
|
||||
ADMINS_ADDED = 6,
|
||||
ADMIN_REMOVED = 7
|
||||
}
|
||||
|
||||
export namespace EventType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof EventType>(__EventTypeValues)
|
||||
}
|
||||
}
|
||||
|
||||
export const codec = (): Codec<MembershipUpdateEvent> => {
|
||||
return message<MembershipUpdateEvent>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'members', codec: string, repeats: true },
|
||||
3: { name: 'name', codec: string },
|
||||
4: { name: 'type', codec: MembershipUpdateEvent.EventType.codec() }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: MembershipUpdateEvent): Uint8Array => {
|
||||
return encodeMessage(obj, MembershipUpdateEvent.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): MembershipUpdateEvent => {
|
||||
return decodeMessage(buf, MembershipUpdateEvent.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface MembershipUpdateMessage {
|
||||
chatId: string
|
||||
events: Uint8Array[]
|
||||
message: ChatMessage
|
||||
emojiReaction: EmojiReaction
|
||||
}
|
||||
|
||||
export namespace MembershipUpdateMessage {
|
||||
export const codec = (): Codec<MembershipUpdateMessage> => {
|
||||
return message<MembershipUpdateMessage>({
|
||||
1: { name: 'chatId', codec: string },
|
||||
2: { name: 'events', codec: bytes, repeats: true },
|
||||
3: { name: 'message', codec: ChatMessage.codec() },
|
||||
4: { name: 'emojiReaction', codec: EmojiReaction.codec() }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: MembershipUpdateMessage): Uint8Array => {
|
||||
return encodeMessage(obj, MembershipUpdateMessage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): MembershipUpdateMessage => {
|
||||
return decodeMessage(buf, MembershipUpdateMessage.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface StickerMessage {
|
||||
hash: string
|
||||
pack: number
|
||||
}
|
||||
|
||||
export namespace StickerMessage {
|
||||
export const codec = (): Codec<StickerMessage> => {
|
||||
return message<StickerMessage>({
|
||||
1: { name: 'hash', codec: string },
|
||||
2: { name: 'pack', codec: int32 }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: StickerMessage): Uint8Array => {
|
||||
return encodeMessage(obj, StickerMessage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): StickerMessage => {
|
||||
return decodeMessage(buf, StickerMessage.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface ImageMessage {
|
||||
payload: Uint8Array
|
||||
type: ImageType
|
||||
}
|
||||
|
||||
export namespace ImageMessage {
|
||||
export const codec = (): Codec<ImageMessage> => {
|
||||
return message<ImageMessage>({
|
||||
1: { name: 'payload', codec: bytes },
|
||||
2: { name: 'type', codec: ImageType.codec() }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: ImageMessage): Uint8Array => {
|
||||
return encodeMessage(obj, ImageMessage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): ImageMessage => {
|
||||
return decodeMessage(buf, ImageMessage.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface AudioMessage {
|
||||
payload: Uint8Array
|
||||
type: AudioMessage.AudioType
|
||||
durationMs: bigint
|
||||
}
|
||||
|
||||
export namespace AudioMessage {
|
||||
export enum AudioType {
|
||||
UNKNOWN_AUDIO_TYPE = 'UNKNOWN_AUDIO_TYPE',
|
||||
AAC = 'AAC',
|
||||
AMR = 'AMR'
|
||||
}
|
||||
|
||||
enum __AudioTypeValues {
|
||||
UNKNOWN_AUDIO_TYPE = 0,
|
||||
AAC = 1,
|
||||
AMR = 2
|
||||
}
|
||||
|
||||
export namespace AudioType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof AudioType>(__AudioTypeValues)
|
||||
}
|
||||
}
|
||||
|
||||
export const codec = (): Codec<AudioMessage> => {
|
||||
return message<AudioMessage>({
|
||||
1: { name: 'payload', codec: bytes },
|
||||
2: { name: 'type', codec: AudioMessage.AudioType.codec() },
|
||||
3: { name: 'durationMs', codec: uint64 }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: AudioMessage): Uint8Array => {
|
||||
return encodeMessage(obj, AudioMessage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): AudioMessage => {
|
||||
return decodeMessage(buf, AudioMessage.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface EditMessage {
|
||||
clock: bigint
|
||||
text: string
|
||||
chatId: string
|
||||
messageId: string
|
||||
grant: Uint8Array
|
||||
messageType: MessageType
|
||||
}
|
||||
|
||||
export namespace EditMessage {
|
||||
export const codec = (): Codec<EditMessage> => {
|
||||
return message<EditMessage>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'text', codec: string },
|
||||
3: { name: 'chatId', codec: string },
|
||||
4: { name: 'messageId', codec: string },
|
||||
5: { name: 'grant', codec: bytes },
|
||||
6: { name: 'messageType', codec: MessageType.codec() }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: EditMessage): Uint8Array => {
|
||||
return encodeMessage(obj, EditMessage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): EditMessage => {
|
||||
return decodeMessage(buf, EditMessage.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface DeleteMessage {
|
||||
clock: bigint
|
||||
chatId: string
|
||||
messageId: string
|
||||
grant: Uint8Array
|
||||
messageType: MessageType
|
||||
}
|
||||
|
||||
export namespace DeleteMessage {
|
||||
export const codec = (): Codec<DeleteMessage> => {
|
||||
return message<DeleteMessage>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'chatId', codec: string },
|
||||
3: { name: 'messageId', codec: string },
|
||||
4: { name: 'grant', codec: bytes },
|
||||
5: { name: 'messageType', codec: MessageType.codec() }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: DeleteMessage): Uint8Array => {
|
||||
return encodeMessage(obj, DeleteMessage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): DeleteMessage => {
|
||||
return decodeMessage(buf, DeleteMessage.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface ChatMessage {
|
||||
clock: bigint
|
||||
timestamp: bigint
|
||||
text: string
|
||||
responseTo: string
|
||||
ensName: string
|
||||
chatId: string
|
||||
messageType: MessageType
|
||||
contentType: ChatMessage.ContentType
|
||||
sticker: StickerMessage
|
||||
image: ImageMessage
|
||||
audio: AudioMessage
|
||||
community: Uint8Array
|
||||
grant: Uint8Array
|
||||
displayName: string
|
||||
}
|
||||
|
||||
export namespace ChatMessage {
|
||||
export enum ContentType {
|
||||
UNKNOWN_CONTENT_TYPE = 'UNKNOWN_CONTENT_TYPE',
|
||||
TEXT_PLAIN = 'TEXT_PLAIN',
|
||||
STICKER = 'STICKER',
|
||||
STATUS = 'STATUS',
|
||||
EMOJI = 'EMOJI',
|
||||
TRANSACTION_COMMAND = 'TRANSACTION_COMMAND',
|
||||
SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP = 'SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP',
|
||||
IMAGE = 'IMAGE',
|
||||
AUDIO = 'AUDIO',
|
||||
COMMUNITY = 'COMMUNITY',
|
||||
SYSTEM_MESSAGE_GAP = 'SYSTEM_MESSAGE_GAP'
|
||||
}
|
||||
|
||||
enum __ContentTypeValues {
|
||||
UNKNOWN_CONTENT_TYPE = 0,
|
||||
TEXT_PLAIN = 1,
|
||||
STICKER = 2,
|
||||
STATUS = 3,
|
||||
EMOJI = 4,
|
||||
TRANSACTION_COMMAND = 5,
|
||||
SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP = 6,
|
||||
IMAGE = 7,
|
||||
AUDIO = 8,
|
||||
COMMUNITY = 9,
|
||||
SYSTEM_MESSAGE_GAP = 10
|
||||
}
|
||||
|
||||
export namespace ContentType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof ContentType>(__ContentTypeValues)
|
||||
}
|
||||
}
|
||||
|
||||
export const codec = (): Codec<ChatMessage> => {
|
||||
return message<ChatMessage>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'timestamp', codec: uint64 },
|
||||
3: { name: 'text', codec: string },
|
||||
4: { name: 'responseTo', codec: string },
|
||||
5: { name: 'ensName', codec: string },
|
||||
6: { name: 'chatId', codec: string },
|
||||
7: { name: 'messageType', codec: MessageType.codec() },
|
||||
8: { name: 'contentType', codec: ChatMessage.ContentType.codec() },
|
||||
9: { name: 'sticker', codec: StickerMessage.codec() },
|
||||
10: { name: 'image', codec: ImageMessage.codec() },
|
||||
11: { name: 'audio', codec: AudioMessage.codec() },
|
||||
12: { name: 'community', codec: bytes },
|
||||
13: { name: 'grant', codec: bytes },
|
||||
14: { name: 'displayName', codec: string }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: ChatMessage): Uint8Array => {
|
||||
return encodeMessage(obj, ChatMessage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): ChatMessage => {
|
||||
return decodeMessage(buf, ChatMessage.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export enum MessageType {
|
||||
UNKNOWN_MESSAGE_TYPE = 'UNKNOWN_MESSAGE_TYPE',
|
||||
ONE_TO_ONE = 'ONE_TO_ONE',
|
||||
PUBLIC_GROUP = 'PUBLIC_GROUP',
|
||||
PRIVATE_GROUP = 'PRIVATE_GROUP',
|
||||
SYSTEM_MESSAGE_PRIVATE_GROUP = 'SYSTEM_MESSAGE_PRIVATE_GROUP',
|
||||
COMMUNITY_CHAT = 'COMMUNITY_CHAT',
|
||||
SYSTEM_MESSAGE_GAP = 'SYSTEM_MESSAGE_GAP'
|
||||
}
|
||||
|
||||
enum __MessageTypeValues {
|
||||
UNKNOWN_MESSAGE_TYPE = 0,
|
||||
ONE_TO_ONE = 1,
|
||||
PUBLIC_GROUP = 2,
|
||||
PRIVATE_GROUP = 3,
|
||||
SYSTEM_MESSAGE_PRIVATE_GROUP = 4,
|
||||
COMMUNITY_CHAT = 5,
|
||||
SYSTEM_MESSAGE_GAP = 6
|
||||
}
|
||||
|
||||
export namespace MessageType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof MessageType>(__MessageTypeValues)
|
||||
}
|
||||
}
|
||||
export enum ImageType {
|
||||
UNKNOWN_IMAGE_TYPE = 'UNKNOWN_IMAGE_TYPE',
|
||||
PNG = 'PNG',
|
||||
JPEG = 'JPEG',
|
||||
WEBP = 'WEBP',
|
||||
GIF = 'GIF'
|
||||
}
|
||||
|
||||
enum __ImageTypeValues {
|
||||
UNKNOWN_IMAGE_TYPE = 0,
|
||||
PNG = 1,
|
||||
JPEG = 2,
|
||||
WEBP = 3,
|
||||
GIF = 4
|
||||
}
|
||||
|
||||
export namespace ImageType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof ImageType>(__ImageTypeValues)
|
||||
}
|
||||
}
|
||||
export interface EmojiReaction {
|
||||
clock: bigint
|
||||
chatId: string
|
||||
messageId: string
|
||||
messageType: MessageType
|
||||
type: EmojiReaction.Type
|
||||
retracted: boolean
|
||||
grant: Uint8Array
|
||||
}
|
||||
|
||||
export namespace EmojiReaction {
|
||||
export enum Type {
|
||||
UNKNOWN_EMOJI_REACTION_TYPE = 'UNKNOWN_EMOJI_REACTION_TYPE',
|
||||
LOVE = 'LOVE',
|
||||
THUMBS_UP = 'THUMBS_UP',
|
||||
THUMBS_DOWN = 'THUMBS_DOWN',
|
||||
LAUGH = 'LAUGH',
|
||||
SAD = 'SAD',
|
||||
ANGRY = 'ANGRY'
|
||||
}
|
||||
|
||||
enum __TypeValues {
|
||||
UNKNOWN_EMOJI_REACTION_TYPE = 0,
|
||||
LOVE = 1,
|
||||
THUMBS_UP = 2,
|
||||
THUMBS_DOWN = 3,
|
||||
LAUGH = 4,
|
||||
SAD = 5,
|
||||
ANGRY = 6
|
||||
}
|
||||
|
||||
export namespace Type {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof Type>(__TypeValues)
|
||||
}
|
||||
}
|
||||
|
||||
export const codec = (): Codec<EmojiReaction> => {
|
||||
return message<EmojiReaction>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'chatId', codec: string },
|
||||
3: { name: 'messageId', codec: string },
|
||||
4: { name: 'messageType', codec: MessageType.codec() },
|
||||
5: { name: 'type', codec: EmojiReaction.Type.codec() },
|
||||
6: { name: 'retracted', codec: bool },
|
||||
7: { name: 'grant', codec: bytes }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: EmojiReaction): Uint8Array => {
|
||||
return encodeMessage(obj, EmojiReaction.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): EmojiReaction => {
|
||||
return decodeMessage(buf, EmojiReaction.codec())
|
||||
}
|
||||
}
|
|
@ -0,0 +1,202 @@
|
|||
// @generated by protoc-gen-es v1.0.0 with parameter "target=ts"
|
||||
// @generated from file membership-update-message.proto (syntax proto3)
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
|
||||
import { Message, proto3, protoInt64 } from "@bufbuild/protobuf";
|
||||
import { ChatMessage } from "./chat-message_pb.js";
|
||||
import { EmojiReaction } from "./emoji-reaction_pb.js";
|
||||
|
||||
/**
|
||||
* @generated from message MembershipUpdateEvent
|
||||
*/
|
||||
export class MembershipUpdateEvent extends Message<MembershipUpdateEvent> {
|
||||
/**
|
||||
* Lamport timestamp of the event
|
||||
*
|
||||
* @generated from field: uint64 clock = 1;
|
||||
*/
|
||||
clock = protoInt64.zero;
|
||||
|
||||
/**
|
||||
* List of public keys of objects of the action
|
||||
*
|
||||
* @generated from field: repeated string members = 2;
|
||||
*/
|
||||
members: string[] = [];
|
||||
|
||||
/**
|
||||
* Name of the chat for the CHAT_CREATED/NAME_CHANGED event types
|
||||
*
|
||||
* @generated from field: string name = 3;
|
||||
*/
|
||||
name = "";
|
||||
|
||||
/**
|
||||
* The type of the event
|
||||
*
|
||||
* @generated from field: MembershipUpdateEvent.EventType type = 4;
|
||||
*/
|
||||
type = MembershipUpdateEvent_EventType.UNKNOWN;
|
||||
|
||||
constructor(data?: PartialMessage<MembershipUpdateEvent>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "MembershipUpdateEvent";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "clock", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
|
||||
{ no: 2, name: "members", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
|
||||
{ no: 3, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 4, name: "type", kind: "enum", T: proto3.getEnumType(MembershipUpdateEvent_EventType) },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MembershipUpdateEvent {
|
||||
return new MembershipUpdateEvent().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MembershipUpdateEvent {
|
||||
return new MembershipUpdateEvent().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MembershipUpdateEvent {
|
||||
return new MembershipUpdateEvent().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: MembershipUpdateEvent | PlainMessage<MembershipUpdateEvent> | undefined, b: MembershipUpdateEvent | PlainMessage<MembershipUpdateEvent> | undefined): boolean {
|
||||
return proto3.util.equals(MembershipUpdateEvent, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from enum MembershipUpdateEvent.EventType
|
||||
*/
|
||||
export enum MembershipUpdateEvent_EventType {
|
||||
/**
|
||||
* @generated from enum value: UNKNOWN = 0;
|
||||
*/
|
||||
UNKNOWN = 0,
|
||||
|
||||
/**
|
||||
* @generated from enum value: CHAT_CREATED = 1;
|
||||
*/
|
||||
CHAT_CREATED = 1,
|
||||
|
||||
/**
|
||||
* @generated from enum value: NAME_CHANGED = 2;
|
||||
*/
|
||||
NAME_CHANGED = 2,
|
||||
|
||||
/**
|
||||
* @generated from enum value: MEMBERS_ADDED = 3;
|
||||
*/
|
||||
MEMBERS_ADDED = 3,
|
||||
|
||||
/**
|
||||
* @generated from enum value: MEMBER_JOINED = 4;
|
||||
*/
|
||||
MEMBER_JOINED = 4,
|
||||
|
||||
/**
|
||||
* @generated from enum value: MEMBER_REMOVED = 5;
|
||||
*/
|
||||
MEMBER_REMOVED = 5,
|
||||
|
||||
/**
|
||||
* @generated from enum value: ADMINS_ADDED = 6;
|
||||
*/
|
||||
ADMINS_ADDED = 6,
|
||||
|
||||
/**
|
||||
* @generated from enum value: ADMIN_REMOVED = 7;
|
||||
*/
|
||||
ADMIN_REMOVED = 7,
|
||||
}
|
||||
// Retrieve enum metadata with: proto3.getEnumType(MembershipUpdateEvent_EventType)
|
||||
proto3.util.setEnumType(MembershipUpdateEvent_EventType, "MembershipUpdateEvent.EventType", [
|
||||
{ no: 0, name: "UNKNOWN" },
|
||||
{ no: 1, name: "CHAT_CREATED" },
|
||||
{ no: 2, name: "NAME_CHANGED" },
|
||||
{ no: 3, name: "MEMBERS_ADDED" },
|
||||
{ no: 4, name: "MEMBER_JOINED" },
|
||||
{ no: 5, name: "MEMBER_REMOVED" },
|
||||
{ no: 6, name: "ADMINS_ADDED" },
|
||||
{ no: 7, name: "ADMIN_REMOVED" },
|
||||
]);
|
||||
|
||||
/**
|
||||
* MembershipUpdateMessage is a message used to propagate information
|
||||
* about group membership changes.
|
||||
* For more information, see https://github.com/status-im/specs/blob/master/status-group-chats-spec.md.
|
||||
*
|
||||
* @generated from message MembershipUpdateMessage
|
||||
*/
|
||||
export class MembershipUpdateMessage extends Message<MembershipUpdateMessage> {
|
||||
/**
|
||||
* The chat id of the private group chat
|
||||
*
|
||||
* @generated from field: string chat_id = 1;
|
||||
*/
|
||||
chatId = "";
|
||||
|
||||
/**
|
||||
* A list of events for this group chat, first x bytes are the signature, then is a
|
||||
* protobuf encoded MembershipUpdateEvent
|
||||
*
|
||||
* @generated from field: repeated bytes events = 2;
|
||||
*/
|
||||
events: Uint8Array[] = [];
|
||||
|
||||
/**
|
||||
* An optional chat message
|
||||
*
|
||||
* @generated from oneof MembershipUpdateMessage.chat_entity
|
||||
*/
|
||||
chatEntity: {
|
||||
/**
|
||||
* @generated from field: ChatMessage message = 3;
|
||||
*/
|
||||
value: ChatMessage;
|
||||
case: "message";
|
||||
} | {
|
||||
/**
|
||||
* @generated from field: EmojiReaction emoji_reaction = 4;
|
||||
*/
|
||||
value: EmojiReaction;
|
||||
case: "emojiReaction";
|
||||
} | { case: undefined; value?: undefined } = { case: undefined };
|
||||
|
||||
constructor(data?: PartialMessage<MembershipUpdateMessage>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "MembershipUpdateMessage";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "chat_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 2, name: "events", kind: "scalar", T: 12 /* ScalarType.BYTES */, repeated: true },
|
||||
{ no: 3, name: "message", kind: "message", T: ChatMessage, oneof: "chat_entity" },
|
||||
{ no: 4, name: "emoji_reaction", kind: "message", T: EmojiReaction, oneof: "chat_entity" },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MembershipUpdateMessage {
|
||||
return new MembershipUpdateMessage().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MembershipUpdateMessage {
|
||||
return new MembershipUpdateMessage().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MembershipUpdateMessage {
|
||||
return new MembershipUpdateMessage().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: MembershipUpdateMessage | PlainMessage<MembershipUpdateMessage> | undefined, b: MembershipUpdateMessage | PlainMessage<MembershipUpdateMessage> | undefined): boolean {
|
||||
return proto3.util.equals(MembershipUpdateMessage, a, b);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
/* eslint-disable import/export */
|
||||
/* eslint-disable @typescript-eslint/no-namespace */
|
||||
|
||||
import { encodeMessage, decodeMessage, message, uint64, string, bool, enumeration } from 'protons-runtime'
|
||||
import type { Codec } from 'protons-runtime'
|
||||
|
||||
export interface PinMessage {
|
||||
clock: bigint
|
||||
messageId: string
|
||||
chatId: string
|
||||
pinned: boolean
|
||||
messageType: MessageType
|
||||
}
|
||||
|
||||
export namespace PinMessage {
|
||||
export const codec = (): Codec<PinMessage> => {
|
||||
return message<PinMessage>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'messageId', codec: string },
|
||||
3: { name: 'chatId', codec: string },
|
||||
4: { name: 'pinned', codec: bool },
|
||||
5: { name: 'messageType', codec: MessageType.codec() }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: PinMessage): Uint8Array => {
|
||||
return encodeMessage(obj, PinMessage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): PinMessage => {
|
||||
return decodeMessage(buf, PinMessage.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export enum MessageType {
|
||||
UNKNOWN_MESSAGE_TYPE = 'UNKNOWN_MESSAGE_TYPE',
|
||||
ONE_TO_ONE = 'ONE_TO_ONE',
|
||||
PUBLIC_GROUP = 'PUBLIC_GROUP',
|
||||
PRIVATE_GROUP = 'PRIVATE_GROUP',
|
||||
SYSTEM_MESSAGE_PRIVATE_GROUP = 'SYSTEM_MESSAGE_PRIVATE_GROUP',
|
||||
COMMUNITY_CHAT = 'COMMUNITY_CHAT',
|
||||
SYSTEM_MESSAGE_GAP = 'SYSTEM_MESSAGE_GAP'
|
||||
}
|
||||
|
||||
enum __MessageTypeValues {
|
||||
UNKNOWN_MESSAGE_TYPE = 0,
|
||||
ONE_TO_ONE = 1,
|
||||
PUBLIC_GROUP = 2,
|
||||
PRIVATE_GROUP = 3,
|
||||
SYSTEM_MESSAGE_PRIVATE_GROUP = 4,
|
||||
COMMUNITY_CHAT = 5,
|
||||
SYSTEM_MESSAGE_GAP = 6
|
||||
}
|
||||
|
||||
export namespace MessageType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof MessageType>(__MessageTypeValues)
|
||||
}
|
||||
}
|
||||
export enum ImageType {
|
||||
UNKNOWN_IMAGE_TYPE = 'UNKNOWN_IMAGE_TYPE',
|
||||
PNG = 'PNG',
|
||||
JPEG = 'JPEG',
|
||||
WEBP = 'WEBP',
|
||||
GIF = 'GIF'
|
||||
}
|
||||
|
||||
enum __ImageTypeValues {
|
||||
UNKNOWN_IMAGE_TYPE = 0,
|
||||
PNG = 1,
|
||||
JPEG = 2,
|
||||
WEBP = 3,
|
||||
GIF = 4
|
||||
}
|
||||
|
||||
export namespace ImageType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof ImageType>(__ImageTypeValues)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
// @generated by protoc-gen-es v1.0.0 with parameter "target=ts"
|
||||
// @generated from file pin-message.proto (syntax proto3)
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
|
||||
import { Message, proto3, protoInt64 } from "@bufbuild/protobuf";
|
||||
import { MessageType } from "./enums_pb.js";
|
||||
|
||||
/**
|
||||
* @generated from message PinMessage
|
||||
*/
|
||||
export class PinMessage extends Message<PinMessage> {
|
||||
/**
|
||||
* @generated from field: uint64 clock = 1;
|
||||
*/
|
||||
clock = protoInt64.zero;
|
||||
|
||||
/**
|
||||
* @generated from field: string message_id = 2;
|
||||
*/
|
||||
messageId = "";
|
||||
|
||||
/**
|
||||
* @generated from field: string chat_id = 3;
|
||||
*/
|
||||
chatId = "";
|
||||
|
||||
/**
|
||||
* @generated from field: bool pinned = 4;
|
||||
*/
|
||||
pinned = false;
|
||||
|
||||
/**
|
||||
* The type of message (public/one-to-one/private-group-chat)
|
||||
*
|
||||
* @generated from field: MessageType message_type = 5;
|
||||
*/
|
||||
messageType = MessageType.UNKNOWN_MESSAGE_TYPE;
|
||||
|
||||
constructor(data?: PartialMessage<PinMessage>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "PinMessage";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "clock", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
|
||||
{ no: 2, name: "message_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 3, name: "chat_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 4, name: "pinned", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
|
||||
{ no: 5, name: "message_type", kind: "enum", T: proto3.getEnumType(MessageType) },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PinMessage {
|
||||
return new PinMessage().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PinMessage {
|
||||
return new PinMessage().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PinMessage {
|
||||
return new PinMessage().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: PinMessage | PlainMessage<PinMessage> | undefined, b: PinMessage | PlainMessage<PinMessage> | undefined): boolean {
|
||||
return proto3.util.equals(PinMessage, a, b);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,223 +0,0 @@
|
|||
/* eslint-disable import/export */
|
||||
/* eslint-disable @typescript-eslint/no-namespace */
|
||||
|
||||
import { encodeMessage, decodeMessage, message, bytes, uint32, int64, string } from 'protons-runtime'
|
||||
import type { Codec } from 'protons-runtime'
|
||||
|
||||
export interface SignedPreKey {
|
||||
signedPreKey: Uint8Array
|
||||
version: number
|
||||
protocolVersion: number
|
||||
}
|
||||
|
||||
export namespace SignedPreKey {
|
||||
export const codec = (): Codec<SignedPreKey> => {
|
||||
return message<SignedPreKey>({
|
||||
1: { name: 'signedPreKey', codec: bytes },
|
||||
2: { name: 'version', codec: uint32 },
|
||||
3: { name: 'protocolVersion', codec: uint32 }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: SignedPreKey): Uint8Array => {
|
||||
return encodeMessage(obj, SignedPreKey.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): SignedPreKey => {
|
||||
return decodeMessage(buf, SignedPreKey.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface Bundle {
|
||||
identity: Uint8Array
|
||||
signedPreKeys: SignedPreKey
|
||||
signature: Uint8Array
|
||||
timestamp: bigint
|
||||
}
|
||||
|
||||
export namespace Bundle {
|
||||
export const codec = (): Codec<Bundle> => {
|
||||
return message<Bundle>({
|
||||
1: { name: 'identity', codec: bytes },
|
||||
2: { name: 'signedPreKeys', codec: SignedPreKey.codec() },
|
||||
4: { name: 'signature', codec: bytes },
|
||||
5: { name: 'timestamp', codec: int64 }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: Bundle): Uint8Array => {
|
||||
return encodeMessage(obj, Bundle.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): Bundle => {
|
||||
return decodeMessage(buf, Bundle.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface BundleContainer {
|
||||
bundle: Bundle
|
||||
privateSignedPreKey: Uint8Array
|
||||
}
|
||||
|
||||
export namespace BundleContainer {
|
||||
export const codec = (): Codec<BundleContainer> => {
|
||||
return message<BundleContainer>({
|
||||
1: { name: 'bundle', codec: Bundle.codec() },
|
||||
2: { name: 'privateSignedPreKey', codec: bytes }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: BundleContainer): Uint8Array => {
|
||||
return encodeMessage(obj, BundleContainer.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): BundleContainer => {
|
||||
return decodeMessage(buf, BundleContainer.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface DRHeader {
|
||||
key: Uint8Array
|
||||
n: number
|
||||
pn: number
|
||||
id: Uint8Array
|
||||
}
|
||||
|
||||
export namespace DRHeader {
|
||||
export const codec = (): Codec<DRHeader> => {
|
||||
return message<DRHeader>({
|
||||
1: { name: 'key', codec: bytes },
|
||||
2: { name: 'n', codec: uint32 },
|
||||
3: { name: 'pn', codec: uint32 },
|
||||
4: { name: 'id', codec: bytes }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: DRHeader): Uint8Array => {
|
||||
return encodeMessage(obj, DRHeader.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): DRHeader => {
|
||||
return decodeMessage(buf, DRHeader.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface DHHeader {
|
||||
key: Uint8Array
|
||||
}
|
||||
|
||||
export namespace DHHeader {
|
||||
export const codec = (): Codec<DHHeader> => {
|
||||
return message<DHHeader>({
|
||||
1: { name: 'key', codec: bytes }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: DHHeader): Uint8Array => {
|
||||
return encodeMessage(obj, DHHeader.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): DHHeader => {
|
||||
return decodeMessage(buf, DHHeader.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface X3DHHeader {
|
||||
key: Uint8Array
|
||||
id: Uint8Array
|
||||
}
|
||||
|
||||
export namespace X3DHHeader {
|
||||
export const codec = (): Codec<X3DHHeader> => {
|
||||
return message<X3DHHeader>({
|
||||
1: { name: 'key', codec: bytes },
|
||||
4: { name: 'id', codec: bytes }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: X3DHHeader): Uint8Array => {
|
||||
return encodeMessage(obj, X3DHHeader.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): X3DHHeader => {
|
||||
return decodeMessage(buf, X3DHHeader.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface HRHeader {
|
||||
keyId: number
|
||||
seqNo: number
|
||||
groupId: string
|
||||
}
|
||||
|
||||
export namespace HRHeader {
|
||||
export const codec = (): Codec<HRHeader> => {
|
||||
return message<HRHeader>({
|
||||
1: { name: 'keyId', codec: uint32 },
|
||||
2: { name: 'seqNo', codec: uint32 },
|
||||
3: { name: 'groupId', codec: string }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: HRHeader): Uint8Array => {
|
||||
return encodeMessage(obj, HRHeader.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): HRHeader => {
|
||||
return decodeMessage(buf, HRHeader.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface EncryptedMessageProtocol {
|
||||
X3DHHeader: X3DHHeader
|
||||
DRHeader: DRHeader
|
||||
DHHeader: DHHeader
|
||||
HRHeader: HRHeader
|
||||
payload: Uint8Array
|
||||
}
|
||||
|
||||
export namespace EncryptedMessageProtocol {
|
||||
export const codec = (): Codec<EncryptedMessageProtocol> => {
|
||||
return message<EncryptedMessageProtocol>({
|
||||
1: { name: 'X3DHHeader', codec: X3DHHeader.codec() },
|
||||
2: { name: 'DRHeader', codec: DRHeader.codec() },
|
||||
101: { name: 'DHHeader', codec: DHHeader.codec() },
|
||||
102: { name: 'HRHeader', codec: HRHeader.codec() },
|
||||
3: { name: 'payload', codec: bytes }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: EncryptedMessageProtocol): Uint8Array => {
|
||||
return encodeMessage(obj, EncryptedMessageProtocol.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): EncryptedMessageProtocol => {
|
||||
return decodeMessage(buf, EncryptedMessageProtocol.codec())
|
||||
}
|
||||
}
|
||||
|
||||
export interface ProtocolMessage {
|
||||
installationId: string
|
||||
bundles: Bundle[]
|
||||
encryptedMessage: EncryptedMessageProtocol
|
||||
publicMessage: Uint8Array
|
||||
}
|
||||
|
||||
export namespace ProtocolMessage {
|
||||
export const codec = (): Codec<ProtocolMessage> => {
|
||||
return message<ProtocolMessage>({
|
||||
2: { name: 'installationId', codec: string },
|
||||
3: { name: 'bundles', codec: Bundle.codec(), repeats: true },
|
||||
101: { name: 'encryptedMessage', codec: EncryptedMessageProtocol.codec() },
|
||||
102: { name: 'publicMessage', codec: bytes }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: ProtocolMessage): Uint8Array => {
|
||||
return encodeMessage(obj, ProtocolMessage.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): ProtocolMessage => {
|
||||
return decodeMessage(buf, ProtocolMessage.codec())
|
||||
}
|
||||
}
|
|
@ -0,0 +1,506 @@
|
|||
// @generated by protoc-gen-es v1.0.0 with parameter "target=ts"
|
||||
// @generated from file protocol-message.proto (syntax proto3)
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
|
||||
import { Message, proto3, protoInt64 } from "@bufbuild/protobuf";
|
||||
|
||||
/**
|
||||
* @generated from message SignedPreKey
|
||||
*/
|
||||
export class SignedPreKey extends Message<SignedPreKey> {
|
||||
/**
|
||||
* @generated from field: bytes signed_pre_key = 1;
|
||||
*/
|
||||
signedPreKey = new Uint8Array(0);
|
||||
|
||||
/**
|
||||
* @generated from field: uint32 version = 2;
|
||||
*/
|
||||
version = 0;
|
||||
|
||||
/**
|
||||
* @generated from field: uint32 protocol_version = 3;
|
||||
*/
|
||||
protocolVersion = 0;
|
||||
|
||||
constructor(data?: PartialMessage<SignedPreKey>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "SignedPreKey";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "signed_pre_key", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
{ no: 2, name: "version", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
||||
{ no: 3, name: "protocol_version", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): SignedPreKey {
|
||||
return new SignedPreKey().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): SignedPreKey {
|
||||
return new SignedPreKey().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): SignedPreKey {
|
||||
return new SignedPreKey().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: SignedPreKey | PlainMessage<SignedPreKey> | undefined, b: SignedPreKey | PlainMessage<SignedPreKey> | undefined): boolean {
|
||||
return proto3.util.equals(SignedPreKey, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* X3DH prekey bundle
|
||||
*
|
||||
* @generated from message Bundle
|
||||
*/
|
||||
export class Bundle extends Message<Bundle> {
|
||||
/**
|
||||
* Identity key
|
||||
*
|
||||
* @generated from field: bytes identity = 1;
|
||||
*/
|
||||
identity = new Uint8Array(0);
|
||||
|
||||
/**
|
||||
* Installation id
|
||||
*
|
||||
* @generated from field: map<string, SignedPreKey> signed_pre_keys = 2;
|
||||
*/
|
||||
signedPreKeys: { [key: string]: SignedPreKey } = {};
|
||||
|
||||
/**
|
||||
* Prekey signature
|
||||
*
|
||||
* @generated from field: bytes signature = 4;
|
||||
*/
|
||||
signature = new Uint8Array(0);
|
||||
|
||||
/**
|
||||
* When the bundle was created locally
|
||||
*
|
||||
* @generated from field: int64 timestamp = 5;
|
||||
*/
|
||||
timestamp = protoInt64.zero;
|
||||
|
||||
constructor(data?: PartialMessage<Bundle>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "Bundle";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "identity", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
{ no: 2, name: "signed_pre_keys", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: SignedPreKey} },
|
||||
{ no: 4, name: "signature", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
{ no: 5, name: "timestamp", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Bundle {
|
||||
return new Bundle().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Bundle {
|
||||
return new Bundle().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Bundle {
|
||||
return new Bundle().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: Bundle | PlainMessage<Bundle> | undefined, b: Bundle | PlainMessage<Bundle> | undefined): boolean {
|
||||
return proto3.util.equals(Bundle, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message BundleContainer
|
||||
*/
|
||||
export class BundleContainer extends Message<BundleContainer> {
|
||||
/**
|
||||
* X3DH prekey bundle
|
||||
*
|
||||
* @generated from field: Bundle bundle = 1;
|
||||
*/
|
||||
bundle?: Bundle;
|
||||
|
||||
/**
|
||||
* Private signed prekey
|
||||
*
|
||||
* @generated from field: bytes private_signed_pre_key = 2;
|
||||
*/
|
||||
privateSignedPreKey = new Uint8Array(0);
|
||||
|
||||
constructor(data?: PartialMessage<BundleContainer>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "BundleContainer";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "bundle", kind: "message", T: Bundle },
|
||||
{ no: 2, name: "private_signed_pre_key", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): BundleContainer {
|
||||
return new BundleContainer().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): BundleContainer {
|
||||
return new BundleContainer().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): BundleContainer {
|
||||
return new BundleContainer().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: BundleContainer | PlainMessage<BundleContainer> | undefined, b: BundleContainer | PlainMessage<BundleContainer> | undefined): boolean {
|
||||
return proto3.util.equals(BundleContainer, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message DRHeader
|
||||
*/
|
||||
export class DRHeader extends Message<DRHeader> {
|
||||
/**
|
||||
* Current ratchet public key
|
||||
*
|
||||
* @generated from field: bytes key = 1;
|
||||
*/
|
||||
key = new Uint8Array(0);
|
||||
|
||||
/**
|
||||
* Number of the message in the sending chain
|
||||
*
|
||||
* @generated from field: uint32 n = 2;
|
||||
*/
|
||||
n = 0;
|
||||
|
||||
/**
|
||||
* Length of the previous sending chain
|
||||
*
|
||||
* @generated from field: uint32 pn = 3;
|
||||
*/
|
||||
pn = 0;
|
||||
|
||||
/**
|
||||
* Bundle ID
|
||||
*
|
||||
* @generated from field: bytes id = 4;
|
||||
*/
|
||||
id = new Uint8Array(0);
|
||||
|
||||
constructor(data?: PartialMessage<DRHeader>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "DRHeader";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "key", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
{ no: 2, name: "n", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
||||
{ no: 3, name: "pn", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
||||
{ no: 4, name: "id", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DRHeader {
|
||||
return new DRHeader().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DRHeader {
|
||||
return new DRHeader().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DRHeader {
|
||||
return new DRHeader().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: DRHeader | PlainMessage<DRHeader> | undefined, b: DRHeader | PlainMessage<DRHeader> | undefined): boolean {
|
||||
return proto3.util.equals(DRHeader, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message DHHeader
|
||||
*/
|
||||
export class DHHeader extends Message<DHHeader> {
|
||||
/**
|
||||
* Compressed ephemeral public key
|
||||
*
|
||||
* @generated from field: bytes key = 1;
|
||||
*/
|
||||
key = new Uint8Array(0);
|
||||
|
||||
constructor(data?: PartialMessage<DHHeader>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "DHHeader";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "key", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DHHeader {
|
||||
return new DHHeader().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DHHeader {
|
||||
return new DHHeader().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DHHeader {
|
||||
return new DHHeader().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: DHHeader | PlainMessage<DHHeader> | undefined, b: DHHeader | PlainMessage<DHHeader> | undefined): boolean {
|
||||
return proto3.util.equals(DHHeader, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message X3DHHeader
|
||||
*/
|
||||
export class X3DHHeader extends Message<X3DHHeader> {
|
||||
/**
|
||||
* Ephemeral key used
|
||||
*
|
||||
* @generated from field: bytes key = 1;
|
||||
*/
|
||||
key = new Uint8Array(0);
|
||||
|
||||
/**
|
||||
* Used bundle's signed prekey
|
||||
*
|
||||
* @generated from field: bytes id = 4;
|
||||
*/
|
||||
id = new Uint8Array(0);
|
||||
|
||||
constructor(data?: PartialMessage<X3DHHeader>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "X3DHHeader";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "key", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
{ no: 4, name: "id", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): X3DHHeader {
|
||||
return new X3DHHeader().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): X3DHHeader {
|
||||
return new X3DHHeader().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): X3DHHeader {
|
||||
return new X3DHHeader().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: X3DHHeader | PlainMessage<X3DHHeader> | undefined, b: X3DHHeader | PlainMessage<X3DHHeader> | undefined): boolean {
|
||||
return proto3.util.equals(X3DHHeader, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hash Ratchet Header
|
||||
*
|
||||
* @generated from message HRHeader
|
||||
*/
|
||||
export class HRHeader extends Message<HRHeader> {
|
||||
/**
|
||||
* community key ID
|
||||
*
|
||||
* @generated from field: uint32 key_id = 1;
|
||||
*/
|
||||
keyId = 0;
|
||||
|
||||
/**
|
||||
* Community message number for this key_id
|
||||
*
|
||||
* @generated from field: uint32 seq_no = 2;
|
||||
*/
|
||||
seqNo = 0;
|
||||
|
||||
/**
|
||||
* Community ID
|
||||
*
|
||||
* @generated from field: string group_id = 3;
|
||||
*/
|
||||
groupId = "";
|
||||
|
||||
constructor(data?: PartialMessage<HRHeader>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "HRHeader";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "key_id", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
||||
{ no: 2, name: "seq_no", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
||||
{ no: 3, name: "group_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): HRHeader {
|
||||
return new HRHeader().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): HRHeader {
|
||||
return new HRHeader().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): HRHeader {
|
||||
return new HRHeader().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: HRHeader | PlainMessage<HRHeader> | undefined, b: HRHeader | PlainMessage<HRHeader> | undefined): boolean {
|
||||
return proto3.util.equals(HRHeader, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Direct message value
|
||||
*
|
||||
* @generated from message EncryptedMessageProtocol
|
||||
*/
|
||||
export class EncryptedMessageProtocol extends Message<EncryptedMessageProtocol> {
|
||||
/**
|
||||
* @generated from field: X3DHHeader X3DH_header = 1;
|
||||
*/
|
||||
X3DHHeader?: X3DHHeader;
|
||||
|
||||
/**
|
||||
* @generated from field: DRHeader DR_header = 2;
|
||||
*/
|
||||
DRHeader?: DRHeader;
|
||||
|
||||
/**
|
||||
* @generated from field: DHHeader DH_header = 101;
|
||||
*/
|
||||
DHHeader?: DHHeader;
|
||||
|
||||
/**
|
||||
* @generated from field: HRHeader HR_header = 102;
|
||||
*/
|
||||
HRHeader?: HRHeader;
|
||||
|
||||
/**
|
||||
* Encrypted payload
|
||||
*
|
||||
* @generated from field: bytes payload = 3;
|
||||
*/
|
||||
payload = new Uint8Array(0);
|
||||
|
||||
constructor(data?: PartialMessage<EncryptedMessageProtocol>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "EncryptedMessageProtocol";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "X3DH_header", kind: "message", T: X3DHHeader },
|
||||
{ no: 2, name: "DR_header", kind: "message", T: DRHeader },
|
||||
{ no: 101, name: "DH_header", kind: "message", T: DHHeader },
|
||||
{ no: 102, name: "HR_header", kind: "message", T: HRHeader },
|
||||
{ no: 3, name: "payload", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): EncryptedMessageProtocol {
|
||||
return new EncryptedMessageProtocol().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): EncryptedMessageProtocol {
|
||||
return new EncryptedMessageProtocol().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): EncryptedMessageProtocol {
|
||||
return new EncryptedMessageProtocol().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: EncryptedMessageProtocol | PlainMessage<EncryptedMessageProtocol> | undefined, b: EncryptedMessageProtocol | PlainMessage<EncryptedMessageProtocol> | undefined): boolean {
|
||||
return proto3.util.equals(EncryptedMessageProtocol, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Top-level protocol message
|
||||
*
|
||||
* @generated from message ProtocolMessage
|
||||
*/
|
||||
export class ProtocolMessage extends Message<ProtocolMessage> {
|
||||
/**
|
||||
* The device id of the sender
|
||||
*
|
||||
* @generated from field: string installation_id = 2;
|
||||
*/
|
||||
installationId = "";
|
||||
|
||||
/**
|
||||
* List of bundles
|
||||
*
|
||||
* @generated from field: repeated Bundle bundles = 3;
|
||||
*/
|
||||
bundles: Bundle[] = [];
|
||||
|
||||
/**
|
||||
* One to one message, encrypted, indexed by installation_id
|
||||
* TODO map here is redundant in case of community messages
|
||||
*
|
||||
* @generated from field: map<string, EncryptedMessageProtocol> encrypted_message = 101;
|
||||
*/
|
||||
encryptedMessage: { [key: string]: EncryptedMessageProtocol } = {};
|
||||
|
||||
/**
|
||||
* Public chats, not encrypted
|
||||
*
|
||||
* @generated from field: bytes public_message = 102;
|
||||
*/
|
||||
publicMessage = new Uint8Array(0);
|
||||
|
||||
constructor(data?: PartialMessage<ProtocolMessage>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "ProtocolMessage";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 2, name: "installation_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 3, name: "bundles", kind: "message", T: Bundle, repeated: true },
|
||||
{ no: 101, name: "encrypted_message", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: EncryptedMessageProtocol} },
|
||||
{ no: 102, name: "public_message", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ProtocolMessage {
|
||||
return new ProtocolMessage().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ProtocolMessage {
|
||||
return new ProtocolMessage().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ProtocolMessage {
|
||||
return new ProtocolMessage().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: ProtocolMessage | PlainMessage<ProtocolMessage> | undefined, b: ProtocolMessage | PlainMessage<ProtocolMessage> | undefined): boolean {
|
||||
return proto3.util.equals(ProtocolMessage, a, b);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/* eslint-disable import/export */
|
||||
/* eslint-disable @typescript-eslint/no-namespace */
|
||||
|
||||
import { enumeration, encodeMessage, decodeMessage, message, uint64, string } from 'protons-runtime'
|
||||
import type { Codec } from 'protons-runtime'
|
||||
|
||||
export interface StatusUpdate {
|
||||
clock: bigint
|
||||
statusType: StatusUpdate.StatusType
|
||||
customText: string
|
||||
}
|
||||
|
||||
export namespace StatusUpdate {
|
||||
export enum StatusType {
|
||||
UNKNOWN_STATUS_TYPE = 'UNKNOWN_STATUS_TYPE',
|
||||
AUTOMATIC = 'AUTOMATIC',
|
||||
DO_NOT_DISTURB = 'DO_NOT_DISTURB',
|
||||
ALWAYS_ONLINE = 'ALWAYS_ONLINE',
|
||||
INACTIVE = 'INACTIVE'
|
||||
}
|
||||
|
||||
enum __StatusTypeValues {
|
||||
UNKNOWN_STATUS_TYPE = 0,
|
||||
AUTOMATIC = 1,
|
||||
DO_NOT_DISTURB = 2,
|
||||
ALWAYS_ONLINE = 3,
|
||||
INACTIVE = 4
|
||||
}
|
||||
|
||||
export namespace StatusType {
|
||||
export const codec = () => {
|
||||
return enumeration<typeof StatusType>(__StatusTypeValues)
|
||||
}
|
||||
}
|
||||
|
||||
export const codec = (): Codec<StatusUpdate> => {
|
||||
return message<StatusUpdate>({
|
||||
1: { name: 'clock', codec: uint64 },
|
||||
2: { name: 'statusType', codec: StatusUpdate.StatusType.codec() },
|
||||
3: { name: 'customText', codec: string }
|
||||
})
|
||||
}
|
||||
|
||||
export const encode = (obj: StatusUpdate): Uint8Array => {
|
||||
return encodeMessage(obj, StatusUpdate.codec())
|
||||
}
|
||||
|
||||
export const decode = (buf: Uint8Array): StatusUpdate => {
|
||||
return decodeMessage(buf, StatusUpdate.codec())
|
||||
}
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
// @generated by protoc-gen-es v1.0.0 with parameter "target=ts"
|
||||
// @generated from file status-update.proto (syntax proto3)
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
|
||||
import { Message, proto3, protoInt64 } from "@bufbuild/protobuf";
|
||||
|
||||
/**
|
||||
* Specs:
|
||||
* :AUTOMATIC
|
||||
* To Send - "AUTOMATIC" status ping every 5 minutes
|
||||
* Display - Online for up to 5 minutes from the last clock, after that Offline
|
||||
* :ALWAYS_ONLINE
|
||||
* To Send - "ALWAYS_ONLINE" status ping every 5 minutes
|
||||
* Display - Online for up to 2 weeks from the last clock, after that Offline
|
||||
* :INACTIVE
|
||||
* To Send - A single "INACTIVE" status ping
|
||||
* Display - Offline forever
|
||||
* Note: Only send pings if the user interacted with the app in the last x minutes.
|
||||
*
|
||||
* @generated from message StatusUpdate
|
||||
*/
|
||||
export class StatusUpdate extends Message<StatusUpdate> {
|
||||
/**
|
||||
* @generated from field: uint64 clock = 1;
|
||||
*/
|
||||
clock = protoInt64.zero;
|
||||
|
||||
/**
|
||||
* @generated from field: StatusUpdate.StatusType status_type = 2;
|
||||
*/
|
||||
statusType = StatusUpdate_StatusType.UNKNOWN_STATUS_TYPE;
|
||||
|
||||
/**
|
||||
* @generated from field: string custom_text = 3;
|
||||
*/
|
||||
customText = "";
|
||||
|
||||
constructor(data?: PartialMessage<StatusUpdate>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime = proto3;
|
||||
static readonly typeName = "StatusUpdate";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "clock", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
|
||||
{ no: 2, name: "status_type", kind: "enum", T: proto3.getEnumType(StatusUpdate_StatusType) },
|
||||
{ no: 3, name: "custom_text", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): StatusUpdate {
|
||||
return new StatusUpdate().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): StatusUpdate {
|
||||
return new StatusUpdate().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): StatusUpdate {
|
||||
return new StatusUpdate().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: StatusUpdate | PlainMessage<StatusUpdate> | undefined, b: StatusUpdate | PlainMessage<StatusUpdate> | undefined): boolean {
|
||||
return proto3.util.equals(StatusUpdate, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from enum StatusUpdate.StatusType
|
||||
*/
|
||||
export enum StatusUpdate_StatusType {
|
||||
/**
|
||||
* @generated from enum value: UNKNOWN_STATUS_TYPE = 0;
|
||||
*/
|
||||
UNKNOWN_STATUS_TYPE = 0,
|
||||
|
||||
/**
|
||||
* @generated from enum value: AUTOMATIC = 1;
|
||||
*/
|
||||
AUTOMATIC = 1,
|
||||
|
||||
/**
|
||||
* @generated from enum value: DO_NOT_DISTURB = 2;
|
||||
*/
|
||||
DO_NOT_DISTURB = 2,
|
||||
|
||||
/**
|
||||
* @generated from enum value: ALWAYS_ONLINE = 3;
|
||||
*/
|
||||
ALWAYS_ONLINE = 3,
|
||||
|
||||
/**
|
||||
* @generated from enum value: INACTIVE = 4;
|
||||
*/
|
||||
INACTIVE = 4,
|
||||
}
|
||||
// Retrieve enum metadata with: proto3.getEnumType(StatusUpdate_StatusType)
|
||||
proto3.util.setEnumType(StatusUpdate_StatusType, "StatusUpdate.StatusType", [
|
||||
{ no: 0, name: "UNKNOWN_STATUS_TYPE" },
|
||||
{ no: 1, name: "AUTOMATIC" },
|
||||
{ no: 2, name: "DO_NOT_DISTURB" },
|
||||
{ no: 3, name: "ALWAYS_ONLINE" },
|
||||
{ no: 4, name: "INACTIVE" },
|
||||
]);
|
||||
|
|
@ -2,10 +2,13 @@ import { bytesToHex, utf8ToBytes } from 'ethereum-cryptography/utils'
|
|||
import { expect, test } from 'vitest'
|
||||
|
||||
import { Account } from '../client/account'
|
||||
import {
|
||||
ApplicationMetadataMessage,
|
||||
ApplicationMetadataMessage_Type,
|
||||
} from '../protos/application-metadata-message_pb'
|
||||
import { recoverPublicKey } from './recover-public-key'
|
||||
|
||||
import type { Client } from '../client/client'
|
||||
import type { ApplicationMetadataMessage } from '../protos/application-metadata-message'
|
||||
|
||||
test('should recover public key', async () => {
|
||||
const payload = utf8ToBytes('hello')
|
||||
|
@ -20,8 +23,8 @@ test('should recover public key', async () => {
|
|||
})
|
||||
|
||||
test('should recover public key from fixture', async () => {
|
||||
const metadataFixture: ApplicationMetadataMessage = {
|
||||
type: 'TYPE_EMOJI_REACTION' as ApplicationMetadataMessage.Type,
|
||||
const metadataFixture = new ApplicationMetadataMessage({
|
||||
type: ApplicationMetadataMessage_Type.EMOJI_REACTION,
|
||||
signature: new Uint8Array([
|
||||
250, 132, 234, 119, 159, 124, 98, 93, 197, 108, 99, 52, 186, 234, 142,
|
||||
101, 147, 180, 50, 190, 102, 61, 219, 189, 95, 124, 29, 74, 43, 46, 106,
|
||||
|
@ -42,7 +45,7 @@ test('should recover public key from fixture', async () => {
|
|||
55, 97, 55, 99, 48, 97, 53, 101, 98, 97, 53, 102, 97, 57, 100, 52, 100,
|
||||
57, 49, 98, 97, 56, 32, 5, 40, 2,
|
||||
]),
|
||||
}
|
||||
})
|
||||
|
||||
const publicKeySnapshot = new Uint8Array([
|
||||
4, 172, 65, 157, 172, 154, 139, 187, 88, 130, 90, 60, 222, 96, 238, 240,
|
||||
|
|
|
@ -1,27 +1,42 @@
|
|||
import type { ChatMessage } from '../protos/chat-message'
|
||||
import {
|
||||
AudioMessage_AudioType,
|
||||
ChatMessage_ContentType,
|
||||
} from '../protos/chat-message_pb'
|
||||
import { ImageType, MessageType } from '../protos/enums_pb'
|
||||
|
||||
import type {
|
||||
AudioMessage,
|
||||
ChatMessage,
|
||||
ImageMessage,
|
||||
} from '../protos/chat-message_pb'
|
||||
|
||||
// TODO?: maybe this should normalize the message?
|
||||
export function validateMessage(message: ChatMessage): boolean {
|
||||
if (message.messageType !== 'COMMUNITY_CHAT') {
|
||||
if (message.messageType !== MessageType.COMMUNITY_CHAT) {
|
||||
return false
|
||||
}
|
||||
|
||||
switch (message.contentType) {
|
||||
case 'TEXT_PLAIN': {
|
||||
case ChatMessage_ContentType.TEXT_PLAIN: {
|
||||
return message.text !== ''
|
||||
}
|
||||
case 'IMAGE': {
|
||||
if (message.image.type === 'UNKNOWN_IMAGE_TYPE') {
|
||||
case ChatMessage_ContentType.IMAGE: {
|
||||
// fixme?
|
||||
const payload = message.payload.value as ImageMessage
|
||||
|
||||
if (payload.type === ImageType.UNKNOWN_IMAGE_TYPE) {
|
||||
return false
|
||||
}
|
||||
|
||||
return message.image.payload.length !== 0
|
||||
return payload.payload.length !== 0
|
||||
}
|
||||
case 'AUDIO': {
|
||||
if (message.audio.type === 'UNKNOWN_AUDIO_TYPE') {
|
||||
case ChatMessage_ContentType.AUDIO: {
|
||||
const payload = message.payload.value as AudioMessage
|
||||
|
||||
if (payload.type === AudioMessage_AudioType.UNKNOWN_AUDIO_TYPE) {
|
||||
return false
|
||||
}
|
||||
return message.audio.payload.length !== 0
|
||||
return payload.payload.length !== 0
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ export { useChat } from './use-chat'
|
|||
export type { Member } from './use-members'
|
||||
export { useMembers } from './use-members'
|
||||
export type { Message, Reaction, Reactions } from './use-messages'
|
||||
export { MessageContentType } from './use-messages'
|
||||
export { useMessages } from './use-messages'
|
||||
export { useProtocol } from './use-protocol'
|
||||
export { useSortedChats } from './use-sorted-chats'
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import { useEffect, useState } from 'react'
|
||||
|
||||
import { MessageContentType } from '@status-im/js'
|
||||
import sub from 'date-fns/sub'
|
||||
|
||||
import { useProtocol } from './use-protocol'
|
||||
|
||||
import type { Message, Reactions } from '@status-im/js'
|
||||
|
||||
type Reaction = keyof Reactions
|
||||
import type { Message, Reaction, Reactions } from '@status-im/js'
|
||||
|
||||
interface Result {
|
||||
data: Message[]
|
||||
|
@ -52,3 +51,4 @@ export const useMessages = (chatId: string): Result => {
|
|||
}
|
||||
|
||||
export type { Message, Reaction, Reactions }
|
||||
export { MessageContentType }
|
||||
|
|
|
@ -2,6 +2,7 @@ import React from 'react'
|
|||
|
||||
import { useChatContext } from '../../../../contexts/chat-context'
|
||||
import { CrossIcon } from '../../../../icons/cross-icon'
|
||||
import { MessageContentType } from '../../../../protocol'
|
||||
import { styled } from '../../../../styles/config'
|
||||
import { Flex, IconButton, Text } from '../../../../system'
|
||||
|
||||
|
@ -34,7 +35,7 @@ export const InputReply = (props: Props) => {
|
|||
<CrossIcon />
|
||||
</IconButton>
|
||||
</Flex>
|
||||
{message.contentType === 'TEXT_PLAIN' && (
|
||||
{message.contentType === MessageContentType.TEXT_PLAIN && (
|
||||
<Flex>
|
||||
<Text size="13" truncate>
|
||||
{message.text}
|
||||
|
|
|
@ -6,7 +6,11 @@ import { useMatch } from 'react-router-dom'
|
|||
import { useChatContext } from '../../../../contexts/chat-context'
|
||||
// import { BellIcon } from '../../../../icons/bell-icon'
|
||||
// import { PinIcon } from '../../../../icons/pin-icon'
|
||||
import { useAccount, useProtocol } from '../../../../protocol'
|
||||
import {
|
||||
MessageContentType,
|
||||
useAccount,
|
||||
useProtocol,
|
||||
} from '../../../../protocol'
|
||||
import { keyframes, styled } from '../../../../styles/config'
|
||||
import {
|
||||
Avatar,
|
||||
|
@ -134,7 +138,7 @@ export const ChatMessage = (props: Props) => {
|
|||
}
|
||||
|
||||
switch (contentType) {
|
||||
case 'TEXT_PLAIN': {
|
||||
case MessageContentType.TEXT_PLAIN: {
|
||||
// <AlertDialogTrigger>
|
||||
// <MessageLink href="https://specs.status.im/spec">
|
||||
// https://specs.status.im/spec
|
||||
|
@ -147,15 +151,22 @@ export const ChatMessage = (props: Props) => {
|
|||
// </AlertDialogTrigger>{' '}
|
||||
return <Text>{message.text}</Text>
|
||||
}
|
||||
case 'EMOJI': {
|
||||
case MessageContentType.EMOJI: {
|
||||
return (
|
||||
<Text css={{ fontSize: '3rem', lineHeight: 1.1, letterSpacing: -2 }}>
|
||||
{message.text}
|
||||
</Text>
|
||||
)
|
||||
}
|
||||
case 'IMAGE': {
|
||||
const blob = new Blob([message.image.payload], { type: 'image/jpeg' })
|
||||
case MessageContentType.IMAGE: {
|
||||
// fixme?
|
||||
const image = message.payload.value as {
|
||||
payload: Uint8Array
|
||||
type: number
|
||||
}
|
||||
const blob = new Blob([image.payload], {
|
||||
type: 'image/jpeg',
|
||||
})
|
||||
|
||||
// TODO?: call URL.revokeObjectURL()
|
||||
return (
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react'
|
||||
|
||||
import { useProtocol } from '../../../../protocol'
|
||||
import { MessageContentType, useProtocol } from '../../../../protocol'
|
||||
import { styled } from '../../../../styles/config'
|
||||
import { Avatar, Box, Flex, Image, Text } from '../../../../system'
|
||||
|
||||
|
@ -36,21 +36,21 @@ export const MessageReply = (props: Props) => {
|
|||
{member.username}
|
||||
</Text>
|
||||
</Flex>
|
||||
{contentType === 'TEXT_PLAIN' && (
|
||||
{contentType === MessageContentType.TEXT_PLAIN && (
|
||||
<Flex>
|
||||
<Text color="gray" size="13" truncate>
|
||||
{text}
|
||||
</Text>
|
||||
</Flex>
|
||||
)}
|
||||
{contentType === 'EMOJI' && (
|
||||
{contentType === MessageContentType.EMOJI && (
|
||||
<Flex>
|
||||
<Text color="gray" size="13" truncate>
|
||||
{text}
|
||||
</Text>
|
||||
</Flex>
|
||||
)}
|
||||
{contentType === 'IMAGE' && (
|
||||
{contentType === MessageContentType.IMAGE && (
|
||||
<Box css={{ paddingTop: '$1' }}>
|
||||
<Image
|
||||
src="TODO"
|
||||
|
|
208
yarn.lock
208
yarn.lock
|
@ -445,6 +445,27 @@
|
|||
"@babel/helper-validator-identifier" "^7.19.1"
|
||||
to-fast-properties "^2.0.0"
|
||||
|
||||
"@bufbuild/protobuf@1.0.0", "@bufbuild/protobuf@^1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@bufbuild/protobuf/-/protobuf-1.0.0.tgz#b25c045f8554f92c3723d5bb28e3a2538662f51b"
|
||||
integrity sha512-oH3jHBrZ6to8Qf4zLg7O8KqSY42kQZNBRXJRMp5uSi0mqE4L8NbyMnZHeOsbXmTb0xpptRyH11LfS+KeVhXzAA==
|
||||
|
||||
"@bufbuild/protoc-gen-es@^1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@bufbuild/protoc-gen-es/-/protoc-gen-es-1.0.0.tgz#9afa22d6296a741f8b512a5fcf0846d948ce7f65"
|
||||
integrity sha512-3NZzjw2hbeO7JFUZ70W4UOkaMyOC6hJfJP4uDczyWWTXoCr2TPDfPyLE2U8DBpKufneLS1YBhFJPPv4QvJkiPA==
|
||||
dependencies:
|
||||
"@bufbuild/protoplugin" "1.0.0"
|
||||
|
||||
"@bufbuild/protoplugin@1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@bufbuild/protoplugin/-/protoplugin-1.0.0.tgz#58708ccbb2710be7d4a69607e2b039ac62cd5665"
|
||||
integrity sha512-L7z2/4MgP36QGEAh8T4OYrdMRv//LAw4gGpL8D3cziE21uP6FLzLKpIxJ4aJBoUyHyS53tpZMpb0djbxYDecFA==
|
||||
dependencies:
|
||||
"@bufbuild/protobuf" "1.0.0"
|
||||
"@typescript/vfs" "^1.4.0"
|
||||
typescript "4.5.2"
|
||||
|
||||
"@chainsafe/libp2p-gossipsub@^4.1.1":
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@chainsafe/libp2p-gossipsub/-/libp2p-gossipsub-4.1.1.tgz#804dbbd262900fd730339c40c46013ff854240af"
|
||||
|
@ -2401,7 +2422,7 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.1.tgz#459c65fa1867dafe6a8f322c4c51695663cc55e9"
|
||||
integrity sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==
|
||||
|
||||
"@types/minimist@^1.2.0", "@types/minimist@^1.2.2":
|
||||
"@types/minimist@^1.2.0":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c"
|
||||
integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==
|
||||
|
@ -2582,6 +2603,13 @@
|
|||
"@typescript-eslint/types" "5.12.1"
|
||||
eslint-visitor-keys "^3.0.0"
|
||||
|
||||
"@typescript/vfs@^1.4.0":
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript/vfs/-/vfs-1.4.0.tgz#2d22985c7666c9d4ce26eb025405e6f156aa32b0"
|
||||
integrity sha512-Pood7yv5YWMIX+yCHo176OnF8WUlKGImFG7XlsuH14Zb1YN5+dYD3uUtS7lqZtsH7tAveNUi2NzdpQCN0yRbaw==
|
||||
dependencies:
|
||||
debug "^4.1.1"
|
||||
|
||||
"@vitejs/plugin-react@^1.3.2":
|
||||
version "1.3.2"
|
||||
resolved "https://registry.yarnpkg.com/@vitejs/plugin-react/-/plugin-react-1.3.2.tgz#2fcf0b6ce9bcdcd4cec5c760c199779d5657ece1"
|
||||
|
@ -2883,26 +2911,11 @@ camelcase-keys@^6.2.2:
|
|||
map-obj "^4.0.0"
|
||||
quick-lru "^4.0.1"
|
||||
|
||||
camelcase-keys@^7.0.0:
|
||||
version "7.0.2"
|
||||
resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-7.0.2.tgz#d048d8c69448745bb0de6fc4c1c52a30dfbe7252"
|
||||
integrity sha512-Rjs1H+A9R+Ig+4E/9oyB66UC5Mj9Xq3N//vcLf2WzgdTi/3gUu3Z9KoqmlrEG4VuuLK8wJHofxzdQXz/knhiYg==
|
||||
dependencies:
|
||||
camelcase "^6.3.0"
|
||||
map-obj "^4.1.0"
|
||||
quick-lru "^5.1.1"
|
||||
type-fest "^1.2.1"
|
||||
|
||||
camelcase@^5.0.0, camelcase@^5.3.1:
|
||||
version "5.3.1"
|
||||
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
|
||||
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
|
||||
|
||||
camelcase@^6.3.0:
|
||||
version "6.3.0"
|
||||
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a"
|
||||
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==
|
||||
|
||||
caniuse-lite@^1.0.30001400, caniuse-lite@^1.0.30001406:
|
||||
version "1.0.30001418"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001418.tgz#5f459215192a024c99e3e3a53aac310fc7cf24e6"
|
||||
|
@ -3216,11 +3229,6 @@ decamelize@^1.1.0, decamelize@^1.2.0:
|
|||
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
||||
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
|
||||
|
||||
decamelize@^5.0.0:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-5.0.1.tgz#db11a92e58c741ef339fb0a2868d8a06a9a7b1e9"
|
||||
integrity sha512-VfxadyCECXgQlkoEAjeghAr5gY3Hf+IKjKb+X8tGVDtveCjN+USwprd2q3QXBR9T1+x2DG0XZF5/w+7HAtSaXA==
|
||||
|
||||
deep-eql@^3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-3.0.1.tgz#dfc9404400ad1c8fe023e7da1df1c147c4b444df"
|
||||
|
@ -4410,13 +4418,6 @@ hosted-git-info@^2.1.4:
|
|||
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9"
|
||||
integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==
|
||||
|
||||
hosted-git-info@^4.0.1:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-4.1.0.tgz#827b82867e9ff1c8d0c4d9d53880397d2c86d224"
|
||||
integrity sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==
|
||||
dependencies:
|
||||
lru-cache "^6.0.0"
|
||||
|
||||
html-entities@^2.3.2:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-2.3.2.tgz#760b404685cb1d794e4f4b744332e3b00dcfe488"
|
||||
|
@ -4496,11 +4497,6 @@ indent-string@^4.0.0:
|
|||
resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251"
|
||||
integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==
|
||||
|
||||
indent-string@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-5.0.0.tgz#4fd2980fccaf8622d14c64d694f4cf33c81951a5"
|
||||
integrity sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==
|
||||
|
||||
inflight@^1.0.4:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
||||
|
@ -4605,7 +4601,7 @@ is-core-module@^2.2.0, is-core-module@^2.8.0, is-core-module@^2.8.1:
|
|||
dependencies:
|
||||
has "^1.0.3"
|
||||
|
||||
is-core-module@^2.5.0, is-core-module@^2.9.0:
|
||||
is-core-module@^2.9.0:
|
||||
version "2.9.0"
|
||||
resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69"
|
||||
integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==
|
||||
|
@ -5297,29 +5293,11 @@ map-obj@^1.0.0:
|
|||
resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d"
|
||||
integrity sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=
|
||||
|
||||
map-obj@^4.0.0, map-obj@^4.1.0:
|
||||
map-obj@^4.0.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.3.0.tgz#9304f906e93faae70880da102a9f1df0ea8bb05a"
|
||||
integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==
|
||||
|
||||
meow@^10.1.2:
|
||||
version "10.1.2"
|
||||
resolved "https://registry.yarnpkg.com/meow/-/meow-10.1.2.tgz#62951cb69afa69594142c8250806bc30a3912e4d"
|
||||
integrity sha512-zbuAlN+V/sXlbGchNS9WTWjUzeamwMt/BApKCJi7B0QyZstZaMx0n4Unll/fg0njGtMdC9UP5SAscvOCLYdM+Q==
|
||||
dependencies:
|
||||
"@types/minimist" "^1.2.2"
|
||||
camelcase-keys "^7.0.0"
|
||||
decamelize "^5.0.0"
|
||||
decamelize-keys "^1.1.0"
|
||||
hard-rejection "^2.1.0"
|
||||
minimist-options "4.1.0"
|
||||
normalize-package-data "^3.0.2"
|
||||
read-pkg-up "^8.0.0"
|
||||
redent "^4.0.0"
|
||||
trim-newlines "^4.0.2"
|
||||
type-fest "^1.2.2"
|
||||
yargs-parser "^20.2.9"
|
||||
|
||||
meow@^6.0.0:
|
||||
version "6.1.1"
|
||||
resolved "https://registry.yarnpkg.com/meow/-/meow-6.1.1.tgz#1ad64c4b76b2a24dfb2f635fddcadf320d251467"
|
||||
|
@ -5387,7 +5365,7 @@ mimic-fn@^2.1.0:
|
|||
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
|
||||
integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
|
||||
|
||||
min-indent@^1.0.0, min-indent@^1.0.1:
|
||||
min-indent@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869"
|
||||
integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==
|
||||
|
@ -5399,7 +5377,7 @@ minimatch@^3.0.4:
|
|||
dependencies:
|
||||
brace-expansion "^1.1.7"
|
||||
|
||||
minimist-options@4.1.0, minimist-options@^4.0.2:
|
||||
minimist-options@^4.0.2:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619"
|
||||
integrity sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==
|
||||
|
@ -5546,16 +5524,6 @@ normalize-package-data@^2.5.0:
|
|||
semver "2 || 3 || 4 || 5"
|
||||
validate-npm-package-license "^3.0.1"
|
||||
|
||||
normalize-package-data@^3.0.2:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-3.0.3.tgz#dbcc3e2da59509a0983422884cd172eefdfa525e"
|
||||
integrity sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==
|
||||
dependencies:
|
||||
hosted-git-info "^4.0.1"
|
||||
is-core-module "^2.5.0"
|
||||
semver "^7.3.4"
|
||||
validate-npm-package-license "^3.0.1"
|
||||
|
||||
normalize-path@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
|
||||
|
@ -5832,7 +5800,7 @@ parse-cache-control@^1.0.1:
|
|||
resolved "https://registry.yarnpkg.com/parse-cache-control/-/parse-cache-control-1.0.1.tgz#8eeab3e54fa56920fe16ba38f77fa21aacc2d74e"
|
||||
integrity sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==
|
||||
|
||||
parse-json@^5.0.0, parse-json@^5.2.0:
|
||||
parse-json@^5.0.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd"
|
||||
integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==
|
||||
|
@ -6021,25 +5989,6 @@ protobufjs@^6.11.2:
|
|||
"@types/node" ">=13.7.0"
|
||||
long "^4.0.0"
|
||||
|
||||
protobufjs@^6.11.3:
|
||||
version "6.11.3"
|
||||
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.11.3.tgz#637a527205a35caa4f3e2a9a4a13ddffe0e7af74"
|
||||
integrity sha512-xL96WDdCZYdU7Slin569tFX712BxsxslWwAfAhCYjQKGTq7dAU91Lomy6nLLhh/dyGhk/YH4TwTSRxTzhuHyZg==
|
||||
dependencies:
|
||||
"@protobufjs/aspromise" "^1.1.2"
|
||||
"@protobufjs/base64" "^1.1.2"
|
||||
"@protobufjs/codegen" "^2.0.4"
|
||||
"@protobufjs/eventemitter" "^1.1.0"
|
||||
"@protobufjs/fetch" "^1.1.0"
|
||||
"@protobufjs/float" "^1.0.2"
|
||||
"@protobufjs/inquire" "^1.1.0"
|
||||
"@protobufjs/path" "^1.1.2"
|
||||
"@protobufjs/pool" "^1.1.0"
|
||||
"@protobufjs/utf8" "^1.1.0"
|
||||
"@types/long" "^4.0.1"
|
||||
"@types/node" ">=13.7.0"
|
||||
long "^4.0.0"
|
||||
|
||||
protobufjs@^7.0.0:
|
||||
version "7.1.0"
|
||||
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.1.0.tgz#5174b5f96fad4f7dea7dd4abd594042ac360e665"
|
||||
|
@ -6058,14 +6007,6 @@ protobufjs@^7.0.0:
|
|||
"@types/node" ">=13.7.0"
|
||||
long "^5.0.0"
|
||||
|
||||
protons-runtime@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/protons-runtime/-/protons-runtime-1.0.4.tgz#85db97f82fb03a1205eafb591904736ba34e2972"
|
||||
integrity sha512-DSKWjAgwaXhtYO5Jo/MrU8n/75I/P2IhxU0Fk/lSrXx6Gxl5DH+I6cHcbGAYFmAlOBmU4QRa0mvVme8VXlDeUg==
|
||||
dependencies:
|
||||
uint8arraylist "^1.4.0"
|
||||
uint8arrays "^3.0.0"
|
||||
|
||||
protons-runtime@^3.0.1, protons-runtime@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/protons-runtime/-/protons-runtime-3.1.0.tgz#500918da4a2d97aa28007f30c3f2f7021e05c0b2"
|
||||
|
@ -6074,14 +6015,6 @@ protons-runtime@^3.0.1, protons-runtime@^3.1.0:
|
|||
protobufjs "^7.0.0"
|
||||
uint8arraylist "^2.3.2"
|
||||
|
||||
protons@^3.0.4:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/protons/-/protons-3.0.4.tgz#29fbcbb2e43952e6a3e072e240b4d94d43778b09"
|
||||
integrity sha512-R0X/4pCfpXo3X2CVMmhDLHnHRqVg202N32p8qESKc1Vh8cD7Lqj6DBB/Z6yk6lgrH2UEneCHmHYzqonRl+l+pg==
|
||||
dependencies:
|
||||
meow "^10.1.2"
|
||||
protobufjs "^6.11.2"
|
||||
|
||||
pseudomap@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
|
||||
|
@ -6114,11 +6047,6 @@ quick-lru@^4.0.1:
|
|||
resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-4.0.1.tgz#5b8878f113a58217848c6482026c73e1ba57727f"
|
||||
integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==
|
||||
|
||||
quick-lru@^5.1.1:
|
||||
version "5.1.1"
|
||||
resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932"
|
||||
integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==
|
||||
|
||||
react-content-loader@^6.2.0:
|
||||
version "6.2.0"
|
||||
resolved "https://registry.yarnpkg.com/react-content-loader/-/react-content-loader-6.2.0.tgz#cd8fee8160b8fda6610d0c69ce5aee7b8094cba6"
|
||||
|
@ -6213,15 +6141,6 @@ read-pkg-up@^7.0.1:
|
|||
read-pkg "^5.2.0"
|
||||
type-fest "^0.8.1"
|
||||
|
||||
read-pkg-up@^8.0.0:
|
||||
version "8.0.0"
|
||||
resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-8.0.0.tgz#72f595b65e66110f43b052dd9af4de6b10534670"
|
||||
integrity sha512-snVCqPczksT0HS2EC+SxUndvSzn6LRCwpfSvLrIfR5BKDQQZMaI6jPRC9dYvYFDRAuFEAnkwww8kBBNE/3VvzQ==
|
||||
dependencies:
|
||||
find-up "^5.0.0"
|
||||
read-pkg "^6.0.0"
|
||||
type-fest "^1.0.1"
|
||||
|
||||
read-pkg@^5.2.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc"
|
||||
|
@ -6232,16 +6151,6 @@ read-pkg@^5.2.0:
|
|||
parse-json "^5.0.0"
|
||||
type-fest "^0.6.0"
|
||||
|
||||
read-pkg@^6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-6.0.0.tgz#a67a7d6a1c2b0c3cd6aa2ea521f40c458a4a504c"
|
||||
integrity sha512-X1Fu3dPuk/8ZLsMhEj5f4wFAF0DWoK7qhGJvgaijocXxBmSToKfbFtqbxMO7bVjNA1dmE5huAzjXj/ey86iw9Q==
|
||||
dependencies:
|
||||
"@types/normalize-package-data" "^2.4.0"
|
||||
normalize-package-data "^3.0.2"
|
||||
parse-json "^5.2.0"
|
||||
type-fest "^1.0.1"
|
||||
|
||||
read-yaml-file@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/read-yaml-file/-/read-yaml-file-1.1.0.tgz#9362bbcbdc77007cc8ea4519fe1c0b821a7ce0d8"
|
||||
|
@ -6280,14 +6189,6 @@ redent@^3.0.0:
|
|||
indent-string "^4.0.0"
|
||||
strip-indent "^3.0.0"
|
||||
|
||||
redent@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/redent/-/redent-4.0.0.tgz#0c0ba7caabb24257ab3bb7a4fd95dd1d5c5681f9"
|
||||
integrity sha512-tYkDkVVtYkSVhuQ4zBgfvciymHaeuel+zFKXShfDnFP5SyVEP7qo70Rf1jTOTCx3vGNAbnEi/xFkcfQVMIBWag==
|
||||
dependencies:
|
||||
indent-string "^5.0.0"
|
||||
strip-indent "^4.0.0"
|
||||
|
||||
regenerator-runtime@^0.13.4:
|
||||
version "0.13.9"
|
||||
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52"
|
||||
|
@ -6464,13 +6365,6 @@ semver@^6.3.0:
|
|||
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
|
||||
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
|
||||
|
||||
semver@^7.3.4:
|
||||
version "7.3.7"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.7.tgz#12c5b649afdbf9049707796e22a4028814ce523f"
|
||||
integrity sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==
|
||||
dependencies:
|
||||
lru-cache "^6.0.0"
|
||||
|
||||
semver@^7.3.5:
|
||||
version "7.3.5"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7"
|
||||
|
@ -6744,13 +6638,6 @@ strip-indent@^3.0.0:
|
|||
dependencies:
|
||||
min-indent "^1.0.0"
|
||||
|
||||
strip-indent@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-4.0.0.tgz#b41379433dd06f5eae805e21d631e07ee670d853"
|
||||
integrity sha512-mnVSV2l+Zv6BLpSD/8V87CW/y9EmmbYzGCIavsnsI6/nwn26DwffM/yztm30Z/I2DY9wdS3vXVCMnHDgZaVNoA==
|
||||
dependencies:
|
||||
min-indent "^1.0.1"
|
||||
|
||||
strip-json-comments@^3.1.0, strip-json-comments@^3.1.1:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
|
||||
|
@ -6916,11 +6803,6 @@ trim-newlines@^3.0.0:
|
|||
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144"
|
||||
integrity sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==
|
||||
|
||||
trim-newlines@^4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-4.0.2.tgz#d6aaaf6a0df1b4b536d183879a6b939489808c7c"
|
||||
integrity sha512-GJtWyq9InR/2HRiLZgpIKv+ufIKrVrvjQWEj7PxAXNc5dwbNJkqhAUoAGgzRmULAnoOM5EIpveYd3J2VeSAIew==
|
||||
|
||||
truncate-utf8-bytes@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz#405923909592d56f78a5818434b0b78489ca5f2b"
|
||||
|
@ -7100,16 +6982,16 @@ type-fest@^0.8.1:
|
|||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
|
||||
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==
|
||||
|
||||
type-fest@^1.0.1, type-fest@^1.2.1, type-fest@^1.2.2:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1"
|
||||
integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==
|
||||
|
||||
typedarray@^0.0.6:
|
||||
version "0.0.6"
|
||||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||
integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==
|
||||
|
||||
typescript@4.5.2:
|
||||
version "4.5.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.2.tgz#8ac1fba9f52256fdb06fb89e4122fa6a346c2998"
|
||||
integrity sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==
|
||||
|
||||
typescript@^4.5.5:
|
||||
version "4.5.5"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.5.tgz#d8c953832d28924a9e3d37c73d729c846c5896f3"
|
||||
|
@ -7130,13 +7012,6 @@ uint8-varint@^1.0.1, uint8-varint@^1.0.2:
|
|||
uint8arraylist "^2.0.0"
|
||||
uint8arrays "^3.1.0"
|
||||
|
||||
uint8arraylist@^1.4.0:
|
||||
version "1.5.1"
|
||||
resolved "https://registry.yarnpkg.com/uint8arraylist/-/uint8arraylist-1.5.1.tgz#b8b325865b65b62b4cec773bc568cdd03c691d08"
|
||||
integrity sha512-UpPGcVlTVc7Brtwt4W2MfTqvJQsr8owHMKBnICsueSImiarVAHf8NGMjhMklFtgbCZN1/9S9oW5k1JwlalGHoA==
|
||||
dependencies:
|
||||
uint8arrays "^3.0.0"
|
||||
|
||||
uint8arraylist@^2.0.0, uint8arraylist@^2.1.0, uint8arraylist@^2.1.1, uint8arraylist@^2.3.1, uint8arraylist@^2.3.2:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/uint8arraylist/-/uint8arraylist-2.3.2.tgz#d301f6cb570828b456ef09655c0a4d3b0929ef06"
|
||||
|
@ -7477,11 +7352,6 @@ yargs-parser@^18.1.2, yargs-parser@^18.1.3:
|
|||
camelcase "^5.0.0"
|
||||
decamelize "^1.2.0"
|
||||
|
||||
yargs-parser@^20.2.9:
|
||||
version "20.2.9"
|
||||
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee"
|
||||
integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==
|
||||
|
||||
yargs-parser@^21.0.0:
|
||||
version "21.0.1"
|
||||
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.0.1.tgz#0267f286c877a4f0f728fceb6f8a3e4cb95c6e35"
|
||||
|
|
Loading…
Reference in New Issue