Files
discord-decomp/sources/modules/rtc/SecureFramesVerifiedStore.tsx
T
2026-07-27 16:20:00 +03:00

355 lines
14 KiB
TypeScript

/* Metro module 9257; source: modules/rtc/SecureFramesVerifiedStore.tsx; dependencies: [6, 7, 15, 17, 18, 1226, 4294, 4395, 9258, 9259, 661, 9275, 4285, 4406, 566, 694, 2] */
function _fun72309(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#72309, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9442:6, offset: 0x01d42290, size: 569 bytes, params: 8, frame: 22
const env0_0 = require;
const _arrayLikeToArray_72315 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const closure = SECURE_FRAMES_TRANSIENT_KEY_CREATE;
const closure2 = CONNECTION_OPEN_72320;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(6) /* metro dependency 6 */;
const env0_3 = importDefault(7) /* metro dependency 7 */;
const env0_4 = importDefault(15) /* metro dependency 15 */;
const env0_5 = importDefault(17) /* metro dependency 17 */;
const env0_6 = importDefault(18) /* metro dependency 18 */;
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
const rtcConnectionStore = importDefault(4294) /* metro dependency 4294: RTCConnectionStore */;
const streamRTCConnectionStore = importDefault(4395) /* metro dependency 4395: StreamRTCConnectionStore */;
const transientKeyStore = importDefault(9258) /* metro dependency 9258: TransientKeyStore */;
const verifiedKeyStore = importDefault(9259) /* metro dependency 9259: VerifiedKeyStore */;
const env0_12 = (require(661) /* metro dependency 661: Constants */).RTCConnectionStates;
let Map = global.Map;
let map = new Map();
Map = global.Map;
map = new Map();
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
_fun72321(Store).displayName = 'SecureFramesVerifiedStore';
map = new map(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: closure2,
VOICE_CHANNEL_SELECT: VOICE_CHANNEL_SELECT_72327, RTC_CONNECTION_STATE: RTC_CONNECTION_STATE_72328,
RTC_CONNECTION_ROSTER_MAP_UPDATE: RTC_CONNECTION_ROSTER_MAP_UPDATE, SECURE_FRAMES_TRANSIENT_KEY_CREATE: closure,
SECURE_FRAMES_TRANSIENT_KEY_DELETE: closure, SECURE_FRAMES_VERIFIED_KEY_CREATE: closure,
SECURE_FRAMES_VERIFIED_KEY_DELETE: closure, SECURE_FRAMES_USER_VERIFIED_KEYS_DELETE: closure});
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/rtc/SecureFramesVerifiedStore.tsx');
exports.default = map;
}
function _isNativeReflectConstruct_72310() { // fn#72310, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9442:232, offset: 0x01d424c9, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_72310_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _createForOfIteratorHelperLoose_72313(a0, a1) { // fn#72313, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9442:425, offset: 0x01d4252b, size: 372 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun72314;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_72315(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_72315(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_72315(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun72314;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
}
function computeStreamVerifications() { // fn#72316, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9442:1371, offset: 0x01d4269f, size: 42 bytes, params: 1, frame: 13
return StreamRTCConnectionStore.getAllActiveStreamKeys().reduce(_fun72317, false);
}
function computeCallVerification() { // fn#72318, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9442:1564, offset: 0x01d4273c, size: 155 bytes, params: 1, frame: 19
var r1;
var r3;
var Set;
var prototype;
var value3;
var set;
var value4;
var value9;
var binding;
var get;
var value10;
var value11;
var value12;
const userIds = RTCConnectionStore.getUserIds();
reducibleJoin2: while (true) {
if (userIds != null) {
r1 = userIds;
break reducibleJoin2;
}
Set = global.Set;
prototype = Set.prototype;
value3 = Object.create(prototype, {constructor: {value: Set}});
set = new Set();
value4 = set instanceof Object ? set : value3;
r1 = value4;
break reducibleJoin2;
}
const id = AuthenticationStore.getId();
const value6 = _createForOfIteratorHelperLoose_72313(r1);
const value7 = value6();
let done = value7.done;
const value8 = true;
if (done) {
r1 = value8;
} else {
r3 = value7;
reducibleLoop3: while (true) {
value9 = r3.value;
if (id !== value9) {
binding = env0_13;
get = binding.get;
value10 = Reflect.apply(get, binding, [value9]);
value11 = false;
reducibleJoin5: while (true) {
if (value8 !== value10) {
r1 = value11;
break reducibleLoop3;
}
break reducibleJoin5;
}
}
value12 = value6();
done = value12.done;
if (done) {
r1 = value8;
break reducibleLoop3;
}
r3 = value12;
continue reducibleLoop3;
}
}
return r1 !== env0_15;
}
function SECURE_FRAMES_TRANSIENT_KEY_CREATE({userId}) { // fn#72319, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9442:1794, offset: 0x01d427d7, size: 256 bytes, params: 2, frame: 17
var r5;
var r0;
var uint8Array;
var moduleValue;
var binding;
var value8;
const getId = AuthenticationStore.getId;
if (Reflect.apply(getId, AuthenticationStore, []) === userId) {
return false;
}
const secureFramesRosterMapEntry = RTCConnectionStore.getSecureFramesRosterMapEntry(userId);
if (secureFramesRosterMapEntry == null) {
r0 = false;
} else {
uint8Array = new global.Uint8Array(secureFramesRosterMapEntry);
r5 = VerifiedKeyStore.isKeyVerified(userId, uint8Array) || TransientKeyStore.isKeyVerified(userId, uint8Array);
moduleValue = require(9275) /* metro dependency 9275: SecureFramesUtils */;
r5 = r5 && !moduleValue.getIsSecureFramesKeyInconsistent(userId, [RTCConnectionStore,
StreamRTCConnectionStore]);
binding = env0_13;
value8 = r5 !== binding.get(userId);
binding = env0_13;
binding.set(userId, r5);
r0 = value8;
}
const streamVerifications = computeStreamVerifications();
const callVerification = computeCallVerification();
r0 = !r0 ? streamVerifications : r0;
r0 = !r0 ? callVerification : r0;
return r0;
}
function CONNECTION_OPEN_72320() { // fn#72320, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9442:2205, offset: 0x01d428d7, size: 41 bytes, params: 1, frame: 10
env0_13.clear();
env0_14.clear();
}
function _fun72321(a0) { // fn#72321, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9442:2259, offset: 0x01d42900, size: 153 bytes, params: 2, frame: 16
const closure = SecureFramesVerifiedStore;
env0_6(closure, a0);
return env0_3(closure, [{key: 'initialize', value: function() {
this.waitFor(AuthenticationStore, RTCConnectionStore, StreamRTCConnectionStore, TransientKeyStore,
VerifiedKeyStore);
}}, {key: 'isCallVerified', value: value_72324}, {key: 'isStreamVerified', value: value_72325},
{key: 'isUserVerified', value: value_72326}]);
}
function VOICE_CHANNEL_SELECT_72327({channelId}) { // fn#72327, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9442:2951, offset: 0x01d429c4, size: 39 bytes, params: 2, frame: 10
if (channelId === env0_16) {
return false;
}
CONNECTION_OPEN_72320();
}
function RTC_CONNECTION_STATE_72328({streamKey, state, context}) { // fn#72328, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9442:3058, offset: 0x01d429eb, size: 154 bytes, params: 2, frame: 15
var r0;
var value2;
const DISCONNECTED = RTCConnectionStates.DISCONNECTED;
if (state !== DISCONNECTED) {
return false;
}
const MediaEngineContextTypes = (require(4406) /* metro dependency 4406: mediaEngine */).MediaEngineContextTypes;
const STREAM = MediaEngineContextTypes.STREAM;
if (STREAM === context) {
value2 = streamKey != null;
if (value2) {
env0_14.delete(streamKey);
r0 = computeCallVerification();
} else {
r0 = value2;
}
return r0;
}
const DEFAULT = MediaEngineContextTypes.DEFAULT;
if (DEFAULT === context) {
CONNECTION_OPEN_72320();
}
}
function RTC_CONNECTION_ROSTER_MAP_UPDATE({userIds}) { // fn#72329, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9442:3364, offset: 0x01d42a85, size: 85 bytes, params: 2, frame: 14
const env0_0 = AuthenticationStore.getId();
const value2 = userIds.reduce(_fun72330, false);
const streamVerifications = computeStreamVerifications();
const callVerification = computeCallVerification();
let r0 = value2 || streamVerifications;
r0 = !r0 ? callVerification : r0;
return r0;
}
function _fun72317(a0, a1) { // fn#72317, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9442:1451, offset: 0x01d426c9, size: 115 bytes, params: 3, frame: 15
const value = a0;
const streamKeyUtilsModule = require(4285) /* metro dependency 4285: StreamKeyUtils */;
const ownerId = streamKeyUtilsModule.decodeStreamKey(a1).ownerId;
let binding = env1_13;
let get = binding.get;
const value4 = Reflect.apply(get, binding, [ownerId]) === true;
binding = env1_14;
get = binding.get;
const value5 = Reflect.apply(get, binding, [a1]) !== value4;
env1_14.set(a1, value4);
return value5 ? !!value5 : value;
}
function _fun72330(a0, a1) { // fn#72330, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9442:3435, offset: 0x01d42ada, size: 57 bytes, params: 3, frame: 13
var r0;
var value3;
var value4;
const value = a0;
if (env0_0 === a1) {
r0 = value;
} else {
value3 = environment.__proto__;
value4 = SECURE_FRAMES_TRANSIENT_KEY_CREATE({userId: a1});
r0 = value4 ? !!value4 : value;
}
return r0;
}