390 lines
18 KiB
TypeScript
390 lines
18 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] */
|
|
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
|
|
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
|
|
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
|
|
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
|
|
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
|
|
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
|
|
import RTCConnectionStore from '../../stores/RTCConnectionStore.tsx'; /* Metro dependency 4294 */
|
|
import StreamRTCConnectionStore from '../../stores/StreamRTCConnectionStore.tsx'; /* Metro dependency 4395 */
|
|
import TransientKeyStore from './TransientKeyStore.tsx'; /* Metro dependency 9258 */
|
|
import VerifiedKeyStore from './VerifiedKeyStore.tsx'; /* Metro dependency 9259 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as StreamKeyUtilsModule from '../go_live/utils/StreamKeyUtils.tsx'; /* Metro dependency 4285 */
|
|
import * as MediaEngineModule from '../../external/discord_common/js/packages/media-engine/index.tsx'; /* Metro dependency 4406 */
|
|
|
|
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 SECURE_FRAMES_TRANSIENT_KEY_CREATE2 = SECURE_FRAMES_TRANSIENT_KEY_CREATE;
|
|
const CONNECTION_OPEN_723202 = CONNECTION_OPEN_72320;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let Map = global.Map;
|
|
let map = new Map();
|
|
Map = global.Map;
|
|
map = new Map();
|
|
const Store = (Flux).Store;
|
|
_fun72321(Store).displayName = 'SecureFramesVerifiedStore';
|
|
map = new map(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: CONNECTION_OPEN_723202,
|
|
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: SECURE_FRAMES_TRANSIENT_KEY_CREATE2,
|
|
SECURE_FRAMES_TRANSIENT_KEY_DELETE: SECURE_FRAMES_TRANSIENT_KEY_CREATE2,
|
|
SECURE_FRAMES_VERIFIED_KEY_CREATE: SECURE_FRAMES_TRANSIENT_KEY_CREATE2,
|
|
SECURE_FRAMES_VERIFIED_KEY_DELETE: SECURE_FRAMES_TRANSIENT_KEY_CREATE2,
|
|
SECURE_FRAMES_USER_VERIFIED_KEYS_DELETE: SECURE_FRAMES_TRANSIENT_KEY_CREATE2});
|
|
(FileImportTrackerModule).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 _fun72314() { // fn#72314, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9442:996, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
|
|
return env0_1 >= env0_0.length ? {done: true} : {done: false,
|
|
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
|
|
}
|
|
|
|
}
|
|
|
|
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 _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 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 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 authenticationStoreBinding = AuthenticationStore;
|
|
const getId = authenticationStoreBinding.getId;
|
|
if (Reflect.apply(getId, authenticationStoreBinding, []) === 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 SecureFramesVerifiedStore2 = SecureFramesVerifiedStore;
|
|
Inherits(SecureFramesVerifiedStore2, a0);
|
|
return CreateClass(SecureFramesVerifiedStore2, [{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 SecureFramesVerifiedStore() { // fn#72322, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9442:2271, offset: 0x010992b7, size: 113 bytes, params: 1, frame: 20
|
|
const value = environment.__proto__;
|
|
env1_2(this, SecureFramesVerifiedStore);
|
|
const value3 = env1_5(SecureFramesVerifiedStore);
|
|
return env1_4(this, _isNativeReflectConstruct_72310() ? global.Reflect.construct(value3, arguments,
|
|
env1_5(this).constructor) : value3.apply(this, arguments));
|
|
}
|
|
|
|
function value_72324() { // fn#72324, offset: 0x00df0e8b, size: 9 bytes, params: 1, frame: 1
|
|
return env1_15;
|
|
}
|
|
|
|
function value_72325(a0) { // fn#72325, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9442:2731, offset: 0x01192701, size: 22 bytes, params: 2, frame: 11
|
|
return env1_14.get(a0);
|
|
}
|
|
|
|
function value_72326(a0) { // fn#72326, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9442:2789, offset: 0x011926eb, size: 22 bytes, params: 2, frame: 11
|
|
return env1_13.get(a0);
|
|
}
|
|
|
|
}
|
|
|
|
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 = (MediaEngineModule).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 _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;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun72309, 9257, [6, 7, 15, 17, 18, 1226, 4294, 4395, 9258, 9259, 661, 9275, 4285, 4406, 566, 694,
|
|
2]) /* metro module 9257, dependencies: [6, 7, 15, 17, 18, 1226, 4294, 4395, 9258, 9259, 661, 9275, 4285, 4406, 566, 694, 2] */;
|