mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-07-12 03:09:15 +00:00
core, ui: message signing (#7115)
This commit is contained in:
@@ -193,6 +193,7 @@ class ChatApi:
|
||||
"sendRef": send_ref,
|
||||
"composedMessages": messages,
|
||||
"liveMessage": live_message,
|
||||
"signMessages": False,
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
@@ -80,11 +80,12 @@ class APISendMessages(TypedDict):
|
||||
sendRef: "T.ChatRef"
|
||||
liveMessage: bool
|
||||
ttl: NotRequired[int] # int
|
||||
signMessages: bool
|
||||
composedMessages: list["T.ComposedMessage"] # non-empty
|
||||
|
||||
|
||||
def APISendMessages_cmd_string(self: APISendMessages) -> str:
|
||||
return '/_send ' + T.ChatRef_cmd_string(self['sendRef']) + (' live=on' if self['liveMessage'] else '') + ((' ttl=' + str(self.get('ttl'))) if self.get('ttl') is not None else '') + ' json ' + json.dumps(self['composedMessages'])
|
||||
return '/_send ' + T.ChatRef_cmd_string(self['sendRef']) + (' live=on' if self['liveMessage'] else '') + ((' ttl=' + str(self.get('ttl'))) if self.get('ttl') is not None else '') + (' sign=on' if self['signMessages'] else '') + ' json ' + json.dumps(self['composedMessages'])
|
||||
|
||||
APISendMessages_Response = CR.NewChatItems | CR.ChatCmdError
|
||||
|
||||
|
||||
@@ -588,7 +588,7 @@ class CIMeta(TypedDict):
|
||||
editable: bool
|
||||
forwardedByMember: NotRequired[int] # int64
|
||||
showGroupAsSender: bool
|
||||
msgSigned: NotRequired["MsgSigStatus"]
|
||||
msgVerified: "MsgVerified"
|
||||
createdAt: str # ISO-8601 timestamp
|
||||
updatedAt: str # ISO-8601 timestamp
|
||||
|
||||
@@ -1776,6 +1776,7 @@ class FullGroupPreferences(TypedDict):
|
||||
support: "SupportGroupPreference"
|
||||
sessions: "RoleGroupPreference"
|
||||
comments: "CommentsGroupPreference"
|
||||
signMessages: "GroupPreference"
|
||||
commands: list["ChatBotCommand"]
|
||||
|
||||
class FullPreferences(TypedDict):
|
||||
@@ -1819,7 +1820,7 @@ class GroupDirectInvitation(TypedDict):
|
||||
fromGroupMemberConnId_: NotRequired[int] # int64
|
||||
groupDirectInvStartedConnection: bool
|
||||
|
||||
GroupFeature = Literal["timedMessages", "directMessages", "fullDelete", "reactions", "voice", "files", "simplexLinks", "reports", "history", "support", "sessions", "comments"]
|
||||
GroupFeature = Literal["timedMessages", "directMessages", "fullDelete", "reactions", "voice", "files", "simplexLinks", "reports", "history", "support", "sessions", "comments", "signMessages"]
|
||||
|
||||
GroupFeatureEnabled = Literal["on", "off"]
|
||||
|
||||
@@ -1967,6 +1968,7 @@ class GroupPreferences(TypedDict):
|
||||
support: NotRequired["SupportGroupPreference"]
|
||||
sessions: NotRequired["RoleGroupPreference"]
|
||||
comments: NotRequired["CommentsGroupPreference"]
|
||||
signMessages: NotRequired["GroupPreference"]
|
||||
commands: NotRequired[list["ChatBotCommand"]]
|
||||
|
||||
class GroupProfile(TypedDict):
|
||||
@@ -2244,6 +2246,20 @@ MsgReceiptStatus = Literal["ok", "badMsgHash"]
|
||||
|
||||
MsgSigStatus = Literal["verified", "signedNoKey"]
|
||||
|
||||
class MsgVerified_signed(TypedDict):
|
||||
type: Literal["signed"]
|
||||
sigStatus: "MsgSigStatus"
|
||||
|
||||
class MsgVerified_sigMissing(TypedDict):
|
||||
type: Literal["sigMissing"]
|
||||
|
||||
class MsgVerified_unsigned(TypedDict):
|
||||
type: Literal["unsigned"]
|
||||
|
||||
MsgVerified = MsgVerified_signed | MsgVerified_sigMissing | MsgVerified_unsigned
|
||||
|
||||
MsgVerified_Tag = Literal["signed", "sigMissing", "unsigned"]
|
||||
|
||||
class NameErrorType_NO_RESOLVER(TypedDict):
|
||||
type: Literal["NO_RESOLVER"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user