@limrun/ui 0.9.0-rc.5 → 0.9.0-rc.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.
Files changed (73) hide show
  1. package/README.md +9 -0
  2. package/dist/components/device-install/device-install-dialog.d.ts +5 -0
  3. package/dist/components/device-install/index.d.ts +2 -0
  4. package/dist/components/inspect-overlay.d.ts +1 -0
  5. package/dist/components/remote-control.d.ts +13 -2
  6. package/dist/core/ax-tree.d.ts +2 -0
  7. package/dist/core/device-install/apple/client.d.ts +17 -0
  8. package/dist/core/device-install/apple/crypto.d.ts +20 -0
  9. package/dist/core/device-install/apple/gsa-srp.d.ts +26 -0
  10. package/dist/core/device-install/apple/index.d.ts +5 -0
  11. package/dist/core/device-install/apple/provisioning.d.ts +161 -0
  12. package/dist/core/device-install/apple/relay.d.ts +29 -0
  13. package/dist/core/device-install/index.d.ts +4 -0
  14. package/dist/core/device-install/operations/index.d.ts +6 -0
  15. package/dist/core/device-install/operations/limbuild-client.d.ts +28 -0
  16. package/dist/core/device-install/operations/operations.d.ts +32 -0
  17. package/dist/core/device-install/operations/relay-client.d.ts +25 -0
  18. package/dist/core/device-install/operations/relay-protocol.d.ts +27 -0
  19. package/dist/core/device-install/operations/usbmux.d.ts +32 -0
  20. package/dist/core/device-install/operations/webusb.d.ts +21 -0
  21. package/dist/core/device-install/storage/browser-storage.d.ts +44 -0
  22. package/dist/core/device-install/storage/index.d.ts +1 -0
  23. package/dist/core/device-install/types.d.ts +48 -0
  24. package/dist/device-install/index.cjs +1 -0
  25. package/dist/device-install/index.d.ts +3 -0
  26. package/dist/device-install/index.js +78 -0
  27. package/dist/device-install/react.cjs +1 -0
  28. package/dist/device-install/react.d.ts +1 -0
  29. package/dist/device-install/react.js +4 -0
  30. package/dist/device-install-dialog-86RDdoK9.js +2 -0
  31. package/dist/device-install-dialog-CnyDWf0q.mjs +462 -0
  32. package/dist/device-install-dialog.css +1 -0
  33. package/dist/hooks/index.d.ts +1 -0
  34. package/dist/hooks/use-device-install.d.ts +73 -0
  35. package/dist/index.cjs +1 -1
  36. package/dist/index.css +1 -1
  37. package/dist/index.d.ts +3 -1
  38. package/dist/index.js +737 -703
  39. package/dist/use-device-install-CbGVvwPp.js +31 -0
  40. package/dist/use-device-install-j1Gekpl4.mjs +13623 -0
  41. package/package.json +15 -2
  42. package/src/components/device-install/device-install-dialog.css +325 -0
  43. package/src/components/device-install/device-install-dialog.tsx +513 -0
  44. package/src/components/device-install/index.ts +2 -0
  45. package/src/components/inspect-overlay.css +6 -0
  46. package/src/components/inspect-overlay.tsx +46 -15
  47. package/src/components/remote-control.tsx +16 -2
  48. package/src/core/ax-tree.test.ts +124 -0
  49. package/src/core/ax-tree.ts +107 -0
  50. package/src/core/device-install/apple/client.ts +152 -0
  51. package/src/core/device-install/apple/crypto.ts +202 -0
  52. package/src/core/device-install/apple/gsa-srp.ts +127 -0
  53. package/src/core/device-install/apple/index.ts +5 -0
  54. package/src/core/device-install/apple/provisioning.ts +298 -0
  55. package/src/core/device-install/apple/relay.ts +221 -0
  56. package/src/core/device-install/index.ts +4 -0
  57. package/src/core/device-install/operations/index.ts +6 -0
  58. package/src/core/device-install/operations/limbuild-client.ts +104 -0
  59. package/src/core/device-install/operations/operations.ts +217 -0
  60. package/src/core/device-install/operations/relay-client.ts +255 -0
  61. package/src/core/device-install/operations/relay-protocol.ts +71 -0
  62. package/src/core/device-install/operations/usbmux.ts +270 -0
  63. package/src/core/device-install/operations/webusb-dom.d.ts +54 -0
  64. package/src/core/device-install/operations/webusb.ts +105 -0
  65. package/src/core/device-install/storage/browser-storage.ts +263 -0
  66. package/src/core/device-install/storage/index.ts +1 -0
  67. package/src/core/device-install/types.ts +65 -0
  68. package/src/device-install/index.ts +3 -0
  69. package/src/device-install/react.ts +1 -0
  70. package/src/hooks/index.ts +1 -0
  71. package/src/hooks/use-device-install.ts +1210 -0
  72. package/src/index.ts +4 -0
  73. package/vite.config.ts +6 -2
