@hot-updater/protocol 1.2.0-rc.27 → 1.2.0-rc.28

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.
@@ -1460,12 +1460,19 @@ const readProfile = (bytes, name) => {
1460
1460
  const entitlements = plist["Entitlements"];
1461
1461
  const applicationId = isDict(entitlements) ? entitlements["application-identifier"] : void 0;
1462
1462
  const bundleId = typeof applicationId === "string" ? applicationId.slice(applicationId.indexOf(".") + 1) : null;
1463
+ const teams = plist["TeamIdentifier"];
1464
+ const team = Array.isArray(teams) ? teams[0] : void 0;
1465
+ const uuid = plist["UUID"];
1463
1466
  return {
1464
1467
  allDevices: plist["ProvisionsAllDevices"] === true,
1465
1468
  devices: devices === void 0 ? null : new Set(devices),
1466
1469
  getTaskAllow: isDict(entitlements) && entitlements["get-task-allow"] === true,
1467
1470
  expiresAtMs,
1468
- bundleId: bundleId === null || bundleId.includes("*") ? null : bundleId
1471
+ bundleId: bundleId === null || bundleId.includes("*") ? null : bundleId,
1472
+ applicationIdentifier: typeof applicationId === "string" ? applicationId : null,
1473
+ teamId: typeof team === "string" && team !== "" ? team : null,
1474
+ xcodeManaged: plist["IsXcodeManaged"] === true,
1475
+ uuid: typeof uuid === "string" && uuid !== "" ? uuid : null
1469
1476
  };
1470
1477
  };
1471
1478
  const distributionOf = (profile) => {
@@ -1475,6 +1482,23 @@ const distributionOf = (profile) => {
1475
1482
  return profile.getTaskAllow ? "development" : "ad-hoc";
1476
1483
  };
1477
1484
  /**
1485
+ * What a provisioning profile's bytes (a `.mobileprovision`, a CMS message
1486
+ * around a plist) say: the same reading an `.ipa`'s profiles get. It verifies
1487
+ * no signature. Throws `NativeArtifactError` for one it can't read.
1488
+ */
1489
+ const readProvisioningProfile = (bytes) => {
1490
+ const profile = readProfile(bytes, "provisioning profile");
1491
+ return {
1492
+ uuid: profile.uuid,
1493
+ distribution: distributionOf(profile),
1494
+ teamId: profile.teamId,
1495
+ applicationIdentifier: profile.applicationIdentifier,
1496
+ xcodeManaged: profile.xcodeManaged,
1497
+ devices: [...profile.devices ?? []].sort(),
1498
+ expiresAtMs: profile.expiresAtMs
1499
+ };
1500
+ };
1501
+ /**
1478
1502
  * What an `.ipa` installs as, reading only its directory, its app's Info.plist
1479
1503
  * and its provisioning profiles: a few requests of a remote file, whatever its
1480
1504
  * size. The `.ipa` is untrusted, and each part is bounded before it is read.
@@ -1518,7 +1542,8 @@ const readIpaInstallInfo = async (source) => {
1518
1542
  distribution,
1519
1543
  devices: listDevices ? [...lists[0] ?? []].filter((udid) => lists.every((list) => list.has(udid))).sort() : [],
1520
1544
  expiresAtMs: expiries.length === 0 ? null : Math.min(...expiries),
1521
- profileBundleIds: [.../* @__PURE__ */ new Set([bundleId, ...profiles.flatMap((item) => item.bundleId ?? [])])]
1545
+ profileBundleIds: [.../* @__PURE__ */ new Set([bundleId, ...profiles.flatMap((item) => item.bundleId ?? [])])],
1546
+ teamId: profile?.teamId ?? null
1522
1547
  };
1523
1548
  };
1524
1549
  //#endregion
@@ -1546,6 +1571,7 @@ exports.parsePreviewLink = parsePreviewLink;
1546
1571
  exports.readIpaInstallInfo = readIpaInstallInfo;
1547
1572
  exports.readNativeArtifact = readNativeArtifact;
1548
1573
  exports.readProfileServiceUdid = readProfileServiceUdid;
