@openlv/react-native 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/polyfills.d.ts +1 -1
- package/dist/polyfills.js +1 -1
- package/dist/polyfills.js.map +1 -1
- package/dist/provider.js +3 -3
- package/dist/provider.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -10,5 +10,5 @@ export declare const SESSION_STATE: {
|
|
|
10
10
|
readonly DISCONNECTED: "disconnected";
|
|
11
11
|
};
|
|
12
12
|
type SessionModule = typeof import("@openlv/session");
|
|
13
|
-
export declare const createSession: (...
|
|
14
|
-
export declare const connectSession: (...
|
|
13
|
+
export declare const createSession: (...arguments_: Parameters<SessionModule["createSession"]>) => ReturnType<SessionModule["createSession"]>;
|
|
14
|
+
export declare const connectSession: (...arguments_: Parameters<SessionModule["connectSession"]>) => ReturnType<SessionModule["connectSession"]>;
|
package/dist/index.js
CHANGED
|
@@ -9,14 +9,14 @@ export const SESSION_STATE = {
|
|
|
9
9
|
CONNECTED: "connected",
|
|
10
10
|
DISCONNECTED: "disconnected",
|
|
11
11
|
};
|
|
12
|
-
export const createSession = async (...
|
|
12
|
+
export const createSession = async (...arguments_) => {
|
|
13
13
|
assertOpenLVReady({ requireCryptoReady: true });
|
|
14
|
-
const
|
|
15
|
-
return
|
|
14
|
+
const module_ = (await import("@openlv/session"));
|
|
15
|
+
return module_.createSession(...arguments_);
|
|
16
16
|
};
|
|
17
|
-
export const connectSession = async (...
|
|
17
|
+
export const connectSession = async (...arguments_) => {
|
|
18
18
|
assertOpenLVReady({ requireCryptoReady: true });
|
|
19
|
-
const
|
|
20
|
-
return
|
|
19
|
+
const module_ = (await import("@openlv/session"));
|
|
20
|
+
return module_.connectSession(...arguments_);
|
|
21
21
|
};
|
|
22
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EACL,qBAAqB,EAErB,iCAAiC,EACjC,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAA2B,MAAM,eAAe,CAAC;AACvE,OAAO,EACL,sBAAsB,GAEvB,MAAM,aAAa,CAAC;AAOrB,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,WAAW;IACtB,YAAY,EAAE,cAAc;CACpB,CAAC;AAIX,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAChC,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EACL,qBAAqB,EAErB,iCAAiC,EACjC,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAA2B,MAAM,eAAe,CAAC;AACvE,OAAO,EACL,sBAAsB,GAEvB,MAAM,aAAa,CAAC;AAOrB,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,WAAW;IACtB,YAAY,EAAE,cAAc;CACpB,CAAC;AAIX,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAChC,GAAG,UAAsD,EACb,EAAE;IAC9C,iBAAiB,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,CAAC,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAkB,CAAC;IAEnE,OAAO,OAAO,CAAC,aAAa,CAAC,GAAG,UAAU,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,GAAG,UAAuD,EACb,EAAE;IAC/C,iBAAiB,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,CAAC,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAkB,CAAC;IAEnE,OAAO,OAAO,CAAC,cAAc,CAAC,GAAG,UAAU,CAAC,CAAC;AAC/C,CAAC,CAAC","sourcesContent":["import { assertOpenLVReady } from \"./assert.js\";\n\nexport {\n ensureWebCryptoSubtle,\n type EnsureWebCryptoSubtleOptions,\n installOpenLVReactNativePolyfills,\n OpenLVCryptoPolyfill,\n} from \"./polyfills.js\";\nexport { OpenLVGlobals, type OpenLVGlobalsProps } from \"./provider.js\";\nexport {\n installWebRTCPolyfills,\n type InstallWebRTCPolyfillsOptions,\n} from \"./webrtc.js\";\nexport type {\n Session,\n SessionState,\n SessionStateObject,\n} from \"@openlv/session\";\n\nexport const SESSION_STATE = {\n CREATED: \"created\",\n SIGNALING: \"signaling\",\n READY: \"ready\",\n CONNECTED: \"connected\",\n DISCONNECTED: \"disconnected\",\n} as const;\n\ntype SessionModule = typeof import(\"@openlv/session\");\n\nexport const createSession = async (\n ...arguments_: Parameters<SessionModule[\"createSession\"]>\n): ReturnType<SessionModule[\"createSession\"]> => {\n assertOpenLVReady({ requireCryptoReady: true });\n const module_ = (await import(\"@openlv/session\")) as SessionModule;\n\n return module_.createSession(...arguments_);\n};\n\nexport const connectSession = async (\n ...arguments_: Parameters<SessionModule[\"connectSession\"]>\n): ReturnType<SessionModule[\"connectSession\"]> => {\n assertOpenLVReady({ requireCryptoReady: true });\n const module_ = (await import(\"@openlv/session\")) as SessionModule;\n\n return module_.connectSession(...arguments_);\n};\n"]}
|
package/dist/polyfills.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export type EnsureWebCryptoSubtleOptions = {
|
|
|
5
5
|
};
|
|
6
6
|
export declare const ensureWebCryptoSubtle: (options?: EnsureWebCryptoSubtleOptions) => Promise<void>;
|
|
7
7
|
export declare const installOpenLVReactNativePolyfills: () => void;
|
|
8
|
-
export declare const OpenLVCryptoPolyfill: (
|
|
8
|
+
export declare const OpenLVCryptoPolyfill: (properties?: Record<string, unknown>) => React.ReactElement;
|
package/dist/polyfills.js
CHANGED
|
@@ -123,5 +123,5 @@ export const installOpenLVReactNativePolyfills = () => {
|
|
|
123
123
|
installWebRTCPolyfills();
|
|
124
124
|
ensureMinimumGlobalsForSession();
|
|
125
125
|
};
|
|
126
|
-
export const OpenLVCryptoPolyfill = (
|
|
126
|
+
export const OpenLVCryptoPolyfill = (properties = {}) => React.createElement(PolyfillCrypto, properties);
|
|
127
127
|
//# sourceMappingURL=polyfills.js.map
|
package/dist/polyfills.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polyfills.js","sourceRoot":"","sources":["../src/polyfills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,cAAc,MAAM,6BAA6B,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAOrD,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,UAAgD,CAAC;AAEzE,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAE1D,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,GAAG,SAAS,EAAE,CAAC;IAEtB,MAAM,WAAW,GAAG,CAAC,CAAC,MAA6C,CAAC;IAEpE,OAAO,CAAC,CAAC,CAAC,MAAM,IAAI,WAAW,EAAE,MAAM,CAEZ,CAAC;AAC9B,CAAC,CAAC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eAAe,CAAC;IAC5D,CAAC;IAED,IAAI,CAAC,kBAAkB,EAAE,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,mIAAmI,CACpI,CAAC;IACJ,CAAC;IAED,sBAAsB,EAAE,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,EACxC,UAAwC,EAAE,EAC3B,EAAE;IACjB,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,KAAM,CAAC;IAC9C,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,EAAE,CAAC;IAEpD,IAAI,kBAAkB,EAAE,EAAE,CAAC;QACzB,oBAAoB,EAAE,CAAC;QAEvB,OAAO;IACT,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAEzB,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,SAAS,EAAE,CAAC;QACtC,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC;QAEtD,IAAI,kBAAkB,EAAE,EAAE,CAAC;YACzB,oBAAoB,EAAE,CAAC;YAEvB,OAAO;QACT,CAAC;IACH,CAAC;IAED,MAAM,IAAI,KAAK,CACb,8QAA8Q,CAC/Q,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAS,EAAE;IAC1D,sBAAsB,EAAE,CAAC;IACzB,8BAA8B,EAAE,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,QAAiC,EAAE,EACf,EAAE,CAAC,KAAK,CAAC,aAAa,CAC1C,cAA8D,EAC9D,KAAK,CACN,CAAC","sourcesContent":["import { decode as base64Decode, encode as base64Encode } from \"base-64\";\nimport * as React from \"react\";\nimport PolyfillCrypto from \"react-native-webview-crypto\";\n\nimport { installWebRTCPolyfills } from \"./webrtc.js\";\n\nexport type EnsureWebCryptoSubtleOptions = {\n timeoutMs?: number;\n pollIntervalMs?: number;\n};\n\nconst getGlobal = () => globalThis as unknown as Record<string, unknown>;\n\nconst CRYPTO_GRV_BACKUP_KEY = \"__openlvRnGetRandomValues\";\n\nconst getCrypto = () => {\n const g = getGlobal();\n\n const maybeWindow = g.window as undefined | Record<string, unknown>;\n\n return (g.crypto ?? maybeWindow?.crypto) as\n | undefined\n | Record<string, unknown>;\n};\n\nconst restoreUnifiedCrypto = () => {\n const g = getGlobal();\n\n const maybeWindow = g.window as undefined | Record<string, unknown>;\n const windowCrypto = maybeWindow?.crypto as\n | undefined\n | Record<string, unknown>;\n\n const globalCrypto = g.crypto as undefined | Record<string, unknown>;\n\n // Ensure `globalThis.crypto` exists (many libs only look here).\n if (!globalCrypto) {\n g.crypto = {};\n }\n\n const targetCrypto = g.crypto as Record<string, unknown>;\n\n // Restore getRandomValues if a previous value was captured before\n // another polyfill replaced globalThis.crypto.\n const backupGetRandomValues = g[CRYPTO_GRV_BACKUP_KEY];\n\n if (\n typeof targetCrypto.getRandomValues !== \"function\"\n && typeof backupGetRandomValues === \"function\"\n ) {\n targetCrypto.getRandomValues = backupGetRandomValues;\n }\n\n // If WebCrypto landed on window.crypto, copy `subtle` onto global crypto.\n if (\n targetCrypto.subtle === undefined\n && windowCrypto\n && windowCrypto.subtle !== undefined\n ) {\n targetCrypto.subtle = windowCrypto.subtle;\n }\n};\n\nconst hasWebCryptoSubtle = (): boolean => {\n const crypto = getCrypto();\n\n return !!crypto && crypto.subtle !== undefined;\n};\n\nconst hasGetRandomValues = (): boolean => {\n const crypto = getCrypto();\n\n return !!crypto && typeof crypto.getRandomValues === \"function\";\n};\n\nconst ensureAtobBtoa = () => {\n const g = getGlobal();\n\n if (g.btoa === undefined) {\n g.btoa = (input: string) => base64Encode(input);\n }\n\n if (g.atob === undefined) {\n g.atob = (input: string) => base64Decode(input);\n }\n};\n\nconst toHex = (b: number) => b.toString(16).padStart(2, \"0\");\nconst ensureCryptoRandomUUID = () => {\n const g = getGlobal();\n\n restoreUnifiedCrypto();\n\n const crypto = g.crypto as Record<string, unknown>;\n\n if (typeof crypto.randomUUID === \"function\") return;\n\n if (typeof crypto.getRandomValues !== \"function\") {\n throw new TypeError(\n \"@openlv/react-native: crypto.getRandomValues is missing. Add <OpenLVGlobals /> from '@openlv/react-native' somewhere in your app.\",\n );\n }\n\n crypto.randomUUID = () => {\n const bytes = new Uint8Array(16);\n\n (crypto.getRandomValues as (a: Uint8Array) => Uint8Array)(bytes);\n\n // RFC 4122 v4\n bytes[6] = (bytes[6] & 0x0F) | 0x40;\n bytes[8] = (bytes[8] & 0x3F) | 0x80;\n\n const hex = Array.from(bytes, toHex);\n\n return (\n hex.slice(0, 4).join(\"\")\n + \"-\"\n + hex.slice(4, 6).join(\"\")\n + \"-\"\n + hex.slice(6, 8).join(\"\")\n + \"-\"\n + hex.slice(8, 10).join(\"\")\n + \"-\"\n + hex.slice(10, 16).join(\"\")\n );\n };\n};\n\nconst ensureMinimumGlobalsForSession = () => {\n const g = getGlobal();\n\n if (g.URL === undefined) {\n throw new TypeError(\n \"@openlv/react-native: global URL is missing. Install a URL polyfill (e.g. 'react-native-url-polyfill') or use an environment that provides URL.\",\n );\n }\n\n if (\n g.TextEncoder === undefined\n || g.TextDecoder === undefined\n ) {\n throw new TypeError(\n \"@openlv/react-native: TextEncoder/TextDecoder are missing. Use Hermes/modern RN, or add a polyfill (e.g. 'fast-text-encoding').\",\n );\n }\n\n ensureAtobBtoa();\n\n // Capture getRandomValues once, so we can restore it later if another\n // polyfill overwrites `globalThis.crypto`.\n restoreUnifiedCrypto();\n const capturedCrypto = g.crypto as undefined | Record<string, unknown>;\n\n if (\n typeof g[CRYPTO_GRV_BACKUP_KEY] !== \"function\"\n && capturedCrypto\n && typeof capturedCrypto.getRandomValues === \"function\"\n ) {\n g[CRYPTO_GRV_BACKUP_KEY] = capturedCrypto.getRandomValues;\n }\n\n if (!hasGetRandomValues()) {\n throw new Error(\n \"@openlv/react-native: crypto.getRandomValues is missing. Add <OpenLVGlobals /> from '@openlv/react-native' somewhere in your app.\",\n );\n }\n\n ensureCryptoRandomUUID();\n};\n\nexport const ensureWebCryptoSubtle = async (\n options: EnsureWebCryptoSubtleOptions = {},\n): Promise<void> => {\n const timeoutMs = options.timeoutMs ?? 15_000;\n const pollIntervalMs = options.pollIntervalMs ?? 25;\n\n if (hasWebCryptoSubtle()) {\n restoreUnifiedCrypto();\n\n return;\n }\n\n const start = Date.now();\n\n while (Date.now() - start < timeoutMs) {\n await new Promise(r => setTimeout(r, pollIntervalMs));\n\n if (hasWebCryptoSubtle()) {\n restoreUnifiedCrypto();\n\n return;\n }\n }\n\n throw new Error(\n \"@openlv/react-native: WebCrypto is not ready (crypto.subtle missing). Add <OpenLVGlobals /> from '@openlv/react-native' somewhere in your app (or render <OpenLVCryptoPolyfill /> manually) and ensure 'react-native-webview' + 'react-native-webview-crypto' are installed.\",\n );\n};\n\nexport const installOpenLVReactNativePolyfills = (): void => {\n installWebRTCPolyfills();\n ensureMinimumGlobalsForSession();\n};\n\nexport const OpenLVCryptoPolyfill = (\n props: Record<string, unknown> = {},\n): React.ReactElement => React.createElement(\n PolyfillCrypto as React.ComponentType<Record<string, unknown>>,\n props,\n);\n"]}
|
|
1
|
+
{"version":3,"file":"polyfills.js","sourceRoot":"","sources":["../src/polyfills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,cAAc,MAAM,6BAA6B,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAOrD,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,UAAgD,CAAC;AAEzE,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAE1D,MAAM,SAAS,GAAG,GAAG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AAE,EACpB,EAAE,CAAC,KAAK,CAAC,aAAa,CAC1C,cAA8D,EAC9D,UAAU,CACX,CAAC","sourcesContent":["import { decode as base64Decode, encode as base64Encode } from \"base-64\";\nimport * as React from \"react\";\nimport PolyfillCrypto from \"react-native-webview-crypto\";\n\nimport { installWebRTCPolyfills } from \"./webrtc.js\";\n\nexport type EnsureWebCryptoSubtleOptions = {\n timeoutMs?: number;\n pollIntervalMs?: number;\n};\n\nconst getGlobal = () => globalThis as unknown as Record<string, unknown>;\n\nconst CRYPTO_GRV_BACKUP_KEY = \"__openlvRnGetRandomValues\";\n\nconst getCrypto = () => {\n const g = getGlobal();\n\n const maybeWindow = g.window as undefined | Record<string, unknown>;\n\n return (g.crypto ?? maybeWindow?.crypto) as\n | undefined\n | Record<string, unknown>;\n};\n\nconst restoreUnifiedCrypto = () => {\n const g = getGlobal();\n\n const maybeWindow = g.window as undefined | Record<string, unknown>;\n const windowCrypto = maybeWindow?.crypto as\n | undefined\n | Record<string, unknown>;\n\n const globalCrypto = g.crypto as undefined | Record<string, unknown>;\n\n // Ensure `globalThis.crypto` exists (many libs only look here).\n if (!globalCrypto) {\n g.crypto = {};\n }\n\n const targetCrypto = g.crypto as Record<string, unknown>;\n\n // Restore getRandomValues if a previous value was captured before\n // another polyfill replaced globalThis.crypto.\n const backupGetRandomValues = g[CRYPTO_GRV_BACKUP_KEY];\n\n if (\n typeof targetCrypto.getRandomValues !== \"function\"\n && typeof backupGetRandomValues === \"function\"\n ) {\n targetCrypto.getRandomValues = backupGetRandomValues;\n }\n\n // If WebCrypto landed on window.crypto, copy `subtle` onto global crypto.\n if (\n targetCrypto.subtle === undefined\n && windowCrypto\n && windowCrypto.subtle !== undefined\n ) {\n targetCrypto.subtle = windowCrypto.subtle;\n }\n};\n\nconst hasWebCryptoSubtle = (): boolean => {\n const crypto = getCrypto();\n\n return !!crypto && crypto.subtle !== undefined;\n};\n\nconst hasGetRandomValues = (): boolean => {\n const crypto = getCrypto();\n\n return !!crypto && typeof crypto.getRandomValues === \"function\";\n};\n\nconst ensureAtobBtoa = () => {\n const g = getGlobal();\n\n if (g.btoa === undefined) {\n g.btoa = (input: string) => base64Encode(input);\n }\n\n if (g.atob === undefined) {\n g.atob = (input: string) => base64Decode(input);\n }\n};\n\nconst toHex = (b: number) => b.toString(16).padStart(2, \"0\");\nconst ensureCryptoRandomUUID = () => {\n const g = getGlobal();\n\n restoreUnifiedCrypto();\n\n const crypto = g.crypto as Record<string, unknown>;\n\n if (typeof crypto.randomUUID === \"function\") return;\n\n if (typeof crypto.getRandomValues !== \"function\") {\n throw new TypeError(\n \"@openlv/react-native: crypto.getRandomValues is missing. Add <OpenLVGlobals /> from '@openlv/react-native' somewhere in your app.\",\n );\n }\n\n crypto.randomUUID = () => {\n const bytes = new Uint8Array(16);\n\n (crypto.getRandomValues as (a: Uint8Array) => Uint8Array)(bytes);\n\n // RFC 4122 v4\n bytes[6] = (bytes[6] & 0x0F) | 0x40;\n bytes[8] = (bytes[8] & 0x3F) | 0x80;\n\n const hex = Array.from(bytes, toHex);\n\n return (\n hex.slice(0, 4).join(\"\")\n + \"-\"\n + hex.slice(4, 6).join(\"\")\n + \"-\"\n + hex.slice(6, 8).join(\"\")\n + \"-\"\n + hex.slice(8, 10).join(\"\")\n + \"-\"\n + hex.slice(10, 16).join(\"\")\n );\n };\n};\n\nconst ensureMinimumGlobalsForSession = () => {\n const g = getGlobal();\n\n if (g.URL === undefined) {\n throw new TypeError(\n \"@openlv/react-native: global URL is missing. Install a URL polyfill (e.g. 'react-native-url-polyfill') or use an environment that provides URL.\",\n );\n }\n\n if (\n g.TextEncoder === undefined\n || g.TextDecoder === undefined\n ) {\n throw new TypeError(\n \"@openlv/react-native: TextEncoder/TextDecoder are missing. Use Hermes/modern RN, or add a polyfill (e.g. 'fast-text-encoding').\",\n );\n }\n\n ensureAtobBtoa();\n\n // Capture getRandomValues once, so we can restore it later if another\n // polyfill overwrites `globalThis.crypto`.\n restoreUnifiedCrypto();\n const capturedCrypto = g.crypto as undefined | Record<string, unknown>;\n\n if (\n typeof g[CRYPTO_GRV_BACKUP_KEY] !== \"function\"\n && capturedCrypto\n && typeof capturedCrypto.getRandomValues === \"function\"\n ) {\n g[CRYPTO_GRV_BACKUP_KEY] = capturedCrypto.getRandomValues;\n }\n\n if (!hasGetRandomValues()) {\n throw new Error(\n \"@openlv/react-native: crypto.getRandomValues is missing. Add <OpenLVGlobals /> from '@openlv/react-native' somewhere in your app.\",\n );\n }\n\n ensureCryptoRandomUUID();\n};\n\nexport const ensureWebCryptoSubtle = async (\n options: EnsureWebCryptoSubtleOptions = {},\n): Promise<void> => {\n const timeoutMs = options.timeoutMs ?? 15_000;\n const pollIntervalMs = options.pollIntervalMs ?? 25;\n\n if (hasWebCryptoSubtle()) {\n restoreUnifiedCrypto();\n\n return;\n }\n\n const start = Date.now();\n\n while (Date.now() - start < timeoutMs) {\n await new Promise(r => setTimeout(r, pollIntervalMs));\n\n if (hasWebCryptoSubtle()) {\n restoreUnifiedCrypto();\n\n return;\n }\n }\n\n throw new Error(\n \"@openlv/react-native: WebCrypto is not ready (crypto.subtle missing). Add <OpenLVGlobals /> from '@openlv/react-native' somewhere in your app (or render <OpenLVCryptoPolyfill /> manually) and ensure 'react-native-webview' + 'react-native-webview-crypto' are installed.\",\n );\n};\n\nexport const installOpenLVReactNativePolyfills = (): void => {\n installWebRTCPolyfills();\n ensureMinimumGlobalsForSession();\n};\n\nexport const OpenLVCryptoPolyfill = (\n properties: Record<string, unknown> = {},\n): React.ReactElement => React.createElement(\n PolyfillCrypto as React.ComponentType<Record<string, unknown>>,\n properties,\n);\n"]}
|
package/dist/provider.js
CHANGED
|
@@ -23,7 +23,7 @@ export const OpenLVGlobals = ({ cryptoTimeoutMs, } = {}) => {
|
|
|
23
23
|
// WebCrypto is delivered by the WebView polyfill, which becomes available
|
|
24
24
|
// asynchronously after the component mounts.
|
|
25
25
|
React.useEffect(() => {
|
|
26
|
-
let
|
|
26
|
+
let isCancelled = false;
|
|
27
27
|
(async () => {
|
|
28
28
|
try {
|
|
29
29
|
await ensureWebCryptoSubtle({ timeoutMs: cryptoTimeoutMs });
|
|
@@ -31,12 +31,12 @@ export const OpenLVGlobals = ({ cryptoTimeoutMs, } = {}) => {
|
|
|
31
31
|
g.__openlvRnCryptoReady = true;
|
|
32
32
|
}
|
|
33
33
|
catch (error_) {
|
|
34
|
-
if (!
|
|
34
|
+
if (!isCancelled)
|
|
35
35
|
setError(error_);
|
|
36
36
|
}
|
|
37
37
|
})();
|
|
38
38
|
return () => {
|
|
39
|
-
|
|
39
|
+
isCancelled = true;
|
|
40
40
|
};
|
|
41
41
|
}, [cryptoTimeoutMs]);
|
|
42
42
|
if (error) {
|
package/dist/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":";AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,oBAAoB,CAAC;AAC5B,OAAO,gCAAgC,CAAC;AAExC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,qBAAqB,EACrB,iCAAiC,EACjC,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AAMxB,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,UAAgD,CAAC;AAEzE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAC5B,eAAe,MACO,EAAE,EAAsB,EAAE;IAChD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAW,CAAC;IAEpD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC;YACH,MAAM,CAAC,GAAG,SAAS,EAAE,CAAC;YAEtB,CAAC,CAAC,wBAAwB,GAAG,IAAI,CAAC;YAElC,IAAI,CAAC,CAAC,CAAC,4BAA4B,EAAE,CAAC;gBACpC,CAAC,CAAC,4BAA4B,GAAG,IAAI,CAAC;gBAEtC,iCA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GAAG,KAAK,CAAC;QAExB,CAAC,KAAK,IAAI,EAAE;YACV,IAAI,CAAC;gBACH,MAAM,qBAAqB,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC;gBAE5D,MAAM,CAAC,GAAG,SAAS,EAAE,CAAC;gBAEtB,CAAC,CAAC,qBAAqB,GAAG,IAAI,CAAC;YACjC,CAAC;YACD,OAAO,MAAM,EAAE,CAAC;gBACd,IAAI,CAAC,WAAW;oBAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;YACrC,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,WAAW,GAAG,IAAI,CAAC;QACrB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;IAEtB,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAEvE,MAAM,IAAI,KAAK,CAAC,wCAAwC,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,KAAC,oBAAoB,KAAG,CAAC;AAClC,CAAC,CAAC","sourcesContent":["import \"react-native-url-polyfill/auto\";\nimport \"fast-text-encoding\";\nimport \"react-native-get-random-values\";\n\nimport * as React from \"react\";\n\nimport {\n ensureWebCryptoSubtle,\n installOpenLVReactNativePolyfills,\n OpenLVCryptoPolyfill,\n} from \"./polyfills.js\";\n\nexport type OpenLVGlobalsProps = {\n cryptoTimeoutMs?: number;\n};\n\nconst getGlobal = () => globalThis as unknown as Record<string, unknown>;\n\nexport const OpenLVGlobals = ({\n cryptoTimeoutMs,\n}: OpenLVGlobalsProps = {}): React.ReactElement => {\n const [error, setError] = React.useState<unknown>();\n\n React.useEffect(() => {\n try {\n const g = getGlobal();\n\n g.__openlvRnGlobalsMounted = true;\n\n if (!g.__openlvRnPolyfillsInstalled) {\n g.__openlvRnPolyfillsInstalled = true;\n\n installOpenLVReactNativePolyfills();\n }\n }\n catch (error_) {\n setError(error_);\n }\n }, []);\n\n // WebCrypto is delivered by the WebView polyfill, which becomes available\n // asynchronously after the component mounts.\n React.useEffect(() => {\n let isCancelled = false;\n\n (async () => {\n try {\n await ensureWebCryptoSubtle({ timeoutMs: cryptoTimeoutMs });\n\n const g = getGlobal();\n\n g.__openlvRnCryptoReady = true;\n }\n catch (error_) {\n if (!isCancelled) setError(error_);\n }\n })();\n\n return () => {\n isCancelled = true;\n };\n }, [cryptoTimeoutMs]);\n\n if (error) {\n const message = error instanceof Error ? error.message : String(error);\n\n throw new Error(`OpenLVGlobals initialization failed: ${message}`);\n }\n\n return <OpenLVCryptoPolyfill />;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openlv/react-native",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"open-lavatory",
|
|
6
6
|
"react-native"
|
|
7
7
|
],
|
|
8
|
-
"homepage": "https://github.com/
|
|
8
|
+
"homepage": "https://github.com/open-lavatory/open-lavatory",
|
|
9
9
|
"bugs": {
|
|
10
|
-
"url": "https://github.com/
|
|
10
|
+
"url": "https://github.com/open-lavatory/open-lavatory/issues"
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/
|
|
14
|
+
"url": "git+https://github.com/open-lavatory/open-lavatory.git",
|
|
15
15
|
"directory": "packages/react-native"
|
|
16
16
|
},
|
|
17
17
|
"license": "LGPL-3.0-only",
|
|
18
18
|
"author": {
|
|
19
19
|
"name": "Open-Lavatory",
|
|
20
|
-
"url": "https://github.com/
|
|
20
|
+
"url": "https://github.com/open-lavatory/open-lavatory"
|
|
21
21
|
},
|
|
22
22
|
"sideEffects": [
|
|
23
23
|
"./dist/provider.js"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"react-native-webrtc": "^124.0.6",
|
|
55
55
|
"react-native-webview": "^13.15.0",
|
|
56
56
|
"react-native-webview-crypto": "^0.0.28",
|
|
57
|
-
"@openlv/session": "0.1.
|
|
57
|
+
"@openlv/session": "0.1.3"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"react": ">=18",
|