@ethora/chat-component-rn 26.8.6 → 26.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/README.md +64 -2
- package/lib/commonjs/assets/icons.js +4 -2
- package/lib/commonjs/assets/icons.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatHeader.js +28 -6
- package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatRoom.js +9 -1
- package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatWrapper.js +5 -3
- package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/EncryptedSendNotice.js +47 -0
- package/lib/commonjs/components/MainComponents/EncryptedSendNotice.js.map +1 -0
- package/lib/commonjs/components/MainComponents/EncryptionCard.js +286 -0
- package/lib/commonjs/components/MainComponents/EncryptionCard.js.map +1 -0
- package/lib/commonjs/components/MainComponents/MediaMessage.js +7 -0
- package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ReduxWrapper.js +13 -0
- package/lib/commonjs/components/MainComponents/ReduxWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/SealedAttachment.js +231 -0
- package/lib/commonjs/components/MainComponents/SealedAttachment.js.map +1 -0
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +26 -13
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/commonjs/components/MenuRoom/MenuRoom.js +5 -3
- package/lib/commonjs/components/MenuRoom/MenuRoom.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/BottomReplyContainer.js +2 -1
- package/lib/commonjs/components/MessageBubble/BottomReplyContainer.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/Message.js +69 -9
- package/lib/commonjs/components/MessageBubble/Message.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/MessageInteractions.js +7 -4
- package/lib/commonjs/components/MessageBubble/MessageInteractions.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +8 -5
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +2 -2
- package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +166 -21
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js +4 -0
- package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
- package/lib/commonjs/components/Modals/Modal/Modal.js +33 -11
- package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
- package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js +8 -8
- package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
- package/lib/commonjs/components/Modals/SettingsModals/ChangePassword/ChangePasswordModal.js +279 -0
- package/lib/commonjs/components/Modals/SettingsModals/ChangePassword/ChangePasswordModal.js.map +1 -0
- package/lib/commonjs/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.js +10 -8
- package/lib/commonjs/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.js.map +1 -1
- package/lib/commonjs/components/Modals/SettingsModals/Visibility/VisibilityModal.js +13 -11
- package/lib/commonjs/components/Modals/SettingsModals/Visibility/VisibilityModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +50 -15
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserSettingsModal/LanguageCard.js +121 -0
- package/lib/commonjs/components/Modals/UserSettingsModal/LanguageCard.js.map +1 -0
- package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +10 -1
- package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +32 -9
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/LastMessageItem.js +6 -0
- package/lib/commonjs/components/RoomComponents/LastMessageItem.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastAudioMessage.js +2 -2
- package/lib/commonjs/components/RoomComponents/styled/LastAudioMessage.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js +4 -6
- package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js +2 -2
- package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessageSealed.js +41 -0
- package/lib/commonjs/components/RoomComponents/styled/LastMessageSealed.js.map +1 -0
- package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js +2 -2
- package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
- package/lib/commonjs/components/Thread/ThreadWrapper.js +56 -46
- package/lib/commonjs/components/Thread/ThreadWrapper.js.map +1 -1
- package/lib/commonjs/components/UsersList/UsersList.js +2 -1
- package/lib/commonjs/components/UsersList/UsersList.js.map +1 -1
- package/lib/commonjs/components/styled/SendInput.js +4 -2
- package/lib/commonjs/components/styled/SendInput.js.map +1 -1
- package/lib/commonjs/e2ee/crypto.js +207 -0
- package/lib/commonjs/e2ee/crypto.js.map +1 -0
- package/lib/commonjs/e2ee/deviceStore.js +84 -0
- package/lib/commonjs/e2ee/deviceStore.js.map +1 -0
- package/lib/commonjs/e2ee/fileCipher.js +95 -0
- package/lib/commonjs/e2ee/fileCipher.js.map +1 -0
- package/lib/commonjs/e2ee/fileEnvelope.js +79 -0
- package/lib/commonjs/e2ee/fileEnvelope.js.map +1 -0
- package/lib/commonjs/e2ee/index.js +210 -0
- package/lib/commonjs/e2ee/index.js.map +1 -0
- package/lib/commonjs/e2ee/limits.js +9 -0
- package/lib/commonjs/e2ee/limits.js.map +1 -0
- package/lib/commonjs/e2ee/ns.js +8 -0
- package/lib/commonjs/e2ee/ns.js.map +1 -0
- package/lib/commonjs/e2ee/omemo.js +622 -0
- package/lib/commonjs/e2ee/omemo.js.map +1 -0
- package/lib/commonjs/e2ee/protobuf.js +149 -0
- package/lib/commonjs/e2ee/protobuf.js.map +1 -0
- package/lib/commonjs/e2ee/ratchet.js +238 -0
- package/lib/commonjs/e2ee/ratchet.js.map +1 -0
- package/lib/commonjs/e2ee/sealedBody.js +23 -0
- package/lib/commonjs/e2ee/sealedBody.js.map +1 -0
- package/lib/commonjs/e2ee/sealedFiles.js +174 -0
- package/lib/commonjs/e2ee/sealedFiles.js.map +1 -0
- package/lib/commonjs/e2ee/send.js +54 -0
- package/lib/commonjs/e2ee/send.js.map +1 -0
- package/lib/commonjs/e2ee/stanza.js +114 -0
- package/lib/commonjs/e2ee/stanza.js.map +1 -0
- package/lib/commonjs/e2ee/store.js +43 -0
- package/lib/commonjs/e2ee/store.js.map +1 -0
- package/lib/commonjs/helpers/accountName.js +23 -0
- package/lib/commonjs/helpers/accountName.js.map +1 -0
- package/lib/commonjs/helpers/constants/MODAL_COMPONENTS.js +2 -0
- package/lib/commonjs/helpers/constants/MODAL_COMPONENTS.js.map +1 -1
- package/lib/commonjs/helpers/constants/MODAL_TYPES.js +1 -0
- package/lib/commonjs/helpers/constants/MODAL_TYPES.js.map +1 -1
- package/lib/commonjs/helpers/createMessageFromXml.js +19 -4
- package/lib/commonjs/helpers/createMessageFromXml.js.map +1 -1
- package/lib/commonjs/helpers/createUserNameFromSetUser.js +2 -1
- package/lib/commonjs/helpers/createUserNameFromSetUser.js.map +1 -1
- package/lib/commonjs/helpers/displayName.js +16 -0
- package/lib/commonjs/helpers/displayName.js.map +1 -0
- package/lib/commonjs/helpers/persistCrypto.js +5 -0
- package/lib/commonjs/helpers/persistCrypto.js.map +1 -1
- package/lib/commonjs/helpers/preferencesStorage.js.map +1 -1
- package/lib/commonjs/helpers/secureKeyValue.js +20 -0
- package/lib/commonjs/helpers/secureKeyValue.js.map +1 -1
- package/lib/commonjs/helpers/videoCache.js +136 -0
- package/lib/commonjs/helpers/videoCache.js.map +1 -0
- package/lib/commonjs/hooks/useChatSettingState.js +2 -0
- package/lib/commonjs/hooks/useChatSettingState.js.map +1 -1
- package/lib/commonjs/hooks/useChatWrapperInit.js +4 -0
- package/lib/commonjs/hooks/useChatWrapperInit.js.map +1 -1
- package/lib/commonjs/hooks/useLogout.js +8 -0
- package/lib/commonjs/hooks/useLogout.js.map +1 -1
- package/lib/commonjs/hooks/useSendMessage.js +71 -7
- package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
- package/lib/commonjs/i18n/strings.js +367 -1
- package/lib/commonjs/i18n/strings.js.map +1 -1
- package/lib/commonjs/i18n/useT.js +8 -4
- package/lib/commonjs/i18n/useT.js.map +1 -1
- package/lib/commonjs/main.js +13 -0
- package/lib/commonjs/main.js.map +1 -1
- package/lib/commonjs/networking/api-requests/auth.api.js +4 -1
- package/lib/commonjs/networking/api-requests/auth.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/rooms.api.js +111 -17
- package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/user.api.js +13 -0
- package/lib/commonjs/networking/api-requests/user.api.js.map +1 -1
- package/lib/commonjs/networking/stanzaHandlers.js +1 -1
- package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
- package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js +40 -0
- package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/sendMediaMessage.xmpp.js +16 -3
- package/lib/commonjs/networking/xmpp/sendMediaMessage.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js +13 -6
- package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +14 -6
- package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmppClient.js +6 -0
- package/lib/commonjs/networking/xmppClient.js.map +1 -1
- package/lib/commonjs/roomStore/chatSettingsSlice.js +7 -2
- package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/commonjs/roomStore/persistBackend.js +9 -12
- package/lib/commonjs/roomStore/persistBackend.js.map +1 -1
- package/lib/commonjs/roomStore/persistence.js +8 -1
- package/lib/commonjs/roomStore/persistence.js.map +1 -1
- package/lib/commonjs/services/languageSettings.js +177 -0
- package/lib/commonjs/services/languageSettings.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/module/assets/icons.js +3 -1
- package/lib/module/assets/icons.js.map +1 -1
- package/lib/module/components/MainComponents/ChatHeader.js +29 -7
- package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/module/components/MainComponents/ChatRoom.js +9 -1
- package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/module/components/MainComponents/ChatWrapper.js +5 -3
- package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/EncryptedSendNotice.js +42 -0
- package/lib/module/components/MainComponents/EncryptedSendNotice.js.map +1 -0
- package/lib/module/components/MainComponents/EncryptionCard.js +281 -0
- package/lib/module/components/MainComponents/EncryptionCard.js.map +1 -0
- package/lib/module/components/MainComponents/MediaMessage.js +7 -0
- package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/module/components/MainComponents/ReduxWrapper.js +14 -1
- package/lib/module/components/MainComponents/ReduxWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/SealedAttachment.js +224 -0
- package/lib/module/components/MainComponents/SealedAttachment.js.map +1 -0
- package/lib/module/components/Menu/HeaderRoomListMenu.js +26 -13
- package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/module/components/MenuRoom/MenuRoom.js +5 -3
- package/lib/module/components/MenuRoom/MenuRoom.js.map +1 -1
- package/lib/module/components/MessageBubble/BottomReplyContainer.js +2 -1
- package/lib/module/components/MessageBubble/BottomReplyContainer.js.map +1 -1
- package/lib/module/components/MessageBubble/Message.js +72 -12
- package/lib/module/components/MessageBubble/Message.js.map +1 -1
- package/lib/module/components/MessageBubble/MessageInteractions.js +7 -4
- package/lib/module/components/MessageBubble/MessageInteractions.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +8 -5
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +2 -2
- package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -1
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +168 -23
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/module/components/Modals/FilePreviewModal/PdfView.js +4 -0
- package/lib/module/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
- package/lib/module/components/Modals/Modal/Modal.js +33 -11
- package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
- package/lib/module/components/Modals/NewChatModal/NewChatModal.js +8 -8
- package/lib/module/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
- package/lib/module/components/Modals/SettingsModals/ChangePassword/ChangePasswordModal.js +274 -0
- package/lib/module/components/Modals/SettingsModals/ChangePassword/ChangePasswordModal.js.map +1 -0
- package/lib/module/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.js +10 -8
- package/lib/module/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.js.map +1 -1
- package/lib/module/components/Modals/SettingsModals/Visibility/VisibilityModal.js +13 -11
- package/lib/module/components/Modals/SettingsModals/Visibility/VisibilityModal.js.map +1 -1
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +54 -18
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/module/components/Modals/UserSettingsModal/LanguageCard.js +116 -0
- package/lib/module/components/Modals/UserSettingsModal/LanguageCard.js.map +1 -0
- package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +10 -1
- package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
- package/lib/module/components/RoomComponents/ChatRoomItem.js +32 -9
- package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/module/components/RoomComponents/LastMessageItem.js +6 -0
- package/lib/module/components/RoomComponents/LastMessageItem.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastAudioMessage.js +2 -2
- package/lib/module/components/RoomComponents/styled/LastAudioMessage.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessageFile.js +4 -6
- package/lib/module/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js +2 -2
- package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessageSealed.js +36 -0
- package/lib/module/components/RoomComponents/styled/LastMessageSealed.js.map +1 -0
- package/lib/module/components/RoomComponents/styled/LastMessageVideo.js +2 -2
- package/lib/module/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
- package/lib/module/components/Thread/ThreadWrapper.js +57 -47
- package/lib/module/components/Thread/ThreadWrapper.js.map +1 -1
- package/lib/module/components/UsersList/UsersList.js +2 -1
- package/lib/module/components/UsersList/UsersList.js.map +1 -1
- package/lib/module/components/styled/SendInput.js +4 -2
- package/lib/module/components/styled/SendInput.js.map +1 -1
- package/lib/module/e2ee/crypto.js +170 -0
- package/lib/module/e2ee/crypto.js.map +1 -0
- package/lib/module/e2ee/deviceStore.js +77 -0
- package/lib/module/e2ee/deviceStore.js.map +1 -0
- package/lib/module/e2ee/fileCipher.js +90 -0
- package/lib/module/e2ee/fileCipher.js.map +1 -0
- package/lib/module/e2ee/fileEnvelope.js +66 -0
- package/lib/module/e2ee/fileEnvelope.js.map +1 -0
- package/lib/module/e2ee/index.js +185 -0
- package/lib/module/e2ee/index.js.map +1 -0
- package/lib/module/e2ee/limits.js +5 -0
- package/lib/module/e2ee/limits.js.map +1 -0
- package/lib/module/e2ee/ns.js +4 -0
- package/lib/module/e2ee/ns.js.map +1 -0
- package/lib/module/e2ee/omemo.js +610 -0
- package/lib/module/e2ee/omemo.js.map +1 -0
- package/lib/module/e2ee/protobuf.js +140 -0
- package/lib/module/e2ee/protobuf.js.map +1 -0
- package/lib/module/e2ee/ratchet.js +228 -0
- package/lib/module/e2ee/ratchet.js.map +1 -0
- package/lib/module/e2ee/sealedBody.js +19 -0
- package/lib/module/e2ee/sealedBody.js.map +1 -0
- package/lib/module/e2ee/sealedFiles.js +154 -0
- package/lib/module/e2ee/sealedFiles.js.map +1 -0
- package/lib/module/e2ee/send.js +48 -0
- package/lib/module/e2ee/send.js.map +1 -0
- package/lib/module/e2ee/stanza.js +107 -0
- package/lib/module/e2ee/stanza.js.map +1 -0
- package/lib/module/e2ee/store.js +35 -0
- package/lib/module/e2ee/store.js.map +1 -0
- package/lib/module/helpers/accountName.js +18 -0
- package/lib/module/helpers/accountName.js.map +1 -0
- package/lib/module/helpers/constants/MODAL_COMPONENTS.js +2 -0
- package/lib/module/helpers/constants/MODAL_COMPONENTS.js.map +1 -1
- package/lib/module/helpers/constants/MODAL_TYPES.js +1 -0
- package/lib/module/helpers/constants/MODAL_TYPES.js.map +1 -1
- package/lib/module/helpers/createMessageFromXml.js +19 -4
- package/lib/module/helpers/createMessageFromXml.js.map +1 -1
- package/lib/module/helpers/createUserNameFromSetUser.js +3 -1
- package/lib/module/helpers/createUserNameFromSetUser.js.map +1 -1
- package/lib/module/helpers/displayName.js +11 -0
- package/lib/module/helpers/displayName.js.map +1 -0
- package/lib/module/helpers/persistCrypto.js +4 -0
- package/lib/module/helpers/persistCrypto.js.map +1 -1
- package/lib/module/helpers/preferencesStorage.js.map +1 -1
- package/lib/module/helpers/secureKeyValue.js +19 -0
- package/lib/module/helpers/secureKeyValue.js.map +1 -1
- package/lib/module/helpers/videoCache.js +125 -0
- package/lib/module/helpers/videoCache.js.map +1 -0
- package/lib/module/hooks/useChatSettingState.js +2 -0
- package/lib/module/hooks/useChatSettingState.js.map +1 -1
- package/lib/module/hooks/useChatWrapperInit.js +4 -0
- package/lib/module/hooks/useChatWrapperInit.js.map +1 -1
- package/lib/module/hooks/useLogout.js +8 -0
- package/lib/module/hooks/useLogout.js.map +1 -1
- package/lib/module/hooks/useSendMessage.js +71 -7
- package/lib/module/hooks/useSendMessage.js.map +1 -1
- package/lib/module/i18n/strings.js +367 -1
- package/lib/module/i18n/strings.js.map +1 -1
- package/lib/module/i18n/useT.js +8 -4
- package/lib/module/i18n/useT.js.map +1 -1
- package/lib/module/main.js +1 -0
- package/lib/module/main.js.map +1 -1
- package/lib/module/networking/api-requests/auth.api.js +4 -1
- package/lib/module/networking/api-requests/auth.api.js.map +1 -1
- package/lib/module/networking/api-requests/rooms.api.js +109 -18
- package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/module/networking/api-requests/user.api.js +12 -0
- package/lib/module/networking/api-requests/user.api.js.map +1 -1
- package/lib/module/networking/stanzaHandlers.js +1 -1
- package/lib/module/networking/stanzaHandlers.js.map +1 -1
- package/lib/module/networking/xmpp/handleStanzas.xmpp.js +38 -0
- package/lib/module/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/sendMediaMessage.xmpp.js +16 -3
- package/lib/module/networking/xmpp/sendMediaMessage.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/sendTextMessage.xmpp.js +13 -6
- package/lib/module/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +14 -6
- package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
- package/lib/module/networking/xmppClient.js +6 -0
- package/lib/module/networking/xmppClient.js.map +1 -1
- package/lib/module/roomStore/chatSettingsSlice.js +5 -1
- package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/module/roomStore/persistBackend.js +10 -13
- package/lib/module/roomStore/persistBackend.js.map +1 -1
- package/lib/module/roomStore/persistence.js +8 -1
- package/lib/module/roomStore/persistence.js.map +1 -1
- package/lib/module/services/languageSettings.js +164 -0
- package/lib/module/services/languageSettings.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/typescript/assets/icons.d.ts +8 -0
- package/lib/typescript/assets/icons.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/EncryptedSendNotice.d.ts +4 -0
- package/lib/typescript/components/MainComponents/EncryptedSendNotice.d.ts.map +1 -0
- package/lib/typescript/components/MainComponents/EncryptionCard.d.ts +10 -0
- package/lib/typescript/components/MainComponents/EncryptionCard.d.ts.map +1 -0
- package/lib/typescript/components/MainComponents/MediaMessage.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ReduxWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/SealedAttachment.d.ts +13 -0
- package/lib/typescript/components/MainComponents/SealedAttachment.d.ts.map +1 -0
- package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts +7 -1
- package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
- package/lib/typescript/components/MenuRoom/MenuRoom.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/BottomReplyContainer.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/Message.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/FilePreviewModal/PdfView.d.ts.map +1 -1
- package/lib/typescript/components/Modals/Modal/Modal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/SettingsModals/ChangePassword/ChangePasswordModal.d.ts +15 -0
- package/lib/typescript/components/Modals/SettingsModals/ChangePassword/ChangePasswordModal.d.ts.map +1 -0
- package/lib/typescript/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/SettingsModals/Visibility/VisibilityModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserSettingsModal/LanguageCard.d.ts +14 -0
- package/lib/typescript/components/Modals/UserSettingsModal/LanguageCard.d.ts.map +1 -0
- package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/LastMessageItem.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastAudioMessage.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessageSealed.d.ts +7 -0
- package/lib/typescript/components/RoomComponents/styled/LastMessageSealed.d.ts.map +1 -0
- package/lib/typescript/components/Thread/ThreadWrapper.d.ts.map +1 -1
- package/lib/typescript/components/UsersList/UsersList.d.ts.map +1 -1
- package/lib/typescript/components/styled/SendInput.d.ts +1 -0
- package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
- package/lib/typescript/e2ee/crypto.d.ts +28 -0
- package/lib/typescript/e2ee/crypto.d.ts.map +1 -0
- package/lib/typescript/e2ee/deviceStore.d.ts +4 -0
- package/lib/typescript/e2ee/deviceStore.d.ts.map +1 -0
- package/lib/typescript/e2ee/fileCipher.d.ts +7 -0
- package/lib/typescript/e2ee/fileCipher.d.ts.map +1 -0
- package/lib/typescript/e2ee/fileEnvelope.d.ts +27 -0
- package/lib/typescript/e2ee/fileEnvelope.d.ts.map +1 -0
- package/lib/typescript/e2ee/index.d.ts +23 -0
- package/lib/typescript/e2ee/index.d.ts.map +1 -0
- package/lib/typescript/e2ee/limits.d.ts +3 -0
- package/lib/typescript/e2ee/limits.d.ts.map +1 -0
- package/lib/typescript/e2ee/ns.d.ts +2 -0
- package/lib/typescript/e2ee/ns.d.ts.map +1 -0
- package/lib/typescript/e2ee/omemo.d.ts +64 -0
- package/lib/typescript/e2ee/omemo.d.ts.map +1 -0
- package/lib/typescript/e2ee/protobuf.d.ts +25 -0
- package/lib/typescript/e2ee/protobuf.d.ts.map +1 -0
- package/lib/typescript/e2ee/ratchet.d.ts +39 -0
- package/lib/typescript/e2ee/ratchet.d.ts.map +1 -0
- package/lib/typescript/e2ee/sealedBody.d.ts +2 -0
- package/lib/typescript/e2ee/sealedBody.d.ts.map +1 -0
- package/lib/typescript/e2ee/sealedFiles.d.ts +31 -0
- package/lib/typescript/e2ee/sealedFiles.d.ts.map +1 -0
- package/lib/typescript/e2ee/send.d.ts +6 -0
- package/lib/typescript/e2ee/send.d.ts.map +1 -0
- package/lib/typescript/e2ee/stanza.d.ts +8 -0
- package/lib/typescript/e2ee/stanza.d.ts.map +1 -0
- package/lib/typescript/e2ee/store.d.ts +16 -0
- package/lib/typescript/e2ee/store.d.ts.map +1 -0
- package/lib/typescript/helpers/accountName.d.ts +7 -0
- package/lib/typescript/helpers/accountName.d.ts.map +1 -0
- package/lib/typescript/helpers/constants/MODAL_COMPONENTS.d.ts.map +1 -1
- package/lib/typescript/helpers/constants/MODAL_TYPES.d.ts +1 -0
- package/lib/typescript/helpers/constants/MODAL_TYPES.d.ts.map +1 -1
- package/lib/typescript/helpers/createMessageFromXml.d.ts.map +1 -1
- package/lib/typescript/helpers/createUserNameFromSetUser.d.ts.map +1 -1
- package/lib/typescript/helpers/displayName.d.ts +2 -0
- package/lib/typescript/helpers/displayName.d.ts.map +1 -0
- package/lib/typescript/helpers/persistCrypto.d.ts +1 -0
- package/lib/typescript/helpers/persistCrypto.d.ts.map +1 -1
- package/lib/typescript/helpers/preferencesStorage.d.ts +4 -0
- package/lib/typescript/helpers/preferencesStorage.d.ts.map +1 -1
- package/lib/typescript/helpers/secureKeyValue.d.ts +4 -0
- package/lib/typescript/helpers/secureKeyValue.d.ts.map +1 -1
- package/lib/typescript/helpers/videoCache.d.ts +19 -0
- package/lib/typescript/helpers/videoCache.d.ts.map +1 -0
- package/lib/typescript/hooks/useChatSettingState.d.ts +1 -0
- package/lib/typescript/hooks/useChatSettingState.d.ts.map +1 -1
- package/lib/typescript/hooks/useChatWrapperInit.d.ts.map +1 -1
- package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
- package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
- package/lib/typescript/i18n/strings.d.ts.map +1 -1
- package/lib/typescript/i18n/useT.d.ts.map +1 -1
- package/lib/typescript/main.d.ts +2 -0
- package/lib/typescript/main.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/auth.api.d.ts +4 -1
- package/lib/typescript/networking/api-requests/auth.api.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/rooms.api.d.ts +22 -1
- package/lib/typescript/networking/api-requests/rooms.api.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/user.api.d.ts +6 -0
- package/lib/typescript/networking/api-requests/user.api.d.ts.map +1 -1
- package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/handleStanzas.xmpp.d.ts +1 -0
- package/lib/typescript/networking/xmpp/handleStanzas.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/sendMediaMessage.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/sendTextMessage.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
- package/lib/typescript/roomStore/chatSettingsSlice.d.ts +8 -1
- package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
- package/lib/typescript/roomStore/persistBackend.d.ts.map +1 -1
- package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
- package/lib/typescript/services/languageSettings.d.ts +29 -0
- package/lib/typescript/services/languageSettings.d.ts.map +1 -0
- package/lib/typescript/types/models/message.model.d.ts +5 -0
- package/lib/typescript/types/models/message.model.d.ts.map +1 -1
- package/lib/typescript/types/models/room.model.d.ts +5 -0
- package/lib/typescript/types/models/room.model.d.ts.map +1 -1
- package/lib/typescript/types/models/user.model.d.ts +4 -0
- package/lib/typescript/types/models/user.model.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +25 -0
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +8 -4
- package/src/assets/icons.tsx +27 -0
- package/src/components/MainComponents/ChatHeader.tsx +30 -9
- package/src/components/MainComponents/ChatRoom.tsx +11 -1
- package/src/components/MainComponents/ChatWrapper.tsx +5 -3
- package/src/components/MainComponents/EncryptedSendNotice.tsx +35 -0
- package/src/components/MainComponents/EncryptionCard.tsx +287 -0
- package/src/components/MainComponents/MediaMessage.tsx +5 -0
- package/src/components/MainComponents/ReduxWrapper.tsx +11 -0
- package/src/components/MainComponents/SealedAttachment.tsx +251 -0
- package/src/components/Menu/HeaderRoomListMenu.tsx +40 -13
- package/src/components/MenuRoom/MenuRoom.tsx +5 -3
- package/src/components/MessageBubble/BottomReplyContainer.tsx +2 -1
- package/src/components/MessageBubble/Message.tsx +99 -9
- package/src/components/MessageBubble/MessageInteractions.tsx +7 -6
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +8 -5
- package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +2 -2
- package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +188 -40
- package/src/components/Modals/FilePreviewModal/PdfView.tsx +4 -0
- package/src/components/Modals/Modal/Modal.tsx +44 -16
- package/src/components/Modals/NewChatModal/NewChatModal.tsx +8 -8
- package/src/components/Modals/SettingsModals/ChangePassword/ChangePasswordModal.tsx +316 -0
- package/src/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.tsx +10 -15
- package/src/components/Modals/SettingsModals/Visibility/VisibilityModal.tsx +13 -14
- package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +72 -20
- package/src/components/Modals/UserSettingsModal/LanguageCard.tsx +144 -0
- package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +13 -1
- package/src/components/RoomComponents/ChatRoomItem.tsx +23 -11
- package/src/components/RoomComponents/LastMessageItem.tsx +5 -0
- package/src/components/RoomComponents/styled/LastAudioMessage.tsx +3 -1
- package/src/components/RoomComponents/styled/LastMessageFile.tsx +2 -2
- package/src/components/RoomComponents/styled/LastMessagePhoto.tsx +1 -1
- package/src/components/RoomComponents/styled/LastMessageSealed.tsx +31 -0
- package/src/components/RoomComponents/styled/LastMessageVideo.tsx +1 -1
- package/src/components/Thread/ThreadWrapper.tsx +17 -2
- package/src/components/UsersList/UsersList.tsx +2 -1
- package/src/components/styled/SendInput.tsx +5 -2
- package/src/e2ee/crypto.ts +194 -0
- package/src/e2ee/deviceStore.ts +80 -0
- package/src/e2ee/fileCipher.ts +86 -0
- package/src/e2ee/fileEnvelope.ts +115 -0
- package/src/e2ee/index.ts +192 -0
- package/src/e2ee/limits.ts +2 -0
- package/src/e2ee/ns.ts +1 -0
- package/src/e2ee/omemo.ts +802 -0
- package/src/e2ee/protobuf.ts +188 -0
- package/src/e2ee/ratchet.ts +271 -0
- package/src/e2ee/sealedBody.ts +17 -0
- package/src/e2ee/sealedFiles.ts +181 -0
- package/src/e2ee/send.ts +70 -0
- package/src/e2ee/stanza.ts +133 -0
- package/src/e2ee/store.ts +54 -0
- package/src/helpers/accountName.ts +15 -0
- package/src/helpers/constants/MODAL_COMPONENTS.tsx +2 -0
- package/src/helpers/constants/MODAL_TYPES.ts +1 -0
- package/src/helpers/createMessageFromXml.ts +31 -6
- package/src/helpers/createUserNameFromSetUser.ts +2 -1
- package/src/helpers/displayName.ts +9 -0
- package/src/helpers/persistCrypto.ts +5 -0
- package/src/helpers/preferencesStorage.ts +4 -0
- package/src/helpers/secureKeyValue.ts +15 -0
- package/src/helpers/videoCache.ts +138 -0
- package/src/hooks/useChatSettingState.tsx +4 -0
- package/src/hooks/useChatWrapperInit.ts +4 -0
- package/src/hooks/useLogout.tsx +9 -0
- package/src/hooks/useSendMessage.tsx +71 -5
- package/src/i18n/strings.ts +367 -1
- package/src/i18n/useT.ts +6 -4
- package/src/main.ts +2 -0
- package/src/networking/api-requests/auth.api.ts +9 -1
- package/src/networking/api-requests/rooms.api.ts +121 -18
- package/src/networking/api-requests/user.api.ts +9 -0
- package/src/networking/stanzaHandlers.ts +1 -0
- package/src/networking/xmpp/handleStanzas.xmpp.ts +49 -0
- package/src/networking/xmpp/sendMediaMessage.xmpp.ts +19 -1
- package/src/networking/xmpp/sendTextMessage.xmpp.ts +17 -10
- package/src/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.ts +23 -10
- package/src/networking/xmppClient.ts +6 -0
- package/src/roomStore/chatSettingsSlice.ts +13 -0
- package/src/roomStore/persistBackend.ts +8 -11
- package/src/roomStore/persistence.ts +15 -0
- package/src/services/languageSettings.ts +143 -0
- package/src/types/models/message.model.ts +5 -0
- package/src/types/models/room.model.ts +5 -0
- package/src/types/models/user.model.ts +4 -0
- package/src/types/types.ts +25 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.sendEncrypted = sendEncrypted;
|
|
7
|
+
exports.sendSealedMedia = sendSealedMedia;
|
|
8
|
+
exports.shouldEncrypt = shouldEncrypt;
|
|
9
|
+
var _index = require("./index");
|
|
10
|
+
function shouldEncrypt(roomJID) {
|
|
11
|
+
return (0, _index.isE2eeEnabled)() && (0, _index.isE2eeRoom)(roomJID);
|
|
12
|
+
}
|
|
13
|
+
let queue = Promise.resolve();
|
|
14
|
+
function sendEncrypted(client, roomJID, id, data, body, plain) {
|
|
15
|
+
queue = queue.then(async () => {
|
|
16
|
+
let stanza = plain;
|
|
17
|
+
try {
|
|
18
|
+
const crypto = await (0, _index.omemoReady)();
|
|
19
|
+
if (!crypto) {
|
|
20
|
+
throw new Error('omemo_not_ready');
|
|
21
|
+
}
|
|
22
|
+
const recipients = await (0, _index.resolveRecipients)(roomJID, (0, _index.accountDomain)(client));
|
|
23
|
+
stanza = await crypto.encryptGroupMessage(roomJID, recipients, [body], id, [data]);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
const reason = String(error?.message || error);
|
|
26
|
+
if (reason.startsWith('omemo_members_unknown')) {
|
|
27
|
+
console.warn(`OMEMO: not sending to ${roomJID} - ${reason}`);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
console.warn(`OMEMO: sending to ${roomJID} in clear - ${reason}`);
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
await client.send(stanza);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
console.error('An error occurred while sending message:', error);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function sendSealedMedia(client, roomJID, id, body, cleartext) {
|
|
40
|
+
queue = queue.then(async () => {
|
|
41
|
+
try {
|
|
42
|
+
const crypto = await (0, _index.omemoReady)();
|
|
43
|
+
if (!crypto) {
|
|
44
|
+
throw new Error('omemo_not_ready');
|
|
45
|
+
}
|
|
46
|
+
const recipients = await (0, _index.resolveRecipients)(roomJID, (0, _index.accountDomain)(client));
|
|
47
|
+
const stanza = await crypto.encryptGroupMessage(roomJID, recipients, [body], id, cleartext);
|
|
48
|
+
await client.send(stanza);
|
|
49
|
+
} catch (error) {
|
|
50
|
+
console.error(`OMEMO: refusing to send sealed attachment to ${roomJID} - ${String(error?.message || error)}`);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=send.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_index","require","shouldEncrypt","roomJID","isE2eeEnabled","isE2eeRoom","queue","Promise","resolve","sendEncrypted","client","id","data","body","plain","then","stanza","crypto","omemoReady","Error","recipients","resolveRecipients","accountDomain","encryptGroupMessage","error","reason","String","message","startsWith","console","warn","send","sendSealedMedia","cleartext"],"sourceRoot":"../../../src","sources":["e2ee/send.ts"],"mappings":";;;;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAQO,SAASC,aAAaA,CAACC,OAAe,EAAW;EACtD,OAAO,IAAAC,oBAAa,EAAC,CAAC,IAAI,IAAAC,iBAAU,EAACF,OAAO,CAAC;AAC/C;AAEA,IAAIG,KAAoB,GAAGC,OAAO,CAACC,OAAO,CAAC,CAAC;AAErC,SAASC,aAAaA,CAC3BC,MAAc,EACdP,OAAe,EACfQ,EAAU,EACVC,IAAa,EACbC,IAAa,EACbC,KAAc,EACR;EACNR,KAAK,GAAGA,KAAK,CAACS,IAAI,CAAC,YAAY;IAC7B,IAAIC,MAAM,GAAGF,KAAK;IAClB,IAAI;MACF,MAAMG,MAAM,GAAG,MAAM,IAAAC,iBAAU,EAAC,CAAC;MACjC,IAAI,CAACD,MAAM,EAAE;QAAC,MAAM,IAAIE,KAAK,CAAC,iBAAiB,CAAC;MAAC;MACjD,MAAMC,UAAU,GAAG,MAAM,IAAAC,wBAAiB,EAAClB,OAAO,EAAE,IAAAmB,oBAAa,EAACZ,MAAM,CAAC,CAAC;MAC1EM,MAAM,GAAG,MAAMC,MAAM,CAACM,mBAAmB,CAACpB,OAAO,EAAEiB,UAAU,EAAE,CAACP,IAAI,CAAC,EAAEF,EAAE,EAAE,CAACC,IAAI,CAAC,CAA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EAAYG,OAAO,IAAIH,KAC/B,CAAC,EACH,CAAC;IACH;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.decryptStanzaInPlace = decryptStanzaInPlace;
|
|
7
|
+
exports.encryptedCarrier = encryptedCarrier;
|
|
8
|
+
exports.placeholderKey = placeholderKey;
|
|
9
|
+
exports.rewriteEncryptedStanza = rewriteEncryptedStanza;
|
|
10
|
+
var _ltx = require("ltx");
|
|
11
|
+
var _roomStore = require("../roomStore");
|
|
12
|
+
var _strings = require("../i18n/strings");
|
|
13
|
+
var _ns = require("./ns");
|
|
14
|
+
var _index = require("./index");
|
|
15
|
+
const READY_TIMEOUT_MS = 8000;
|
|
16
|
+
function encryptedCarrier(stanza, depth = 0) {
|
|
17
|
+
if (depth > 4 || !stanza?.getChild) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
if (stanza.name === 'message' && stanza.getChild('encrypted', _ns.NS_OMEMO)) {
|
|
21
|
+
return stanza;
|
|
22
|
+
}
|
|
23
|
+
for (const child of stanza.children ?? []) {
|
|
24
|
+
if (typeof child === 'string') {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
const found = encryptedCarrier(child, depth + 1);
|
|
28
|
+
if (found) {
|
|
29
|
+
return found;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
const PLACEHOLDER_KEY = {
|
|
35
|
+
unsupported: 'e2ee.unsupportedMessage',
|
|
36
|
+
'other-device': 'e2ee.otherDevice',
|
|
37
|
+
failed: 'e2ee.undecryptable'
|
|
38
|
+
};
|
|
39
|
+
function placeholderKey(error) {
|
|
40
|
+
return PLACEHOLDER_KEY[error] ?? PLACEHOLDER_KEY.failed;
|
|
41
|
+
}
|
|
42
|
+
function placeholder(error) {
|
|
43
|
+
const settings = _roomStore.store.getState()?.chatSettingStore;
|
|
44
|
+
return new _ltx.Element('body', {}).t((0, _strings.translateKey)(placeholderKey(error), settings?.uiLocale || settings?.config?.i18n?.locale || settings?.langSource, settings?.config?.i18n?.strings));
|
|
45
|
+
}
|
|
46
|
+
function mark(carrier, error) {
|
|
47
|
+
let data = carrier.getChild('data');
|
|
48
|
+
if (!data) {
|
|
49
|
+
data = new _ltx.Element('data', {});
|
|
50
|
+
carrier.append(data);
|
|
51
|
+
}
|
|
52
|
+
data.attrs.omemoEncrypted = 'true';
|
|
53
|
+
if (error) {
|
|
54
|
+
data.attrs.undecryptable = 'true';
|
|
55
|
+
data.attrs.e2eeError = error;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function strip(carrier) {
|
|
59
|
+
carrier.remove('encrypted', _ns.NS_OMEMO);
|
|
60
|
+
carrier.remove('encryption', 'urn:xmpp:eme:0');
|
|
61
|
+
carrier.remove('body');
|
|
62
|
+
}
|
|
63
|
+
function close(carrier, error) {
|
|
64
|
+
strip(carrier);
|
|
65
|
+
carrier.append(placeholder(error));
|
|
66
|
+
mark(carrier, error);
|
|
67
|
+
return 'undecryptable';
|
|
68
|
+
}
|
|
69
|
+
function rewriteEncryptedStanza(stanza) {
|
|
70
|
+
const carrier = encryptedCarrier(stanza);
|
|
71
|
+
if (!carrier) {
|
|
72
|
+
return 'not-encrypted';
|
|
73
|
+
}
|
|
74
|
+
const encrypted = carrier.getChild('encrypted', _ns.NS_OMEMO);
|
|
75
|
+
if (!encrypted?.getChild('payload')) {
|
|
76
|
+
return 'drop';
|
|
77
|
+
}
|
|
78
|
+
return close(carrier, 'unsupported');
|
|
79
|
+
}
|
|
80
|
+
const waitForDevice = () => {
|
|
81
|
+
let timer;
|
|
82
|
+
const timeout = new Promise(resolve => {
|
|
83
|
+
timer = setTimeout(() => resolve(undefined), READY_TIMEOUT_MS);
|
|
84
|
+
});
|
|
85
|
+
return Promise.race([(0, _index.omemoReady)(), timeout]).finally(() => {
|
|
86
|
+
if (timer) {
|
|
87
|
+
clearTimeout(timer);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
async function decryptStanzaInPlace(stanza, domain) {
|
|
92
|
+
const carrier = encryptedCarrier(stanza);
|
|
93
|
+
if (!carrier) {
|
|
94
|
+
return 'not-encrypted';
|
|
95
|
+
}
|
|
96
|
+
const encrypted = carrier.getChild('encrypted', _ns.NS_OMEMO);
|
|
97
|
+
if (!encrypted?.getChild('payload')) {
|
|
98
|
+
return 'drop';
|
|
99
|
+
}
|
|
100
|
+
const from = String(carrier.attrs?.from || '');
|
|
101
|
+
const roomJid = from.split('/')[0];
|
|
102
|
+
const sender = (0, _index.senderJidFromMuc)(from, domain);
|
|
103
|
+
const crypto = await waitForDevice();
|
|
104
|
+
const decrypted = sender ? await crypto?.decrypt(carrier, sender, roomJid) : undefined;
|
|
105
|
+
if (!decrypted?.content) {
|
|
106
|
+
return close(carrier, decrypted?.error === 'omemo_not_encrypted_for_this_device' ? 'other-device' : 'failed');
|
|
107
|
+
}
|
|
108
|
+
strip(carrier);
|
|
109
|
+
const wrapper = (0, _ltx.parse)(`<omemo-content>${decrypted.content}</omemo-content>`);
|
|
110
|
+
carrier.append(...wrapper.children);
|
|
111
|
+
mark(carrier);
|
|
112
|
+
return 'decrypted';
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=stanza.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ltx","require","_roomStore","_strings","_ns","_index","READY_TIMEOUT_MS","encryptedCarrier","stanza","depth","getChild","undefined","name","NS_OMEMO","child","children","found","PLACEHOLDER_KEY","unsupported","failed","placeholderKey","error","placeholder","settings","store","getState","chatSettingStore","Element","t","translateKey","uiLocale","config","i18n","locale","langSource","strings","mark","carrier","data","append","attrs","omemoEncrypted","undecryptable","e2eeError","strip","remove","close","rewriteEncryptedStanza","encrypted","waitForDevice","timer","timeout","Promise","resolve","setTimeout","race","omemoReady","finally","clearTimeout","decryptStanzaInPlace","domain","from","String","roomJid","split","sender","senderJidFromMuc","crypto","decrypted","decrypt","content","wrapper","parse"],"sourceRoot":"../../../src","sources":["e2ee/stanza.ts"],"mappings":";;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,GAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAaA,MAAMK,gBAAgB,GAAG,IAAI;AAEtB,SAASC,gBAAgBA,CAC9BC,MAAe,EACfC,KAAK,GAAG,CAAC,EACY;EACrB,IAAIA,KAAK,GAAG,CAAC,IAAI,CAACD,MAAM,EAAEE,QAAQ,EAAE;IAAC,OAAOC,SAAS;EAAC;EACtD,IAAIH,MAAM,CAACI,IAAI,KAAK,SAAS,IAAIJ,MAAM,CAACE,QAAQ,CAAC,WAAW,EAAEG,YAAQ,CAAC,EAAE;IACvE,OAAOL,MAAM;EACf;EACA,KAAK,MAAMM,KAAK,IAAIN,MAAM,CAACO,QAAQ,IAAI,EAAE,EAAE;IACzC,IAAI,OAAOD,KAAK,KAAK,QAAQ,EAAE;MAAC;IAAS;IACzC,MAAME,KAAK,GAAGT,gBAAgB,CAACO,KAAK,EAAaL,KAAK,GAAG,CAAC,CAAC;IAC3D,IAAIO,KAAK,EAAE;MAAC,OAAOA,KAAK;IAAC;EAC3B;EACA,OAAOL,SAAS;AAClB;AAEA,MAAMM,eAA0C,GAAG;EACjDC,WAAW,EAAE,yBAAyB;EACtC,cAAc,EAAE,kBAAkB;EAClCC,MAAM,EAAE;AACV,CAAC;AAEM,SAASC,cAAcA,CAACC,KAAc,EAAU;EACrD,OAAOJ,eAAe,CAACI,KAAK,CAAc,IAAIJ,eAAe,CAACE,MAAM;AACtE;AAEA,SAASG,WAAWA,CAACD,KAAgB,EAAW;EAC9C,MAAME,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,OAAO,CAACG,KAAK,EAAEqB,IAAI,IAAI,EAAE,CAAC;EAC9C,MAAME,OAAO,GAAGF,IAAI,CAACG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE;EACnC,MAAMC,MAAM,GAAG,IAAAC,uBAAgB,EAACL,IAAI,EAAED,MAAM,CAAC;EAC7C,MAAMO,MAAM,GAAG,MAAMlB,aAAa,CAAC,CAAC;EACpC,MAAMmB,SAAS,GAAGH,MAAM,GACpB,MAAME,MAAM,EAAEE,OAAO,CAAChC,OAAO,EAAE4B,MAAM,EAAEF,OAAO,CAAC,GAC/CpD,SAAS;EAEb,IAAI,CAACyD,SAAS,EAAEE,OAAO,EAAE;IACvB,OAAOxB,KAAK,CACVT,OAAO,EACP+B,SAAS,EAAE/C,KAAK,KAAK,qCAAqC,GACtD,cAAc,GACd,QACN,CAAC;EACH;EAEAuB,KAAK,CAACP,OAAO,CAAC;EACd,MAAMkC,OAAO,GAAG,IAAAC,UAAK,EAAC,kBAAkBJ,SAAS,CAACE,OAAO,kBAAkB,CAAC;EAC5EjC,OAAO,CAACE,MAAM,CAAC,GAAGgC,OAAO,CAACxD,QAAQ,CAAC;EACnCqB,IAAI,CAACC,OAAO,CAAC;EACb,OAAO,WAAW;AACpB","ignoreList":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createMemoryBackend = createMemoryBackend;
|
|
7
|
+
exports.createMemoryStore = createMemoryStore;
|
|
8
|
+
exports.createStore = createStore;
|
|
9
|
+
exports.decodeValue = decodeValue;
|
|
10
|
+
exports.encodeValue = encodeValue;
|
|
11
|
+
var _crypto = require("./crypto");
|
|
12
|
+
const BYTES_TAG = '$bytes';
|
|
13
|
+
function encodeValue(value) {
|
|
14
|
+
return JSON.stringify(value, (_key, item) => item instanceof Uint8Array ? {
|
|
15
|
+
[BYTES_TAG]: (0, _crypto.toBase64)(item)
|
|
16
|
+
} : item);
|
|
17
|
+
}
|
|
18
|
+
function decodeValue(text) {
|
|
19
|
+
return JSON.parse(text, (_key, item) => item && typeof item === 'object' && typeof item[BYTES_TAG] === 'string' ? (0, _crypto.fromBase64)(item[BYTES_TAG]) : item);
|
|
20
|
+
}
|
|
21
|
+
function createStore(backend, jid) {
|
|
22
|
+
const prefix = `${jid.toLowerCase()}|`;
|
|
23
|
+
return {
|
|
24
|
+
get: async key => {
|
|
25
|
+
const raw = await backend.getItem(prefix + key);
|
|
26
|
+
return raw === null ? undefined : decodeValue(raw);
|
|
27
|
+
},
|
|
28
|
+
set: (key, value) => backend.setItem(prefix + key, encodeValue(value)),
|
|
29
|
+
delete: key => backend.removeItem(prefix + key)
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function createMemoryBackend() {
|
|
33
|
+
const data = new Map();
|
|
34
|
+
return {
|
|
35
|
+
getItem: async key => data.get(key) ?? null,
|
|
36
|
+
setItem: async (key, value) => void data.set(key, value),
|
|
37
|
+
removeItem: async key => void data.delete(key)
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function createMemoryStore(jid = 'memory') {
|
|
41
|
+
return createStore(createMemoryBackend(), jid);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_crypto","require","BYTES_TAG","encodeValue","value","JSON","stringify","_key","item","Uint8Array","toBase64","decodeValue","text","parse","fromBase64","createStore","backend","jid","prefix","toLowerCase","get","key","raw","getItem","undefined","set","setItem","delete","removeItem","createMemoryBackend","data","Map","createMemoryStore"],"sourceRoot":"../../../src","sources":["e2ee/store.ts"],"mappings":";;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAQA,MAAMC,SAAS,GAAG,QAAQ;AAEnB,SAASC,WAAWA,CAACC,KAAc,EAAU;EAClD,OAAOC,IAAI,CAACC,SAA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O,EAAE,MAAAA,CAAOL,GAAG,EAAEjB,KAAK,KAAK,KAAK0B,IAAI,CAACL,GAAG,CAACJ,GAAG,EAAEjB,KAAK,CAAC;IACxDwB,UAAU,EAAE,MAAOP,GAAG,IAAK,KAAKS,IAAI,CAACH,MAAM,CAACN,GAAG;EACjD,CAAC;AACH;AAEO,SAASW,iBAAiBA,CAACf,GAAG,GAAG,QAAQ,EAAc;EAC5D,OAAOF,WAAW,CAACc,mBAAmB,CAAC,CAAC,EAAEZ,GAAG,CAAC;AAChD","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.accountNameOf = void 0;
|
|
7
|
+
const accountNameOf = (user, appId) => {
|
|
8
|
+
for (const raw of [user?.xmppUsername, user?.userJID, user?.id, user?._id]) {
|
|
9
|
+
const value = String(raw || '').split('@')[0].trim();
|
|
10
|
+
if (!value) {
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
if (value.includes('_')) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
if (appId) {
|
|
17
|
+
return `${appId}_${value}`;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return '';
|
|
21
|
+
};
|
|
22
|
+
exports.accountNameOf = accountNameOf;
|
|
23
|
+
//# sourceMappingURL=accountName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["accountNameOf","user","appId","raw","xmppUsername","userJID","id","_id","value","String","split","trim","includes","exports"],"sourceRoot":"../../../src","sources":["helpers/accountName.ts"],"mappings":";;;;;;AAAO,MAAMA,aAAa,GAAGA,CAC3BC,IAGa,EACbC,KAAa,KACF;EACX,KAAK,MAAMC,GAAG,IAAI,CAACF,IAAI,EAAEG,YAAY,EAAEH,IAAI,EAAEI,OAAO,EAAEJ,IAAI,EAAEK,EAAE,EAAEL,IAAI,EAAEM,GAAG,CAAC,EAAE;IAC1E,MAAMC,KAAK,GAAGC,MAAM,CAACN,GAAG,IAAI,EAAE,CAAC,CAACO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAEC,IAAI,CAAC,CAAC;IACrD,IAAI,CAACH,KAAK,EAAE;MAAC;IAAS;IACtB,IAAIA,KAAK,CAACI,QAAQ,CAAC,GAAG,CAAC,EAAE;MAAC,OAAOJ,KAAK;IAAC;IACvC,IAAIN,KAAK,EAAE;MAAC,OAAO,GAAGA,KAAK,IAAIM,KAAK,EAAE;IAAC;EACzC;EACA,OAAO,EAAE;AACX,CAAC;AAACK,OAAA,CAAAb,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -14,6 +14,7 @@ var _ManageDataModal = _interopRequireDefault(require("../../components/Modals/S
|
|
|
14
14
|
var _ProfileShares = _interopRequireDefault(require("../../components/Modals/SettingsModals/ProfileShares/ProfileShares"));
|
|
15
15
|
var _Referrals = _interopRequireDefault(require("../../components/Modals/SettingsModals/Referrals/Referrals"));
|
|
16
16
|
var _VisibilityModal = _interopRequireDefault(require("../../components/Modals/SettingsModals/Visibility/VisibilityModal"));
|
|
17
|
+
var _ChangePasswordModal = _interopRequireDefault(require("../../components/Modals/SettingsModals/ChangePassword/ChangePasswordModal"));
|
|
17
18
|
var _UserProfileModal = _interopRequireDefault(require("../../components/Modals/UserProfileModal/UserProfileModal"));
|
|
18
19
|
var _UserSettingsModal = _interopRequireDefault(require("../../components/Modals/UserSettingsModal/UserSettingsModal"));
|
|
19
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -29,6 +30,7 @@ const MODAL_COMPONENTS = exports.MODAL_COMPONENTS = {
|
|
|
29
30
|
[_MODAL_TYPES.MODAL_TYPES.CHAT_PROFILE]: _ChatProfileModal.default,
|
|
30
31
|
[_MODAL_TYPES.MODAL_TYPES.MANAGE_DATA]: _ManageDataModal.default,
|
|
31
32
|
[_MODAL_TYPES.MODAL_TYPES.VISIBILITY]: _VisibilityModal.default,
|
|
33
|
+
[_MODAL_TYPES.MODAL_TYPES.CHANGE_PASSWORD]: _ChangePasswordModal.default,
|
|
32
34
|
[_MODAL_TYPES.MODAL_TYPES.REFERRALS]: _Referrals.default,
|
|
33
35
|
[_MODAL_TYPES.MODAL_TYPES.DOCUMENT_SHARES]: _DocumentSharesModal.default,
|
|
34
36
|
[_MODAL_TYPES.MODAL_TYPES.PROFILE_SHARES]: _ProfileShares.default,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_MODAL_TYPES","require","_ChatProfileModal","_interopRequireDefault","_FilePreviewModal","_NewChatModal","_BlockedUsersModal","_DocumentSharesModal","_ManageDataModal","_ProfileShares","_Referrals","_VisibilityModal","_UserProfileModal","_UserSettingsModal","e","__esModule","default","MODAL_COMPONENTS","exports","MODAL_TYPES","SETTINGS","UserSettingsModal","NEW_CHAT","NewChatModal","PROFILE","UserProfileModal","CHAT_PROFILE","ChatProfileModal","MANAGE_DATA","ManageDataModal","VISIBILITY","VisibilityModal","REFERRALS","ReferralsModal","DOCUMENT_SHARES","DocumentSharesModal","PROFILE_SHARES","ProfileSharesModal","BLOCKED_USERS","BlockedUsersModal","FILE_PREVIEW","FilePreviewModal"],"sourceRoot":"../../../../src","sources":["helpers/constants/MODAL_COMPONENTS.tsx"],"mappings":";;;;;;AAMA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,aAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,kBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,oBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,gBAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,cAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,UAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,gBAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,
|
|
1
|
+
{"version":3,"names":["_MODAL_TYPES","require","_ChatProfileModal","_interopRequireDefault","_FilePreviewModal","_NewChatModal","_BlockedUsersModal","_DocumentSharesModal","_ManageDataModal","_ProfileShares","_Referrals","_VisibilityModal","_ChangePasswordModal","_UserProfileModal","_UserSettingsModal","e","__esModule","default","MODAL_COMPONENTS","exports","MODAL_TYPES","SETTINGS","UserSettingsModal","NEW_CHAT","NewChatModal","PROFILE","UserProfileModal","CHAT_PROFILE","ChatProfileModal","MANAGE_DATA","ManageDataModal","VISIBILITY","VisibilityModal","CHANGE_PASSWORD","ChangePasswordModal","REFERRALS","ReferralsModal","DOCUMENT_SHARES","DocumentSharesModal","PROFILE_SHARES","ProfileSharesModal","BLOCKED_USERS","BlockedUsersModal","FILE_PREVIEW","FilePreviewModal"],"sourceRoot":"../../../../src","sources":["helpers/constants/MODAL_COMPONENTS.tsx"],"mappings":";;;;;;AAMA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,aAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,kBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,oBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,gBAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,cAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,UAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,gBAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,oBAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,iBAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,kBAAA,GAAAX,sBAAA,CAAAF,OAAA;AAA4F,SAAAE,uBAAAY,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAlB5F;AACA;AACA;AACA;;AAiBO,MAAMG,gBAGZ,GAAAC,OAAA,CAAAD,gBAAA,GAAG;EACF,CAACE,wBAAW,CAACC,QAAQ,GAAGC,0BAAiB;EACzC,CAACF,wBAAW,CAACG,QAAQ,GAAGC,qBAAY;EACpC,CAACJ,wBAAW,CAACK,OAAO,GAAGC,yBAAgB;EACvC,CAACN,wBAAW,CAACO,YAAY,GAAGC,yBAAgB;EAC5C,CAACR,wBAAW,CAACS,WAAW,GAAGC,wBAAe;EAC1C,CAACV,wBAAW,CAACW,UAAU,GAAGC,wBAAe;EACzC,CAACZ,wBAAW,CAACa,eAAe,GAAGC,4BAAmB;EAClD,CAACd,wBAAW,CAACe,SAAS,GAAGC,kBAAc;EACvC,CAAChB,wBAAW,CAACiB,eAAe,GAAGC,4BAAmB;EAClD,CAAClB,wBAAW,CAACmB,cAAc,GAAGC,sBAAkB;EAChD,CAACpB,wBAAW,CAACqB,aAAa,GAAGC,0BAAiB;EAC9C,CAACtB,wBAAW,CAACuB,YAAY,GAAGC;AAC9B,CAAC","ignoreList":[]}
|
|
@@ -21,6 +21,7 @@ const MODAL_TYPES = exports.MODAL_TYPES = {
|
|
|
21
21
|
CHAT_PROFILE: 'chatprofile',
|
|
22
22
|
MANAGE_DATA: 'managedata',
|
|
23
23
|
VISIBILITY: 'visibility',
|
|
24
|
+
CHANGE_PASSWORD: 'change_password',
|
|
24
25
|
PROFILE_SHARES: 'profile_shares',
|
|
25
26
|
DOCUMENT_SHARES: 'document_shares',
|
|
26
27
|
BLOCKED_USERS: 'blocked_users',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MODAL_TYPES","exports","SETTINGS","PROFILE","CHAT_PROFILE","MANAGE_DATA","VISIBILITY","PROFILE_SHARES","DOCUMENT_SHARES","BLOCKED_USERS","REFERRALS","FILE_PREVIEW","NEW_CHAT"],"sourceRoot":"../../../../src","sources":["helpers/constants/MODAL_TYPES.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG;EACzBE,QAAQ,EAAE,UAAU;EACpBC,OAAO,EAAE,SAAS;EAClBC,YAAY,EAAE,aAAa;EAC3BC,WAAW,EAAE,YAAY;EACzBC,UAAU,EAAE,YAAY;
|
|
1
|
+
{"version":3,"names":["MODAL_TYPES","exports","SETTINGS","PROFILE","CHAT_PROFILE","MANAGE_DATA","VISIBILITY","CHANGE_PASSWORD","PROFILE_SHARES","DOCUMENT_SHARES","BLOCKED_USERS","REFERRALS","FILE_PREVIEW","NEW_CHAT"],"sourceRoot":"../../../../src","sources":["helpers/constants/MODAL_TYPES.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG;EACzBE,QAAQ,EAAE,UAAU;EACpBC,OAAO,EAAE,SAAS;EAClBC,YAAY,EAAE,aAAa;EAC3BC,WAAW,EAAE,YAAY;EACzBC,UAAU,EAAE,YAAY;EACxBC,eAAe,EAAE,iBAAiB;EAElCC,cAAc,EAAE,gBAAgB;EAChCC,eAAe,EAAE,iBAAiB;EAClCC,aAAa,EAAE,eAAe;EAE9BC,SAAS,EAAE,WAAW;EAEtBC,YAAY,EAAE,cAAc;EAE5BC,QAAQ,EAAE;AACZ,CAAC","ignoreList":[]}
|
|
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createMessageFromXml = void 0;
|
|
7
|
+
var _e2ee = require("../e2ee");
|
|
8
|
+
var _displayName = require("./displayName");
|
|
9
|
+
var _sealedBody = require("../e2ee/sealedBody");
|
|
7
10
|
/**
|
|
8
11
|
* Build an IMessage from XML.
|
|
9
12
|
*
|
|
@@ -81,11 +84,14 @@ const createMessageFromXml = async (arg, bodyEl, positionalId, positionalFrom, p
|
|
|
81
84
|
// Synthesize user.name from sender attrs (web reads usersSet from
|
|
82
85
|
// redux in <Message>; we fix it once at the source so Avatar /
|
|
83
86
|
// MessageHeader render the actual sender instead of "??").
|
|
84
|
-
const firstName = (merged.senderFirstName || '').toString().trim();
|
|
85
|
-
const lastName = (merged.senderLastName || '').toString().trim();
|
|
87
|
+
const firstName = (merged.senderFirstName || merged.firstName || '').toString().trim();
|
|
88
|
+
const lastName = (merged.senderLastName || merged.lastName || '').toString().trim();
|
|
86
89
|
const fullName = (merged.fullName || '').toString().trim();
|
|
87
90
|
const senderJID = (merged.senderJID || '').toString();
|
|
88
|
-
const
|
|
91
|
+
const senderBare = senderJID.split('/')[0] || '';
|
|
92
|
+
const senderResource = senderJID.includes('/') ? senderJID.split('/')[1] || '' : '';
|
|
93
|
+
const senderIsOccupant = !!senderResource && (senderBare === String(merged.roomJid || '') || /@conference\./i.test(senderBare));
|
|
94
|
+
const senderLocal = senderIsOccupant ? senderResource : senderBare.includes('@') ? senderBare.split('@')[0] : senderBare;
|
|
89
95
|
|
|
90
96
|
// Bug #41 root cause: the resource of the MUC `from` (room@conference/
|
|
91
97
|
// occupant-id) is the SAME field getDataFromXml uses to derive
|
|
@@ -104,11 +110,20 @@ const createMessageFromXml = async (arg, bodyEl, positionalId, positionalFrom, p
|
|
|
104
110
|
// the "official" fetch lands.
|
|
105
111
|
const xmppFrom = (merged.xmppFrom || '').toString();
|
|
106
112
|
const fromResource = xmppFrom.includes('/') ? xmppFrom.split('/')[1] : '';
|
|
107
|
-
const composed =
|
|
113
|
+
const composed = (0, _displayName.composeName)(firstName, lastName);
|
|
108
114
|
const existingName = String(merged?.user?.name || '').trim();
|
|
109
115
|
const resolvedName = existingName || composed || fullName || senderLocal || merged?.user?.id || '';
|
|
116
|
+
const unencrypted = merged.omemoEncrypted !== 'true' && (0, _e2ee.isE2eeRoom)(String(merged.roomJid || ''));
|
|
117
|
+
const sealedKeys = merged.clientEncrypted === 'true' ? (0, _sealedBody.parseSealedMediaBody)(merged.body) : undefined;
|
|
110
118
|
const message = {
|
|
111
119
|
...merged,
|
|
120
|
+
...(unencrypted ? {
|
|
121
|
+
unencrypted: true
|
|
122
|
+
} : {}),
|
|
123
|
+
...(sealedKeys ? {
|
|
124
|
+
e2eeKeys: sealedKeys,
|
|
125
|
+
body: 'media'
|
|
126
|
+
} : {}),
|
|
112
127
|
user: {
|
|
113
128
|
...(merged.user || {}),
|
|
114
129
|
id: merged?.user?.id || fromResource || senderLocal,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createMessageFromXml","arg","bodyEl","positionalId","positionalFrom","positionalDeleted","console","log","id","body","date","user","name","roomJid","isPositional","undefined","inner","outerExtras","bodyText","getText","text","split","xmppFrom","deleted","data","merged","isDeleted","numericPart","exec","String","Date","slice","toISOString","now","firstName","senderFirstName","toString","trim","lastName","senderLastName","fullName","senderJID","
|
|
1
|
+
{"version":3,"names":["_e2ee","require","_displayName","_sealedBody","createMessageFromXml","arg","bodyEl","positionalId","positionalFrom","positionalDeleted","console","log","id","body","date","user","name","roomJid","isPositional","undefined","inner","outerExtras","bodyText","getText","text","split","xmppFrom","deleted","data","merged","isDeleted","numericPart","exec","String","Date","slice","toISOString","now","firstName","senderFirstName","toString","trim","lastName","senderLastName","fullName","senderJID","senderBare","senderResource","includes","senderIsOccupant","test","senderLocal","fromResource","composed","composeName","existingName","resolvedName","unencrypted","omemoEncrypted","isE2eeRoom","sealedKeys","clientEncrypted","parseSealedMediaBody","message","e2eeKeys","exports"],"sourceRoot":"../../../src","sources":["helpers/createMessageFromXml.ts"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAA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AM,CAAC6B,cAAc,KAAK,MAAM,IAAI,IAAAC,gBAAU,EAAC1B,MAAM,CAACJ,MAAM,CAACZ,OAAO,IAAI,EAAE,CAAC,CAAC;EAE9E,MAAM2C,UAAU,GACd/B,MAAM,CAACgC,eAAe,KAAK,MAAM,GAC7B,IAAAC,gCAAoB,EAACjC,MAAM,CAAChB,IAAI,CAAC,GACjCM,SAAS;EAEf,MAAM4C,OAAiB,GAAG;IACxB,GAAGlC,MAAM;IACT,IAAI4B,WAAW,GAAG;MAAEA,WAAW,EAAE;IAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7C,IAAIG,UAAU,GAAG;MAAEI,QAAQ,EAAEJ,UAAU;MAAE/C,IAAI,EAAE;IAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9DE,IAAI,EAAE;MACJ,IAAIc,MAAM,CAACd,IAAI,IAAI,CAAC,CAAC,CAAC;MACtBH,EAAE,EAAEiB,MAAM,EAAEd,IAAI,EAAEH,EAAE,IAAIwC,YAAY,IAAID,WAAW;MACnDnC,IAAI,EAAEwC,YAAY;MAClBlB,SAAS,EAAEA,SAAS,IAAIT,MAAM,EAAEd,IAAI,EAAEuB,SAAS;MAC/CI,QAAQ,EAAEA,QAAQ,IAAIb,MAAM,EAAEd,IAAI,EAAE2B;IACtC;EACF,CAAC;EAED,OAAOqB,OAAO;AAChB,CAAC;AAACE,OAAA,CAAA7D,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.resolveSenderDisplayName = exports.createUserNameFromSetUser = void 0;
|
|
7
|
+
var _displayName = require("./displayName");
|
|
7
8
|
/**
|
|
8
9
|
* Cache-only lookup. Returns the literal "Deleted User" as a MISS sentinel
|
|
9
10
|
* when `usersSet` has no entry for `userId` yet, callers that want a
|
|
@@ -21,7 +22,7 @@ const createUserNameFromSetUser = (usersSet, userId) => {
|
|
|
21
22
|
// members (no REST match yet) carry just the roster `name` attr —
|
|
22
23
|
// fall back to that before giving up and returning the raw id.
|
|
23
24
|
const bareName = user.name?.trim() || '';
|
|
24
|
-
return
|
|
25
|
+
return (0, _displayName.composeName)(firstName, lastName) || bareName || userId;
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createUserNameFromSetUser","usersSet","userId","user","firstName","trim","lastName","bareName","name","exports","resolveSenderDisplayName","message","rawUserId","String","id","localUserId","split","currentNameRaw","currentName","dataFullName","fullName","dataFirst","senderFirstName","dataLast","senderLastName","composedFromData","usersSetName","usersSetNameAlt","isUsersSetUseful"],"sourceRoot":"../../../src","sources":["helpers/createUserNameFromSetUser.ts"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,
|
|
1
|
+
{"version":3,"names":["_displayName","require","createUserNameFromSetUser","usersSet","userId","user","firstName","trim","lastName","bareName","name","composeName","exports","resolveSenderDisplayName","message","rawUserId","String","id","localUserId","split","currentNameRaw","currentName","dataFullName","fullName","dataFirst","senderFirstName","dataLast","senderLastName","composedFromData","usersSetName","usersSetNameAlt","isUsersSetUseful"],"sourceRoot":"../../../src","sources":["helpers/createUserNameFromSetUser.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,yBAAyB,GAAGA,CACvCC,QAAoC,EACpCC,MAAc,KACH;EACX,MAAMC,IAAI,GAAGF,QAAQ,CAACC,MAAM,CAAC;EAE7B,IAAI,CAACC,IAAI,EAAE;IAAC,OAAO,cAAc;EAAC;EAElC,MAAMC,SAAS,GAAGD,IAAI,CAACC,SAAS,EAAEC,IAAI,CAAC,CAAC,IAAI,EAAE;EAC9C,MAAMC,QAAQ,GAAGH,IAAI,CAACG,QAAQ,EAAED,IAAI,CAAC,CAAC,IAAI,EAAE;EAC5C;EACA;EACA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AC;EACrE,MAAMY,eAAe,GAAG5B,yBAAyB,CAACC,QAAQ,EAAEY,SAAS,CAAC;EACtE,MAAMgB,gBAAgB,GAAIrB,IAAY,IAAK,CAAC,CAACA,IAAI,IAAIA,IAAI,KAAK,cAAc;EAE5E,OACEW,WAAW,IACVU,gBAAgB,CAACF,YAAY,CAAC,IAAIA,YAAa,IAC/CE,gBAAgB,CAACD,eAAe,CAAC,IAAIA,eAAgB,IACtDF,gBAAgB,IAChBV,WAAW,IACXH,SAAS,IACT,cAAc;AAElB,CAAC;AAACH,OAAA,CAAAC,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.composeName = void 0;
|
|
7
|
+
const composeName = (first, last) => {
|
|
8
|
+
const f = String(first ?? '').trim();
|
|
9
|
+
const l = String(last ?? '').trim();
|
|
10
|
+
if (f && f.includes('@') && f.toLowerCase() === l.toLowerCase()) {
|
|
11
|
+
return f;
|
|
12
|
+
}
|
|
13
|
+
return `${f} ${l}`.trim();
|
|
14
|
+
};
|
|
15
|
+
exports.composeName = composeName;
|
|
16
|
+
//# sourceMappingURL=displayName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["composeName","first","last","f","String","trim","l","includes","toLowerCase","exports"],"sourceRoot":"../../../src","sources":["helpers/displayName.ts"],"mappings":";;;;;;AAAO,MAAMA,WAAW,GAAGA,CACzBC,KAAqB,EACrBC,IAAoB,KACT;EACX,MAAMC,CAAC,GAAGC,MAAM,CAACH,KAAK,IAAI,EAAE,CAAC,CAACI,IAAI,CAAC,CAAC;EACpC,MAAMC,CAAC,GAAGF,MAAM,CAACF,IAAI,IAAI,EAAE,CAAC,CAACG,IAAI,CAAC,CAAC;EACnC,IAAIF,CAAC,IAAIA,CAAC,CAACI,QAAQ,CAAC,GAAG,CAAC,IAAIJ,CAAC,CAACK,WAAW,CAAC,CAAC,KAAKF,CAAC,CAACE,WAAW,CAAC,CAAC,EAAE;IAAC,OAAOL,CAAC;EAAC;EAC3E,OAAO,GAAGA,CAAC,IAAIG,CAAC,EAAE,CAACD,IAAI,CAAC,CAAC;AAC3B,CAAC;AAACI,OAAA,CAAAT,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.__resetPersistCryptoKeyForTests = void 0;
|
|
7
7
|
exports.decryptFromPersist = decryptFromPersist;
|
|
8
8
|
exports.encryptForPersist = encryptForPersist;
|
|
9
|
+
exports.isPersistKeyKept = isPersistKeyKept;
|
|
9
10
|
var _cryptoJs = _interopRequireDefault(require("crypto-js"));
|
|
10
11
|
var _secureKeyValue = require("./secureKeyValue");
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -66,6 +67,10 @@ const loadOrCreateKey = () => {
|
|
|
66
67
|
})();
|
|
67
68
|
return cachedKeyPromise;
|
|
68
69
|
};
|
|
70
|
+
async function isPersistKeyKept() {
|
|
71
|
+
const key = await loadOrCreateKey();
|
|
72
|
+
return (await (0, _secureKeyValue.secureGet)(CIPHER_KEY_STORE_KEY)) === _cryptoJs.default.enc.Base64.stringify(key);
|
|
73
|
+
}
|
|
69
74
|
|
|
70
75
|
/** Encrypt a JSON-serialisable payload for storage. Returns the string to persist. */
|
|
71
76
|
async function encryptForPersist(plaintext) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_cryptoJs","_interopRequireDefault","require","_secureKeyValue","e","__esModule","default","CIPHER_KEY_STORE_KEY","ENVELOPE_VERSION","KEY_BYTES","IV_BYTES","randomWordArray","byteLength","bytes","Uint8Array","global","crypto","getRandomValues","words","i","length","push","CryptoJS","lib","WordArray","create","cachedKeyPromise","loadOrCreateKey","existing","secureGet","enc","Base64","parse","key","secureSet","stringify","encryptForPersist","plaintext","iv","encrypted","AES","encrypt","mode","CBC","padding","pad","Pkcs7","envelope","v","ct","ciphertext","toString","JSON","decryptFromPersist","stored","decrypted","decrypt","Utf8","__resetPersistCryptoKeyForTests","exports"],"sourceRoot":"../../../src","sources":["helpers/persistCrypto.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_cryptoJs","_interopRequireDefault","require","_secureKeyValue","e","__esModule","default","CIPHER_KEY_STORE_KEY","ENVELOPE_VERSION","KEY_BYTES","IV_BYTES","randomWordArray","byteLength","bytes","Uint8Array","global","crypto","getRandomValues","words","i","length","push","CryptoJS","lib","WordArray","create","cachedKeyPromise","loadOrCreateKey","existing","secureGet","enc","Base64","parse","key","secureSet","stringify","isPersistKeyKept","encryptForPersist","plaintext","iv","encrypted","AES","encrypt","mode","CBC","padding","pad","Pkcs7","envelope","v","ct","ciphertext","toString","JSON","decryptFromPersist","stored","decrypted","decrypt","Utf8","__resetPersistCryptoKeyForTests","exports"],"sourceRoot":"../../../src","sources":["helpers/persistCrypto.ts"],"mappings":";;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAAwD,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,oBAAoB,GAAG,2BAA2B;AACxD,MAAMC,gBAAgB,GAAG,CAAC;AAC1B,MAAMC,SAAS,GAAG,EAAE,CAAC,CAAC;AACtB,MAAMC,QAAQ,GAAG,EAAE,CAAC,CAAC;;AAQrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAIC,UAAkB,IAA6B;EACtE,MAAMC,KAAK,GAAG,IAAIC,UAAU,CAACF,UAAU,CAAC;EACvCG,MAAM,CAASC,M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MN,eAAe,CAAC,CAAC;IACnC,MAAMY,EAAE,GAAGjB,iBAAQ,CAACQ,GAAG,CAACC,MAAM,CAACC,KAAK,CAACgB,QAAQ,CAACT,EAAE,CAAC;IACjD,MAAMY,UAAU,GAAG7B,iBAAQ,CAACQ,GAAG,CAACC,MAAM,CAACC,KAAK,CAACgB,QAAQ,CAACE,EAAE,CAAC;IACzD,MAAMM,SAAS,GAAGlC,iBAAQ,CAACmB,GAAG,CAACgB,OAAO,CACpC;MAAEN;IAAW,CAAC,EACdlB,GAAG,EACH;MAAEM,EAAE;MAAEI,IAAI,EAAErB,iBAAQ,CAACqB,IAAI,CAACC,GAAG;MAAEC,OAAO,EAAEvB,iBAAQ,CAACwB,GAAG,CAACC;IAAM,CAC7D,CAAC;IACD,MAAMT,SAAS,GAAGkB,SAAS,CAACJ,QAAQ,CAAC9B,iBAAQ,CAACQ,GAAG,CAAC4B,IAAI,CAAC;IACvD,OAAOpB,SAAS,IAAI,IAAI;EAC1B,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF;;AAEA;AACO,MAAMqB,+BAA+B,GAAGA,CAAA,KAAY;EACzDjC,gBAAgB,GAAG,IAAI;AACzB,CAAC;AAACkC,OAAA,CAAAD,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_asyncStorage","_interopRequireDefault","require","e","__esModule","default","KEY","loadPreferences","raw","AsyncStorage","getItem","JSON","parse","exports","savePreferences","patch","current","setItem","stringify","error","console","warn","clearPreferences","removeItem"],"sourceRoot":"../../../src","sources":["helpers/preferencesStorage.ts"],"mappings":";;;;;;AAEA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAqE,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAFrE;;AAKA,MAAMG,GAAG,GAAG,qBAAqB;;AAEjC;;
|
|
1
|
+
{"version":3,"names":["_asyncStorage","_interopRequireDefault","require","e","__esModule","default","KEY","loadPreferences","raw","AsyncStorage","getItem","JSON","parse","exports","savePreferences","patch","current","setItem","stringify","error","console","warn","clearPreferences","removeItem"],"sourceRoot":"../../../src","sources":["helpers/preferencesStorage.ts"],"mappings":";;;;;;AAEA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAqE,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAFrE;;AAKA,MAAMG,GAAG,GAAG,qBAAqB;;AAEjC;;AAUO,MAAMC,eAAe,GAAG,MAAAA,CAAA,KAAwC;EACrE,IAAI;IACF,MAAMC,GAAG,GAAG,MAAMC,qBAAY,CAACC,OAAO,CAACJ,GAAG,CAAC;IAC3C,OAAOE,GAAG,GAAIG,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC,GAAyB,CAAC,CAAC;EAC1D,CAAC,CAAC,MAAM;IACN,OAAO,CAAC,CAAC;EACX;AACF,CAAC;AAACK,OAAA,CAAAN,eAAA,GAAAA,eAAA;AAEK,MAAMO,eAAe,GAAG,MAC7BC,KAAwB,IACN;EAClB,IAAI;IACF,MAAMC,OAAO,GAAG,MAAMT,eAAe,CAAC,CAAC;IACvC,MAAME,qBAAY,CAACQ,OAAO,CAACX,GAAG,EAAEK,IAAI,CAACO,SAAS,CAAC;MAAE,GAAGF,OAAO;MAAE,GAAGD;IAAM,CAAC,CAAC,CAAC;EAC3E,CAAC,CAAC,OAAOI,KAAK,EAAE;IACdC,OAAO,CAACC,IAAI,CAAC,2BAA2B,EAAEF,KAAK,CAAC;EAClD;AACF,CAAC;AAACN,OAAA,CAAAC,eAAA,GAAAA,eAAA;AAEK,MAAMQ,gBAAgB,GAAG,MAAAA,CAAA,KAA2B;EACzD,IAAI;IACF,MAAMb,qBAAY,CAACc,UAAU,CAACjB,GAAG,CAAC;EACpC,CAAC,CAAC,MAAM;IACN;EAAA;AAEJ,CAAC;AAACO,OAAA,CAAAS,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.__resetSecureKeyValueWarningForTests = void 0;
|
|
7
7
|
exports.secureGet = secureGet;
|
|
8
|
+
exports.secureGetOrCreate = secureGetOrCreate;
|
|
8
9
|
exports.secureRemove = secureRemove;
|
|
9
10
|
exports.secureSet = secureSet;
|
|
10
11
|
var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
|
|
@@ -74,6 +75,25 @@ async function secureRemove(key) {
|
|
|
74
75
|
}
|
|
75
76
|
await _asyncStorage.default.removeItem(FALLBACK_PREFIX + key).catch(() => undefined);
|
|
76
77
|
}
|
|
78
|
+
async function secureGetOrCreate(key, create) {
|
|
79
|
+
const existing = await secureGet(key);
|
|
80
|
+
if (existing) {
|
|
81
|
+
return {
|
|
82
|
+
value: existing,
|
|
83
|
+
created: false
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const value = create();
|
|
87
|
+
await secureSet(key, value);
|
|
88
|
+
if ((await secureGet(key)) !== value) {
|
|
89
|
+
(0, _devLogger.pushLog)('warn', `secureStore: ${key} was not kept`);
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
value,
|
|
94
|
+
created: true
|
|
95
|
+
};
|
|
96
|
+
}
|
|
77
97
|
|
|
78
98
|
/** Test seam only. */
|
|
79
99
|
const __resetSecureKeyValueWarningForTests = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_asyncStorage","_interopRequireDefault","require","_secureStoreRuntime","_devLogger","e","__esModule","default","FALLBACK_PREFIX","warnedFallback","warnFallbackOnce","pushLog","secureGet","key","store","loadSecureStore","getItemAsync","AsyncStorage","getItem","secureSet","value","setItemAsync","removeItem","catch","undefined","setItem","secureRemove","deleteItemAsync","__resetSecureKeyValueWarningForTests","exports"],"sourceRoot":"../../../src","sources":["helpers/secureKeyValue.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_asyncStorage","_interopRequireDefault","require","_secureStoreRuntime","_devLogger","e","__esModule","default","FALLBACK_PREFIX","warnedFallback","warnFallbackOnce","pushLog","secureGet","key","store","loadSecureStore","getItemAsync","AsyncStorage","getItem","secureSet","value","setItemAsync","removeItem","catch","undefined","setItem","secureRemove","deleteItemAsync","secureGetOrCreate","create","existing","created","__resetSecureKeyValueWarningForTests","exports"],"sourceRoot":"../../../src","sources":["helpers/secureKeyValue.ts"],"mappings":";;;;;;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAA6C,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE7C;AACA;AACA;AACA;AACA,MAAMG,eAAe,GAAG,0BAA0B;AAElD,IAAIC,cAAc,GAAG,KAAK;AAC1B,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;EAC7B,IAAID,cAAc,EAAE;IAAC;EAAO;EAC5BA,cAAc,GAAG,IAAI;EACrB,IAAAE,kBAAO,EACL,MAAM,EACN,6DAA6D,GAC3D,gEAAgE,GAChE,mEAAmE,GACnE,mEAAmE,GACnE,yBACJ,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,SAASA,CAACC,GAAW,EAA0B;EACnE,MAAMC,KAAK,GAAG,IAAAC,mCAAe,EAAC,CAAC;EAC/B,IAAID,KAAK,EAAE;IACT,IAAI;MACF,OAAO,MAAMA,KAAK,CAACE,YAAY,CAACH,GAAG,CAAC;IACtC,CAAC,CAAC,OAAOR,CAAC,EAAE;MACV,IAAAM,kBAAO,EAAC,MAAM,EAAE,6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