1574
+ exports.readProvisioningProfile = readProvisioningProfile;
1549
1575
  exports.readZipDirectory = readZipDirectory;
1550
1576
  exports.recordedSandboxUrlScheme = recordedSandboxUrlScheme;
1551
1577
  exports.sandboxArtifactProblem = sandboxArtifactProblem;
@@ -196,6 +196,11 @@ interface IpaInstallInfo {
196
196
  * the app's first: what signing a new `.ipa` needs a profile for.
197
197
  */
198
198
  readonly profileBundleIds: readonly string[];
199
+ /**
200
+ * The Apple Developer team the app's profile belongs to, its
201
+ * `TeamIdentifier`: null for an IPA with no profile.
202
+ */
203
+ readonly teamId: string | null;
199
204
  }
200
205
  /**
201
206
  * The form two UDIDs compare in, or null for text that isn't one. Apple writes
@@ -208,6 +213,27 @@ declare const normalizeIosUdid: (value: string) => string | null;
208
213
  * around it, so nothing automated may trust the result.
209
214
  */
210
215
  declare const readProfileServiceUdid: (body: Uint8Array) => string | null;
216
+ /** What a provisioning profile file says it is for and whom it lists. */
217
+ interface ProvisioningProfileInfo {
218
+ /** Its `UUID`, which Xcode names the file it saves after. */
219
+ readonly uuid: string | null;
220
+ readonly distribution: IpaDistribution;
221
+ /** The first of its `TeamIdentifier`s. */
222
+ readonly teamId: string | null;
223
+ /** Its `application-identifier` entitlement, such as `ABCDE12345.com.example.app`. */
224
+ readonly applicationIdentifier: string | null;
225
+ /** Whether Xcode made it and manages it: `IsXcodeManaged`. */
226
+ readonly xcodeManaged: boolean;
227
+ /** The normalized UDIDs it lists: empty for one that lists none. */
228
+ readonly devices: readonly string[];
229
+ readonly expiresAtMs: number | null;
230
+ }
231
+ /**
232
+ * What a provisioning profile's bytes (a `.mobileprovision`, a CMS message
233
+ * around a plist) say: the same reading an `.ipa`'s profiles get. It verifies
234
+ * no signature. Throws `NativeArtifactError` for one it can't read.
235
+ */
236
+ declare const readProvisioningProfile: (bytes: Uint8Array) => ProvisioningProfileInfo;
211
237
  /**
212
238
  * What an `.ipa` installs as, reading only its directory, its app's Info.plist
213
239
  * and its provisioning profiles: a few requests of a remote file, whatever its
@@ -366,4 +392,4 @@ declare const createPreviewLink: ({ urlScheme, appId, channel, fingerprintHash,
366
392
  */
367
393
  declare const parsePreviewLink: (link: string) => PreviewLink | null;
368
394
  //#endregion