package/README.md CHANGED
@@ -4,6 +4,15 @@
4
4
 
5
5
  See [examples](../../examples/) to see how it can be used.
6
6
 
7
+ ## Real Device Installation
8
+
9
+ `@limrun/ui` also includes a browser-based iPhone installation flow:
10
+
11
+ - `@limrun/ui/device-install/react` exports the headless `useDeviceInstall` hook for clients that want to render their own UI.
12
+ - `@limrun/ui/device-install` exports the guided `DeviceInstallDialog` UI, which walks users through a signed device build, USB access, browser pairing, and installation.
13
+
14
+ WebUSB requires a Chromium browser and a secure context. Pair records and signing assets, including the `.p12` password, are stored in the browser's IndexedDB.
15
+
7
16
  ### Releasing
8
17
 
9
18
  This package is not part of generated SDK, hence you need to publish it manually in GitHub Actions.
@@ -0,0 +1,5 @@
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;
@@ -0,0 +1,2 @@
1
+ export { DeviceInstallDialog, DeviceInstallDialog as DeviceInstallRelay } from './device-install-dialog';
2
+ export type { DeviceInstallDialogProps } from './device-install-dialog';
@@ -13,6 +13,7 @@ export interface InspectOverlayProps {
13
13
  highlightedId: string | null;
14
14
  selectedId: string | null;
15
15
  mode: InspectMode;
16
+ instanceId?: string;
16
17
  cursorPosition: {
17
18
  x: number;
18
19
  y: number;
@@ -20,14 +20,25 @@ interface RemoteControlProps {
20
20
  * video stream.
21
21
  *
22
22
  * - `true` — Select mode. Boxes are clickable, click pins a selection
23
- * with action buttons (Tap / Copy selector / Copy id), ESC clears.
24
- * Device input is blocked while in this mode.
23
+ * with action buttons (Tap / Copy selector / Copy command), ESC
24
+ * clears. The cursor turns into a crosshair while inspecting and the
25
+ * info card hangs off the pointer. Device input is blocked while in
26
+ * this mode.
25
27
  * - `'hover-only'` — Boxes follow the cursor as a visual preview. Device
26
28
  * input still passes through, so you can drive the simulator while
27
29
  * inspecting.
28
30
  * - `undefined` / `false` (default) — overlay disabled, no polling.
29
31
  */
30
32
  inspectMode?: boolean | 'hover-only';
33
+ /**
34
+ * Optional instance id used to render the "Copy command" button in the
35
+ * inspect-mode info card. When provided, the button copies a CLI
36
+ * invocation like
37
+ * `lim ios tap-element --ax-label 'Sign in' --type Button --id <instanceId>`
38
+ * (or its Android equivalent) that targets this exact element on this
39
+ * exact instance. When omitted the button is hidden.
40
+ */
41
+ instanceId?: string;
31
42
  /**
32
43
  * Fires whenever a fresh accessibility snapshot is delivered.
33
44
  *
@@ -94,6 +94,8 @@ export declare function axElementsEqual(a: AxElement, b: AxElement): boolean;
94
94
  export declare function axSnapshotsEqual(a: AxSnapshot | null, b: AxSnapshot | null): boolean;
95
95
  export declare function axElementAtPoint(snapshot: AxSnapshot, x: number, y: number): AxElement | null;
96
96
  export declare function axElementSelectorExpression(el: AxElement, platform: AxPlatform): string | null;
97
+ export declare function axElementSelectorObject(el: AxElement, platform: AxPlatform): Record<string, string> | null;
98
+ export declare function axCliTapCommand(el: AxElement, platform: AxPlatform, instanceId: string): string | null;
97
99
  export declare function axElementRoleLabel(el: AxElement): string;
98
100
  export declare function axElementSummary(el: AxElement): string;
99
101
  export {};
@@ -0,0 +1,17 @@
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>;
@@ -0,0 +1,20 @@
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;
@@ -0,0 +1,26 @@
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
+ }
@@ -0,0 +1,5 @@
1
+ export * from './client';
2
+ export * from './crypto';
3
+ export * from './gsa-srp';
4
+ export * from './provisioning';
5
+ export * from './relay';
@@ -0,0 +1,161 @@
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[];
@@ -0,0 +1,29 @@
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>>;
@@ -0,0 +1,4 @@
1
+ export * from './types';
2
+ export * from './apple';
3
+ export * from './operations';
4
+ export * from './storage';
@@ -0,0 +1,6 @@
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';
@@ -0,0 +1,28 @@
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;
@@ -0,0 +1,32 @@
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;
@@ -0,0 +1,25 @@
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
+ }
@@ -0,0 +1,27 @@
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;
@@ -0,0 +1,32 @@
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;
@@ -0,0 +1,21 @@
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>>;
@@ -0,0 +1,44 @@
1
+ import { ProvisioningProfileInfo, PutSigningAssetsInput, StoredPairRecord, StoredSigningAssets, PairRecordPayload } from '../types';
2
+ export declare function normalizeUDID(udid?: string): string;
3
+ export declare function normalizeBundleID(bundleID?: string): string;
4
+ export declare function getPairRecord(udid?: string): Promise<StoredPairRecord | undefined>;
5
+ export declare function putPairRecord(record: PairRecordPayload, metadata?: {
6
+ productName?: string;
7
+ }): Promise<StoredPairRecord>;
8
+ export declare function getSigningAssets({ deviceUDID, bundleID, }: {
9
+ deviceUDID?: string;
10
+ bundleID?: string;
11
+ }): Promise<StoredSigningAssets | undefined>;
12
+ export declare function getLatestSigningAssets(): Promise<StoredSigningAssets>;
13
+ export declare function getLatestSigningAssetsWithCertificate(teamID?: string): Promise<StoredSigningAssets>;
14
+ export declare function putSigningAssets(input: PutSigningAssetsInput): Promise<StoredSigningAssets>;
15
+ export declare function findSigningAssetsForBundle(bundleID?: string): Promise<StoredSigningAssets[]>;
16
+ export declare function profileContainsDevice(profile: ProvisioningProfileInfo, deviceUDID?: string): boolean;
17
+ export declare function profileMatchesBundleID(profile: ProvisioningProfileInfo, bundleID?: string): boolean;
18
+ export declare function parseProvisioningProfile(file: File): Promise<{
19
+ name: string | undefined;
20
+ uuid: string | undefined;
21
+ teamID: string;
22
+ applicationIdentifier: string | undefined;
23
+ bundleID: string | undefined;
24
+ provisionedDevices: string[];
25
+ expirationDate: string | undefined;
26
+ }>;
27
+ export declare function parseProvisioningProfileBase64(base64: string): {
28
+ name: string | undefined;
29
+ uuid: string | undefined;
30
+ teamID: string;
31
+ applicationIdentifier: string | undefined;
32
+ bundleID: string | undefined;
33
+ provisionedDevices: string[];
34
+ expirationDate: string | undefined;
35
+ };
36
+ export declare function parseProvisioningProfileBytes(bytes: Uint8Array): {
37
+ name: string | undefined;
38
+ uuid: string | undefined;
39
+ teamID: string;
40
+ applicationIdentifier: string | undefined;
41
+ bundleID: string | undefined;
42
+ provisionedDevices: string[];
43
+ expirationDate: string | undefined;
44
+ };
@@ -0,0 +1 @@
1
+ export * from './browser-storage';
@@ -0,0 +1,48 @@
1
+ export type DeviceInstallLog = (message: string, detail?: string) => void;
2
+ export type DeviceInstallStep = 'signing' | 'connect' | 'build' | 'install';
3
+ export type DeviceInstallStepStatus = 'idle' | 'active' | 'complete' | 'error';
4
+ export type DeviceInstallBusyAction = 'signing' | 'usb' | 'pair' | 'build' | 'install';
5
+ export type DeviceInstallBuildStatus = 'idle' | 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';
6
+ export type BuildLogLine = {
7
+ type: 'command' | 'stdout' | 'stderr' | 'meta';
8
+ data: string;
9
+ };
10
+ export type DeviceHello = {
11
+ serialNumber?: string;
12
+ productName?: string;
13
+ manufacturerName?: string;
14
+ productId: number;
15
+ vendorId: number;
16
+ };
17
+ export type PairRecordPayload = {
18
+ udid: string;
19
+ pairRecordBase64: string;
20
+ };
21
+ export type StoredPairRecord = PairRecordPayload & {
22
+ productName?: string;
23
+ updatedAt: string;
24
+ };
25
+ export type ProvisioningProfileInfo = {
26
+ name?: string;
27
+ uuid?: string;
28
+ teamID?: string;
29
+ applicationIdentifier?: string;
30
+ bundleID?: string;
31
+ provisionedDevices: string[];
32
+ expirationDate?: string;
33
+ };
34
+ export type StoredSigningAssets = {
35
+ id: string;
36
+ deviceUDID?: string;
37
+ teamID?: string;
38
+ bundleID: string;
39
+ certificateID?: string;
40
+ certificateP12Base64: string;
41
+ certificateFileName?: string;
42
+ certificatePassword: string;
43
+ provisioningProfileBase64: string;
44
+ profileFileName?: string;
45
+ profile: ProvisioningProfileInfo;
46
+ updatedAt: string;
47
+ };
48
+ export type PutSigningAssetsInput = Omit<StoredSigningAssets, 'id' | 'updatedAt'>;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../use-device-install-CbGVvwPp.js"),t=require("../device-install-dialog-86RDdoK9.js");exports.AppleGsaSrpClient=e.AppleGsaSrpClient;exports.RELAY_HEADER_BYTES=e.RELAY_HEADER_BYTES;exports.RELAY_PROTOCOL_VERSION=e.RELAY_PROTOCOL_VERSION;exports.RelayClient=e.RelayClient;exports.RelayMessageType=e.RelayMessageType;exports.claimUsbmux=e.claimUsbmux;exports.closeDeviceRelayTarget=e.closeDeviceRelayTarget;exports.closeUsbmuxSession=e.closeUsbmuxSession;exports.createAppleRelaySession=e.createAppleRelaySession;exports.createBundleIDRequest=e.createBundleIDRequest;exports.createDevelopmentProfileRequest=e.createDevelopmentProfileRequest;exports.createUsbmuxSession=e.createUsbmuxSession;exports.decodeFrame=e.decodeFrame;exports.decodeJson=e.decodeJson;exports.deleteAppleRelaySession=e.deleteAppleRelaySession;exports.deviceRelayWebSocketUrl=e.deviceRelayWebSocketUrl;exports.downloadCertificateRequest=e.downloadCertificateRequest;exports.downloadProfileRequest=e.downloadProfileRequest;exports.encodeFrame=e.encodeFrame;exports.encodeJson=e.encodeJson;exports.exportAppleCertificateP12=e.exportAppleCertificateP12;exports.fetchAppleAccountSession=e.fetchAppleAccountSession;exports.fetchLimbuildInfo=e.fetchLimbuildInfo;exports.findBundleIDRequest=e.findBundleIDRequest;exports.findDevelopmentCertificatesRequest=e.findDevelopmentCertificatesRequest;exports.findDevelopmentProfilesRequest=e.findDevelopmentProfilesRequest;exports.findDeviceRequest=e.findDeviceRequest;exports.findSigningAssetsForBundle=e.findSigningAssetsForBundle;exports.findUsbmuxCandidates=e.findUsbmuxCandidates;exports.generateAppleSigningKeyAndCSR=e.generateAppleSigningKeyAndCSR;exports.getBulkEndpoints=e.getBulkEndpoints;exports.getLatestSigningAssets=e.getLatestSigningAssets;exports.getLatestSigningAssetsWithCertificate=e.getLatestSigningAssetsWithCertificate;exports.getPairRecord=e.getPairRecord;exports.getReusableAppleSigningAssets=e.getReusableAppleSigningAssets;exports.getSigningAssets=e.getSigningAssets;exports.listTeamsRequest=e.listTeamsRequest;exports.normalizeBundleID=e.normalizeBundleID;exports.normalizeUDID=e.normalizeUDID;exports.openStream=e.openStream;exports.parseProvisioningProfile=e.parseProvisioningProfile;exports.parseProvisioningProfileBase64=e.parseProvisioningProfileBase64;exports.parseProvisioningProfileBytes=e.parseProvisioningProfileBytes;exports.profileContainsDevice=e.profileContainsDevice;exports.profileMatchesBundleID=e.profileMatchesBundleID;exports.proxyPhoneTwoFactorCode=e.proxyPhoneTwoFactorCode;exports.proxyProvisioningRequest=e.proxyProvisioningRequest;exports.proxySrpComplete=e.proxySrpComplete;exports.proxySrpInit=e.proxySrpInit;exports.proxyTwoFactorCode=e.proxyTwoFactorCode;exports.putAppleGeneratedSigningAssets=e.putAppleGeneratedSigningAssets;exports.putPairRecord=e.putPairRecord;exports.putSigningAssets=e.putSigningAssets;exports.receiveStreamData=e.receiveStreamData;exports.registerDeviceRequest=e.registerDeviceRequest;exports.requestAppleDevice=e.requestAppleDevice;exports.requestUSBAccess=e.requestUSBAccess;exports.selectDeveloperPortalTeam=e.selectDeveloperPortalTeam;exports.sendStreamData=e.sendStreamData;exports.startBrowserOwnedAppleIDLogin=e.startBrowserOwnedAppleIDLogin;exports.startInstallRelay=e.startInstallRelay;exports.startPairingRelay=e.startPairingRelay;exports.startSignedDeviceBuild=e.startSignedDeviceBuild;exports.storedSigningAssetsReusable=e.storedSigningAssetsReusable;exports.submitDevelopmentCSRRequest=e.submitDevelopmentCSRRequest;exports.teamIDCandidates=e.teamIDCandidates;exports.transferIn=e.transferIn;exports.transferOutWithZlp=e.transferOutWithZlp;exports.triggerPhoneTwoFactor=e.triggerPhoneTwoFactor;exports.triggerTrustedDeviceTwoFactor=e.triggerTrustedDeviceTwoFactor;exports.useDeviceInstall=e.useDeviceInstall;exports.watchBuildLogEvents=e.watchBuildLogEvents;exports.DeviceInstallDialog=t.DeviceInstallDialog;exports.DeviceInstallRelay=t.DeviceInstallDialog;
@@ -0,0 +1,3 @@
1
+ export * from '../core/device-install';
2
+ export { DeviceInstallDialog, DeviceInstallRelay } from '../components/device-install';
3
+ export { useDeviceInstall } from '../hooks/use-device-install';