@limrun/ui 0.14.0-rc.5 → 0.14.1
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/README.md +9 -26
- package/dist/components/remote-control.d.ts +36 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1351 -1196
- package/package.json +10 -51
- package/src/components/remote-control.tsx +414 -2
- package/src/index.ts +1 -1
- package/vite.config.ts +0 -9
- package/dist/app-store-relay/index.cjs +0 -9
- package/dist/app-store-relay/index.d.ts +0 -204
- package/dist/app-store-relay/index.js +0 -677
- package/dist/app-store-relay/react.cjs +0 -1
- package/dist/app-store-relay/react.d.ts +0 -15
- package/dist/app-store-relay/react.js +0 -69
- package/dist/apple-credentials/index.cjs +0 -1
- package/dist/apple-credentials/index.d.ts +0 -110
- package/dist/apple-credentials/index.js +0 -291
- package/dist/browser-storage-BnO-Ma-e.mjs +0 -219
- package/dist/browser-storage-DLxIqZk5.js +0 -1
- package/dist/client-C9z_sgOf.js +0 -1
- package/dist/client-CFDB4mX5.mjs +0 -191
- package/dist/core/device-install/apple/client.d.ts +0 -18
- package/dist/core/device-install/apple/crypto.d.ts +0 -20
- package/dist/core/device-install/apple/gsa-srp.d.ts +0 -26
- package/dist/core/device-install/apple/index.d.ts +0 -5
- package/dist/core/device-install/apple/provisioning.d.ts +0 -237
- package/dist/core/device-install/apple/relay.d.ts +0 -53
- package/dist/core/device-install/index.d.ts +0 -4
- package/dist/core/device-install/operations/index.d.ts +0 -6
- package/dist/core/device-install/operations/limbuild-client.d.ts +0 -43
- package/dist/core/device-install/operations/operations.d.ts +0 -47
- package/dist/core/device-install/operations/relay-client.d.ts +0 -26
- package/dist/core/device-install/operations/relay-protocol.d.ts +0 -27
- package/dist/core/device-install/operations/usbmux.d.ts +0 -32
- package/dist/core/device-install/operations/webusb.d.ts +0 -21
- package/dist/core/device-install/storage/browser-storage.d.ts +0 -56
- package/dist/core/device-install/storage/index.d.ts +0 -2
- package/dist/core/device-install/storage/secret-store.d.ts +0 -124
- package/dist/core/device-install/types.d.ts +0 -57
- package/dist/core/errors.d.ts +0 -1
- package/dist/core/play-publish/google.d.ts +0 -13
- package/dist/core/play-publish/publish.d.ts +0 -34
- package/dist/device-build/index.cjs +0 -1
- package/dist/device-build/index.d.ts +0 -4
- package/dist/device-build/index.js +0 -85
- package/dist/device-build/react.cjs +0 -1
- package/dist/device-build/react.d.ts +0 -21
- package/dist/device-build/react.js +0 -68
- package/dist/device-build/signing.d.ts +0 -20
- package/dist/device-install/demo/demo.d.ts +0 -0
- package/dist/device-install/index.cjs +0 -1
- package/dist/device-install/index.d.ts +0 -18
- package/dist/device-install/index.js +0 -594
- package/dist/device-install/react.cjs +0 -1
- package/dist/device-install/react.d.ts +0 -24
- package/dist/device-install/react.js +0 -105
- package/dist/errors-BSkqS7U-.js +0 -1
- package/dist/errors-gy8yQJos.mjs +0 -6
- package/dist/gsa-srp-Bme3JLEi.mjs +0 -266
- package/dist/gsa-srp-CCIfUz7Y.js +0 -1
- package/dist/index-ChhtuQ7e.js +0 -22
- package/dist/index-YDu8K9a4.mjs +0 -11279
- package/dist/limbuild-client-BagK_FWE.mjs +0 -83
- package/dist/limbuild-client-CVDwq54z.js +0 -1
- package/dist/play-publish/index.cjs +0 -1
- package/dist/play-publish/index.d.ts +0 -2
- package/dist/play-publish/index.js +0 -109
- package/dist/play-publish/react.cjs +0 -1
- package/dist/play-publish/react.d.ts +0 -31
- package/dist/play-publish/react.js +0 -91
- package/dist/provisioning-CDPvxd1h.mjs +0 -270
- package/dist/provisioning-CbC4h--7.js +0 -1
- package/src/app-store-relay/index.test.ts +0 -60
- package/src/app-store-relay/index.ts +0 -846
- package/src/app-store-relay/react.ts +0 -131
- package/src/apple-credentials/index.test.ts +0 -180
- package/src/apple-credentials/index.ts +0 -388
- package/src/core/device-install/apple/client.ts +0 -150
- package/src/core/device-install/apple/crypto.ts +0 -205
- package/src/core/device-install/apple/gsa-srp.ts +0 -123
- package/src/core/device-install/apple/index.ts +0 -5
- package/src/core/device-install/apple/provisioning.test.ts +0 -114
- package/src/core/device-install/apple/provisioning.ts +0 -419
- package/src/core/device-install/apple/relay.ts +0 -202
- package/src/core/device-install/index.ts +0 -4
- package/src/core/device-install/operations/index.ts +0 -6
- package/src/core/device-install/operations/limbuild-client.ts +0 -144
- package/src/core/device-install/operations/operations.ts +0 -239
- package/src/core/device-install/operations/relay-client.ts +0 -286
- package/src/core/device-install/operations/relay-protocol.ts +0 -71
- package/src/core/device-install/operations/usbmux.ts +0 -270
- package/src/core/device-install/operations/webusb-dom.d.ts +0 -54
- package/src/core/device-install/operations/webusb.ts +0 -110
- package/src/core/device-install/storage/browser-storage.test.ts +0 -65
- package/src/core/device-install/storage/browser-storage.ts +0 -325
- package/src/core/device-install/storage/index.ts +0 -2
- package/src/core/device-install/storage/secret-store.ts +0 -332
- package/src/core/device-install/types.ts +0 -69
- package/src/core/errors.ts +0 -3
- package/src/core/play-publish/google.ts +0 -113
- package/src/core/play-publish/publish.test.ts +0 -68
- package/src/core/play-publish/publish.ts +0 -89
- package/src/device-build/index.ts +0 -42
- package/src/device-build/react.ts +0 -130
- package/src/device-build/signing.ts +0 -94
- package/src/device-install/README.md +0 -423
- package/src/device-install/demo/demo.css +0 -493
- package/src/device-install/demo/demo.tsx +0 -1061
- package/src/device-install/demo/index.html +0 -12
- package/src/device-install/index.ts +0 -50
- package/src/device-install/react.ts +0 -195
- package/src/play-publish/README.md +0 -66
- package/src/play-publish/index.ts +0 -12
- package/src/play-publish/react.ts +0 -208
|
@@ -1,419 +0,0 @@
|
|
|
1
|
-
import type { DeviceInstallSigningMode, ProvisioningProfileInfo, StoredSigningAssets } from '../types';
|
|
2
|
-
import {
|
|
3
|
-
getSigningAssets,
|
|
4
|
-
normalizeBundleID,
|
|
5
|
-
normalizeUDID,
|
|
6
|
-
profileContainsDevice,
|
|
7
|
-
profileMatchesBundleID,
|
|
8
|
-
putSigningAssets,
|
|
9
|
-
} from '../storage';
|
|
10
|
-
import type { AppleProvisioningRequest } from './relay';
|
|
11
|
-
|
|
12
|
-
export type AppleDeveloperPortalTeam = {
|
|
13
|
-
name?: string;
|
|
14
|
-
teamId?: string;
|
|
15
|
-
providerId?: string | number;
|
|
16
|
-
publicProviderId?: string;
|
|
17
|
-
type?: string;
|
|
18
|
-
subType?: string;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type AppleDeveloperPortalDevice = {
|
|
22
|
-
deviceId?: string;
|
|
23
|
-
name?: string;
|
|
24
|
-
deviceNumber?: string;
|
|
25
|
-
deviceClass?: string;
|
|
26
|
-
model?: string;
|
|
27
|
-
status?: string;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export type AppleDeveloperPortalAppID = {
|
|
31
|
-
appId?: string;
|
|
32
|
-
appIdId?: string;
|
|
33
|
-
identifier?: string;
|
|
34
|
-
bundleId?: string;
|
|
35
|
-
name?: string;
|
|
36
|
-
prefix?: string;
|
|
37
|
-
platform?: string;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export type AppleDeveloperPortalResponse = {
|
|
41
|
-
resultCode?: number;
|
|
42
|
-
resultString?: string;
|
|
43
|
-
userString?: string;
|
|
44
|
-
teams?: AppleDeveloperPortalTeam[];
|
|
45
|
-
provider?: AppleDeveloperPortalTeam;
|
|
46
|
-
availableProviders?: AppleDeveloperPortalTeam[];
|
|
47
|
-
appIds?: AppleDeveloperPortalAppID[];
|
|
48
|
-
devices?: AppleDeveloperPortalDevice[];
|
|
49
|
-
certRequests?: Array<Record<string, unknown>>;
|
|
50
|
-
certRequest?: Record<string, unknown>;
|
|
51
|
-
appId?: Record<string, unknown>;
|
|
52
|
-
device?: Record<string, unknown>;
|
|
53
|
-
provisioningProfile?: Record<string, unknown>;
|
|
54
|
-
provisioningProfiles?: Array<Record<string, unknown>>;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export type AppleProvisioningContext = {
|
|
58
|
-
bundleID: string;
|
|
59
|
-
deviceUDID: string;
|
|
60
|
-
teamID?: string;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export type AppleSigningAssetCacheInput = {
|
|
64
|
-
bundleID: string;
|
|
65
|
-
deviceUDID?: string;
|
|
66
|
-
teamID?: string;
|
|
67
|
-
signingMode?: DeviceInstallSigningMode;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export type PutAppleGeneratedSigningAssetsInput = {
|
|
71
|
-
bundleID: string;
|
|
72
|
-
deviceUDID?: string;
|
|
73
|
-
teamID?: string;
|
|
74
|
-
signingMode?: DeviceInstallSigningMode;
|
|
75
|
-
certificateID?: string;
|
|
76
|
-
certificateP12Base64: string;
|
|
77
|
-
certificatePassword?: string;
|
|
78
|
-
provisioningProfileBase64: string;
|
|
79
|
-
profile: ProvisioningProfileInfo;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export function listTeamsRequest(): AppleProvisioningRequest {
|
|
83
|
-
return {
|
|
84
|
-
method: 'POST',
|
|
85
|
-
path: '/account/listTeams.action',
|
|
86
|
-
payload: {},
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export function findBundleIDRequest({
|
|
91
|
-
bundleID,
|
|
92
|
-
teamID = '',
|
|
93
|
-
}: Pick<AppleProvisioningContext, 'bundleID' | 'teamID'>) {
|
|
94
|
-
void bundleID;
|
|
95
|
-
return pagedRequest('/account/ios/identifiers/listAppIds.action', teamID, { sort: 'name=asc' });
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export function findDeviceRequest({
|
|
99
|
-
deviceUDID,
|
|
100
|
-
teamID = '',
|
|
101
|
-
}: Pick<AppleProvisioningContext, 'deviceUDID' | 'teamID'>) {
|
|
102
|
-
void deviceUDID;
|
|
103
|
-
return pagedRequest('/account/ios/device/listDevices.action', teamID, {
|
|
104
|
-
sort: 'name=asc',
|
|
105
|
-
includeRemovedDevices: false,
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export function findDevelopmentCertificatesRequest(teamID = '') {
|
|
110
|
-
return pagedRequest('/account/ios/certificate/listCertRequests.action', teamID, {
|
|
111
|
-
sort: 'name=asc',
|
|
112
|
-
types: '83Q87W3TGH,5QPB9NHCEI',
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export function findDistributionCertificatesRequest(teamID = '') {
|
|
117
|
-
return pagedRequest('/account/ios/certificate/listCertRequests.action', teamID, {
|
|
118
|
-
sort: 'name=asc',
|
|
119
|
-
types: 'WXV89964HE,R58UK2EWSO',
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export function findDevelopmentProfilesRequest({
|
|
124
|
-
bundleID,
|
|
125
|
-
teamID = '',
|
|
126
|
-
}: Pick<AppleProvisioningContext, 'bundleID' | 'teamID'>) {
|
|
127
|
-
return pagedRequest('/account/ios/profile/listProvisioningProfiles.action', teamID, {
|
|
128
|
-
search: bundleID,
|
|
129
|
-
sort: 'name=asc',
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export function findAdHocProfilesRequest({
|
|
134
|
-
bundleID,
|
|
135
|
-
teamID = '',
|
|
136
|
-
}: Pick<AppleProvisioningContext, 'bundleID' | 'teamID'>) {
|
|
137
|
-
return pagedRequest('/account/ios/profile/listProvisioningProfiles.action', teamID, {
|
|
138
|
-
search: bundleID,
|
|
139
|
-
sort: 'name=asc',
|
|
140
|
-
distributionType: 'adhoc',
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export function findAppStoreProfilesRequest({
|
|
145
|
-
bundleID,
|
|
146
|
-
teamID = '',
|
|
147
|
-
}: Pick<AppleProvisioningContext, 'bundleID' | 'teamID'>) {
|
|
148
|
-
return pagedRequest('/account/ios/profile/listProvisioningProfiles.action', teamID, {
|
|
149
|
-
search: bundleID,
|
|
150
|
-
sort: 'name=asc',
|
|
151
|
-
distributionType: 'store',
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export function registerDeviceRequest({
|
|
156
|
-
deviceUDID,
|
|
157
|
-
teamID = '',
|
|
158
|
-
name = 'Limrun iPhone',
|
|
159
|
-
}: Pick<AppleProvisioningContext, 'deviceUDID' | 'teamID'> & { name?: string }) {
|
|
160
|
-
return {
|
|
161
|
-
method: 'POST',
|
|
162
|
-
path: '/account/ios/device/addDevices.action',
|
|
163
|
-
payload: {
|
|
164
|
-
teamId: teamID,
|
|
165
|
-
deviceNames: name,
|
|
166
|
-
deviceNumbers: normalizeUDID(deviceUDID),
|
|
167
|
-
deviceClasses: 'iphone',
|
|
168
|
-
register: 'single',
|
|
169
|
-
},
|
|
170
|
-
} satisfies AppleProvisioningRequest;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export function createBundleIDRequest({
|
|
174
|
-
bundleID,
|
|
175
|
-
teamID = '',
|
|
176
|
-
name,
|
|
177
|
-
}: Pick<AppleProvisioningContext, 'bundleID' | 'teamID'> & { name?: string }) {
|
|
178
|
-
return {
|
|
179
|
-
method: 'POST',
|
|
180
|
-
path: '/account/ios/identifiers/addAppId.action',
|
|
181
|
-
payload: {
|
|
182
|
-
teamId: teamID,
|
|
183
|
-
name: name ?? bundleID,
|
|
184
|
-
identifier: bundleID,
|
|
185
|
-
type: 'explicit',
|
|
186
|
-
},
|
|
187
|
-
} satisfies AppleProvisioningRequest;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export function submitDevelopmentCSRRequest({ csrPEM, teamID = '' }: { csrPEM: string; teamID?: string }) {
|
|
191
|
-
return {
|
|
192
|
-
method: 'POST',
|
|
193
|
-
path: '/account/ios/certificate/submitCertificateRequest.action',
|
|
194
|
-
payload: {
|
|
195
|
-
teamId: teamID,
|
|
196
|
-
type: '83Q87W3TGH',
|
|
197
|
-
csrContent: csrPEM,
|
|
198
|
-
},
|
|
199
|
-
} satisfies AppleProvisioningRequest;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export function submitDistributionCSRRequest({ csrPEM, teamID = '' }: { csrPEM: string; teamID?: string }) {
|
|
203
|
-
return {
|
|
204
|
-
method: 'POST',
|
|
205
|
-
path: '/account/ios/certificate/submitCertificateRequest.action',
|
|
206
|
-
payload: {
|
|
207
|
-
teamId: teamID,
|
|
208
|
-
type: 'WXV89964HE',
|
|
209
|
-
csrContent: csrPEM,
|
|
210
|
-
},
|
|
211
|
-
} satisfies AppleProvisioningRequest;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
export function downloadCertificateRequest(certificateID: string, teamID = '') {
|
|
215
|
-
return {
|
|
216
|
-
method: 'GET',
|
|
217
|
-
path: '/account/ios/certificate/downloadCertificateContent.action',
|
|
218
|
-
payload: {
|
|
219
|
-
teamId: teamID,
|
|
220
|
-
certificateId: certificateID,
|
|
221
|
-
type: '83Q87W3TGH',
|
|
222
|
-
},
|
|
223
|
-
} satisfies AppleProvisioningRequest;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export function downloadDistributionCertificateRequest(certificateID: string, teamID = '') {
|
|
227
|
-
return {
|
|
228
|
-
method: 'GET',
|
|
229
|
-
path: '/account/ios/certificate/downloadCertificateContent.action',
|
|
230
|
-
payload: {
|
|
231
|
-
teamId: teamID,
|
|
232
|
-
certificateId: certificateID,
|
|
233
|
-
type: 'WXV89964HE',
|
|
234
|
-
},
|
|
235
|
-
} satisfies AppleProvisioningRequest;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
export function createDevelopmentProfileRequest({
|
|
239
|
-
bundleID,
|
|
240
|
-
teamID = '',
|
|
241
|
-
appIDID,
|
|
242
|
-
certificateID,
|
|
243
|
-
deviceIDs,
|
|
244
|
-
name,
|
|
245
|
-
}: Pick<AppleProvisioningContext, 'bundleID' | 'teamID'> & {
|
|
246
|
-
appIDID: string;
|
|
247
|
-
certificateID: string;
|
|
248
|
-
deviceIDs: string[];
|
|
249
|
-
name?: string;
|
|
250
|
-
}) {
|
|
251
|
-
return {
|
|
252
|
-
method: 'POST',
|
|
253
|
-
path: '/account/ios/profile/createProvisioningProfile.action',
|
|
254
|
-
payload: {
|
|
255
|
-
teamId: teamID,
|
|
256
|
-
provisioningProfileName: name ?? `Limrun ${bundleID}`,
|
|
257
|
-
certificateIds: [certificateID],
|
|
258
|
-
appIdId: appIDID,
|
|
259
|
-
deviceIds: deviceIDs,
|
|
260
|
-
distributionType: 'limited',
|
|
261
|
-
subPlatform: 'ios',
|
|
262
|
-
},
|
|
263
|
-
} satisfies AppleProvisioningRequest;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
export function createAdHocProfileRequest({
|
|
267
|
-
bundleID,
|
|
268
|
-
teamID = '',
|
|
269
|
-
appIDID,
|
|
270
|
-
certificateID,
|
|
271
|
-
deviceIDs,
|
|
272
|
-
name,
|
|
273
|
-
}: Pick<AppleProvisioningContext, 'bundleID' | 'teamID'> & {
|
|
274
|
-
appIDID: string;
|
|
275
|
-
certificateID: string;
|
|
276
|
-
deviceIDs: string[];
|
|
277
|
-
name?: string;
|
|
278
|
-
}) {
|
|
279
|
-
return {
|
|
280
|
-
method: 'POST',
|
|
281
|
-
path: '/account/ios/profile/createProvisioningProfile.action',
|
|
282
|
-
payload: {
|
|
283
|
-
teamId: teamID,
|
|
284
|
-
provisioningProfileName: name ?? `Limrun Ad Hoc ${bundleID}`,
|
|
285
|
-
certificateIds: [certificateID],
|
|
286
|
-
appIdId: appIDID,
|
|
287
|
-
deviceIds: deviceIDs,
|
|
288
|
-
distributionType: 'adhoc',
|
|
289
|
-
subPlatform: 'ios',
|
|
290
|
-
},
|
|
291
|
-
} satisfies AppleProvisioningRequest;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* App Store distribution profiles bind no devices, and the name is required
|
|
296
|
-
* because implementors brand profiles themselves; there is no default.
|
|
297
|
-
*/
|
|
298
|
-
export function createAppStoreProfileRequest({
|
|
299
|
-
teamID = '',
|
|
300
|
-
appIDID,
|
|
301
|
-
certificateID,
|
|
302
|
-
name,
|
|
303
|
-
}: Pick<AppleProvisioningContext, 'teamID'> & {
|
|
304
|
-
appIDID: string;
|
|
305
|
-
certificateID: string;
|
|
306
|
-
name: string;
|
|
307
|
-
}) {
|
|
308
|
-
return {
|
|
309
|
-
method: 'POST',
|
|
310
|
-
path: '/account/ios/profile/createProvisioningProfile.action',
|
|
311
|
-
payload: {
|
|
312
|
-
teamId: teamID,
|
|
313
|
-
provisioningProfileName: name,
|
|
314
|
-
certificateIds: [certificateID],
|
|
315
|
-
appIdId: appIDID,
|
|
316
|
-
distributionType: 'store',
|
|
317
|
-
subPlatform: 'ios',
|
|
318
|
-
},
|
|
319
|
-
} satisfies AppleProvisioningRequest;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
export function downloadProfileRequest(profileID: string, teamID = '') {
|
|
323
|
-
return {
|
|
324
|
-
method: 'GET',
|
|
325
|
-
path: '/account/ios/profile/downloadProfileContent',
|
|
326
|
-
payload: {
|
|
327
|
-
teamId: teamID,
|
|
328
|
-
provisioningProfileId: profileID,
|
|
329
|
-
},
|
|
330
|
-
} satisfies AppleProvisioningRequest;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
export async function getReusableAppleSigningAssets({
|
|
334
|
-
bundleID,
|
|
335
|
-
deviceUDID,
|
|
336
|
-
teamID,
|
|
337
|
-
signingMode,
|
|
338
|
-
}: AppleSigningAssetCacheInput) {
|
|
339
|
-
const stored = await getSigningAssets({ bundleID, deviceUDID, signingMode });
|
|
340
|
-
if (!stored || !storedSigningAssetsReusable(stored, { bundleID, deviceUDID, teamID, signingMode })) {
|
|
341
|
-
return undefined;
|
|
342
|
-
}
|
|
343
|
-
return stored;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
export async function putAppleGeneratedSigningAssets(input: PutAppleGeneratedSigningAssetsInput) {
|
|
347
|
-
return putSigningAssets({
|
|
348
|
-
...input,
|
|
349
|
-
certificateFileName:
|
|
350
|
-
input.certificateID ? `${input.certificateID}.p12` : `apple-${input.signingMode ?? 'development'}.p12`,
|
|
351
|
-
certificatePassword: input.certificatePassword || undefined,
|
|
352
|
-
signingMode: input.signingMode,
|
|
353
|
-
profileFileName:
|
|
354
|
-
input.profile.uuid ?
|
|
355
|
-
`${input.profile.uuid}.mobileprovision`
|
|
356
|
-
: `${input.signingMode ?? 'development'}.mobileprovision`,
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
export function storedSigningAssetsReusable(
|
|
361
|
-
stored: StoredSigningAssets,
|
|
362
|
-
{ bundleID, deviceUDID, teamID, signingMode = 'development' }: AppleSigningAssetCacheInput,
|
|
363
|
-
) {
|
|
364
|
-
if ((stored.signingMode ?? 'development') !== signingMode) {
|
|
365
|
-
return false;
|
|
366
|
-
}
|
|
367
|
-
if (!profileMatchesBundleID(stored.profile, bundleID)) {
|
|
368
|
-
return false;
|
|
369
|
-
}
|
|
370
|
-
if (teamID && stored.teamID && stored.teamID !== teamID) {
|
|
371
|
-
return false;
|
|
372
|
-
}
|
|
373
|
-
if (deviceUDID && !profileContainsDevice(stored.profile, deviceUDID)) {
|
|
374
|
-
return false;
|
|
375
|
-
}
|
|
376
|
-
if (stored.profile.expirationDate && new Date(stored.profile.expirationDate).getTime() <= Date.now()) {
|
|
377
|
-
return false;
|
|
378
|
-
}
|
|
379
|
-
return normalizeBundleID(stored.bundleID) === normalizeBundleID(bundleID);
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
export function selectDeveloperPortalTeam(body: unknown): AppleDeveloperPortalTeam | undefined {
|
|
383
|
-
const response = body as AppleDeveloperPortalResponse | undefined;
|
|
384
|
-
return response?.teams?.[0] ?? response?.provider ?? response?.availableProviders?.[0];
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
export function teamIDCandidates(body: unknown): string[] {
|
|
388
|
-
const response = body as AppleDeveloperPortalResponse | undefined;
|
|
389
|
-
const teams = [
|
|
390
|
-
...(response?.teams ?? []),
|
|
391
|
-
...(response?.provider ? [response.provider] : []),
|
|
392
|
-
...(response?.availableProviders ?? []),
|
|
393
|
-
];
|
|
394
|
-
const ids = new Set<string>();
|
|
395
|
-
for (const team of teams) {
|
|
396
|
-
for (const value of [team.teamId, team.providerId, team.publicProviderId]) {
|
|
397
|
-
if (value !== undefined && value !== '') {
|
|
398
|
-
ids.add(String(value));
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
return [...ids];
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
function pagedRequest(path: string, teamID: string, payload: Record<string, unknown> = {}) {
|
|
406
|
-
const basePayload: Record<string, unknown> = {
|
|
407
|
-
pageNumber: 1,
|
|
408
|
-
pageSize: 200,
|
|
409
|
-
...payload,
|
|
410
|
-
};
|
|
411
|
-
if (teamID) {
|
|
412
|
-
basePayload.teamId = teamID;
|
|
413
|
-
}
|
|
414
|
-
return {
|
|
415
|
-
method: 'POST',
|
|
416
|
-
path,
|
|
417
|
-
payload: basePayload,
|
|
418
|
-
} satisfies AppleProvisioningRequest;
|
|
419
|
-
}
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import type { AppleSRPCompleteProof, AppleSRPInitRequest, AppleSRPInitResponse } from './gsa-srp';
|
|
2
|
-
|
|
3
|
-
export type AppleRelayResponse<T = unknown> = {
|
|
4
|
-
status: number;
|
|
5
|
-
statusText: string;
|
|
6
|
-
headers?: Record<string, string>;
|
|
7
|
-
body?: T;
|
|
8
|
-
rawBody?: string;
|
|
9
|
-
rawBodyBase64?: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type AppleProvisioningRequest = {
|
|
13
|
-
method?: 'GET' | 'POST';
|
|
14
|
-
path: string;
|
|
15
|
-
payload?: unknown;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* A session-authenticated App Store Connect request proxied by the relay.
|
|
20
|
-
* Unlike provisioning requests, payloads pass through as JSON and GET
|
|
21
|
-
* parameters go into an explicit query map because the App Store Connect
|
|
22
|
-
* API uses bracketed JSON:API keys like fields[apiKeys].
|
|
23
|
-
*/
|
|
24
|
-
export type AppStoreConnectRequest = {
|
|
25
|
-
method?: 'GET' | 'POST';
|
|
26
|
-
path: string;
|
|
27
|
-
query?: Record<string, string>;
|
|
28
|
-
payload?: unknown;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
type AppleRelayWebSocketMessage<T = unknown> = {
|
|
32
|
-
id: string;
|
|
33
|
-
ok: boolean;
|
|
34
|
-
response?: AppleRelayResponse<T>;
|
|
35
|
-
error?: string;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export class AppleRelayWebSocketClient {
|
|
39
|
-
private socket?: WebSocket;
|
|
40
|
-
private nextId = 1;
|
|
41
|
-
private readonly pending = new Map<
|
|
42
|
-
string,
|
|
43
|
-
{
|
|
44
|
-
resolve: (response: AppleRelayResponse) => void;
|
|
45
|
-
reject: (error: Error) => void;
|
|
46
|
-
}
|
|
47
|
-
>();
|
|
48
|
-
|
|
49
|
-
constructor(
|
|
50
|
-
private readonly apiUrl: string,
|
|
51
|
-
private readonly token?: string,
|
|
52
|
-
private readonly organizationId?: string,
|
|
53
|
-
) {}
|
|
54
|
-
|
|
55
|
-
async connect() {
|
|
56
|
-
if (this.socket && this.socket.readyState === WebSocket.OPEN) return;
|
|
57
|
-
const socket = new WebSocket(appleRelayWebSocketURL(this.apiUrl, this.token, this.organizationId));
|
|
58
|
-
this.socket = socket;
|
|
59
|
-
socket.onmessage = (event) => this.handleMessage(event);
|
|
60
|
-
socket.onclose = () => this.rejectPending(new Error('Apple relay WebSocket closed'));
|
|
61
|
-
socket.onerror = () => this.rejectPending(new Error('Apple relay WebSocket failed'));
|
|
62
|
-
await new Promise<void>((resolve, reject) => {
|
|
63
|
-
socket.onopen = () => resolve();
|
|
64
|
-
socket.onerror = () => reject(new Error('Apple relay WebSocket connection failed'));
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
request<T = unknown>(type: string, payload?: unknown) {
|
|
69
|
-
const socket = this.socket;
|
|
70
|
-
if (!socket || socket.readyState !== WebSocket.OPEN) {
|
|
71
|
-
throw new Error('Apple relay WebSocket is not connected.');
|
|
72
|
-
}
|
|
73
|
-
const id = String(this.nextId++);
|
|
74
|
-
const response = new Promise<AppleRelayResponse<T>>((resolve, reject) => {
|
|
75
|
-
this.pending.set(id, {
|
|
76
|
-
resolve: (value) => resolve(normalizeAppleProxyResponse<T>(value as AppleRelayResponse<T>)),
|
|
77
|
-
reject,
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
socket.send(JSON.stringify({ id, type, ...(payload === undefined ? {} : { payload }) }));
|
|
81
|
-
return response;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
close() {
|
|
85
|
-
this.rejectPending(new Error('Apple relay WebSocket closed'));
|
|
86
|
-
this.socket?.close();
|
|
87
|
-
this.socket = undefined;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
private handleMessage(event: MessageEvent) {
|
|
91
|
-
const message = JSON.parse(String(event.data)) as AppleRelayWebSocketMessage;
|
|
92
|
-
const waiter = this.pending.get(message.id);
|
|
93
|
-
if (!waiter) return;
|
|
94
|
-
this.pending.delete(message.id);
|
|
95
|
-
if (!message.ok) {
|
|
96
|
-
waiter.reject(new Error(message.error || 'Apple relay request failed'));
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (!message.response) {
|
|
100
|
-
waiter.reject(new Error('Apple relay response was empty.'));
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
waiter.resolve(message.response);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
private rejectPending(error: Error) {
|
|
107
|
-
for (const waiter of this.pending.values()) {
|
|
108
|
-
waiter.reject(error);
|
|
109
|
-
}
|
|
110
|
-
this.pending.clear();
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export async function openAppleRelayWebSocket(apiUrl: string, token?: string, organizationId?: string) {
|
|
115
|
-
const client = new AppleRelayWebSocketClient(apiUrl, token, organizationId);
|
|
116
|
-
await client.connect();
|
|
117
|
-
return client;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export async function proxySrpInit(relay: AppleRelayWebSocketClient, payload: AppleSRPInitRequest) {
|
|
121
|
-
return relay.request<AppleSRPInitResponse>('srpInit', payload);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export async function proxySrpComplete(
|
|
125
|
-
relay: AppleRelayWebSocketClient,
|
|
126
|
-
payload: AppleSRPCompleteProof & {
|
|
127
|
-
rememberMe: boolean;
|
|
128
|
-
trustTokens: string[];
|
|
129
|
-
},
|
|
130
|
-
) {
|
|
131
|
-
return relay.request('srpComplete', payload);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export async function triggerTrustedDeviceTwoFactor(relay: AppleRelayWebSocketClient) {
|
|
135
|
-
return relay.request('triggerTrustedDevice2FA');
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export async function triggerPhoneTwoFactor(
|
|
139
|
-
relay: AppleRelayWebSocketClient,
|
|
140
|
-
phoneNumberId: number,
|
|
141
|
-
mode = 'sms',
|
|
142
|
-
) {
|
|
143
|
-
return relay.request('triggerPhone2FA', { phoneNumberId, mode });
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export async function proxyTwoFactorCode(relay: AppleRelayWebSocketClient, code: string) {
|
|
147
|
-
return relay.request('submitTrustedDevice2FA', { code });
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export async function proxyPhoneTwoFactorCode(
|
|
151
|
-
relay: AppleRelayWebSocketClient,
|
|
152
|
-
phoneNumberId: number,
|
|
153
|
-
code: string,
|
|
154
|
-
mode = 'sms',
|
|
155
|
-
) {
|
|
156
|
-
return relay.request('submitPhone2FA', { phoneNumberId, mode, code });
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export async function fetchAppleAccountSession(relay: AppleRelayWebSocketClient) {
|
|
160
|
-
return relay.request('finalize');
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export async function proxyProvisioningRequest<T = unknown>(
|
|
164
|
-
relay: AppleRelayWebSocketClient,
|
|
165
|
-
request: AppleProvisioningRequest,
|
|
166
|
-
) {
|
|
167
|
-
return relay.request<T>('provisioning', request);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export async function proxyAppStoreConnectRequest<T = unknown>(
|
|
171
|
-
relay: AppleRelayWebSocketClient,
|
|
172
|
-
request: AppStoreConnectRequest,
|
|
173
|
-
) {
|
|
174
|
-
return relay.request<T>('appstoreconnect', request);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function normalizeAppleProxyResponse<T>(response: AppleRelayResponse<T>) {
|
|
178
|
-
if (response.body !== undefined || !response.rawBody) {
|
|
179
|
-
return response;
|
|
180
|
-
}
|
|
181
|
-
try {
|
|
182
|
-
return {
|
|
183
|
-
...response,
|
|
184
|
-
body: JSON.parse(response.rawBody) as T,
|
|
185
|
-
};
|
|
186
|
-
} catch {
|
|
187
|
-
return response;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function appleRelayWebSocketURL(apiUrl: string, token?: string, organizationId?: string) {
|
|
192
|
-
const url = new URL(apiUrl);
|
|
193
|
-
url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
194
|
-
url.pathname = `${url.pathname.replace(/\/$/, '')}/ios/appstoreconnect/ws`;
|
|
195
|
-
if (token) {
|
|
196
|
-
url.searchParams.set('token', token);
|
|
197
|
-
}
|
|
198
|
-
if (organizationId) {
|
|
199
|
-
url.searchParams.set('organization', organizationId);
|
|
200
|
-
}
|
|
201
|
-
return url.toString();
|
|
202
|
-
}
|