mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-06-29 18:22:11 +00:00
refactor(names): agent resolution + one error type
Adopt the simplexmq names rework (PR #7045): name resolution is now owned by the agent (resolveSimplexName picks a names-role server), so the chat-side iteration is removed - delete ResolveError, iterateResolvers, resolveOnUserServers, enabledSMPServersForUser and resolveErrorToChatError. One error type: resolver/agent failures flow through ChatErrorAgent; remove the CEvtSimplexName* events, SimplexNameVerifyFailReason, SimplexNameConflictEntity and CESimplexNameResolverUnavailable. APIVerifySimplexName returns CRSimplexNameVerified (verified::Bool), mirroring CRConnectionVerified. connectPlan handles the name target directly; updateProfile WithConflict aliases collapsed into the plain functions. Add the per-operator "names" SMP server role (migration 20260612_smp_role_names, official operator on by default) feeding ServerRoles.names -> UserServers.nameSrvs. Bump simplexmq pin to ce69adfd and regenerate sha256map.nix.
This commit is contained in:
@@ -596,7 +596,7 @@ def APISetUserAutoAcceptMemberContacts_cmd_string(self: APISetUserAutoAcceptMemb
|
||||
APISetUserAutoAcceptMemberContacts_Response = CR.CmdOk | CR.ChatCmdError
|
||||
|
||||
|
||||
# Verify a contact's or group's claimed SimpleX name by RSLV-resolving the claim and comparing the resolved link to the peer's stored connection link. Synchronously returns `CRCmdOk`; the verification outcome is delivered asynchronously via [CEvtSimplexNameVerified](./EVENTS.md#cevtsimplexnameverified) or [CEvtSimplexNameVerifyFailed](./EVENTS.md#cevtsimplexnameverifyfailed).
|
||||
# Verify a contact's or group's claimed SimpleX name by RSLV-resolving the claim and comparing the resolved link to the peer's stored connection link. Returns `CRSimplexNameVerified` with a boolean `verified` (a match also writes the verification timestamp); resolver / agent failures are reported as `CRChatCmdError`.
|
||||
# Network usage: interactive.
|
||||
class APIVerifySimplexName(TypedDict):
|
||||
chatRef: "T.ChatRef"
|
||||
@@ -605,7 +605,7 @@ class APIVerifySimplexName(TypedDict):
|
||||
def APIVerifySimplexName_cmd_string(self: APIVerifySimplexName) -> str:
|
||||
return '/_verify simplex name ' + T.ChatRef_cmd_string(self['chatRef'])
|
||||
|
||||
APIVerifySimplexName_Response = CR.CmdOk | CR.ChatCmdError
|
||||
APIVerifySimplexName_Response = CR.SimplexNameVerified | CR.ChatCmdError
|
||||
|
||||
|
||||
# User profile commands
|
||||
|
||||
@@ -35,34 +35,6 @@ class NewMemberContactReceivedInv(TypedDict):
|
||||
groupInfo: "T.GroupInfo"
|
||||
member: "T.GroupMember"
|
||||
|
||||
class SimplexNameConflict(TypedDict):
|
||||
type: Literal["simplexNameConflict"]
|
||||
user: "T.User"
|
||||
simplexName: "T.SimplexNameInfo"
|
||||
entity: "T.SimplexNameConflictEntity"
|
||||
claimedBy: str
|
||||
displacedFrom: str
|
||||
|
||||
class SimplexNameVerified(TypedDict):
|
||||
type: Literal["simplexNameVerified"]
|
||||
user: "T.User"
|
||||
chatRef: "T.ChatRef"
|
||||
simplexName: "T.SimplexNameInfo"
|
||||
verifiedAt: str # ISO-8601 timestamp
|
||||
|
||||
class SimplexNameVerifyFailed(TypedDict):
|
||||
type: Literal["simplexNameVerifyFailed"]
|
||||
user: "T.User"
|
||||
chatRef: "T.ChatRef"
|
||||
simplexName: "T.SimplexNameInfo"
|
||||
reason: "T.SimplexNameVerifyFailReason"
|
||||
|
||||
class SimplexNameUnverified(TypedDict):
|
||||
type: Literal["simplexNameUnverified"]
|
||||
user: "T.User"
|
||||
chatRef: "T.ChatRef"
|
||||
simplexName: "T.SimplexNameInfo"
|
||||
|
||||
class ContactSndReady(TypedDict):
|
||||
type: Literal["contactSndReady"]
|
||||
user: "T.User"
|
||||
@@ -358,10 +330,6 @@ ChatEvent = (
|
||||
| ContactDeletedByContact
|
||||
| ReceivedContactRequest
|
||||
| NewMemberContactReceivedInv
|
||||
| SimplexNameConflict
|
||||
| SimplexNameVerified
|
||||
| SimplexNameVerifyFailed
|
||||
| SimplexNameUnverified
|
||||
| ContactSndReady
|
||||
| NewChatItems
|
||||
| ChatItemReaction
|
||||
@@ -409,7 +377,7 @@ ChatEvent = (
|
||||
| ChatErrors
|
||||
)
|
||||
|
||||
ChatEvent_Tag = Literal["contactConnected", "contactUpdated", "contactDeletedByContact", "receivedContactRequest", "newMemberContactReceivedInv", "simplexNameConflict", "simplexNameVerified", "simplexNameVerifyFailed", "simplexNameUnverified", "contactSndReady", "newChatItems", "chatItemReaction", "chatItemsDeleted", "chatItemUpdated", "groupChatItemsDeleted", "chatItemsStatusesUpdated", "receivedGroupInvitation", "userJoinedGroup", "groupUpdated", "joinedGroupMember", "memberRole", "deletedMember", "leftMember", "deletedMemberUser", "groupDeleted", "connectedToGroupMember", "memberAcceptedByOther", "memberBlockedForAll", "groupMemberUpdated", "groupLinkDataUpdated", "groupRelayUpdated", "rcvFileDescrReady", "rcvFileComplete", "sndFileCompleteXFTP", "rcvFileStart", "rcvFileSndCancelled", "rcvFileAccepted", "rcvFileError", "rcvFileWarning", "sndFileError", "sndFileWarning", "acceptingContactRequest", "acceptingBusinessRequest", "contactConnecting", "businessLinkConnecting", "joinedGroupMemberConnecting", "sentGroupInvitation", "groupLinkConnecting", "hostConnected", "hostDisconnected", "subscriptionStatus", "messageError", "chatError", "chatErrors"]
|
||||
ChatEvent_Tag = Literal["contactConnected", "contactUpdated", "contactDeletedByContact", "receivedContactRequest", "newMemberContactReceivedInv", "contactSndReady", "newChatItems", "chatItemReaction", "chatItemsDeleted", "chatItemUpdated", "groupChatItemsDeleted", "chatItemsStatusesUpdated", "receivedGroupInvitation", "userJoinedGroup", "groupUpdated", "joinedGroupMember", "memberRole", "deletedMember", "leftMember", "deletedMemberUser", "groupDeleted", "connectedToGroupMember", "memberAcceptedByOther", "memberBlockedForAll", "groupMemberUpdated", "groupLinkDataUpdated", "groupRelayUpdated", "rcvFileDescrReady", "rcvFileComplete", "sndFileCompleteXFTP", "rcvFileStart", "rcvFileSndCancelled", "rcvFileAccepted", "rcvFileError", "rcvFileWarning", "sndFileError", "sndFileWarning", "acceptingContactRequest", "acceptingBusinessRequest", "contactConnecting", "businessLinkConnecting", "joinedGroupMemberConnecting", "sentGroupInvitation", "groupLinkConnecting", "hostConnected", "hostDisconnected", "subscriptionStatus", "messageError", "chatError", "chatErrors"]
|
||||
|
||||
|
||||
class OnEventDecorator(Protocol):
|
||||
@@ -450,30 +418,6 @@ class OnEventDecorator(Protocol):
|
||||
Callable[["NewMemberContactReceivedInv"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["simplexNameConflict"], /) -> Callable[
|
||||
[Callable[["SimplexNameConflict"], Awaitable[None]]],
|
||||
Callable[["SimplexNameConflict"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["simplexNameVerified"], /) -> Callable[
|
||||
[Callable[["SimplexNameVerified"], Awaitable[None]]],
|
||||
Callable[["SimplexNameVerified"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["simplexNameVerifyFailed"], /) -> Callable[
|
||||
[Callable[["SimplexNameVerifyFailed"], Awaitable[None]]],
|
||||
Callable[["SimplexNameVerifyFailed"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["simplexNameUnverified"], /) -> Callable[
|
||||
[Callable[["SimplexNameUnverified"], Awaitable[None]]],
|
||||
Callable[["SimplexNameUnverified"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["contactSndReady"], /) -> Callable[
|
||||
[Callable[["ContactSndReady"], Awaitable[None]]],
|
||||
|
||||
@@ -245,6 +245,13 @@ class SentInvitation(TypedDict):
|
||||
connection: "T.PendingContactConnection"
|
||||
customUserProfile: NotRequired["T.Profile"]
|
||||
|
||||
class SimplexNameVerified(TypedDict):
|
||||
type: Literal["simplexNameVerified"]
|
||||
user: "T.User"
|
||||
chatRef: "T.ChatRef"
|
||||
simplexName: "T.SimplexNameInfo"
|
||||
verified: bool
|
||||
|
||||
class SndFileCancelled(TypedDict):
|
||||
type: Literal["sndFileCancelled"]
|
||||
user: "T.User"
|
||||
@@ -350,6 +357,7 @@ ChatResponse = (
|
||||
| SentConfirmation
|
||||
| SentGroupInvitation
|
||||
| SentInvitation
|
||||
| SimplexNameVerified
|
||||
| SndFileCancelled
|
||||
| UserAcceptedGroupSent
|
||||
| UserContactLink
|
||||
@@ -363,4 +371,4 @@ ChatResponse = (
|
||||
| ApiChats
|
||||
)
|
||||
|
||||
ChatResponse_Tag = Literal["acceptingContactRequest", "activeUser", "chatItemNotChanged", "chatItemReaction", "chatItemUpdated", "chatItemsDeleted", "chatRunning", "chatStarted", "chatStopped", "cmdOk", "chatCmdError", "connectionPlan", "contactAlreadyExists", "contactConnectionDeleted", "contactDeleted", "contactPrefsUpdated", "contactRequestRejected", "contactsList", "groupDeletedUser", "groupLink", "groupLinkCreated", "groupLinkDeleted", "groupCreated", "publicGroupCreated", "publicGroupCreationFailed", "groupRelays", "groupRelaysAdded", "groupRelaysAddFailed", "relayGroupAllowed", "groupMembers", "groupUpdated", "groupsList", "invitation", "leftMemberUser", "memberAccepted", "membersBlockedForAllUser", "membersRoleUser", "newChatItems", "rcvFileAccepted", "rcvFileAcceptedSndCancelled", "rcvFileCancelled", "sentConfirmation", "sentGroupInvitation", "sentInvitation", "sndFileCancelled", "userAcceptedGroupSent", "userContactLink", "userContactLinkCreated", "userContactLinkDeleted", "userContactLinkUpdated", "userDeletedMembers", "userProfileUpdated", "userProfileNoChange", "usersList", "apiChats"]
|
||||
ChatResponse_Tag = Literal["acceptingContactRequest", "activeUser", "chatItemNotChanged", "chatItemReaction", "chatItemUpdated", "chatItemsDeleted", "chatRunning", "chatStarted", "chatStopped", "cmdOk", "chatCmdError", "connectionPlan", "contactAlreadyExists", "contactConnectionDeleted", "contactDeleted", "contactPrefsUpdated", "contactRequestRejected", "contactsList", "groupDeletedUser", "groupLink", "groupLinkCreated", "groupLinkDeleted", "groupCreated", "publicGroupCreated", "publicGroupCreationFailed", "groupRelays", "groupRelaysAdded", "groupRelaysAddFailed", "relayGroupAllowed", "groupMembers", "groupUpdated", "groupsList", "invitation", "leftMemberUser", "memberAccepted", "membersBlockedForAllUser", "membersRoleUser", "newChatItems", "rcvFileAccepted", "rcvFileAcceptedSndCancelled", "rcvFileCancelled", "sentConfirmation", "sentGroupInvitation", "sentInvitation", "simplexNameVerified", "sndFileCancelled", "userAcceptedGroupSent", "userContactLink", "userContactLinkCreated", "userContactLinkDeleted", "userContactLinkUpdated", "userDeletedMembers", "userProfileUpdated", "userProfileNoChange", "usersList", "apiChats"]
|
||||
|
||||
@@ -78,6 +78,10 @@ class AgentErrorType_FILE(TypedDict):
|
||||
type: Literal["FILE"]
|
||||
fileErr: "FileErrorType"
|
||||
|
||||
class AgentErrorType_NAME(TypedDict):
|
||||
type: Literal["NAME"]
|
||||
nameErr: "NameErrorType"
|
||||
|
||||
class AgentErrorType_PROXY(TypedDict):
|
||||
type: Literal["PROXY"]
|
||||
proxyServer: str
|
||||
@@ -123,6 +127,7 @@ AgentErrorType = (
|
||||
| AgentErrorType_NTF
|
||||
| AgentErrorType_XFTP
|
||||
| AgentErrorType_FILE
|
||||
| AgentErrorType_NAME
|
||||
| AgentErrorType_PROXY
|
||||
| AgentErrorType_RCP
|
||||
| AgentErrorType_BROKER
|
||||
@@ -133,7 +138,7 @@ AgentErrorType = (
|
||||
| AgentErrorType_INACTIVE
|
||||
)
|
||||
|
||||
AgentErrorType_Tag = Literal["CMD", "CONN", "NO_USER", "SMP", "NTF", "XFTP", "FILE", "PROXY", "RCP", "BROKER", "AGENT", "NOTICE", "INTERNAL", "CRITICAL", "INACTIVE"]
|
||||
AgentErrorType_Tag = Literal["CMD", "CONN", "NO_USER", "SMP", "NTF", "XFTP", "FILE", "NAME", "PROXY", "RCP", "BROKER", "AGENT", "NOTICE", "INTERNAL", "CRITICAL", "INACTIVE"]
|
||||
|
||||
class AutoAccept(TypedDict):
|
||||
acceptIncognito: bool
|
||||
@@ -777,10 +782,6 @@ class ChatErrorType_simplexNameUnprepared(TypedDict):
|
||||
type: Literal["simplexNameUnprepared"]
|
||||
simplexName: "SimplexNameInfo"
|
||||
|
||||
class ChatErrorType_simplexNameResolverUnavailable(TypedDict):
|
||||
type: Literal["simplexNameResolverUnavailable"]
|
||||
simplexName: "SimplexNameInfo"
|
||||
|
||||
class ChatErrorType_unsupportedConnReq(TypedDict):
|
||||
type: Literal["unsupportedConnReq"]
|
||||
|
||||
@@ -1013,7 +1014,6 @@ ChatErrorType = (
|
||||
| ChatErrorType_invalidConnReq
|
||||
| ChatErrorType_simplexNameNotFound
|
||||
| ChatErrorType_simplexNameUnprepared
|
||||
| ChatErrorType_simplexNameResolverUnavailable
|
||||
| ChatErrorType_unsupportedConnReq
|
||||
| ChatErrorType_connReqMessageProhibited
|
||||
| ChatErrorType_contactNotReady
|
||||
@@ -1070,7 +1070,7 @@ ChatErrorType = (
|
||||
| ChatErrorType_exception
|
||||
)
|
||||
|
||||
ChatErrorType_Tag = Literal["noActiveUser", "noConnectionUser", "noSndFileUser", "noRcvFileUser", "userUnknown", "userExists", "chatRelayExists", "differentActiveUser", "cantDeleteActiveUser", "cantDeleteLastUser", "cantHideLastUser", "hiddenUserAlwaysMuted", "emptyUserPassword", "userAlreadyHidden", "userNotHidden", "invalidDisplayName", "chatNotStarted", "chatNotStopped", "chatStoreChanged", "invalidConnReq", "simplexNameNotFound", "simplexNameUnprepared", "simplexNameResolverUnavailable", "unsupportedConnReq", "connReqMessageProhibited", "contactNotReady", "contactNotActive", "contactDisabled", "connectionDisabled", "groupUserRole", "groupMemberInitialRole", "contactIncognitoCantInvite", "groupIncognitoCantInvite", "groupContactRole", "groupDuplicateMember", "groupDuplicateMemberId", "groupNotJoined", "groupMemberNotActive", "cantBlockMemberForSelf", "groupMemberUserRemoved", "groupMemberNotFound", "groupCantResendInvitation", "groupInternal", "fileNotFound", "fileSize", "fileAlreadyReceiving", "fileCancelled", "fileCancel", "fileAlreadyExists", "fileWrite", "fileSend", "fileRcvChunk", "fileInternal", "fileImageType", "fileImageSize", "fileNotReceived", "fileNotApproved", "fallbackToSMPProhibited", "inlineFileProhibited", "invalidForward", "invalidChatItemUpdate", "invalidChatItemDelete", "hasCurrentCall", "noCurrentCall", "callContact", "directMessagesProhibited", "agentVersion", "agentNoSubResult", "commandError", "agentCommandError", "invalidFileDescription", "connectionIncognitoChangeProhibited", "connectionUserChangeProhibited", "peerChatVRangeIncompatible", "relayTestError", "internalError", "exception"]
|
||||
ChatErrorType_Tag = Literal["noActiveUser", "noConnectionUser", "noSndFileUser", "noRcvFileUser", "userUnknown", "userExists", "chatRelayExists", "differentActiveUser", "cantDeleteActiveUser", "cantDeleteLastUser", "cantHideLastUser", "hiddenUserAlwaysMuted", "emptyUserPassword", "userAlreadyHidden", "userNotHidden", "invalidDisplayName", "chatNotStarted", "chatNotStopped", "chatStoreChanged", "invalidConnReq", "simplexNameNotFound", "simplexNameUnprepared", "unsupportedConnReq", "connReqMessageProhibited", "contactNotReady", "contactNotActive", "contactDisabled", "connectionDisabled", "groupUserRole", "groupMemberInitialRole", "contactIncognitoCantInvite", "groupIncognitoCantInvite", "groupContactRole", "groupDuplicateMember", "groupDuplicateMemberId", "groupNotJoined", "groupMemberNotActive", "cantBlockMemberForSelf", "groupMemberUserRemoved", "groupMemberNotFound", "groupCantResendInvitation", "groupInternal", "fileNotFound", "fileSize", "fileAlreadyReceiving", "fileCancelled", "fileCancel", "fileAlreadyExists", "fileWrite", "fileSend", "fileRcvChunk", "fileInternal", "fileImageType", "fileImageSize", "fileNotReceived", "fileNotApproved", "fallbackToSMPProhibited", "inlineFileProhibited", "invalidForward", "invalidChatItemUpdate", "invalidChatItemDelete", "hasCurrentCall", "noCurrentCall", "callContact", "directMessagesProhibited", "agentVersion", "agentNoSubResult", "commandError", "agentCommandError", "invalidFileDescription", "connectionIncognitoChangeProhibited", "connectionUserChangeProhibited", "peerChatVRangeIncompatible", "relayTestError", "internalError", "exception"]
|
||||
|
||||
ChatFeature = Literal["timedMessages", "fullDelete", "reactions", "voice", "files", "calls", "sessions"]
|
||||
|
||||
@@ -1569,6 +1569,10 @@ class ErrorType_EXPIRED(TypedDict):
|
||||
class ErrorType_INTERNAL(TypedDict):
|
||||
type: Literal["INTERNAL"]
|
||||
|
||||
class ErrorType_NAME(TypedDict):
|
||||
type: Literal["NAME"]
|
||||
nameErr: "NameErrorType"
|
||||
|
||||
class ErrorType_DUPLICATE_(TypedDict):
|
||||
type: Literal["DUPLICATE_"]
|
||||
|
||||
@@ -1587,10 +1591,11 @@ ErrorType = (
|
||||
| ErrorType_LARGE_MSG
|
||||
| ErrorType_EXPIRED
|
||||
| ErrorType_INTERNAL
|
||||
| ErrorType_NAME
|
||||
| ErrorType_DUPLICATE_
|
||||
)
|
||||
|
||||
ErrorType_Tag = Literal["BLOCK", "SESSION", "CMD", "PROXY", "AUTH", "BLOCKED", "SERVICE", "CRYPTO", "QUOTA", "STORE", "NO_MSG", "LARGE_MSG", "EXPIRED", "INTERNAL", "DUPLICATE_"]
|
||||
ErrorType_Tag = Literal["BLOCK", "SESSION", "CMD", "PROXY", "AUTH", "BLOCKED", "SERVICE", "CRYPTO", "QUOTA", "STORE", "NO_MSG", "LARGE_MSG", "EXPIRED", "INTERNAL", "NAME", "DUPLICATE_"]
|
||||
|
||||
FeatureAllowed = Literal["always", "yes", "no"]
|
||||
|
||||
@@ -2233,6 +2238,28 @@ MsgReceiptStatus = Literal["ok", "badMsgHash"]
|
||||
|
||||
MsgSigStatus = Literal["verified", "signedNoKey"]
|
||||
|
||||
class NameErrorType_NO_RESOLVER(TypedDict):
|
||||
type: Literal["NO_RESOLVER"]
|
||||
|
||||
class NameErrorType_NO_NAME(TypedDict):
|
||||
type: Literal["NO_NAME"]
|
||||
|
||||
class NameErrorType_NO_SERVERS(TypedDict):
|
||||
type: Literal["NO_SERVERS"]
|
||||
|
||||
class NameErrorType_RESOLVER(TypedDict):
|
||||
type: Literal["RESOLVER"]
|
||||
resolverErr: str
|
||||
|
||||
NameErrorType = (
|
||||
NameErrorType_NO_RESOLVER
|
||||
| NameErrorType_NO_NAME
|
||||
| NameErrorType_NO_SERVERS
|
||||
| NameErrorType_RESOLVER
|
||||
)
|
||||
|
||||
NameErrorType_Tag = Literal["NO_RESOLVER", "NO_NAME", "NO_SERVERS", "RESOLVER"]
|
||||
|
||||
class NetworkError_connectError(TypedDict):
|
||||
type: Literal["connectError"]
|
||||
connectError: str
|
||||
@@ -2737,8 +2764,6 @@ class SimplePreference(TypedDict):
|
||||
|
||||
SimplexLinkType = Literal["contact", "invitation", "group", "channel", "relay"]
|
||||
|
||||
SimplexNameConflictEntity = Literal["contact", "group"]
|
||||
|
||||
class SimplexNameDomain(TypedDict):
|
||||
nameTLD: "SimplexTLD"
|
||||
domain: str
|
||||
@@ -2750,24 +2775,6 @@ class SimplexNameInfo(TypedDict):
|
||||
|
||||
SimplexNameType = Literal["publicGroup", "contact"]
|
||||
|
||||
class SimplexNameVerifyFailReason_linkMismatch(TypedDict):
|
||||
type: Literal["linkMismatch"]
|
||||
|
||||
class SimplexNameVerifyFailReason_nameNotRegistered(TypedDict):
|
||||
type: Literal["nameNotRegistered"]
|
||||
|
||||
class SimplexNameVerifyFailReason_resolverError(TypedDict):
|
||||
type: Literal["resolverError"]
|
||||
agentError: "AgentErrorType"
|
||||
|
||||
SimplexNameVerifyFailReason = (
|
||||
SimplexNameVerifyFailReason_linkMismatch
|
||||
| SimplexNameVerifyFailReason_nameNotRegistered
|
||||
| SimplexNameVerifyFailReason_resolverError
|
||||
)
|
||||
|
||||
SimplexNameVerifyFailReason_Tag = Literal["linkMismatch", "nameNotRegistered", "resolverError"]
|
||||
|
||||
SimplexTLD = Literal["simplex", "testing", "web"]
|
||||
|
||||
SndCIStatusProgress = Literal["partial", "complete"]
|
||||
|
||||
Reference in New Issue
Block a user