Реализация сигналинга и обмена ключами

This commit is contained in:
RoyceDa
2026-03-02 18:53:15 +02:00
parent 7a89a3a307
commit e06d58facf
3 changed files with 10 additions and 27 deletions

View File

@@ -26,6 +26,7 @@ export interface CallContextValue {
export enum CallState {
CONNECTING,
KEY_EXCHANGE,
WEB_RTC_EXCHANGE,
ACTIVE,
ENDED,
INCOMING
@@ -128,28 +129,6 @@ export function CallProvider(props : CallProviderProps) {
info("Generated shared secret for call session: " + Buffer.from(computedSharedSecret).toString('hex'));
setSharedSecret(Buffer.from(computedSharedSecret).toString('hex'));
}
if(signalType == SignalType.OFFER){
const offerJson = packet.getOffer();
if(!offerJson || !peerConnectionRef.current){
info("Received offer but peer connection is not ready");
return;
}
handleOffer(offerJson);
}
if(signalType == SignalType.ANSWER){
const answerJson = packet.getAnswer();
if(!answerJson || !peerConnectionRef.current){
info("Received answer but peer connection is not ready");
return;
}
handleAnswer(answerJson);
}
if(signalType == SignalType.ACTIVE_CALL) {
setCallState(CallState.ACTIVE);
}
}, [activeCall, sessionKeys]);
const generateSessionKeys = () => {