Фикс бесконечного обмена ключами
This commit is contained in:
@@ -301,17 +301,23 @@ export function CallProvider(props : CallProviderProps) {
|
||||
return;
|
||||
}
|
||||
|
||||
const computedSharedSecret = nacl.box.before(Buffer.from(sharedPublic, 'hex'), keys.secretKey);
|
||||
sharedSecretRef.current = Buffer.from(computedSharedSecret).toString('hex');
|
||||
info("Generated shared secret for call session: " + sharedSecretRef.current);
|
||||
setCallState(CallState.WEB_RTC_EXCHANGE);
|
||||
|
||||
if(roleRef.current == CallRole.CALLER){
|
||||
/**
|
||||
* Вызывающий уже отправил ключ
|
||||
*/
|
||||
return;
|
||||
}
|
||||
const signalPacket = new PacketSignalPeer();
|
||||
signalPacket.setSrc(publicKey);
|
||||
signalPacket.setDst(activeCall);
|
||||
signalPacket.setSignalType(SignalType.KEY_EXCHANGE);
|
||||
signalPacket.setSharedPublic(Buffer.from(keys.publicKey).toString('hex'));
|
||||
send(signalPacket);
|
||||
|
||||
const computedSharedSecret = nacl.box.before(Buffer.from(sharedPublic, 'hex'), keys.secretKey);
|
||||
sharedSecretRef.current = Buffer.from(computedSharedSecret).toString('hex');
|
||||
info("Generated shared secret for call session: " + sharedSecretRef.current);
|
||||
setCallState(CallState.WEB_RTC_EXCHANGE);
|
||||
}
|
||||
if(signalType == SignalType.ACCEPT){
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user