86 lines
4.1 KiB
TypeScript
86 lines
4.1 KiB
TypeScript
/* Metro module 4232; source: utils/PurchaseTokenUtils.tsx; dependencies: [5, 672, 587, 491, 2] */
|
|
import Module00005 from '../by-id/module-00005.js'; /* Metro dependency 5 */
|
|
import Durations from './Durations.tsx'; /* Metro dependency 672 */
|
|
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as StorageModule from '../external/discord_common/js/packages/storage/Storage.tsx'; /* Metro dependency 587 */
|
|
|
|
function _fun34937(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#34937, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4403:6, offset: 0x0106667f, size: 179 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const getPurchaseToken2 = getPurchaseToken;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const Millis = (Durations).Millis;
|
|
const DAY = Millis.DAY;
|
|
const env0_4 = 60 * DAY;
|
|
(FileImportTrackerModule).fileFinishedImporting('utils/PurchaseTokenUtils.tsx');
|
|
exports.getPurchaseToken = getPurchaseToken2;
|
|
exports.getPurchaseTokenHash = function() {
|
|
return _getPurchaseTokenHash.apply(this, arguments);
|
|
};
|
|
function getPurchaseToken() { // fn#34938, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4403:149, offset: 0x01066732, size: 185 bytes, params: 1, frame: 18
|
|
var Date;
|
|
var value3;
|
|
var set;
|
|
var binding;
|
|
var object;
|
|
const Storage = (StorageModule).Storage;
|
|
const value2 = Storage.get(env0_3);
|
|
if (value2 == null) {
|
|
value3 = (require(491) /* metro dependency 491 */).v4();
|
|
set = Storage.set;
|
|
binding = env0_3;
|
|
object = {purchaseToken: value3};
|
|
object.expires = global.Date.now() + env0_4;
|
|
} else {
|
|
var expires = value2.expires;
|
|
Date = global.Date;
|
|
if (expires >= Date.now()) {
|
|
return value2.purchaseToken;
|
|
}
|
|
value3 = (require(491) /* metro dependency 491 */).v4();
|
|
set = Storage.set;
|
|
binding = env0_3;
|
|
object = {purchaseToken: value3};
|
|
Date = global.Date;
|
|
object.expires = Date.now() + env0_4;
|
|
}
|
|
Reflect.apply(set, Storage, [binding, object]);
|
|
return value3;
|
|
}
|
|
|
|
function _getPurchaseTokenHash() { // fn#34939, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4403:353, offset: 0x010667eb, size: 48 bytes, params: 1, frame: 14
|
|
return Module00005(_fun34941).apply(this, arguments);
|
|
function* _fun34941() { // fn#34941, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4403:418, offset: 0x01066824, size: 223 bytes, params: 1, frame: 19
|
|
var environment;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
let Uint8Array = global.Uint8Array;
|
|
value = environment.__proto__.__proto__;
|
|
value = env2_5();
|
|
value = value.split('');
|
|
value = value.map(function(a0) {
|
|
return a0.charCodeAt(0);
|
|
});
|
|
let uint8Array = new Uint8Array(value);
|
|
const subtle = global.window.crypto.subtle;
|
|
yield subtle.digest({name: 'SHA-256'}, uint8Array);
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
const btoa = global.btoa;
|
|
const String = global.String;
|
|
const fromCharCode = String.fromCharCode;
|
|
Uint8Array = global.Uint8Array;
|
|
uint8Array = new Uint8Array(uint8Array);
|
|
items2 = [];
|
|
arraySpread(items2, uint8Array, 0, undefined);
|
|
return btoa(apply(fromCharCode, items2, String, undefined));
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun34937, 4232, [5, 672, 587, 491, 2]) /* metro module 4232, dependencies: [5, 672, 587, 491, 2] */;
|