369
- export { type ByteSource, type ImportableNativeBuild, type IpaDistribution, type IpaInstallInfo, type NativeArtifactCheck, NativeArtifactError, type NativeArtifactInfo, type NativeArtifactKind, type NativeArtifactProblem, type NativeArtifactProblemCode, type PreviewLink, type PreviewLinkPlatform, SANDBOX_ACTIVITY, SANDBOX_APPLICATION_ID_SUFFIX, SANDBOX_CODE_MARKER, SANDBOX_INFO_PLIST_KEY, SANDBOX_META_DATA, SANDBOX_URL_SCHEME_INFO_PLIST_KEY, SANDBOX_URL_SCHEME_META_DATA, SANDBOX_URL_TYPE_NAME, type UnreadableValue, type ZipEntry, alreadyImportedProblem, blobSource, checkNativeArtifact, createPreviewLink, findZipEntry, isConfigurableSandboxUrlScheme, isRecordedUrlSchemeSyntax, isSandboxChannel, isSandboxUrlScheme, normalizeIosUdid, openZipEntry, parsePreviewLink, readIpaInstallInfo, readNativeArtifact, readProfileServiceUdid, readZipDirectory, recordedSandboxUrlScheme, sandboxArtifactProblem, sandboxChannelOf, sandboxUrlSchemeOf };
395
+ export { type ByteSource, type ImportableNativeBuild, type IpaDistribution, type IpaInstallInfo, type NativeArtifactCheck, NativeArtifactError, type NativeArtifactInfo, type NativeArtifactKind, type NativeArtifactProblem, type NativeArtifactProblemCode, type PreviewLink, type PreviewLinkPlatform, type ProvisioningProfileInfo, SANDBOX_ACTIVITY, SANDBOX_APPLICATION_ID_SUFFIX, SANDBOX_CODE_MARKER, SANDBOX_INFO_PLIST_KEY, SANDBOX_META_DATA, SANDBOX_URL_SCHEME_INFO_PLIST_KEY, SANDBOX_URL_SCHEME_META_DATA, SANDBOX_URL_TYPE_NAME, type UnreadableValue, type ZipEntry, alreadyImportedProblem, blobSource, checkNativeArtifact, createPreviewLink, findZipEntry, isConfigurableSandboxUrlScheme, isRecordedUrlSchemeSyntax, isSandboxChannel, isSandboxUrlScheme, normalizeIosUdid, openZipEntry, parsePreviewLink, readIpaInstallInfo, readNativeArtifact, readProfileServiceUdid, readProvisioningProfile, readZipDirectory, recordedSandboxUrlScheme, sandboxArtifactProblem, sandboxChannelOf, sandboxUrlSchemeOf };
@@ -196,6 +196,11 @@ interface IpaInstallInfo {
196
196
  * the app's first: what signing a new `.ipa` needs a profile for.
197
197
  */
198
198
  readonly profileBundleIds: readonly string[];
199
+ /**
200
+ * The Apple Developer team the app's profile belongs to, its
201
+ * `TeamIdentifier`: null for an IPA with no profile.
202
+ */
203
+ readonly teamId: string | null;
199
204
  }
200
205
  /**
201
206
  * The form two UDIDs compare in, or null for text that isn't one. Apple writes
@@ -208,6 +213,27 @@ declare const normalizeIosUdid: (value: string) => string | null;
208
213
  * around it, so nothing automated may trust the result.
209
214
  */
210
215
  declare const readProfileServiceUdid: (body: Uint8Array) => string | null;
216
+ /** What a provisioning profile file says it is for and whom it lists. */
217
+ interface ProvisioningProfileInfo {
218
+ /** Its `UUID`, which Xcode names the file it saves after. */
219
+ readonly uuid: string | null;
220
+ readonly distribution: IpaDistribution;
221
+ /** The first of its `TeamIdentifier`s. */
222
+ readonly teamId: string | null;
223
+ /** Its `application-identifier` entitlement, such as `ABCDE12345.com.example.app`. */
224
+ readonly applicationIdentifier: string | null;
225
+ /** Whether Xcode made it and manages it: `IsXcodeManaged`. */
226
+ readonly xcodeManaged: boolean;
227
+ /** The normalized UDIDs it lists: empty for one that lists none. */
228
+ readonly devices: readonly string[];
229
+ readonly expiresAtMs: number | null;
230
+ }
231
+ /**
232
+ * What a provisioning profile's bytes (a `.mobileprovision`, a CMS message
233
+ * around a plist) say: the same reading an `.ipa`'s profiles get. It verifies
234
+ * no signature. Throws `NativeArtifactError` for one it can't read.
235
+ */
236
+ declare const readProvisioningProfile: (bytes: Uint8Array) => ProvisioningProfileInfo;
211
237
  /**
212
238
  * What an `.ipa` installs as, reading only its directory, its app's Info.plist
213
239
  * and its provisioning profiles: a few requests of a remote file, whatever its
@@ -366,4 +392,4 @@ declare const createPreviewLink: ({ urlScheme, appId, channel, fingerprintHash,
366
392
  */
367
393
  declare const parsePreviewLink: (link: string) => PreviewLink | null;
368
394
  //#endregion
