From 1bbcd1008a09595a3caa761ba3242d8749a17ada Mon Sep 17 00:00:00 2001 From: Toshit Chawda Date: Sat, 21 Dec 2024 15:48:16 -0800 Subject: [PATCH] random uuid --- src/auth.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/auth.ts b/src/auth.ts index da2421f..22d6a8e 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -19,6 +19,15 @@ export interface CapeInfo extends AccessoryInfo { alias: string; } +// https://github.com/MercuryWorkshop/epoxy-tls/blob/7ce772da7de828d61b26e13a51ae1c32a8ff913d/client/src/utils/js.rs#L19-L24 +function randomUUID() { + return ( + /* @ts-ignore */ + [1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, + c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16) + ); +} + async function xboxAuth(msToken: string): Promise { const res = await fetch("https://user.auth.xboxlive.com/user/authenticate", { headers: {