@limrun/ui 0.9.0-rc.11 → 0.9.0-rc.12

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.
Files changed (66) hide show
  1. package/README.md +0 -9
  2. package/dist/components/remote-control.d.ts +28 -0
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.d.ts +0 -2
  5. package/dist/index.js +965 -945
  6. package/package.json +2 -15
  7. package/src/components/remote-control.tsx +65 -1
  8. package/src/index.ts +0 -3
  9. package/vite.config.ts +2 -6
  10. package/dist/components/device-install/device-install-dialog.d.ts +0 -5
  11. package/dist/components/device-install/index.d.ts +0 -2
  12. package/dist/core/device-install/apple/client.d.ts +0 -17
  13. package/dist/core/device-install/apple/crypto.d.ts +0 -20
  14. package/dist/core/device-install/apple/gsa-srp.d.ts +0 -26
  15. package/dist/core/device-install/apple/index.d.ts +0 -5
  16. package/dist/core/device-install/apple/provisioning.d.ts +0 -161
  17. package/dist/core/device-install/apple/relay.d.ts +0 -29
  18. package/dist/core/device-install/index.d.ts +0 -4
  19. package/dist/core/device-install/operations/index.d.ts +0 -6
  20. package/dist/core/device-install/operations/limbuild-client.d.ts +0 -28
  21. package/dist/core/device-install/operations/operations.d.ts +0 -32
  22. package/dist/core/device-install/operations/relay-client.d.ts +0 -25
  23. package/dist/core/device-install/operations/relay-protocol.d.ts +0 -27
  24. package/dist/core/device-install/operations/usbmux.d.ts +0 -32
  25. package/dist/core/device-install/operations/webusb.d.ts +0 -21
  26. package/dist/core/device-install/storage/browser-storage.d.ts +0 -44
  27. package/dist/core/device-install/storage/index.d.ts +0 -1
  28. package/dist/core/device-install/types.d.ts +0 -48
  29. package/dist/device-install/index.cjs +0 -1
  30. package/dist/device-install/index.d.ts +0 -3
  31. package/dist/device-install/index.js +0 -78
  32. package/dist/device-install/react.cjs +0 -1
  33. package/dist/device-install/react.d.ts +0 -1
  34. package/dist/device-install/react.js +0 -4
  35. package/dist/device-install-dialog-CjH25hnN.js +0 -2
  36. package/dist/device-install-dialog-W5Xv9kWL.mjs +0 -443
  37. package/dist/device-install-dialog.css +0 -1
  38. package/dist/hooks/index.d.ts +0 -1
  39. package/dist/hooks/use-device-install.d.ts +0 -73
  40. package/dist/use-device-install-Y1u6vIBB.js +0 -31
  41. package/dist/use-device-install-sDVvby1V.mjs +0 -13627
  42. package/src/components/device-install/device-install-dialog.css +0 -325
  43. package/src/components/device-install/device-install-dialog.tsx +0 -495
  44. package/src/components/device-install/index.ts +0 -2
  45. package/src/core/device-install/apple/client.ts +0 -152
  46. package/src/core/device-install/apple/crypto.ts +0 -202
  47. package/src/core/device-install/apple/gsa-srp.ts +0 -127
  48. package/src/core/device-install/apple/index.ts +0 -5
  49. package/src/core/device-install/apple/provisioning.ts +0 -298
  50. package/src/core/device-install/apple/relay.ts +0 -221
  51. package/src/core/device-install/index.ts +0 -4
  52. package/src/core/device-install/operations/index.ts +0 -6
  53. package/src/core/device-install/operations/limbuild-client.ts +0 -104
  54. package/src/core/device-install/operations/operations.ts +0 -217
  55. package/src/core/device-install/operations/relay-client.ts +0 -255
  56. package/src/core/device-install/operations/relay-protocol.ts +0 -71
  57. package/src/core/device-install/operations/usbmux.ts +0 -270
  58. package/src/core/device-install/operations/webusb-dom.d.ts +0 -54
  59. package/src/core/device-install/operations/webusb.ts +0 -105
  60. package/src/core/device-install/storage/browser-storage.ts +0 -263
  61. package/src/core/device-install/storage/index.ts +0 -1
  62. package/src/core/device-install/types.ts +0 -65
  63. package/src/device-install/index.ts +0 -3
  64. package/src/device-install/react.ts +0 -1
  65. package/src/hooks/index.ts +0 -1
  66. package/src/hooks/use-device-install.ts +0 -1221
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limrun/ui",
3
- "version": "0.9.0-rc.11",
3
+ "version": "0.9.0-rc.12",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -13,16 +13,6 @@
13
13
  "import": "./dist/index.js",