369
- export { type ByteSource, type ImportableNativeBuild, type IpaDistribution, type IpaInstallInfo, type NativeArtifactCheck, NativeArtifactError, type NativeArtifactInfo, type NativeArtifactKind, type NativeArtifactProblem, type NativeArtifactProblemCode, type PreviewLink, type PreviewLinkPlatform, SANDBOX_ACTIVITY, SANDBOX_APPLICATION_ID_SUFFIX, SANDBOX_CODE_MARKER, SANDBOX_INFO_PLIST_KEY, SANDBOX_META_DATA, SANDBOX_URL_SCHEME_INFO_PLIST_KEY, SANDBOX_URL_SCHEME_META_DATA, SANDBOX_URL_TYPE_NAME, type UnreadableValue, type ZipEntry, alreadyImportedProblem, blobSource, checkNativeArtifact, createPreviewLink, findZipEntry, isConfigurableSandboxUrlScheme, isRecordedUrlSchemeSyntax, isSandboxChannel, isSandboxUrlScheme, normalizeIosUdid, openZipEntry, parsePreviewLink, readIpaInstallInfo, readNativeArtifact, readProfileServiceUdid, readZipDirectory, recordedSandboxUrlScheme, sandboxArtifactProblem, sandboxChannelOf, sandboxUrlSchemeOf };
395
+ export { type ByteSource, type ImportableNativeBuild, type IpaDistribution, type IpaInstallInfo, type NativeArtifactCheck, NativeArtifactError, type NativeArtifactInfo, type NativeArtifactKind, type NativeArtifactProblem, type NativeArtifactProblemCode, type PreviewLink, type PreviewLinkPlatform, type ProvisioningProfileInfo, SANDBOX_ACTIVITY, SANDBOX_APPLICATION_ID_SUFFIX, SANDBOX_CODE_MARKER, SANDBOX_INFO_PLIST_KEY, SANDBOX_META_DATA, SANDBOX_URL_SCHEME_INFO_PLIST_KEY, SANDBOX_URL_SCHEME_META_DATA, SANDBOX_URL_TYPE_NAME, type UnreadableValue, type ZipEntry, alreadyImportedProblem, blobSource, checkNativeArtifact, createPreviewLink, findZipEntry, isConfigurableSandboxUrlScheme, isRecordedUrlSchemeSyntax, isSandboxChannel, isSandboxUrlScheme, normalizeIosUdid, openZipEntry, parsePreviewLink, readIpaInstallInfo, readNativeArtifact, readProfileServiceUdid, readProvisioningProfile, readZipDirectory, recordedSandboxUrlScheme, sandboxArtifactProblem, sandboxChannelOf, sandboxUrlSchemeOf };
@@ -1459,12 +1459,19 @@ const readProfile = (bytes, name) => {
1459
1459
  const entitlements = plist["Entitlements"];
1460
1460
  const applicationId = isDict(entitlements) ? entitlements["application-identifier"] : void 0;
1461
1461
  const bundleId = typeof applicationId === "string" ? applicationId.slice(applicationId.indexOf(".") + 1) : null;
1462
+ const teams = plist["TeamIdentifier"];
1463
+ const team = Array.isArray(teams) ? teams[0] : void 0;
1464
+ const uuid = plist["UUID"];
1462
1465
  return {
1463
1466
  allDevices: plist["ProvisionsAllDevices"] === true,
1464
1467
  devices: devices === void 0 ? null : new Set(devices),
1465
1468
  getTaskAllow: isDict(entitlements) && entitlements["get-task-allow"] === true,
1466
1469
  expiresAtMs,
1467
- bundleId: bundleId === null || bundleId.includes("*") ? null : bundleId
1470
+ bundleId: bundleId === null || bundleId.includes("*") ? null : bundleId,
1471
+ applicationIdentifier: typeof applicationId === "string" ? applicationId : null,
1472
+ teamId: typeof team === "string" && team !== "" ? team : null,
1473
+ xcodeManaged: plist["IsXcodeManaged"] === true,
1474
+ uuid: typeof uuid === "string" && uuid !== "" ? uuid : null
1468
1475
  };
1469
1476
  };
