WIP: Refactor and polyfill updates

- Add crypto polyfill for Expo
- Update daemon client and websocket server
- Simplify codex agent tests
This commit is contained in:
Mohamed Boudra
2026-01-13 11:06:21 +07:00
parent 868f9fb571
commit 2fa7ec17cb
11 changed files with 94 additions and 73 deletions
+24
View File
@@ -0,0 +1,24 @@
import * as ExpoCrypto from "expo-crypto";
declare global {
interface Crypto {
randomUUID(): `${string}-${string}-${string}-${string}-${string}`;
}
}
export function polyfillCrypto(): void {
if (typeof globalThis.crypto === "undefined") {
(globalThis as any).crypto = {};
}
if (typeof globalThis.crypto.randomUUID !== "function") {
globalThis.crypto.randomUUID = () =>
ExpoCrypto.randomUUID() as `${string}-${string}-${string}-${string}-${string}`;
}
if (typeof globalThis.crypto.getRandomValues !== "function") {
globalThis.crypto.getRandomValues = <T extends ArrayBufferView>(array: T): T => {
return ExpoCrypto.getRandomValues(array as any) as T;
};
}
}