14
14
  "require": "./dist/index.cjs"
15
15
  },
16
- "./device-install": {
17
- "types": "./dist/device-install/index.d.ts",
18
- "import": "./dist/device-install/index.js",
19
- "require": "./dist/device-install/index.cjs"
20
- },
21
- "./device-install/react": {
22
- "types": "./dist/device-install/react.d.ts",
23
- "import": "./dist/device-install/react.js",
24
- "require": "./dist/device-install/react.cjs"
25
- },
26
16
  "./package.json": "./package.json"
27
17
  },
28
18
  "scripts": {
@@ -41,7 +31,6 @@
41
31
  },
42
32
  "license": "MIT",
43
33
  "devDependencies": {
44
- "@types/node-forge": "^1.3.14",
45
34
  "@types/react": "^19.1.12",
46
35
  "@types/react-dom": "^19.1.9",
47
36
  "@vitejs/plugin-react-swc": "^4.0.1",
@@ -55,8 +44,6 @@
55
44
  "vitest": "^2.1.9"
56
45
  },
57
46
  "dependencies": {
58
- "@foxt/js-srp": "^0.0.3-patch2",
59
- "clsx": "^2.1.1",
60
- "node-forge": "^1.4.0"
47
+ "clsx": "^2.1.1"
61
48
  }
62
49
  }
@@ -140,6 +140,35 @@ interface RemoteControlProps {
140
140
  * @default 2000
141
141
  */
142
142
  axMaxBackoffMs?: number;
143
+
144
+ /**
145
+ * Optional outbound camera input.
146
+ *
147
+ * When provided, every video track on this `MediaStream` is forwarded
148
+ * up the same `RTCPeerConnection` that already carries the device
149
+ * screen downstream. On iOS instances, the limulator-side injector
150
+ * splices those frames into apps that use AVFoundation, so the user's
151
+ * browser camera becomes the iOS camera (`AVCaptureDevice.default(for:
152
+ * .video)`).
153
+ *
154
+ * Today this is only honored by iOS instances launched with the
155
+ * camera runtime; Android instances ignore it.
156
+ *
157
+ * Lifecycle expectations:
158
+ * - Pass `null`/`undefined` to skip outbound camera (default).
159
+ * - Pass a `MediaStream` obtained from
160
+ * `navigator.mediaDevices.getUserMedia({ video: true })` (or any
161
+ * other source — screen capture, virtual camera, etc.).
162
+ * - Changing the `MediaStream.id` triggers a connection restart so
163
+ * the new track is included in the SDP offer. The reference itself
164
+ * is allowed to be unstable across renders — we key the reconnect
165
+ * on `id`, not object identity, so memoization isn't required.
166
+ * - Stopping the tracks (e.g. `track.stop()`) on the parent side is
167
+ * sufficient to cut the outbound feed without restarting; the peer
168
+ * connection just stops getting frames on that track. To fully
169
+ * detach the track from the SDP, swap the prop to `null`.
170
+ */
171
+ cameraStream?: MediaStream | null;
143
172
  }
144
173
 
145
174
  interface ScreenshotData {
@@ -338,6 +367,7 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
338
367
  onAxStatusChange,
339
368
  axPollIntervalMs,
340
369
  axMaxBackoffMs,
370
+ cameraStream,
341
371
  }: RemoteControlProps,
342
372
  ref,