1470
1477
  const distributionOf = (profile) => {
@@ -1474,6 +1481,23 @@ const distributionOf = (profile) => {
1474
1481
  return profile.getTaskAllow ? "development" : "ad-hoc";
1475
1482
  };
1476
1483
  /**
1484
+ * What a provisioning profile's bytes (a `.mobileprovision`, a CMS message
1485
+ * around a plist) say: the same reading an `.ipa`'s profiles get. It verifies
1486
+ * no signature. Throws `NativeArtifactError` for one it can't read.
1487
+ */
1488
+ const readProvisioningProfile = (bytes) => {
1489
+ const profile = readProfile(bytes, "provisioning profile");
1490
+ return {
1491
+ uuid: profile.uuid,
1492
+ distribution: distributionOf(profile),
1493
+ teamId: profile.teamId,
1494
+ applicationIdentifier: profile.applicationIdentifier,
1495
+ xcodeManaged: profile.xcodeManaged,
1496
+ devices: [...profile.devices ?? []].sort(),
1497
+ expiresAtMs: profile.expiresAtMs
1498
+ };
1499
+ };
1500
+ /**
1477
1501
  * What an `.ipa` installs as, reading only its directory, its app's Info.plist
1478
1502
  * and its provisioning profiles: a few requests of a remote file, whatever its
1479
1503
  * size. The `.ipa` is untrusted, and each part is bounded before it is read.
@@ -1517,8 +1541,9 @@ const readIpaInstallInfo = async (source) => {
1517
1541
  distribution,
1518
1542
  devices: listDevices ? [...lists[0] ?? []].filter((udid) => lists.every((list) => list.has(udid))).sort() : [],
1519
1543
  expiresAtMs: expiries.length === 0 ? null : Math.min(...expiries),
1520
- profileBundleIds: [.../* @__PURE__ */ new Set([bundleId, ...profiles.flatMap((item) => item.bundleId ?? [])])]
1544
+ profileBundleIds: [.../* @__PURE__ */ new Set([bundleId, ...profiles.flatMap((item) => item.bundleId ?? [])])],
1545
+ teamId: profile?.teamId ?? null
1521
1546
  };
1522
1547
  };
1523
1548
  //#endregion
1524
- export { NativeArtifactError, SANDBOX_ACTIVITY, SANDBOX_APPLICATION_ID_SUFFIX, SANDBOX_CODE_MARKER, SANDBOX_INFO_PLIST_KEY, SANDBOX_META_DATA, SANDBOX_URL_SCHEME_INFO_PLIST_KEY, SANDBOX_URL_SCHEME_META_DATA, SANDBOX_URL_TYPE_NAME, alreadyImportedProblem, blobSource, checkNativeArtifact, createPreviewLink, findZipEntry, isConfigurableSandboxUrlScheme, isRecordedUrlSchemeSyntax, isSandboxChannel, isSandboxUrlScheme, normalizeIosUdid, openZipEntry, parsePreviewLink, readIpaInstallInfo, readNativeArtifact, readProfileServiceUdid, readZipDirectory, recordedSandboxUrlScheme, sandboxArtifactProblem, sandboxChannelOf, sandboxUrlSchemeOf };
1549
+ export { NativeArtifactError, SANDBOX_ACTIVITY, SANDBOX_APPLICATION_ID_SUFFIX, SANDBOX_CODE_MARKER, SANDBOX_INFO_PLIST_KEY, SANDBOX_META_DATA, SANDBOX_URL_SCHEME_INFO_PLIST_KEY, SANDBOX_URL_SCHEME_META_DATA, SANDBOX_URL_TYPE_NAME, alreadyImportedProblem, blobSource, checkNativeArtifact, createPreviewLink, findZipEntry, isConfigurableSandboxUrlScheme, isRecordedUrlSchemeSyntax, isSandboxChannel, isSandboxUrlScheme, normalizeIosUdid, openZipEntry, parsePreviewLink, readIpaInstallInfo, readNativeArtifact, readProfileServiceUdid, readProvisioningProfile, readZipDirectory, recordedSandboxUrlScheme, sandboxArtifactProblem, sandboxChannelOf, sandboxUrlSchemeOf };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/protocol",
3
- "version": "1.2.0-rc.27",
3
+ "version": "1.2.0-rc.28",
4
4
  "type": "module",
5
5
  "description": "The data formats and pure computations that Hot Updater's app and server share",
6
6
  "sideEffects": false,