mirror of
https://github.com/fromchat-messenger/web.git
synced 2026-09-22 19:15:08 +03:00
Start the implementation
This commit is contained in:
@@ -2,7 +2,7 @@ import { useAppState } from "@/pages/chat/state";
|
||||
import * as WebRTC from "@/core/calls/webrtc";
|
||||
import { CallSignalingHandler } from "@/core/calls/signaling";
|
||||
import { setCallSignalingHandler } from "@/core/websocket";
|
||||
import { generateCallSessionKey, generateCallEmojis, createCallSessionKeyFromHash } from "@/core/calls/encryption";
|
||||
import { generateCallSessionKey, generateCallEmojis } from "@/core/calls/encryption";
|
||||
import { createRef, useEffect } from "react";
|
||||
|
||||
// Global audio ref shared across all instances
|
||||
@@ -25,7 +25,15 @@ export default function useAudioCall() {
|
||||
state.receiveCall(userId, username);
|
||||
},
|
||||
endCall,
|
||||
setCallSessionKeyHash
|
||||
setCallSessionKeyHash,
|
||||
setRemoteVideoEnabled: (enabled: boolean) => {
|
||||
const state = useAppState.getState();
|
||||
state.setRemoteVideoEnabled(enabled);
|
||||
},
|
||||
setRemoteScreenSharing: (enabled: boolean) => {
|
||||
const state = useAppState.getState();
|
||||
state.setRemoteScreenSharing(enabled);
|
||||
}
|
||||
}));
|
||||
setCallSignalingHandler(signalingHandler);
|
||||
|
||||
@@ -207,12 +215,12 @@ export default function useAudioCall() {
|
||||
|
||||
async function handleCallSessionKey(sessionKeyHash: string) {
|
||||
try {
|
||||
// Create session key from the hash provided by the caller
|
||||
const sessionKey = await createCallSessionKeyFromHash(sessionKeyHash);
|
||||
const emojis = generateCallEmojis(sessionKey.hash);
|
||||
setCallEncryption(sessionKey.hash, emojis);
|
||||
// Just generate and display the emojis from the hash
|
||||
// The actual session key will arrive via the wrapped key mechanism
|
||||
const emojis = generateCallEmojis(sessionKeyHash);
|
||||
setCallEncryption(sessionKeyHash, emojis);
|
||||
} catch (error) {
|
||||
console.error("Failed to create call session key from hash:", error);
|
||||
console.error("Failed to generate call emojis from hash:", error);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user