343
373
  ) => {
@@ -363,6 +393,13 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
363
393
  // Mirrored to a ref so stale closures in event handlers see the latest value.
364
394
  const autoReconnectRef = useRef(autoReconnect);
365
395
  autoReconnectRef.current = autoReconnect;
396
+ // Outbound camera input. Held in a ref so the deferred WebRTC setup
397
+ // path picks up the latest stream even if React re-renders between
398
+ // the connection effect firing and `startAttempt` reaching the
399
+ // `addTrack` step. Reconnects are keyed on `MediaStream.id`, not
400
+ // reference identity (see the connection effect's deps).
401
+ const cameraStreamRef = useRef<MediaStream | null>(cameraStream ?? null);
402
+ cameraStreamRef.current = cameraStream ?? null;
366
403
  const firstFrameShownRef = useRef(false);
367
404
  const pendingScreenshotResolversRef = useRef<
368
405
  Map<string, (value: ScreenshotData | PromiseLike<ScreenshotData>) => void>
@@ -1644,6 +1681,27 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
1644
1681
  peerConnection.addTransceiver('audio', { direction: 'recvonly' });
1645
1682
  const videoTransceiver = peerConnection.addTransceiver('video', { direction: 'recvonly' });
1646
1683
 
1684
+ // Outbound camera input — splice the parent-provided MediaStream's
1685
+ // video tracks into the same PC. `addTrack` creates an implicit
1686
+ // sendonly transceiver and lands the track in the SDP offer; the
1687
+ // limulator side picks it up via `peerConnection(_:didAdd:)` and
1688
+ // forwards every frame into the camera-injector IOSurface ring.
1689
+ // We pass the original MediaStream so the answerer can recover
1690
+ // the parent stream id if it cares; today nothing does, but it
1691
+ // costs nothing to be correct.
1692
+ const outboundCamera = cameraStreamRef.current;
1693
+ if (outboundCamera) {
1694
+ for (const track of outboundCamera.getVideoTracks()) {
1695
+ peerConnection.addTrack(track, outboundCamera);
1696
+ }
1697
+ debugLog(
1698
+ 'Attached outbound camera tracks:',
1699
+ outboundCamera.getVideoTracks().length,
1700
+ 'streamId:',
1701
+ outboundCamera.id,
1702
+ );
1703
+ }
1704
+
1647
1705
  // As hardware encoder, we use H265 for iOS and VP9 for Android.
1648
1706
  // We make sure these two are the first ones in the list.
1649
1707
  // If not, the fallback is H264 which is also hardware accelerated, although not as good,
@@ -2080,7 +2138,13 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
2080
2138
  stop();
2081
2139
  document.removeEventListener('visibilitychange', handleVisibilityChange);
2082
2140
  };
2083
- }, [url, token, propSessionId]);
2141
+ // We key reconnects on `MediaStream.id` rather than the prop's
2142
+ // object identity so callers don't have to memoize the stream —
2143
+ // turning the camera on/off swaps the underlying MediaStream and
2144
+ // its id, but rerenders that happen to re-create the parent's
2145
+ // wrapping object don't trigger churn.
2146
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2147
+ }, [url, token, propSessionId, cameraStream?.id]);
2084
2148
 
2085
2149
  // Recompute the inspect-overlay geometry (container-local pixel rect of
2086
2150
  // the actually-rendered video content) from the current mapping context.
package/src/index.ts CHANGED
@@ -17,6 +17,3 @@ export {
17
17
  normalizeIosTree,
18
18
  AX_UNAVAILABLE_ERROR,
19
19
  } from './core/ax-tree';
