@limrun/ui 0.14.0-rc.3 → 0.14.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-store-relay/index.cjs +3 -3
- package/dist/app-store-relay/index.d.ts +108 -4
- package/dist/app-store-relay/index.js +353 -160
- package/dist/app-store-relay/react.cjs +1 -1
- package/dist/app-store-relay/react.js +32 -33
- package/dist/apple-credentials/index.cjs +1 -0
- package/dist/apple-credentials/index.d.ts +110 -0
- package/dist/apple-credentials/index.js +291 -0
- package/dist/browser-storage-BnO-Ma-e.mjs +219 -0
- package/dist/browser-storage-DLxIqZk5.js +1 -0
- package/dist/client-C9z_sgOf.js +1 -0
- package/dist/{client-C8ZDEjtD.mjs → client-CFDB4mX5.mjs} +38 -31
- package/dist/components/remote-control.d.ts +156 -0
- package/dist/core/device-install/apple/provisioning.d.ts +25 -0
- package/dist/core/device-install/apple/relay.d.ts +13 -0
- package/dist/core/device-install/storage/browser-storage.d.ts +8 -0
- package/dist/core/device-install/storage/index.d.ts +1 -0
- package/dist/core/device-install/storage/secret-store.d.ts +124 -0
- package/dist/core/device-install/types.d.ts +6 -0
- package/dist/core/errors.d.ts +1 -0
- package/dist/core/play-publish/google.d.ts +1 -1
- package/dist/device-build/index.cjs +1 -1
- package/dist/device-build/index.js +21 -20
- package/dist/device-build/react.cjs +1 -1
- package/dist/device-build/react.js +42 -43
- package/dist/device-install/index.cjs +1 -1
- package/dist/device-install/index.js +64 -63
- package/dist/device-install/react.cjs +1 -1
- package/dist/device-install/react.js +47 -49
- package/dist/errors-BSkqS7U-.js +1 -0
- package/dist/errors-gy8yQJos.mjs +6 -0
- package/dist/gsa-srp-Bme3JLEi.mjs +266 -0
- package/dist/gsa-srp-CCIfUz7Y.js +1 -0
- package/dist/index-ChhtuQ7e.js +22 -0
- package/dist/index-YDu8K9a4.mjs +11279 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +1405 -1125
- package/dist/play-publish/index.cjs +1 -1
- package/dist/play-publish/index.js +27 -24
- package/dist/play-publish/react.cjs +1 -1
- package/dist/play-publish/react.d.ts +12 -2
- package/dist/play-publish/react.js +70 -60
- package/dist/{provisioning-BmsEnF6X.mjs → provisioning-CDPvxd1h.mjs} +64 -33
- package/dist/provisioning-CbC4h--7.js +1 -0
- package/package.json +6 -1
- package/src/app-store-relay/index.ts +358 -23
- package/src/app-store-relay/react.ts +1 -4
- package/src/apple-credentials/index.test.ts +180 -0
- package/src/apple-credentials/index.ts +388 -0
- package/src/components/remote-control.css +32 -0
- package/src/components/remote-control.tsx +865 -5
- package/src/core/device-install/apple/client.ts +13 -6
- package/src/core/device-install/apple/provisioning.test.ts +30 -0
- package/src/core/device-install/apple/provisioning.ts +39 -0
- package/src/core/device-install/apple/relay.ts +20 -0
- package/src/core/device-install/operations/operations.ts +7 -5
- package/src/core/device-install/storage/browser-storage.test.ts +65 -0
- package/src/core/device-install/storage/browser-storage.ts +33 -0
- package/src/core/device-install/storage/index.ts +1 -0
- package/src/core/device-install/storage/secret-store.ts +332 -0
- package/src/core/device-install/types.ts +6 -0
- package/src/core/errors.ts +3 -0
- package/src/core/play-publish/google.ts +11 -2
- package/src/device-build/react.ts +1 -4
- package/src/device-install/demo/demo.tsx +1 -4
- package/src/device-install/react.ts +1 -4
- package/src/play-publish/README.md +5 -4
- package/src/play-publish/react.ts +72 -32
- package/vite.config.ts +1 -0
- package/dist/browser-storage-Cx9eW-bm.mjs +0 -205
- package/dist/browser-storage-jJaIht4K.js +0 -1
- package/dist/client-BtC4n_qf.js +0 -1
- package/dist/index-CMeQfhYy.js +0 -22
- package/dist/index-DFdCvi2_.mjs +0 -11543
- package/dist/provisioning-Va0PH4Kk.js +0 -1
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headless helpers that turn an authenticated Apple relay session into
|
|
3
|
+
* signing credentials persisted in a SigningSecretStore. The Apple relay
|
|
4
|
+
* only proxies: certificate and profile bytes always land in the browser
|
|
5
|
+
* first, and the browser writes them into the configured store (Limrun's
|
|
6
|
+
* org secret store by default, or a customer-provided one).
|
|
7
|
+
*/
|
|
8
|
+
import {
|
|
9
|
+
createAppleCertificate,
|
|
10
|
+
createAppStoreConnectApiKey,
|
|
11
|
+
downloadAppleCertificate,
|
|
12
|
+
downloadAppleProfile,
|
|
13
|
+
downloadAppStoreConnectApiKeyPrivateKey,
|
|
14
|
+
exportAppleCertificateP12,
|
|
15
|
+
generateAppleSigningKeyAndCSR,
|
|
16
|
+
listAppleCertificates,
|
|
17
|
+
listAppleProfiles,
|
|
18
|
+
listAppStoreConnectApiKeys,
|
|
19
|
+
switchAppStoreConnectProvider,
|
|
20
|
+
type AppleCertificateKind,
|
|
21
|
+
type AppleProfileKind,
|
|
22
|
+
type AppStoreConnectApiKeyRole,
|
|
23
|
+
} from '../app-store-relay';
|
|
24
|
+
import type { AppleRelayWebSocketClient } from '../core/device-install/apple';
|
|
25
|
+
import {
|
|
26
|
+
normalizeCertificateSerial,
|
|
27
|
+
parseProvisioningProfileBase64,
|
|
28
|
+
} from '../core/device-install/storage/browser-storage';
|
|
29
|
+
import {
|
|
30
|
+
APP_STORE_CONNECT_API_KEY_SECRET_TYPE,
|
|
31
|
+
APPLE_CERTIFICATE_SECRET_TYPE,
|
|
32
|
+
putAppleCertificateSecret,
|
|
33
|
+
putAppleProvisioningProfileSecret,
|
|
34
|
+
putAppStoreConnectApiKeySecret,
|
|
35
|
+
type AppleCertificateSecretData,
|
|
36
|
+
type AppleCertificateType,
|
|
37
|
+
type AppStoreConnectApiKeySecretData,
|
|
38
|
+
type SigningSecret,
|
|
39
|
+
type SigningSecretStore,
|
|
40
|
+
} from '../core/device-install/storage/secret-store';
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
APP_STORE_CONNECT_API_KEY_SECRET_TYPE,
|
|
44
|
+
APPLE_CERTIFICATE_SECRET_TYPE,
|
|
45
|
+
APPLE_PROVISIONING_PROFILE_SECRET_TYPE,
|
|
46
|
+
createBrowserSecretStore,
|
|
47
|
+
createLimrunSecretStore,
|
|
48
|
+
putAppleCertificateSecret,
|
|
49
|
+
putAppleProvisioningProfileSecret,
|
|
50
|
+
putAppStoreConnectApiKeySecret,
|
|
51
|
+
type AppleCertificateSecretData,
|
|
52
|
+
type AppleCertificateType,
|
|
53
|
+
type AppleProvisioningProfileSecretData,
|
|
54
|
+
type AppStoreConnectApiKeySecretData,
|
|
55
|
+
type LimrunSecretStoreOptions,
|
|
56
|
+
type SigningSecret,
|
|
57
|
+
type SigningSecretData,
|
|
58
|
+
type SigningSecretMetadata,
|
|
59
|
+
type SigningSecretStore,
|
|
60
|
+
type SigningSecretType,
|
|
61
|
+
} from '../core/device-install/storage/secret-store';
|
|
62
|
+
export { normalizeCertificateSerial } from '../core/device-install/storage/browser-storage';
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Conventional secret name of a team's certificate bundle. One bundle per
|
|
66
|
+
* team and Apple certificate type; the type is in the name so development
|
|
67
|
+
* and distribution material never collide.
|
|
68
|
+
*/
|
|
69
|
+
export function appleCertificateSecretName(teamId: string, certificateType: AppleCertificateType) {
|
|
70
|
+
return `${teamId}/${certificateType}`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export type EnsureAppleCertificateInput = {
|
|
74
|
+
relay: AppleRelayWebSocketClient;
|
|
75
|
+
teamId: string;
|
|
76
|
+
secretStore: SigningSecretStore;
|
|
77
|
+
/**
|
|
78
|
+
* Which portal certificate kind to ensure. Ad-hoc and App Store signing
|
|
79
|
+
* both use the distribution certificate. Defaults to development.
|
|
80
|
+
*/
|
|
81
|
+
certificateKind?: AppleCertificateKind;
|
|
82
|
+
/** Common name used when minting a new certificate. */
|
|
83
|
+
commonName?: string;
|
|
84
|
+
log?: (message: string, detail?: string) => void;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export type EnsureAppleCertificateResult = {
|
|
88
|
+
secret: SigningSecret;
|
|
89
|
+
certificateId: string;
|
|
90
|
+
/** True when a new certificate was minted instead of reusing the stored one. */
|
|
91
|
+
created: boolean;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Returns a usable certificate secret of the requested kind for the team,
|
|
96
|
+
* reusing the stored one when its certificate is still on the team and
|
|
97
|
+
* minting a new one otherwise. Apple caps certificates per kind (2 for
|
|
98
|
+
* development, 3 for distribution) and never returns private keys, so
|
|
99
|
+
* reuse of the stored p12 is strongly preferred.
|
|
100
|
+
*
|
|
101
|
+
* Durability of the stored material is the secret store's concern:
|
|
102
|
+
* implementors who want retries or fallbacks build them into their
|
|
103
|
+
* SigningSecretStore.
|
|
104
|
+
*/
|
|
105
|
+
export async function ensureAppleCertificateSecret({
|
|
106
|
+
relay,
|
|
107
|
+
teamId,
|
|
108
|
+
secretStore,
|
|
109
|
+
certificateKind = 'development',
|
|
110
|
+
commonName,
|
|
111
|
+
log = () => {},
|
|
112
|
+
}: EnsureAppleCertificateInput): Promise<EnsureAppleCertificateResult> {
|
|
113
|
+
// The portal kinds map onto Apple's App Store Connect certificate type
|
|
114
|
+
// enum, which is what consumers of the stored secret filter on.
|
|
115
|
+
const certificateType: AppleCertificateType =
|
|
116
|
+
certificateKind === 'distribution' ? 'DISTRIBUTION' : 'DEVELOPMENT';
|
|
117
|
+
const secretName = appleCertificateSecretName(teamId, certificateType);
|
|
118
|
+
const current = await listAppleCertificates({ relay, teamId, certificateKind });
|
|
119
|
+
const findOnTeam = (certificateId: string | undefined) =>
|
|
120
|
+
certificateId === undefined ? undefined : (
|
|
121
|
+
current.find(
|
|
122
|
+
(item) =>
|
|
123
|
+
stringField(item, 'certificateId') === certificateId ||
|
|
124
|
+
stringField(item, 'certRequestId') === certificateId,
|
|
125
|
+
)
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
const stored = await secretStore.get(APPLE_CERTIFICATE_SECRET_TYPE, secretName);
|
|
129
|
+
const storedCertificateId = stringField(stored?.data, 'certificateID');
|
|
130
|
+
if (stored && storedCertificateId && stored.data.certificateP12Base64) {
|
|
131
|
+
// The stored value may be a certRequestId; resolve the canonical
|
|
132
|
+
// certificateId the profile API expects. If the cert is no longer on
|
|
133
|
+
// the team (revoked), fall through and mint a new one.
|
|
134
|
+
const matched = findOnTeam(storedCertificateId);
|
|
135
|
+
if (matched) {
|
|
136
|
+
const certificateId = stringField(matched, 'certificateId') ?? storedCertificateId;
|
|
137
|
+
log('Reusing stored Apple certificate', certificateId);
|
|
138
|
+
return { secret: stored, certificateId, created: false };
|
|
139
|
+
}
|
|
140
|
+
log('Stored certificate is no longer on the team', 'Minting a new one.');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// The private key is generated and kept in this browser; Apple only ever
|
|
144
|
+
// sees the CSR. Without this key the downloaded cert cannot sign anything.
|
|
145
|
+
const key = await generateAppleSigningKeyAndCSR({ commonName: commonName ?? `Limrun ${teamId}` });
|
|
146
|
+
const certificate = await createAppleCertificate({
|
|
147
|
+
relay,
|
|
148
|
+
teamId,
|
|
149
|
+
certificateKind,
|
|
150
|
+
csrPEM: key.csrPEM,
|
|
151
|
+
});
|
|
152
|
+
const certificateId =
|
|
153
|
+
stringField(certificate, 'certificateId') ?? stringField(certificate, 'certRequestId');
|
|
154
|
+
if (!certificateId) {
|
|
155
|
+
throw new Error('Apple certificate creation did not return a certificate ID.');
|
|
156
|
+
}
|
|
157
|
+
const downloaded = await downloadAppleCertificate({
|
|
158
|
+
relay,
|
|
159
|
+
teamId,
|
|
160
|
+
certificateKind,
|
|
161
|
+
certificateId,
|
|
162
|
+
});
|
|
163
|
+
if (!downloaded.rawBodyBase64) {
|
|
164
|
+
throw new Error('Apple certificate download returned no bytes.');
|
|
165
|
+
}
|
|
166
|
+
const data: AppleCertificateSecretData = {
|
|
167
|
+
certificateP12Base64: exportAppleCertificateP12({
|
|
168
|
+
privateKeyPKCS8Base64: key.privateKeyPKCS8Base64,
|
|
169
|
+
certificateBase64: downloaded.rawBodyBase64,
|
|
170
|
+
password: '',
|
|
171
|
+
friendlyName: `Apple ${certificateKind === 'distribution' ? 'Distribution' : 'Development'} ${teamId}`,
|
|
172
|
+
}),
|
|
173
|
+
certificateType,
|
|
174
|
+
teamID: teamId,
|
|
175
|
+
certificateID: certificateId,
|
|
176
|
+
// Normalized so it equals the serials profiles reference.
|
|
177
|
+
serialNumber: normalizeCertificateSerial(stringField(certificate, 'serialNum')),
|
|
178
|
+
expirationDate: stringField(certificate, 'expirationDateString'),
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
let secret: SigningSecret;
|
|
182
|
+
try {
|
|
183
|
+
secret = await putAppleCertificateSecret(secretStore, secretName, data);
|
|
184
|
+
} catch (error) {
|
|
185
|
+
// The key existed only in this browser's memory; once this throw
|
|
186
|
+
// unwinds it is gone, and the portal certificate is unusable.
|
|
187
|
+
throw new Error(
|
|
188
|
+
`Certificate ${certificateId} was created on the Apple Developer portal but saving its private ` +
|
|
189
|
+
`key to the secret store failed: ${errorText(error)}. The key cannot be recovered; revoke ` +
|
|
190
|
+
`certificate ${certificateId} at developer.apple.com before retrying, or the retry will mint ` +
|
|
191
|
+
`another certificate against Apple's limit.`,
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
log('Apple certificate stored', certificateId);
|
|
195
|
+
return { secret, certificateId, created: true };
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function errorText(error: unknown) {
|
|
199
|
+
return error instanceof Error ? error.message : String(error);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export type SaveAppleProfileInput = {
|
|
203
|
+
relay: AppleRelayWebSocketClient;
|
|
204
|
+
teamId: string;
|
|
205
|
+
profileId: string;
|
|
206
|
+
secretStore: SigningSecretStore;
|
|
207
|
+
log?: (message: string, detail?: string) => void;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Downloads the provisioning profile and stores it as an
|
|
212
|
+
* appleProvisioningProfile secret named `${teamId}/${uuid}`. The UUID is
|
|
213
|
+
* unique per profile, so a team can hold many profiles for the same
|
|
214
|
+
* bundle ID and certificate set; the reference fields (certificate
|
|
215
|
+
* serials, bundle IDs, device IDs parsed out of the profile) are what
|
|
216
|
+
* consumers filter on.
|
|
217
|
+
*/
|
|
218
|
+
export async function saveAppleProfileSecret({
|
|
219
|
+
relay,
|
|
220
|
+
teamId,
|
|
221
|
+
profileId,
|
|
222
|
+
secretStore,
|
|
223
|
+
log = () => {},
|
|
224
|
+
}: SaveAppleProfileInput): Promise<SigningSecret> {
|
|
225
|
+
const downloaded = await downloadAppleProfile({ relay, teamId, profileId });
|
|
226
|
+
const profileBase64 = downloaded.rawBodyBase64;
|
|
227
|
+
if (!profileBase64) {
|
|
228
|
+
throw new Error('Apple provisioning profile download returned no bytes.');
|
|
229
|
+
}
|
|
230
|
+
const info = parseProvisioningProfileBase64(profileBase64);
|
|
231
|
+
const name = `${teamId}/${info.uuid ?? profileId}`;
|
|
232
|
+
const secret = await putAppleProvisioningProfileSecret(secretStore, name, {
|
|
233
|
+
provisioningProfileBase64: profileBase64,
|
|
234
|
+
certificateSerialNumbers: info.certificateSerialNumbers.join(','),
|
|
235
|
+
bundleIDs: info.bundleID,
|
|
236
|
+
deviceIDs: info.provisionedDevices.join(','),
|
|
237
|
+
teamID: info.teamID ?? teamId,
|
|
238
|
+
profileName: info.name,
|
|
239
|
+
uuid: info.uuid,
|
|
240
|
+
expirationDate: info.expirationDate,
|
|
241
|
+
});
|
|
242
|
+
log('Apple provisioning profile stored', name);
|
|
243
|
+
return secret;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Conventional secret name of a team's App Store Connect API key: one
|
|
248
|
+
* shared key per team.
|
|
249
|
+
*/
|
|
250
|
+
export function appStoreConnectApiKeySecretName(teamId: string) {
|
|
251
|
+
return `${teamId}/APP_STORE_CONNECT_API_KEY`;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export type EnsureAppStoreConnectApiKeyInput = {
|
|
255
|
+
relay: AppleRelayWebSocketClient;
|
|
256
|
+
teamId: string;
|
|
257
|
+
/**
|
|
258
|
+
* Numeric provider ID of the team from the Apple team list. When given,
|
|
259
|
+
* the App Store Connect session is switched to this provider first;
|
|
260
|
+
* required for accounts that belong to multiple teams.
|
|
261
|
+
*/
|
|
262
|
+
providerId?: string | number;
|
|
263
|
+
secretStore: SigningSecretStore;
|
|
264
|
+
/** Display name for a newly minted key. Required; there is no default. */
|
|
265
|
+
nickname: string;
|
|
266
|
+
/** Roles of a newly minted key. Defaults to APP_MANAGER. */
|
|
267
|
+
roles?: AppStoreConnectApiKeyRole[];
|
|
268
|
+
log?: (message: string, detail?: string) => void;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
export type EnsureAppStoreConnectApiKeyResult = {
|
|
272
|
+
secret: SigningSecret;
|
|
273
|
+
keyId: string;
|
|
274
|
+
/** True when a new key was minted instead of reusing the stored one. */
|
|
275
|
+
created: boolean;
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Returns a usable App Store Connect API key secret for the team, reusing
|
|
280
|
+
* the stored one when its key is still active and minting a new one
|
|
281
|
+
* otherwise. Apple serves a key's private half exactly once (at creation
|
|
282
|
+
* time through the sparse fieldset download), so reuse of the stored .p8
|
|
283
|
+
* is strongly preferred.
|
|
284
|
+
*
|
|
285
|
+
* The session user must be a team Admin to list or create keys.
|
|
286
|
+
*/
|
|
287
|
+
export async function ensureAppStoreConnectApiKeySecret({
|
|
288
|
+
relay,
|
|
289
|
+
teamId,
|
|
290
|
+
providerId,
|
|
291
|
+
secretStore,
|
|
292
|
+
nickname,
|
|
293
|
+
roles,
|
|
294
|
+
log = () => {},
|
|
295
|
+
}: EnsureAppStoreConnectApiKeyInput): Promise<EnsureAppStoreConnectApiKeyResult> {
|
|
296
|
+
if (!nickname) {
|
|
297
|
+
throw new Error('A nickname is required to ensure an App Store Connect API key.');
|
|
298
|
+
}
|
|
299
|
+
if (providerId !== undefined) {
|
|
300
|
+
await switchAppStoreConnectProvider({ relay, providerId });
|
|
301
|
+
}
|
|
302
|
+
const secretName = appStoreConnectApiKeySecretName(teamId);
|
|
303
|
+
// Listing also primes the session's CSRF context, which Apple requires
|
|
304
|
+
// on the creation POST below.
|
|
305
|
+
const current = await listAppStoreConnectApiKeys({ relay });
|
|
306
|
+
|
|
307
|
+
const stored = await secretStore.get(APP_STORE_CONNECT_API_KEY_SECRET_TYPE, secretName);
|
|
308
|
+
const storedKeyId = stringField(stored?.data, 'keyId');
|
|
309
|
+
if (stored && storedKeyId && stored.data.privateKeyP8Base64) {
|
|
310
|
+
const matched = current.find((item) => item.id === storedKeyId && !keyRevoked(item.attributes));
|
|
311
|
+
if (matched) {
|
|
312
|
+
log('Reusing stored App Store Connect API key', storedKeyId);
|
|
313
|
+
return { secret: stored, keyId: storedKeyId, created: false };
|
|
314
|
+
}
|
|
315
|
+
log('Stored App Store Connect API key is no longer active', 'Minting a new one.');
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
const created = await createAppStoreConnectApiKey({ relay, nickname, roles });
|
|
319
|
+
const keyId = created.id!;
|
|
320
|
+
const downloaded = await downloadAppStoreConnectApiKeyPrivateKey({ relay, keyId });
|
|
321
|
+
const data: AppStoreConnectApiKeySecretData = {
|
|
322
|
+
privateKeyP8Base64: base64FromText(downloaded.privateKeyPem),
|
|
323
|
+
keyId,
|
|
324
|
+
issuerId: downloaded.issuerId,
|
|
325
|
+
nickname,
|
|
326
|
+
teamID: teamId,
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
let secret: SigningSecret;
|
|
330
|
+
try {
|
|
331
|
+
secret = await putAppStoreConnectApiKeySecret(secretStore, secretName, data);
|
|
332
|
+
} catch (error) {
|
|
333
|
+
// Apple never serves the private key again; once this throw unwinds
|
|
334
|
+
// the downloaded copy is gone and the portal key is unusable.
|
|
335
|
+
throw new Error(
|
|
336
|
+
`App Store Connect API key ${keyId} was created but saving its private key to the secret ` +
|
|
337
|
+
`store failed: ${errorText(error)}. The key cannot be downloaded again; revoke key ` +
|
|
338
|
+
`${keyId} in App Store Connect before retrying, or the retry will mint another key.`,
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
log('App Store Connect API key stored', keyId);
|
|
342
|
+
return { secret, keyId, created: true };
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function keyRevoked(attributes: Record<string, unknown> | undefined) {
|
|
346
|
+
if (!attributes) return false;
|
|
347
|
+
if (attributes.isActive === false) return true;
|
|
348
|
+
const revokingDate = attributes.revokingDate ?? attributes.revocationDate;
|
|
349
|
+
return typeof revokingDate === 'string' && revokingDate !== '';
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function base64FromText(text: string) {
|
|
353
|
+
const bytes = new TextEncoder().encode(text);
|
|
354
|
+
let binary = '';
|
|
355
|
+
for (const byte of bytes) {
|
|
356
|
+
binary += String.fromCharCode(byte);
|
|
357
|
+
}
|
|
358
|
+
return btoa(binary);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export type ListTeamProfilesInput = {
|
|
362
|
+
relay: AppleRelayWebSocketClient;
|
|
363
|
+
teamId: string;
|
|
364
|
+
/**
|
|
365
|
+
* Which portal profile listing to use. The development listing is
|
|
366
|
+
* unfiltered on the portal side and returns profiles of every
|
|
367
|
+
* distribution method; adhoc narrows to ad-hoc profiles. Defaults to
|
|
368
|
+
* development.
|
|
369
|
+
*/
|
|
370
|
+
profileKind?: AppleProfileKind;
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
/** Lists the team's provisioning profiles from the portal. */
|
|
374
|
+
export async function listTeamAppleProfiles({
|
|
375
|
+
relay,
|
|
376
|
+
teamId,
|
|
377
|
+
profileKind = 'development',
|
|
378
|
+
}: ListTeamProfilesInput) {
|
|
379
|
+
return listAppleProfiles({ relay, teamId, profileKind });
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/** Read a string-ish value from a loosely typed portal record. */
|
|
383
|
+
export function stringField(record: Record<string, unknown> | undefined, key: string) {
|
|
384
|
+
const value = record?.[key];
|
|
385
|
+
if (typeof value === 'string') return value;
|
|
386
|
+
if (typeof value === 'number' || typeof value === 'boolean') return String(value);
|
|
387
|
+
return undefined;
|
|
388
|
+
}
|
|
@@ -97,3 +97,35 @@
|
|
|
97
97
|
outline: 2px solid #2563eb;
|
|
98
98
|
outline-offset: 2px;
|
|
99
99
|
}
|
|
100
|
+
|
|
101
|
+
.rc-terminated {
|
|
102
|
+
position: absolute;
|
|
103
|
+
z-index: 50;
|
|
104
|
+
top: 50%;
|
|
105
|
+
left: 50%;
|
|
106
|
+
transform: translate(-50%, -50%);
|
|
107
|
+
display: flex;
|
|
108
|
+
flex-direction: column;
|
|
109
|
+
align-items: center;
|
|
110
|
+
gap: 4px;
|
|
111
|
+
max-width: 240px;
|
|
112
|
+
padding: 12px 18px;
|
|
113
|
+
border-radius: 16px;
|
|
114
|
+
text-align: center;
|
|
115
|
+
font: inherit;
|
|
116
|
+
background: rgba(255, 255, 255, 0.92);
|
|
117
|
+
color: #111827;
|
|
118
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.rc-terminated-title {
|
|
122
|
+
font: inherit;
|
|
123
|
+
font-weight: 600;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.rc-terminated-message {
|
|
127
|
+
font: inherit;
|
|
128
|
+
font-size: 0.8125rem;
|
|
129
|
+
line-height: 1.3;
|
|
130
|
+
color: #6b7280;
|
|
131
|
+
}
|