decord/alpha/source/modules/rtc/SecureFramesVerifiedStore.tsx

176 lines
5.7 KiB
TypeScript
Raw Normal View History

2026-10-09 10:00:15 +00:00
// Module ID: 8791
// Function ID: 8792
// Name: SecureFramesVerifiedStore
2026-10-09 10:00:15 +00:00
// Dependencies: [502, 5109, 7428, 8792, 8793, 1085, 8809, 5897, 5136, 504, 584, 2]
2026-07-21 06:55:02 +00:00
2026-10-09 10:00:15 +00:00
// Module 8791 (SecureFramesVerifiedStore)
2026-10-03 08:58:59 +00:00
import get_initializedDefault from "get initialized" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 584 */;
import Constants from "Constants" /* 1085 */;
2026-10-09 10:00:15 +00:00
import BaseConnectionEvent from "BaseConnectionEvent" /* 5136 */;
import SecureFramesUtils from "SecureFramesUtils" /* 8809 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
2026-10-09 10:00:15 +00:00
import RTCConnectionStore from "RTCConnectionStore" /* 5109 */;
import StreamRTCConnectionStore from "StreamRTCConnectionStore" /* 7428 */;
import TransientKeyStore from "TransientKeyStore" /* 8792 */;
import VerifiedKeyStore from "VerifiedKeyStore" /* 8793 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-09 10:00:15 +00:00
const f99218 = (acc, item) => {
2026-10-03 08:58:59 +00:00
const obj = closure_0(dependencyMap[7]);
const tmp = true === map.get(obj.decodeStreamKey(item).ownerId);
const value = map1.get(item);
const result = map1.set(item, tmp);
return value !== tmp || acc;
};
2026-07-20 16:05:17 +00:00
function computeCallVerification() {
let userIds = RTCConnectionStore.getUserIds();
2026-07-29 08:29:29 +00:00
if (userIds == null) {
2026-07-20 16:05:17 +00:00
const _Set = Set;
2026-10-03 08:58:59 +00:00
const self = this;
const self2 = this;
2026-07-20 16:05:17 +00:00
userIds = new Set();
}
let flag = true;
2026-07-29 08:29:29 +00:00
for (const item10020 of userIds) {
2026-10-03 08:58:59 +00:00
if (tmp3 !== item10020) {
if (true !== map.get(tmp4)) {
2026-07-20 16:05:17 +00:00
flag = false;
2026-07-29 08:29:29 +00:00
obj.return();
break;
2026-07-20 16:05:17 +00:00
}
c10 = flag;
return flag !== c10;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
}
function handleUserUpdate(userId) {
userId = userId.userId;
if (AuthenticationStore.getId() === userId) {
2026-07-20 16:05:17 +00:00
return false;
} else {
const secureFramesRosterMapEntry = RTCConnectionStore.getSecureFramesRosterMapEntry(userId);
2026-07-20 16:05:17 +00:00
let flag = false;
2026-10-03 08:58:59 +00:00
const tmp17 = RTCConnectionStore;
2026-07-20 16:05:17 +00:00
if (null != secureFramesRosterMapEntry) {
const _Uint8Array = Uint8Array;
2026-10-03 08:58:59 +00:00
const self = this;
const self2 = this;
2026-07-20 16:05:17 +00:00
const uint8Array = new Uint8Array(secureFramesRosterMapEntry);
2026-10-03 08:58:59 +00:00
let isKeyVerifiedResult = VerifiedKeyStore.isKeyVerified(userId, uint8Array) || TransientKeyStore.isKeyVerified(userId, uint8Array);
const items = [tmp17, StreamRTCConnectionStore];
const obj = SecureFramesUtils;
2026-07-20 16:05:17 +00:00
if (isKeyVerifiedResult) {
isKeyVerifiedResult = !obj.getIsSecureFramesKeyInconsistent(userId, items);
}
flag = isKeyVerifiedResult !== map.get(userId);
const result = map.set(userId, isKeyVerifiedResult);
2026-07-29 08:29:29 +00:00
}
const allActiveStreamKeys = StreamRTCConnectionStore.getAllActiveStreamKeys();
2026-10-09 10:00:15 +00:00
const reduced = allActiveStreamKeys.reduce(f99218, false);
2026-10-03 08:58:59 +00:00
const tmp16 = computeCallVerification();
2026-07-20 16:05:17 +00:00
if (!flag) {
2026-07-29 08:29:29 +00:00
flag = reduced;
2026-07-20 16:05:17 +00:00
}
if (!flag) {
2026-10-03 08:58:59 +00:00
flag = tmp16;
2026-07-20 16:05:17 +00:00
}
return flag;
}
}
2026-10-03 08:58:59 +00:00
const RTCConnectionStates = Constants.RTCConnectionStates;
2026-07-20 16:05:17 +00:00
const map = new Map();
const map1 = new Map();
2026-07-29 08:29:29 +00:00
let c10 = false;
let channelId = null;
2026-10-03 08:58:59 +00:00
const Store = get_initializedDefault.Store;
2026-07-29 08:29:29 +00:00
class SecureFramesVerifiedStore extends Store {
2026-10-03 08:58:59 +00:00
initialize() {
this.waitFor(AuthenticationStore, RTCConnectionStore, StreamRTCConnectionStore, TransientKeyStore, VerifiedKeyStore);
}
isCallVerified() {
return c10;
}
isStreamVerified(streamKey) {
return map1.get(streamKey);
}
isUserVerified(userId) {
return map.get(userId);
}
2026-07-29 08:29:29 +00:00
}
const prototype = SecureFramesVerifiedStore.prototype;
SecureFramesVerifiedStore.displayName = "SecureFramesVerifiedStore";
2026-10-03 08:58:59 +00:00
let obj = {
2026-07-29 08:29:29 +00:00
CONNECTION_OPEN: function handleReset() {
map.clear();
map1.clear();
2026-08-24 06:08:38 +00:00
c10 = false;
2026-07-29 08:29:29 +00:00
},
2026-07-20 16:05:17 +00:00
VOICE_CHANNEL_SELECT: function handleVoiceChannelSelect(channelId) {
channelId = channelId.channelId;
2026-07-23 10:11:24 +00:00
if (channelId === channelId) {
2026-07-20 16:05:17 +00:00
return false;
} else {
2026-07-29 08:29:29 +00:00
map.clear();
map1.clear();
2026-08-24 06:08:38 +00:00
c10 = false;
2026-07-20 16:05:17 +00:00
}
},
RTC_CONNECTION_STATE: function handleRtcConnectionState(state) {
2026-10-03 08:58:59 +00:00
let context;
let streamKey;
2026-07-20 16:05:17 +00:00
({ streamKey, context } = state);
if (state.state !== RTCConnectionStates.DISCONNECTED) {
return false;
2026-07-29 08:29:29 +00:00
} else {
2026-10-03 08:58:59 +00:00
const tmp10 = require;
2026-08-24 06:08:38 +00:00
if (BaseConnectionEvent.MediaEngineContextTypes.STREAM === context) {
2026-07-29 08:29:29 +00:00
let tmp6 = null != streamKey;
if (tmp6) {
map1.delete(streamKey);
tmp6 = computeCallVerification();
}
return tmp6;
2026-10-09 10:00:15 +00:00
} else if (tmp10(5136).MediaEngineContextTypes.DEFAULT === context) {
2026-07-29 08:29:29 +00:00
map.clear();
map1.clear();
2026-08-24 06:08:38 +00:00
c10 = false;
2026-07-20 16:05:17 +00:00
}
}
},
RTC_CONNECTION_ROSTER_MAP_UPDATE: function handleBulkUserUpdate(userIds) {
2026-10-03 08:58:59 +00:00
let closure_0;
2026-07-20 16:05:17 +00:00
userIds = userIds.userIds;
const id = AuthenticationStore.getId();
let reduced = userIds.reduce((acc, userId) => {
let tmp = acc;
if (closure_0 !== userId) {
const obj = { userId };
tmp = handleUserUpdate(obj) || acc;
2026-10-03 08:58:59 +00:00
handleUserUpdate(obj) || acc;
2026-07-20 16:05:17 +00:00
}
return tmp;
}, false);
const allActiveStreamKeys = StreamRTCConnectionStore.getAllActiveStreamKeys();
2026-10-09 10:00:15 +00:00
const reduced1 = allActiveStreamKeys.reduce(f99218, false);
2026-10-03 08:58:59 +00:00
const tmp3 = computeCallVerification();
2026-07-20 16:05:17 +00:00
if (!reduced) {
2026-07-29 08:29:29 +00:00
reduced = reduced1;
2026-07-20 16:05:17 +00:00
}
if (!reduced) {
reduced = tmp3;
}
return reduced;
},
SECURE_FRAMES_TRANSIENT_KEY_CREATE: handleUserUpdate,
SECURE_FRAMES_TRANSIENT_KEY_DELETE: handleUserUpdate,
SECURE_FRAMES_VERIFIED_KEY_CREATE: handleUserUpdate,
SECURE_FRAMES_VERIFIED_KEY_DELETE: handleUserUpdate,
SECURE_FRAMES_USER_VERIFIED_KEYS_DELETE: handleUserUpdate
2026-10-03 08:58:59 +00:00
};
const secureFramesVerifiedStore = new SecureFramesVerifiedStore(DispatcherDefault, obj);
let result = size.fileFinishedImporting("modules/rtc/SecureFramesVerifiedStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default secureFramesVerifiedStore;