20
-
21
- export { DeviceInstallDialog, DeviceInstallRelay } from './components/device-install';
22
- export { useDeviceInstall } from './hooks/use-device-install';
package/vite.config.ts CHANGED
@@ -9,14 +9,10 @@ export default defineConfig({
9
9
  plugins: [react(), libInjectCss(), dts({ include: ['src'] })],
10
10
  build: {
11
11
  lib: {
12
- entry: {
13
- index: resolve(__dirname, 'src/index.ts'),
14
- 'device-install/index': resolve(__dirname, 'src/device-install/index.ts'),
15
- 'device-install/react': resolve(__dirname, 'src/device-install/react.ts'),
16
- },
12
+ entry: resolve(__dirname, 'src/index.ts'),
17
13
  name: 'LimrunUI',
18
14
  formats: ['es', 'cjs'],
19
- fileName: (format, entryName) => `${entryName}.${format === 'es' ? 'js' : 'cjs'}`,
15
+ fileName: (format) => `index.${format === 'es' ? 'js' : 'cjs'}`,
20
16
  },
21
17
  rollupOptions: {
22
18
  external: ['react', 'react-dom', 'react/jsx-runtime'],
@@ -1,5 +0,0 @@
1
- import { UseDeviceInstallOptions } from '../../hooks/use-device-install';
2
- export type DeviceInstallDialogProps = UseDeviceInstallOptions & {
3
- disabled?: boolean;
4
- };
5
- export declare function DeviceInstallDialog({ disabled, ...hookOptions }: DeviceInstallDialogProps): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +0,0 @@
1
- export { DeviceInstallDialog, DeviceInstallDialog as DeviceInstallRelay } from './device-install-dialog';
2
- export type { DeviceInstallDialogProps } from './device-install-dialog';
@@ -1,17 +0,0 @@
1
- import { AppleRelayResponse } from './relay';
2
- export type AppleIDLoginInput = {
3
- limbuildApiUrl: string;
4
- accountName: string;
5
- password: string;
6
- token?: string;
7
- };
8
- export type AppleIDLoginResult = {
9
- appleSessionId: string;
10
- completeResponse: AppleRelayResponse;
11
- twoFactorChallengeResponse?: AppleRelayResponse;
12
- requiresTwoFactor: boolean;
13
- finishTwoFactor: (code: string) => Promise<AppleRelayResponse>;
14
- finalize: () => Promise<AppleRelayResponse>;
15
- close: () => Promise<void>;
16
- };
17
- export declare function startBrowserOwnedAppleIDLogin({ limbuildApiUrl, accountName, password, token, }: AppleIDLoginInput): Promise<AppleIDLoginResult>;
@@ -1,20 +0,0 @@
1
- export type AppleSigningKeyMaterial = {
2
- privateKey: CryptoKey;
3
- privateKeyPKCS8Base64: string;
4
- publicKeySPKIBase64: string;
5
- csrPEM: string;
6
- csrBase64: string;
7
- };
8
- export type AppleCSRInput = {
9
- commonName: string;
10
- emailAddress?: string;
11
- };
12
- export type ExportP12Input = {
13
- privateKeyPKCS8Base64: string;
14
- certificateBase64?: string;
15
- certificatePEM?: string;
16
- password: string;
17
- friendlyName?: string;
18
- };
19
- export declare function generateAppleSigningKeyAndCSR(input: AppleCSRInput): Promise<AppleSigningKeyMaterial>;
20
- export declare function exportAppleCertificateP12(input: ExportP12Input): string;
@@ -1,26 +0,0 @@
1
- export type AppleSRPProtocol = 's2k' | 's2k_fo';
2
- export type AppleSRPInitRequest = {
3
- a: string;
4
- accountName: string;
5
- protocols: AppleSRPProtocol[];
6
- };
7
- export type AppleSRPInitResponse = {
8
- iteration: number;
9
- salt: string;
10
- protocol: AppleSRPProtocol;
11
- b: string;
12
- c: string;
13
- };
14
- export type AppleSRPCompleteProof = {
15
- accountName: string;
16
- m1: string;
17
- m2: string;
18
- c: string;
19
- };
20
- export declare class AppleGsaSrpClient {
21
- private readonly accountName;
22
- private srpClient?;
23
- constructor(accountName: string);
24
- init(): Promise<AppleSRPInitRequest>;
25
- complete(password: string, serverData: AppleSRPInitResponse): Promise<AppleSRPCompleteProof>;
26
- }
@@ -1,5 +0,0 @@
1
- export * from './client';
2
- export * from './crypto';
3
- export * from './gsa-srp';
4
- export * from './provisioning';
5
- export * from './relay';
@@ -1,161 +0,0 @@
1
- import { ProvisioningProfileInfo, StoredSigningAssets } from '../types';
2
- import { AppleProvisioningRequest } from './relay';
3
- export type AppleDeveloperPortalTeam = {
4
- name?: string;
5
- teamId?: string;
6
- providerId?: string | number;
7
- publicProviderId?: string;
8
- type?: string;
9
- subType?: string;
10
- };
11
- export type AppleDeveloperPortalDevice = {
12
- deviceId?: string;
13
- name?: string;
14
- deviceNumber?: string;
15
- deviceClass?: string;
16
- model?: string;
17
- status?: string;
18
- };
19
- export type AppleDeveloperPortalAppID = {
20
- appId?: string;
21
- appIdId?: string;
22
- identifier?: string;
23
- bundleId?: string;
24
- name?: string;
25
- prefix?: string;
26
- platform?: string;
27
- };
28
- export type AppleDeveloperPortalResponse = {
29
- resultCode?: number;
30
- resultString?: string;
31
- userString?: string;
32
- teams?: AppleDeveloperPortalTeam[];
33
- provider?: AppleDeveloperPortalTeam;
34
- availableProviders?: AppleDeveloperPortalTeam[];
35
- appIds?: AppleDeveloperPortalAppID[];
36
- devices?: AppleDeveloperPortalDevice[];
37
- certRequests?: Array<Record<string, unknown>>;
38
- certRequest?: Record<string, unknown>;
39
- appId?: Record<string, unknown>;
40
- device?: Record<string, unknown>;
41
- provisioningProfile?: Record<string, unknown>;
42
- provisioningProfiles?: Array<Record<string, unknown>>;
43
- };
44
- export type AppleProvisioningContext = {
45
- bundleID: string;
46
- deviceUDID: string;
47
- teamID?: string;
48
- };
49
- export type AppleSigningAssetCacheInput = {
50
- bundleID: string;
51
- deviceUDID?: string;
52
- teamID?: string;
53
- };
54
- export type PutAppleGeneratedSigningAssetsInput = {
55
- bundleID: string;
56
- deviceUDID?: string;
57
- teamID?: string;
58
- certificateID?: string;
59
- certificateP12Base64: string;
60
- certificatePassword: string;
61
- provisioningProfileBase64: string;
62
- profile: ProvisioningProfileInfo;
63
- };
64
- export declare function listTeamsRequest(): AppleProvisioningRequest;
65
- export declare function findBundleIDRequest({ bundleID, teamID }: Pick<AppleProvisioningContext, 'bundleID' | 'teamID'>): {
66
- method: "POST";
67
- path: string;
68
- payload: Record<string, unknown>;
69
- };
70
- export declare function findDeviceRequest({ deviceUDID, teamID }: Pick<AppleProvisioningContext, 'deviceUDID' | 'teamID'>): {
71
- method: "POST";
72
- path: string;
73
- payload: Record<string, unknown>;
74
- };
75
- export declare function findDevelopmentCertificatesRequest(teamID?: string): {
76
- method: "POST";
77
- path: string;
78
- payload: Record<string, unknown>;
79
- };
80
- export declare function findDevelopmentProfilesRequest({ bundleID, teamID, }: Pick<AppleProvisioningContext, 'bundleID' | 'teamID'>): {
81
- method: "POST";
82
- path: string;
83
- payload: Record<string, unknown>;
84
- };
85
- export declare function registerDeviceRequest({ deviceUDID, teamID, name, }: Pick<AppleProvisioningContext, 'deviceUDID' | 'teamID'> & {
86
- name?: string;
87
- }): {
88
- method: "POST";
89
- path: string;
90
- payload: {
91
- teamId: string;
92
- deviceNames: string;
93
- deviceNumbers: string;
94
- deviceClasses: string;
95
- register: string;
96
- };
97
- };
98
- export declare function createBundleIDRequest({ bundleID, teamID, name, }: Pick<AppleProvisioningContext, 'bundleID' | 'teamID'> & {
99
- name?: string;
100
- }): {
101
- method: "POST";
102
- path: string;
103
- payload: {
104
- teamId: string;
105
- name: string;
106
- identifier: string;
107
- type: string;
108
- };
109
- };
110
- export declare function submitDevelopmentCSRRequest({ csrPEM, teamID, }: {
111
- csrPEM: string;
112
- teamID?: string;
113
- }): {
114
- method: "POST";
115
- path: string;
116
- payload: {
117
- teamId: string;
118
- type: string;
119
- csrContent: string;
120
- };
121
- };
122
- export declare function downloadCertificateRequest(certificateID: string, teamID?: string): {
123
- method: "GET";
124
- path: string;
125
- payload: {
126
- teamId: string;
127
- certificateId: string;
128
- type: string;
129
- };
130
- };
131
- export declare function createDevelopmentProfileRequest({ bundleID, teamID, appIDID, certificateID, deviceIDs, name, }: Pick<AppleProvisioningContext, 'bundleID' | 'teamID'> & {
132
- appIDID: string;
133
- certificateID: string;
134
- deviceIDs: string[];
135
- name?: string;
136
- }): {
137
- method: "POST";
138
- path: string;
139
- payload: {
140
- teamId: string;
141
- provisioningProfileName: string;
142
- certificateIds: string[];
143
- appIdId: string;
144
- deviceIds: string[];
145
- distributionType: string;
146
- subPlatform: string;
147
- };
148
- };
149
- export declare function downloadProfileRequest(profileID: string, teamID?: string): {
150
- method: "GET";
151
- path: string;
152
- payload: {
153
- teamId: string;
154
- provisioningProfileId: string;
155
- };
156
- };
157
- export declare function getReusableAppleSigningAssets({ bundleID, deviceUDID, teamID, }: AppleSigningAssetCacheInput): Promise<StoredSigningAssets | undefined>;
158
- export declare function putAppleGeneratedSigningAssets(input: PutAppleGeneratedSigningAssetsInput): Promise<StoredSigningAssets>;
159
- export declare function storedSigningAssetsReusable(stored: StoredSigningAssets, { bundleID, deviceUDID, teamID }: AppleSigningAssetCacheInput): boolean;
160
- export declare function selectDeveloperPortalTeam(body: unknown): AppleDeveloperPortalTeam | undefined;
161
- export declare function teamIDCandidates(body: unknown): string[];
@@ -1,29 +0,0 @@
1
- import { AppleSRPCompleteProof, AppleSRPInitRequest, AppleSRPInitResponse } from './gsa-srp';
2
- export type AppleRelayResponse<T = unknown> = {
3
- status: number;
4
- statusText: string;
5
- headers?: Record<string, string>;
6
- body?: T;
7
- rawBody?: string;
8
- rawBodyBase64?: string;
9
- };
10
- export type AppleProvisioningRequest = {
11
- method?: 'GET' | 'POST';
12
- path: string;
13
- payload?: unknown;
14
- };
15
- export declare function createAppleRelaySession(limbuildApiUrl: string, token?: string): Promise<{
16
- appleSessionId: string;
17
- }>;
18
- export declare function deleteAppleRelaySession(limbuildApiUrl: string, appleSessionId: string, token?: string): Promise<void>;
19
- export declare function proxySrpInit(limbuildApiUrl: string, appleSessionId: string, payload: AppleSRPInitRequest, token?: string): Promise<AppleRelayResponse<AppleSRPInitResponse>>;
20
- export declare function proxySrpComplete(limbuildApiUrl: string, appleSessionId: string, payload: AppleSRPCompleteProof & {
21
- rememberMe: boolean;
22
- trustTokens: string[];
23
- }, token?: string): Promise<AppleRelayResponse<unknown>>;
24
- export declare function triggerTrustedDeviceTwoFactor(limbuildApiUrl: string, appleSessionId: string, token?: string): Promise<AppleRelayResponse<unknown>>;
25
- export declare function triggerPhoneTwoFactor(limbuildApiUrl: string, appleSessionId: string, phoneNumberId: number, mode?: string, token?: string): Promise<AppleRelayResponse<unknown>>;
26
- export declare function proxyTwoFactorCode(limbuildApiUrl: string, appleSessionId: string, code: string, token?: string): Promise<AppleRelayResponse<unknown>>;
27
- export declare function proxyPhoneTwoFactorCode(limbuildApiUrl: string, appleSessionId: string, phoneNumberId: number, code: string, mode?: string, token?: string): Promise<AppleRelayResponse<unknown>>;
28
- export declare function fetchAppleAccountSession(limbuildApiUrl: string, appleSessionId: string, token?: string): Promise<AppleRelayResponse<unknown>>;
29
- export declare function proxyProvisioningRequest<T = unknown>(limbuildApiUrl: string, appleSessionId: string, request: AppleProvisioningRequest, token?: string): Promise<AppleRelayResponse<T>>;
@@ -1,4 +0,0 @@
1
- export * from './types';
2
- export * from './apple';
3
- export * from './operations';
4
- export * from './storage';
@@ -1,6 +0,0 @@
1
- export * from './limbuild-client';
2
- export * from './operations';
3
- export * from './relay-client';
4
- export * from './relay-protocol';
5
- export * from './usbmux';
6
- export * from './webusb';
@@ -1,28 +0,0 @@
1
- import { BuildLogLine, DeviceInstallBuildStatus } from '../types';
2
- export type LimbuildInfo = {
3
- homeDir?: string;
4
- lastBuildConfig?: {
5
- bundleId?: string;
6
- sdk?: string;
7
- };
8
- };
9
- export type StartSignedDeviceBuildOptions = {
10
- limbuildApiUrl: string;
11
- token?: string;
12
- certificateP12Base64: string;
13
- certificatePassword: string;
14
- provisioningProfileBase64: string;
15
- };
16
- export type BuildLogEventsOptions = {
17
- limbuildApiUrl: string;
18
- execId: string;
19
- token?: string;
20
- onLine: (line: BuildLogLine) => void;
21
- onStatus: (status: DeviceInstallBuildStatus) => void;
22
- onError?: (error: Error) => void;
23
- };
24
- export declare function fetchLimbuildInfo(limbuildApiUrl: string, token?: string): Promise<LimbuildInfo>;
25
- export declare function startSignedDeviceBuild({ limbuildApiUrl, token, certificateP12Base64, certificatePassword, provisioningProfileBase64, }: StartSignedDeviceBuildOptions): Promise<{
26
- execId?: string;
27
- }>;
28
- export declare function watchBuildLogEvents({ limbuildApiUrl, execId, token, onLine, onStatus, onError, }: BuildLogEventsOptions): () => void;
@@ -1,32 +0,0 @@
1
- import { DeviceHello, DeviceInstallLog, PairRecordPayload } from '../types';
2
- import { RelayClient } from './relay-client';
3
- import { UsbmuxSession } from './usbmux';
4
- import { UsbmuxCandidate } from './webusb';
5
- export type DeviceRelayTarget = {
6
- device: USBDevice;
7
- candidate: UsbmuxCandidate;
8
- session?: UsbmuxSession;
9
- claimedInterfaceNumber?: number;
10
- hello: DeviceHello;
11
- };
12
- export type RequestUSBAccessOptions = {
13
- log: DeviceInstallLog;
14
- };
15
- export type StartPairingRelayOptions = {
16
- limbuildApiUrl: string;
17
- token?: string;
18
- log: DeviceInstallLog;
19
- target: DeviceRelayTarget;
20
- };
21
- export type StartInstallRelayOptions = StartPairingRelayOptions & {
22
- pairRecord: PairRecordPayload;
23
- };
24
- export declare function requestUSBAccess({ log }: RequestUSBAccessOptions): Promise<DeviceRelayTarget>;
25
- export declare function startPairingRelay({ limbuildApiUrl, token, log, target }: StartPairingRelayOptions): Promise<{
26
- relay: RelayClient;
27
- pairRecord: PairRecordPayload;
28
- target: DeviceRelayTarget;
29
- }>;
30
- export declare function startInstallRelay({ limbuildApiUrl, token, log, target, pairRecord, }: StartInstallRelayOptions): Promise<RelayClient>;
31
- export declare function closeDeviceRelayTarget(target: DeviceRelayTarget | undefined, log?: DeviceInstallLog): Promise<void>;
32
- export declare function deviceRelayWebSocketUrl(limbuildApiUrl: string, token?: string): string;
@@ -1,25 +0,0 @@
1
- import { DeviceHello, DeviceInstallLog, PairRecordPayload } from '../types';
2
- import { UsbmuxSession } from './usbmux';
3
- export declare class RelayClient {
4
- private readonly webSocketUrl;
5
- private readonly session;
6
- private readonly deviceHello;
7
- private readonly log;
8
- private socket?;
9
- private streams;
10
- private frameQueue;
11
- private closed;
12
- private pairRecordWaiter?;
13
- constructor(webSocketUrl: string, session: UsbmuxSession, deviceHello: DeviceHello, log: DeviceInstallLog);
14
- connect(): Promise<void>;
15
- startPairing(): Promise<PairRecordPayload>;
16
- startInstall(pairRecord: PairRecordPayload): Promise<void>;
17
- close(): void;
18
- private enqueueFrame;
19
- private handleFrame;
20
- private handleError;
21
- private handlePairRecordReady;
22
- private handleOpenStream;
23
- private pumpDeviceToServer;
24
- private send;
25
- }
@@ -1,27 +0,0 @@
1
- export declare const RELAY_PROTOCOL_VERSION = 1;
2
- export declare const RELAY_HEADER_BYTES = 16;
3
- export declare const RelayMessageType: {
4
- readonly DeviceHello: 1;
5
- readonly OpenStream: 2;
6
- readonly OpenResult: 3;
7
- readonly StreamData: 4;
8
- readonly StreamClose: 5;
9
- readonly InstallProgress: 6;
10
- readonly Error: 7;
11
- readonly Ping: 8;
12
- readonly Pong: 9;
13
- readonly StartPairing: 10;
14
- readonly StartInstall: 11;
15
- readonly PairRecordReady: 12;
16
- };
17
- export type RelayMessageType = (typeof RelayMessageType)[keyof typeof RelayMessageType];
18
- export type RelayFrame = {
19
- type: RelayMessageType;
20
- requestId: number;
21
- streamId: number;
22
- payload: Uint8Array;
23
- };
24
- export declare function encodeFrame(frame: RelayFrame): Uint8Array<ArrayBuffer>;
25
- export declare function decodeFrame(data: Uint8Array): RelayFrame;
26
- export declare function encodeJson(value: unknown): Uint8Array<ArrayBufferLike>;
27
- export declare function decodeJson<T>(payload: Uint8Array): T;
@@ -1,32 +0,0 @@
1
- import { UsbmuxCandidate, getBulkEndpoints } from './webusb';
2
- export type UsbmuxSession = {
3
- device: USBDevice;
4
- candidate: UsbmuxCandidate;
5
- inEndpoint: ReturnType<typeof getBulkEndpoints>['inEndpoint'];
6
- outEndpoint: ReturnType<typeof getBulkEndpoints>['outEndpoint'];
7
- muxVersion: number;
8
- txSeq: number;
9
- rxSeq: number;
10
- nextSport: number;
11
- streams: Map<string, UsbmuxStream>;
12
- writeChain: Promise<void>;
13
- closed: boolean;
14
- };
15
- export type UsbmuxStream = {
16
- session: UsbmuxSession;
17
- sport: number;
18
- dport: number;
19
- seq: number;
20
- ack: number;
21
- queue: Uint8Array[];
22
- waiters: Array<(value: Uint8Array) => void>;
23
- error?: Error;
24
- opened: Promise<void>;
25
- resolveOpened: () => void;
26
- rejectOpened: (error: Error) => void;
27
- };
28
- export declare function createUsbmuxSession(device: USBDevice, candidate: UsbmuxCandidate): Promise<UsbmuxSession>;
29
- export declare function openStream(session: UsbmuxSession, port: number): Promise<UsbmuxStream>;
30
- export declare function sendStreamData(stream: UsbmuxStream, bytes: Uint8Array): Promise<void>;
31
- export declare function receiveStreamData(stream: UsbmuxStream): Promise<Uint8Array<ArrayBufferLike>>;
32
- export declare function closeUsbmuxSession(session: UsbmuxSession): void;
@@ -1,21 +0,0 @@
1
- export type UsbEndpoint = {
2
- endpointNumber: number;
3
- direction: 'in' | 'out';
4
- type: string;
5
- packetSize: number;
6
- };
7
- export type UsbmuxCandidate = {
8
- configurationValue: number;
9
- interfaceNumber: number;
10
- alternateSetting: number;
11
- endpoints: UsbEndpoint[];
12
- };
13
- export declare function requestAppleDevice(): Promise<USBDevice>;
14
- export declare function findUsbmuxCandidates(device: USBDevice): UsbmuxCandidate[];
15
- export declare function claimUsbmux(device: USBDevice, candidate: UsbmuxCandidate): Promise<void>;
16
- export declare function getBulkEndpoints(candidate: UsbmuxCandidate): {
17
- outEndpoint: UsbEndpoint;
18
- inEndpoint: UsbEndpoint;
19
- };
20
- export declare function transferOutWithZlp(device: USBDevice, endpoint: UsbEndpoint, bytes: Uint8Array): Promise<void>;
21
- export declare function transferIn(device: USBDevice, endpoint: UsbEndpoint, size?: number): Promise<Uint8Array<ArrayBufferLike>>;