Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32168935
D12077.1765055674.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D12077.1765055674.diff
View Options
diff --git a/lib/handlers/db-ops-handler.react.js b/lib/handlers/db-ops-handler.react.js
--- a/lib/handlers/db-ops-handler.react.js
+++ b/lib/handlers/db-ops-handler.react.js
@@ -11,6 +11,8 @@
peerToPeerMessageTypes,
} from '../types/tunnelbroker/peer-to-peer-message-types.js';
import { getConfig } from '../utils/config.js';
+import { getContentSigningKey } from '../utils/crypto-utils.js';
+import { getMessageForException } from '../utils/errors.js';
import { useDispatch, useSelector } from '../utils/redux-utils.js';
type Props = {
@@ -41,16 +43,26 @@
type: opsProcessingFinishedActionType,
});
if (messageSourceMetadata) {
- const { messageID, senderDeviceID } = messageSourceMetadata;
- const message: MessageProcessed = {
- type: peerToPeerMessageTypes.MESSAGE_PROCESSED,
- messageID,
- };
- await sendMessage({
- deviceID: senderDeviceID,
- payload: JSON.stringify(message),
- });
- await sqliteAPI.removeInboundP2PMessages([messageID]);
+ try {
+ const { messageID, senderDeviceID } = messageSourceMetadata;
+ const deviceID = await getContentSigningKey();
+ const message: MessageProcessed = {
+ type: peerToPeerMessageTypes.MESSAGE_PROCESSED,
+ messageID,
+ deviceID,
+ };
+ await sendMessage({
+ deviceID: senderDeviceID,
+ payload: JSON.stringify(message),
+ });
+ await sqliteAPI.removeInboundP2PMessages([messageID]);
+ } catch (e) {
+ console.log(
+ `Error while sending confirmation: ${
+ getMessageForException(e) ?? 'unknown error'
+ }`,
+ );
+ }
}
})();
}, [queueFront, dispatch, processDBStoreOperations, sendMessage, sqliteAPI]);
diff --git a/lib/types/tunnelbroker/peer-to-peer-message-types.js b/lib/types/tunnelbroker/peer-to-peer-message-types.js
--- a/lib/types/tunnelbroker/peer-to-peer-message-types.js
+++ b/lib/types/tunnelbroker/peer-to-peer-message-types.js
@@ -91,11 +91,13 @@
export type MessageProcessed = {
+type: 'MessageProcessed',
+messageID: string,
+ +deviceID: string,
};
export const messageProcessedValidator: TInterface<MessageProcessed> =
tShape<MessageProcessed>({
type: tString(peerToPeerMessageTypes.MESSAGE_PROCESSED),
messageID: t.String,
+ deviceID: t.String,
});
export type PeerToPeerMessage =
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 6, 9:14 PM (2 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5840647
Default Alt Text
D12077.1765055674.diff (2 KB)
Attached To
Mode
D12077: [lib] add `deviceID` prop to Tunnelbroker's `MessageProcessed`
Attached
Detach File
Event Timeline
Log In to Comment