Spaces:
Running
Running
Download socket/handlers/e2ee.js from 4send/messenger: direct link, hf CLI and curl.
- Browser
- Download file 818 Bytes
-
https://huggingface.co/spaces/4send/messenger/resolve/main/socket/handlers/e2ee.js
- Command line
-
hf download hf://spaces/4send/messenger/socket/handlers/e2ee.js
-
curl -L -o e2ee.js https://huggingface.co/spaces/4send/messenger/resolve/main/socket/handlers/e2ee.js
818 Bytes
| const { getIO } = require('../io'); | |
| const handleE2EEInit = (socket, data) => { | |
| const from = socket.username ? socket.username.toLowerCase() : null; | |
| if (!from || !data || !data.to) return; | |
| const target = data.to.toLowerCase(); | |
| const io = getIO(); | |
| io.to(target).emit('e2ee_init', { from }); | |
| }; | |
| const handleE2EEAccept = (socket, data) => { | |
| const from = socket.username ? socket.username.toLowerCase() : null; | |
| if (!from || !data || !data.to) return; | |
| const target = data.to.toLowerCase(); | |
| const io = getIO(); | |
| io.to(target).emit('e2ee_accept', { | |
| from, | |
| identityKey: data.identityKey, | |
| ephemeralKey: data.ephemeralKey, | |
| usedKeyId: data.usedKeyId, | |
| ciphertext: data.ciphertext, | |
| }); | |
| }; | |
| module.exports = { handleE2EEInit, handleE2EEAccept }; |