@limrun/ui 0.14.0-rc.4 → 0.14.0
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 +1189 -1089
- package/package.json +10 -51
- package/src/components/remote-control.tsx +267 -0
- 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 -100
- package/dist/app-store-relay/index.js +0 -484
- 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 -59
- package/dist/apple-credentials/index.js +0 -227
- package/dist/browser-storage-BnO-Ma-e.mjs +0 -219
- package/dist/browser-storage-DLxIqZk5.js +0 -1
- package/dist/client-D1drDXxE.js +0 -1
- package/dist/client-DSuNtWDv.mjs +0 -184
- 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 -212
- package/dist/core/device-install/apple/relay.d.ts +0 -40
- 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 -101
- 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 -591
- 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-B_DefBEp.mjs +0 -239
- package/dist/provisioning-BlQMccX_.js +0 -1
- package/src/app-store-relay/index.test.ts +0 -60
- package/src/app-store-relay/index.ts +0 -511
- package/src/app-store-relay/react.ts +0 -131
- package/src/apple-credentials/index.test.ts +0 -158
- package/src/apple-credentials/index.ts +0 -241
- package/src/core/device-install/apple/client.ts +0 -143
- 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 -84
- package/src/core/device-install/apple/provisioning.ts +0 -380
- package/src/core/device-install/apple/relay.ts +0 -182
- 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 -234
- 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 -298
- 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,227 +0,0 @@
|
|
|
1
|
-
import { listAppleCertificates as h, generateAppleSigningKeyAndCSR as C, createAppleCertificate as D, downloadAppleCertificate as I, exportAppleCertificateP12 as T, downloadAppleProfile as $, listAppleProfiles as B } from "../app-store-relay/index.js";
|
|
2
|
-
import { l as R, f as N } from "../browser-storage-BnO-Ma-e.mjs";
|
|
3
|
-
const A = "appleCertificate", v = "appleProvisioningProfile";
|
|
4
|
-
function P(r) {
|
|
5
|
-
const e = {};
|
|
6
|
-
for (const [o, n] of Object.entries(r))
|
|
7
|
-
n && (e[o] = n);
|
|
8
|
-
return e;
|
|
9
|
-
}
|
|
10
|
-
async function j(r, e, o) {
|
|
11
|
-
return r.put(A, e, P(o));
|
|
12
|
-
}
|
|
13
|
-
async function O(r, e, o) {
|
|
14
|
-
return r.put(v, e, P(o));
|
|
15
|
-
}
|
|
16
|
-
function z(r) {
|
|
17
|
-
const e = r.fetch ?? fetch.bind(globalThis), o = r.apiUrl.replace(/\/+$/, ""), n = (t, s) => `${o}/v1/organizations/${encodeURIComponent(r.organizationId)}/secrets/${encodeURIComponent(
|
|
18
|
-
t
|
|
19
|
-
)}/${encodeURIComponent(s)}`, c = {
|
|
20
|
-
Authorization: `Bearer ${r.token}`,
|
|
21
|
-
"Content-Type": "application/json"
|
|
22
|
-
};
|
|
23
|
-
async function a(t, s) {
|
|
24
|
-
let i = `${t.status}`;
|
|
25
|
-
try {
|
|
26
|
-
const d = await t.json();
|
|
27
|
-
d.message && (i = d.message);
|
|
28
|
-
} catch {
|
|
29
|
-
}
|
|
30
|
-
throw new Error(`Failed to ${s} secret: ${i}`);
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
async put(t, s, i) {
|
|
34
|
-
const d = await e(n(t, s), {
|
|
35
|
-
method: "PUT",
|
|
36
|
-
headers: c,
|
|
37
|
-
body: JSON.stringify({ data: i, replace: !0 })
|
|
38
|
-
});
|
|
39
|
-
d.ok || await a(d, "store");
|
|
40
|
-
const l = await d.json();
|
|
41
|
-
return { type: l.type, name: l.name, createdAt: l.createdAt, data: l.data };
|
|
42
|
-
},
|
|
43
|
-
async get(t, s) {
|
|
44
|
-
const i = await e(n(t, s), { method: "GET", headers: c });
|
|
45
|
-
if (i.status === 404) return;
|
|
46
|
-
i.ok || await a(i, "fetch");
|
|
47
|
-
const d = await i.json();
|
|
48
|
-
return { type: d.type, name: d.name, createdAt: d.createdAt, data: d.data };
|
|
49
|
-
},
|
|
50
|
-
async list() {
|
|
51
|
-
const t = await e(
|
|
52
|
-
`${o}/v1/organizations/${encodeURIComponent(r.organizationId)}/secrets`,
|
|
53
|
-
{ method: "GET", headers: c }
|
|
54
|
-
);
|
|
55
|
-
return t.ok || await a(t, "list"), (await t.json()).filter(
|
|
56
|
-
(i) => i.type === A || i.type === v
|
|
57
|
-
).map((i) => ({ type: i.type, name: i.name, createdAt: i.createdAt }));
|
|
58
|
-
},
|
|
59
|
-
async delete(t, s) {
|
|
60
|
-
const i = await e(n(t, s), { method: "DELETE", headers: c });
|
|
61
|
-
i.status !== 404 && (i.ok || await a(i, "delete"));
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
const _ = "limrun-signing-secrets", k = 1, p = "secrets";
|
|
66
|
-
function M() {
|
|
67
|
-
const r = (n, c) => `${n}:${c}`;
|
|
68
|
-
function e() {
|
|
69
|
-
return new Promise((n, c) => {
|
|
70
|
-
const a = indexedDB.open(_, k);
|
|
71
|
-
a.onupgradeneeded = () => {
|
|
72
|
-
const t = a.result;
|
|
73
|
-
t.objectStoreNames.contains(p) || t.createObjectStore(p, { keyPath: "id" });
|
|
74
|
-
}, a.onsuccess = () => n(a.result), a.onerror = () => c(a.error ?? new Error("Open IndexedDB failed"));
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
function o(n) {
|
|
78
|
-
return new Promise((c, a) => {
|
|
79
|
-
n.onsuccess = () => c(n.result), n.onerror = () => a(n.error ?? new Error("IndexedDB request failed"));
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
async put(n, c, a) {
|
|
84
|
-
const t = await e(), s = await o(
|
|
85
|
-
t.transaction(p, "readonly").objectStore(p).get(r(n, c))
|
|
86
|
-
), i = {
|
|
87
|
-
id: r(n, c),
|
|
88
|
-
type: n,
|
|
89
|
-
name: c,
|
|
90
|
-
data: a,
|
|
91
|
-
createdAt: s?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
92
|
-
};
|
|
93
|
-
return await o(
|
|
94
|
-
t.transaction(p, "readwrite").objectStore(p).put(i)
|
|
95
|
-
), { type: n, name: c, createdAt: i.createdAt, data: a };
|
|
96
|
-
},
|
|
97
|
-
async get(n, c) {
|
|
98
|
-
const a = await e(), t = await o(
|
|
99
|
-
a.transaction(p, "readonly").objectStore(p).get(r(n, c))
|
|
100
|
-
);
|
|
101
|
-
if (t)
|
|
102
|
-
return { type: t.type, name: t.name, createdAt: t.createdAt, data: t.data };
|
|
103
|
-
},
|
|
104
|
-
async list() {
|
|
105
|
-
const n = await e();
|
|
106
|
-
return (await o(
|
|
107
|
-
n.transaction(p, "readonly").objectStore(p).getAll()
|
|
108
|
-
)).map((a) => ({ type: a.type, name: a.name, createdAt: a.createdAt }));
|
|
109
|
-
},
|
|
110
|
-
async delete(n, c) {
|
|
111
|
-
const a = await e();
|
|
112
|
-
await o(
|
|
113
|
-
a.transaction(p, "readwrite").objectStore(p).delete(r(n, c))
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
function x(r, e) {
|
|
119
|
-
return `${r}/${e}`;
|
|
120
|
-
}
|
|
121
|
-
async function F({
|
|
122
|
-
relay: r,
|
|
123
|
-
teamId: e,
|
|
124
|
-
secretStore: o,
|
|
125
|
-
commonName: n,
|
|
126
|
-
log: c = () => {
|
|
127
|
-
}
|
|
128
|
-
}) {
|
|
129
|
-
const a = "DEVELOPMENT", t = x(e, a), s = await h({ relay: r, teamId: e, certificateKind: "development" }), i = (f) => f === void 0 ? void 0 : s.find(
|
|
130
|
-
(m) => u(m, "certificateId") === f || u(m, "certRequestId") === f
|
|
131
|
-
), d = await o.get(A, t), l = u(d?.data, "certificateID");
|
|
132
|
-
if (d && l && d.data.certificateP12Base64) {
|
|
133
|
-
const f = i(l);
|
|
134
|
-
if (f) {
|
|
135
|
-
const m = u(f, "certificateId") ?? l;
|
|
136
|
-
return c("Reusing stored Apple certificate", m), { secret: d, certificateId: m, created: !1 };
|
|
137
|
-
}
|
|
138
|
-
c("Stored certificate is no longer on the team", "Minting a new one.");
|
|
139
|
-
}
|
|
140
|
-
const S = await C({ commonName: n ?? `Limrun ${e}` }), y = await D({
|
|
141
|
-
relay: r,
|
|
142
|
-
teamId: e,
|
|
143
|
-
certificateKind: "development",
|
|
144
|
-
csrPEM: S.csrPEM
|
|
145
|
-
}), w = u(y, "certificateId") ?? u(y, "certRequestId");
|
|
146
|
-
if (!w)
|
|
147
|
-
throw new Error("Apple certificate creation did not return a certificate ID.");
|
|
148
|
-
const g = await I({
|
|
149
|
-
relay: r,
|
|
150
|
-
teamId: e,
|
|
151
|
-
certificateKind: "development",
|
|
152
|
-
certificateId: w
|
|
153
|
-
});
|
|
154
|
-
if (!g.rawBodyBase64)
|
|
155
|
-
throw new Error("Apple certificate download returned no bytes.");
|
|
156
|
-
const b = {
|
|
157
|
-
certificateP12Base64: T({
|
|
158
|
-
privateKeyPKCS8Base64: S.privateKeyPKCS8Base64,
|
|
159
|
-
certificateBase64: g.rawBodyBase64,
|
|
160
|
-
password: "",
|
|
161
|
-
friendlyName: `Apple Development ${e}`
|
|
162
|
-
}),
|
|
163
|
-
certificateType: a,
|
|
164
|
-
teamID: e,
|
|
165
|
-
certificateID: w,
|
|
166
|
-
// Normalized so it equals the serials profiles reference.
|
|
167
|
-
serialNumber: R(u(y, "serialNum")),
|
|
168
|
-
expirationDate: u(y, "expirationDateString")
|
|
169
|
-
};
|
|
170
|
-
let E;
|
|
171
|
-
try {
|
|
172
|
-
E = await j(o, t, b);
|
|
173
|
-
} catch (f) {
|
|
174
|
-
throw new Error(
|
|
175
|
-
`Certificate ${w} was created on the Apple Developer portal but saving its private key to the secret store failed: ${K(f)}. The key cannot be recovered; revoke certificate ${w} at developer.apple.com before retrying, or the retry will mint another certificate against Apple's limit.`
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
return c("Apple certificate stored", w), { secret: E, certificateId: w, created: !0 };
|
|
179
|
-
}
|
|
180
|
-
function K(r) {
|
|
181
|
-
return r instanceof Error ? r.message : String(r);
|
|
182
|
-
}
|
|
183
|
-
async function G({
|
|
184
|
-
relay: r,
|
|
185
|
-
teamId: e,
|
|
186
|
-
profileId: o,
|
|
187
|
-
secretStore: n,
|
|
188
|
-
log: c = () => {
|
|
189
|
-
}
|
|
190
|
-
}) {
|
|
191
|
-
const t = (await $({ relay: r, teamId: e, profileId: o })).rawBodyBase64;
|
|
192
|
-
if (!t)
|
|
193
|
-
throw new Error("Apple provisioning profile download returned no bytes.");
|
|
194
|
-
const s = N(t), i = `${e}/${s.uuid ?? o}`, d = await O(n, i, {
|
|
195
|
-
provisioningProfileBase64: t,
|
|
196
|
-
certificateSerialNumbers: s.certificateSerialNumbers.join(","),
|
|
197
|
-
bundleIDs: s.bundleID,
|
|
198
|
-
deviceIDs: s.provisionedDevices.join(","),
|
|
199
|
-
teamID: s.teamID ?? e,
|
|
200
|
-
profileName: s.name,
|
|
201
|
-
uuid: s.uuid,
|
|
202
|
-
expirationDate: s.expirationDate
|
|
203
|
-
});
|
|
204
|
-
return c("Apple provisioning profile stored", i), d;
|
|
205
|
-
}
|
|
206
|
-
async function V({ relay: r, teamId: e }) {
|
|
207
|
-
return B({ relay: r, teamId: e, profileKind: "development" });
|
|
208
|
-
}
|
|
209
|
-
function u(r, e) {
|
|
210
|
-
const o = r?.[e];
|
|
211
|
-
if (typeof o == "string") return o;
|
|
212
|
-
if (typeof o == "number" || typeof o == "boolean") return String(o);
|
|
213
|
-
}
|
|
214
|
-
export {
|
|
215
|
-
A as APPLE_CERTIFICATE_SECRET_TYPE,
|
|
216
|
-
v as APPLE_PROVISIONING_PROFILE_SECRET_TYPE,
|
|
217
|
-
x as appleCertificateSecretName,
|
|
218
|
-
M as createBrowserSecretStore,
|
|
219
|
-
z as createLimrunSecretStore,
|
|
220
|
-
F as ensureAppleCertificateSecret,
|
|
221
|
-
V as listTeamAppleProfiles,
|
|
222
|
-
R as normalizeCertificateSerial,
|
|
223
|
-
j as putAppleCertificateSecret,
|
|
224
|
-
O as putAppleProvisioningProfileSecret,
|
|
225
|
-
G as saveAppleProfileSecret,
|
|
226
|
-
u as stringField
|
|
227
|
-
};
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import { f as D } from "./index-YDu8K9a4.mjs";
|
|
2
|
-
const P = "limbuild-device-pairing", x = 1, d = "pairRecords", y = "limbuild-device-signing", A = 1, c = "signingAssets";
|
|
3
|
-
function l(e) {
|
|
4
|
-
return (e ?? "").replace(/-/g, "").replace(/[^a-fA-F0-9]/g, "");
|
|
5
|
-
}
|
|
6
|
-
function f(e) {
|
|
7
|
-
return (e ?? "").trim();
|
|
8
|
-
}
|
|
9
|
-
async function j(e) {
|
|
10
|
-
const t = l(e);
|
|
11
|
-
if (!t) return;
|
|
12
|
-
const r = await p(P, x, d, "udid");
|
|
13
|
-
return g(
|
|
14
|
-
r.transaction(d, "readonly").objectStore(d).get(t)
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
async function G(e, t = {}) {
|
|
18
|
-
const r = l(e.udid);
|
|
19
|
-
if (!r) throw new Error("Cannot store pair record without a UDID.");
|
|
20
|
-
const n = {
|
|
21
|
-
...e,
|
|
22
|
-
udid: r,
|
|
23
|
-
productName: t.productName,
|
|
24
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
25
|
-
}, i = await p(P, x, d, "udid");
|
|
26
|
-
return await g(
|
|
27
|
-
i.transaction(d, "readwrite").objectStore(d).put(n)
|
|
28
|
-
), n;
|
|
29
|
-
}
|
|
30
|
-
async function M({
|
|
31
|
-
deviceUDID: e,
|
|
32
|
-
bundleID: t,
|
|
33
|
-
signingMode: r = "development"
|
|
34
|
-
}) {
|
|
35
|
-
const n = f(t);
|
|
36
|
-
if (!n) return;
|
|
37
|
-
const i = l(e), o = await h(I("bundle", n, r));
|
|
38
|
-
if (o) return o;
|
|
39
|
-
if (i) {
|
|
40
|
-
const s = await h(I(i, n, r));
|
|
41
|
-
if (s) return s;
|
|
42
|
-
}
|
|
43
|
-
return (await T(n, r))[0];
|
|
44
|
-
}
|
|
45
|
-
async function k(e = "development") {
|
|
46
|
-
return (await b()).filter((r) => (r.signingMode ?? "development") === e).sort((r, n) => new Date(n.updatedAt).getTime() - new Date(r.updatedAt).getTime())[0];
|
|
47
|
-
}
|
|
48
|
-
async function V(e, t = "development") {
|
|
49
|
-
return (await b()).filter((n) => !n.certificateID || !n.certificateP12Base64 || (n.signingMode ?? "development") !== t ? !1 : !e || !n.teamID || n.teamID === e).sort((n, i) => new Date(i.updatedAt).getTime() - new Date(n.updatedAt).getTime())[0];
|
|
50
|
-
}
|
|
51
|
-
async function F(e) {
|
|
52
|
-
const t = f(e.bundleID);
|
|
53
|
-
if (!t)
|
|
54
|
-
throw new Error("Cannot store signing assets without a bundle ID.");
|
|
55
|
-
const r = l(e.deviceUDID), n = e.signingMode ?? "development", i = I("bundle", t, n), o = {
|
|
56
|
-
...e,
|
|
57
|
-
id: i,
|
|
58
|
-
deviceUDID: r || void 0,
|
|
59
|
-
signingMode: n,
|
|
60
|
-
bundleID: t,
|
|
61
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
62
|
-
}, a = await p(y, A, c, "id");
|
|
63
|
-
return await g(
|
|
64
|
-
a.transaction(c, "readwrite").objectStore(c).put(o)
|
|
65
|
-
), o;
|
|
66
|
-
}
|
|
67
|
-
async function T(e, t = "development") {
|
|
68
|
-
const r = f(e);
|
|
69
|
-
return r ? (await b()).filter(
|
|
70
|
-
(i) => i.bundleID === r && (i.signingMode ?? "development") === t
|
|
71
|
-
) : [];
|
|
72
|
-
}
|
|
73
|
-
function W(e, t) {
|
|
74
|
-
const r = l(t);
|
|
75
|
-
return !!r && e.provisionedDevices.some((n) => l(n) === r);
|
|
76
|
-
}
|
|
77
|
-
function $(e, t) {
|
|
78
|
-
const r = f(t), n = f(e.bundleID);
|
|
79
|
-
if (!r || !n) return !1;
|
|
80
|
-
if (n === r || n === "*") return !0;
|
|
81
|
-
if (!n.endsWith(".*")) return !1;
|
|
82
|
-
const i = n.slice(0, -1);
|
|
83
|
-
return r.startsWith(i);
|
|
84
|
-
}
|
|
85
|
-
async function q(e) {
|
|
86
|
-
return E(new Uint8Array(await e.arrayBuffer()));
|
|
87
|
-
}
|
|
88
|
-
function L(e) {
|
|
89
|
-
const t = atob(e), r = new Uint8Array(t.length);
|
|
90
|
-
for (let n = 0; n < t.length; n += 1)
|
|
91
|
-
r[n] = t.charCodeAt(n);
|
|
92
|
-
return E(r);
|
|
93
|
-
}
|
|
94
|
-
function E(e) {
|
|
95
|
-
const t = new TextDecoder("latin1").decode(e), r = t.indexOf("<?xml"), n = t.indexOf("</plist>");
|
|
96
|
-
if (r < 0 || n < r)
|
|
97
|
-
throw new Error("Provisioning profile plist not found.");
|
|
98
|
-
const i = t.slice(r, n + 8);
|
|
99
|
-
if (/<!ENTITY/i.test(i))
|
|
100
|
-
throw new Error("Provisioning profile plist contains a disallowed ENTITY declaration.");
|
|
101
|
-
const o = new DOMParser().parseFromString(i, "application/xml");
|
|
102
|
-
if (o.querySelector("parsererror"))
|
|
103
|
-
throw new Error("Provisioning profile plist could not be parsed.");
|
|
104
|
-
const a = o.querySelector("plist > dict");
|
|
105
|
-
if (!a)
|
|
106
|
-
throw new Error("Provisioning profile plist dictionary not found.");
|
|
107
|
-
const s = v(a);
|
|
108
|
-
if (!N(s))
|
|
109
|
-
throw new Error("Provisioning profile plist has an unexpected shape.");
|
|
110
|
-
const m = N(s.Entitlements) ? s.Entitlements : {}, S = u(m["application-identifier"]), B = _(S);
|
|
111
|
-
return {
|
|
112
|
-
name: u(s.Name),
|
|
113
|
-
uuid: u(s.UUID),
|
|
114
|
-
teamID: u(m["com.apple.developer.team-identifier"]) ?? w(s.TeamIdentifier)[0],
|
|
115
|
-
applicationIdentifier: S,
|
|
116
|
-
bundleID: B,
|
|
117
|
-
provisionedDevices: w(s.ProvisionedDevices),
|
|
118
|
-
certificateSerialNumbers: O(w(s.DeveloperCertificates)),
|
|
119
|
-
getTaskAllow: R(m["get-task-allow"]),
|
|
120
|
-
expirationDate: u(s.ExpirationDate)
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
function z(e) {
|
|
124
|
-
return (e ?? "").replace(/^0+/, "").toUpperCase() || void 0;
|
|
125
|
-
}
|
|
126
|
-
function O(e) {
|
|
127
|
-
const t = [];
|
|
128
|
-
for (const r of e)
|
|
129
|
-
try {
|
|
130
|
-
const n = atob(r.replace(/\s+/g, "")), i = D.pki.certificateFromAsn1(D.asn1.fromDer(D.util.createBuffer(n))), o = z(i.serialNumber);
|
|
131
|
-
o && !t.includes(o) && t.push(o);
|
|
132
|
-
} catch {
|
|
133
|
-
}
|
|
134
|
-
return t;
|
|
135
|
-
}
|
|
136
|
-
async function h(e) {
|
|
137
|
-
if (!e) return;
|
|
138
|
-
const t = await p(y, A, c, "id");
|
|
139
|
-
return g(
|
|
140
|
-
t.transaction(c, "readonly").objectStore(c).get(e)
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
async function b() {
|
|
144
|
-
const e = await p(y, A, c, "id");
|
|
145
|
-
return g(
|
|
146
|
-
e.transaction(c, "readonly").objectStore(c).getAll()
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
function I(e, t, r) {
|
|
150
|
-
return `${r}:${e}:${t}`;
|
|
151
|
-
}
|
|
152
|
-
function _(e) {
|
|
153
|
-
if (!e) return;
|
|
154
|
-
const t = e.indexOf(".");
|
|
155
|
-
return t >= 0 ? e.slice(t + 1) : void 0;
|
|
156
|
-
}
|
|
157
|
-
function v(e) {
|
|
158
|
-
switch (e.tagName) {
|
|
159
|
-
case "dict":
|
|
160
|
-
return C(e);
|
|
161
|
-
case "array":
|
|
162
|
-
return Array.from(e.children).map(v);
|
|
163
|
-
case "string":
|
|
164
|
-
case "date":
|
|
165
|
-
return e.textContent ?? "";
|
|
166
|
-
default:
|
|
167
|
-
return e.textContent ?? "";
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
function C(e) {
|
|
171
|
-
const t = {}, r = Array.from(e.children);
|
|
172
|
-
for (let n = 0; n < r.length; n += 2) {
|
|
173
|
-
const i = r[n], o = r[n + 1];
|
|
174
|
-
!i || i.tagName !== "key" || !o || (t[i.textContent ?? ""] = v(o));
|
|
175
|
-
}
|
|
176
|
-
return t;
|
|
177
|
-
}
|
|
178
|
-
function u(e) {
|
|
179
|
-
return typeof e == "string" && e ? e : void 0;
|
|
180
|
-
}
|
|
181
|
-
function w(e) {
|
|
182
|
-
return Array.isArray(e) ? e.filter((t) => typeof t == "string") : [];
|
|
183
|
-
}
|
|
184
|
-
function R(e) {
|
|
185
|
-
return typeof e == "boolean" ? e : void 0;
|
|
186
|
-
}
|
|
187
|
-
function N(e) {
|
|
188
|
-
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
189
|
-
}
|
|
190
|
-
function p(e, t, r, n) {
|
|
191
|
-
return new Promise((i, o) => {
|
|
192
|
-
const a = indexedDB.open(e, t);
|
|
193
|
-
a.onupgradeneeded = () => {
|
|
194
|
-
const s = a.result;
|
|
195
|
-
s.objectStoreNames.contains(r) || s.createObjectStore(r, { keyPath: n });
|
|
196
|
-
}, a.onsuccess = () => i(a.result), a.onerror = () => o(a.error ?? new Error("Open IndexedDB failed"));
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
function g(e) {
|
|
200
|
-
return new Promise((t, r) => {
|
|
201
|
-
e.onsuccess = () => t(e.result), e.onerror = () => r(e.error ?? new Error("IndexedDB request failed"));
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
export {
|
|
205
|
-
F as a,
|
|
206
|
-
$ as b,
|
|
207
|
-
W as c,
|
|
208
|
-
V as d,
|
|
209
|
-
M as e,
|
|
210
|
-
L as f,
|
|
211
|
-
k as g,
|
|
212
|
-
E as h,
|
|
213
|
-
f as i,
|
|
214
|
-
j,
|
|
215
|
-
G as k,
|
|
216
|
-
z as l,
|
|
217
|
-
l as n,
|
|
218
|
-
q as p
|
|
219
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const m=require("./index-ChhtuQ7e.js"),B="limbuild-device-pairing",x=1,l="pairRecords",A="limbuild-device-signing",y=1,c="signingAssets";function d(e){return(e??"").replace(/-/g,"").replace(/[^a-fA-F0-9]/g,"")}function u(e){return(e??"").trim()}async function C(e){const t=d(e);if(!t)return;const r=await g(B,x,l,"udid");return p(r.transaction(l,"readonly").objectStore(l).get(t))}async function T(e,t={}){const r=d(e.udid);if(!r)throw new Error("Cannot store pair record without a UDID.");const n={...e,udid:r,productName:t.productName,updatedAt:new Date().toISOString()},i=await g(B,x,l,"udid");return await p(i.transaction(l,"readwrite").objectStore(l).put(n)),n}async function R({deviceUDID:e,bundleID:t,signingMode:r="development"}){const n=u(t);if(!n)return;const i=d(e),o=await h(I("bundle",n,r));if(o)return o;if(i){const s=await h(I(i,n,r));if(s)return s}return(await M(n,r))[0]}async function O(e="development"){return(await S()).filter(r=>(r.signingMode??"development")===e).sort((r,n)=>new Date(n.updatedAt).getTime()-new Date(r.updatedAt).getTime())[0]}async function U(e,t="development"){return(await S()).filter(n=>!n.certificateID||!n.certificateP12Base64||(n.signingMode??"development")!==t?!1:!e||!n.teamID||n.teamID===e).sort((n,i)=>new Date(i.updatedAt).getTime()-new Date(n.updatedAt).getTime())[0]}async function _(e){const t=u(e.bundleID);if(!t)throw new Error("Cannot store signing assets without a bundle ID.");const r=d(e.deviceUDID),n=e.signingMode??"development",i=I("bundle",t,n),o={...e,id:i,deviceUDID:r||void 0,signingMode:n,bundleID:t,updatedAt:new Date().toISOString()},a=await g(A,y,c,"id");return await p(a.transaction(c,"readwrite").objectStore(c).put(o)),o}async function M(e,t="development"){const r=u(e);return r?(await S()).filter(i=>i.bundleID===r&&(i.signingMode??"development")===t):[]}function G(e,t){const r=d(t);return!!r&&e.provisionedDevices.some(n=>d(n)===r)}function j(e,t){const r=u(t),n=u(e.bundleID);if(!r||!n)return!1;if(n===r||n==="*")return!0;if(!n.endsWith(".*"))return!1;const i=n.slice(0,-1);return r.startsWith(i)}async function V(e){return v(new Uint8Array(await e.arrayBuffer()))}function k(e){const t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n+=1)r[n]=t.charCodeAt(n);return v(r)}function v(e){const t=new TextDecoder("latin1").decode(e),r=t.indexOf("<?xml"),n=t.indexOf("</plist>");if(r<0||n<r)throw new Error("Provisioning profile plist not found.");const i=t.slice(r,n+8);if(/<!ENTITY/i.test(i))throw new Error("Provisioning profile plist contains a disallowed ENTITY declaration.");const o=new DOMParser().parseFromString(i,"application/xml");if(o.querySelector("parsererror"))throw new Error("Provisioning profile plist could not be parsed.");const a=o.querySelector("plist > dict");if(!a)throw new Error("Provisioning profile plist dictionary not found.");const s=b(a);if(!N(s))throw new Error("Provisioning profile plist has an unexpected shape.");const D=N(s.Entitlements)?s.Entitlements:{},P=f(D["application-identifier"]),z=L(P);return{name:f(s.Name),uuid:f(s.UUID),teamID:f(D["com.apple.developer.team-identifier"])??w(s.TeamIdentifier)[0],applicationIdentifier:P,bundleID:z,provisionedDevices:w(s.ProvisionedDevices),certificateSerialNumbers:F(w(s.DeveloperCertificates)),getTaskAllow:q(D["get-task-allow"]),expirationDate:f(s.ExpirationDate)}}function E(e){return(e??"").replace(/^0+/,"").toUpperCase()||void 0}function F(e){const t=[];for(const r of e)try{const n=atob(r.replace(/\s+/g,"")),i=m.forge.pki.certificateFromAsn1(m.forge.asn1.fromDer(m.forge.util.createBuffer(n))),o=E(i.serialNumber);o&&!t.includes(o)&&t.push(o)}catch{}return t}async function h(e){if(!e)return;const t=await g(A,y,c,"id");return p(t.transaction(c,"readonly").objectStore(c).get(e))}async function S(){const e=await g(A,y,c,"id");return p(e.transaction(c,"readonly").objectStore(c).getAll())}function I(e,t,r){return`${r}:${e}:${t}`}function L(e){if(!e)return;const t=e.indexOf(".");return t>=0?e.slice(t+1):void 0}function b(e){switch(e.tagName){case"dict":return W(e);case"array":return Array.from(e.children).map(b);case"string":case"date":return e.textContent??"";default:return e.textContent??""}}function W(e){const t={},r=Array.from(e.children);for(let n=0;n<r.length;n+=2){const i=r[n],o=r[n+1];!i||i.tagName!=="key"||!o||(t[i.textContent??""]=b(o))}return t}function f(e){return typeof e=="string"&&e?e:void 0}function w(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function q(e){return typeof e=="boolean"?e:void 0}function N(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function g(e,t,r,n){return new Promise((i,o)=>{const a=indexedDB.open(e,t);a.onupgradeneeded=()=>{const s=a.result;s.objectStoreNames.contains(r)||s.createObjectStore(r,{keyPath:n})},a.onsuccess=()=>i(a.result),a.onerror=()=>o(a.error??new Error("Open IndexedDB failed"))})}function p(e){return new Promise((t,r)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>r(e.error??new Error("IndexedDB request failed"))})}exports.getLatestSigningAssets=O;exports.getLatestSigningAssetsWithCertificate=U;exports.getPairRecord=C;exports.getSigningAssets=R;exports.normalizeBundleID=u;exports.normalizeCertificateSerial=E;exports.normalizeUDID=d;exports.parseProvisioningProfile=V;exports.parseProvisioningProfileBase64=k;exports.parseProvisioningProfileBytes=v;exports.profileContainsDevice=G;exports.profileMatchesBundleID=j;exports.putPairRecord=T;exports.putSigningAssets=_;
|
package/dist/client-D1drDXxE.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const F=require("./gsa-srp-CCIfUz7Y.js");class g{constructor(t,r,o){this.apiUrl=t,this.token=r,this.organizationId=o}socket;nextId=1;pending=new Map;async connect(){if(this.socket&&this.socket.readyState===WebSocket.OPEN)return;const t=new WebSocket(E(this.apiUrl,this.token,this.organizationId));this.socket=t,t.onmessage=r=>this.handleMessage(r),t.onclose=()=>this.rejectPending(new Error("Apple relay WebSocket closed")),t.onerror=()=>this.rejectPending(new Error("Apple relay WebSocket failed")),await new Promise((r,o)=>{t.onopen=()=>r(),t.onerror=()=>o(new Error("Apple relay WebSocket connection failed"))})}request(t,r){const o=this.socket;if(!o||o.readyState!==WebSocket.OPEN)throw new Error("Apple relay WebSocket is not connected.");const a=String(this.nextId++),n=new Promise((p,i)=>{this.pending.set(a,{resolve:h=>p(q(h)),reject:i})});return o.send(JSON.stringify({id:a,type:t,...r===void 0?{}:{payload:r}})),n}close(){this.rejectPending(new Error("Apple relay WebSocket closed")),this.socket?.close(),this.socket=void 0}handleMessage(t){const r=JSON.parse(String(t.data)),o=this.pending.get(r.id);if(o){if(this.pending.delete(r.id),!r.ok){o.reject(new Error(r.error||"Apple relay request failed"));return}if(!r.response){o.reject(new Error("Apple relay response was empty."));return}o.resolve(r.response)}}rejectPending(t){for(const r of this.pending.values())r.reject(t);this.pending.clear()}}async function m(e,t,r){const o=new g(e,t,r);return await o.connect(),o}async function S(e,t){return e.request("srpInit",t)}async function A(e,t){return e.request("srpComplete",t)}async function P(e){return e.request("triggerTrustedDevice2FA")}async function b(e,t,r="sms"){return e.request("triggerPhone2FA",{phoneNumberId:t,mode:r})}async function k(e,t){return e.request("submitTrustedDevice2FA",{code:t})}async function T(e,t,r,o="sms"){return e.request("submitPhone2FA",{phoneNumberId:t,mode:o,code:r})}async function v(e){return e.request("finalize")}async function R(e,t){return e.request("provisioning",t)}function q(e){if(e.body!==void 0||!e.rawBody)return e;try{return{...e,body:JSON.parse(e.rawBody)}}catch{return e}}function E(e,t,r){const o=new URL(e);return o.protocol=o.protocol==="https:"?"wss:":"ws:",o.pathname=`${o.pathname.replace(/\/$/,"")}/ios/appstoreconnect/ws`,t&&o.searchParams.set("token",t),r&&o.searchParams.set("organization",r),o.toString()}async function N({registryApiUrl:e,accountName:t,password:r,token:o,organizationId:a}){const n=await m(e,o,a);try{const p=new F.AppleGsaSrpClient(t),i=await S(n,await p.init());if(i.status<200||i.status>=300)throw new Error(`Apple SRP init failed: HTTP ${i.status} ${i.rawBody??""}`.trim());if(!i.body)throw new Error("Apple SRP init response did not include a body.");const h=await p.complete(r,i.body),u=await A(n,{...h,rememberMe:!1,trustTokens:[]}),y=u.status===409;let s,d={type:"trustedDevice"};if(y){s=await P(n);const c=x(s.body);if(s.status===412){if(!c)throw new Error("Apple requested phone verification but did not include a trusted phone number.");d={type:"phone",phoneNumberId:c.id,mode:c.pushMode??"sms"},s=await b(n,c.id,c.pushMode??"sms")}if(s.status<200||s.status>=300)throw new Error(`Apple two-factor challenge failed: HTTP ${s.status} ${s.rawBody??""}`.trim())}else if(u.status<200||u.status>=300)throw new Error(`Apple SRP complete failed: HTTP ${u.status} ${u.rawBody??""}`.trim());return{relay:n,completeResponse:u,twoFactorChallengeResponse:s,requiresTwoFactor:y,finishTwoFactor:async c=>{const l=d.type==="phone"?await T(n,d.phoneNumberId,c,d.mode):await k(n,c);if(l.status<200||l.status>=300)throw new Error(`Apple two-factor code failed: HTTP ${l.status} ${l.rawBody??""}`.trim());return l},finalize:async()=>v(n),close:async()=>n.close()}}catch(p){throw n.close(),p}}function x(e){if(!f(e))return;const t=f(e.phoneNumberVerification)?e.phoneNumberVerification:void 0,r=w(t?.trustedPhoneNumber)??w(e.trustedPhoneNumber)??w(e.phoneNumber);if(!r)return;const o=r.id;if(typeof o!="number")return;const a=typeof r.pushMode=="string"?r.pushMode:typeof e.mode=="string"?e.mode:void 0;return{id:o,pushMode:a}}function w(e){return f(e)?e:void 0}function f(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}exports.AppleRelayWebSocketClient=g;exports.fetchAppleAccountSession=v;exports.openAppleRelayWebSocket=m;exports.proxyPhoneTwoFactorCode=T;exports.proxyProvisioningRequest=R;exports.proxySrpComplete=A;exports.proxySrpInit=S;exports.proxyTwoFactorCode=k;exports.startBrowserOwnedAppleIDLogin=N;exports.triggerPhoneTwoFactor=b;exports.triggerTrustedDeviceTwoFactor=P;
|
package/dist/client-DSuNtWDv.mjs
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { A as m } from "./gsa-srp-Bme3JLEi.mjs";
|
|
2
|
-
class g {
|
|
3
|
-
constructor(t, r, o) {
|
|
4
|
-
this.apiUrl = t, this.token = r, this.organizationId = o;
|
|
5
|
-
}
|
|
6
|
-
socket;
|
|
7
|
-
nextId = 1;
|
|
8
|
-
pending = /* @__PURE__ */ new Map();
|
|
9
|
-
async connect() {
|
|
10
|
-
if (this.socket && this.socket.readyState === WebSocket.OPEN) return;
|
|
11
|
-
const t = new WebSocket(R(this.apiUrl, this.token, this.organizationId));
|
|
12
|
-
this.socket = t, t.onmessage = (r) => this.handleMessage(r), t.onclose = () => this.rejectPending(new Error("Apple relay WebSocket closed")), t.onerror = () => this.rejectPending(new Error("Apple relay WebSocket failed")), await new Promise((r, o) => {
|
|
13
|
-
t.onopen = () => r(), t.onerror = () => o(new Error("Apple relay WebSocket connection failed"));
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
request(t, r) {
|
|
17
|
-
const o = this.socket;
|
|
18
|
-
if (!o || o.readyState !== WebSocket.OPEN)
|
|
19
|
-
throw new Error("Apple relay WebSocket is not connected.");
|
|
20
|
-
const c = String(this.nextId++), n = new Promise((p, i) => {
|
|
21
|
-
this.pending.set(c, {
|
|
22
|
-
resolve: (h) => p(N(h)),
|
|
23
|
-
reject: i
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
return o.send(JSON.stringify({ id: c, type: t, ...r === void 0 ? {} : { payload: r } })), n;
|
|
27
|
-
}
|
|
28
|
-
close() {
|
|
29
|
-
this.rejectPending(new Error("Apple relay WebSocket closed")), this.socket?.close(), this.socket = void 0;
|
|
30
|
-
}
|
|
31
|
-
handleMessage(t) {
|
|
32
|
-
const r = JSON.parse(String(t.data)), o = this.pending.get(r.id);
|
|
33
|
-
if (o) {
|
|
34
|
-
if (this.pending.delete(r.id), !r.ok) {
|
|
35
|
-
o.reject(new Error(r.error || "Apple relay request failed"));
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
if (!r.response) {
|
|
39
|
-
o.reject(new Error("Apple relay response was empty."));
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
o.resolve(r.response);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
rejectPending(t) {
|
|
46
|
-
for (const r of this.pending.values())
|
|
47
|
-
r.reject(t);
|
|
48
|
-
this.pending.clear();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async function b(e, t, r) {
|
|
52
|
-
const o = new g(e, t, r);
|
|
53
|
-
return await o.connect(), o;
|
|
54
|
-
}
|
|
55
|
-
async function A(e, t) {
|
|
56
|
-
return e.request("srpInit", t);
|
|
57
|
-
}
|
|
58
|
-
async function P(e, t) {
|
|
59
|
-
return e.request("srpComplete", t);
|
|
60
|
-
}
|
|
61
|
-
async function S(e) {
|
|
62
|
-
return e.request("triggerTrustedDevice2FA");
|
|
63
|
-
}
|
|
64
|
-
async function k(e, t, r = "sms") {
|
|
65
|
-
return e.request("triggerPhone2FA", { phoneNumberId: t, mode: r });
|
|
66
|
-
}
|
|
67
|
-
async function T(e, t) {
|
|
68
|
-
return e.request("submitTrustedDevice2FA", { code: t });
|
|
69
|
-
}
|
|
70
|
-
async function v(e, t, r, o = "sms") {
|
|
71
|
-
return e.request("submitPhone2FA", { phoneNumberId: t, mode: o, code: r });
|
|
72
|
-
}
|
|
73
|
-
async function E(e) {
|
|
74
|
-
return e.request("finalize");
|
|
75
|
-
}
|
|
76
|
-
async function W(e, t) {
|
|
77
|
-
return e.request("provisioning", t);
|
|
78
|
-
}
|
|
79
|
-
function N(e) {
|
|
80
|
-
if (e.body !== void 0 || !e.rawBody)
|
|
81
|
-
return e;
|
|
82
|
-
try {
|
|
83
|
-
return {
|
|
84
|
-
...e,
|
|
85
|
-
body: JSON.parse(e.rawBody)
|
|
86
|
-
};
|
|
87
|
-
} catch {
|
|
88
|
-
return e;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
function R(e, t, r) {
|
|
92
|
-
const o = new URL(e);
|
|
93
|
-
return o.protocol = o.protocol === "https:" ? "wss:" : "ws:", o.pathname = `${o.pathname.replace(/\/$/, "")}/ios/appstoreconnect/ws`, t && o.searchParams.set("token", t), r && o.searchParams.set("organization", r), o.toString();
|
|
94
|
-
}
|
|
95
|
-
async function M({
|
|
96
|
-
registryApiUrl: e,
|
|
97
|
-
accountName: t,
|
|
98
|
-
password: r,
|
|
99
|
-
token: o,
|
|
100
|
-
organizationId: c
|
|
101
|
-
}) {
|
|
102
|
-
const n = await b(e, o, c);
|
|
103
|
-
try {
|
|
104
|
-
const p = new m(t), i = await A(n, await p.init());
|
|
105
|
-
if (i.status < 200 || i.status >= 300)
|
|
106
|
-
throw new Error(
|
|
107
|
-
`Apple SRP init failed: HTTP ${i.status} ${i.rawBody ?? ""}`.trim()
|
|
108
|
-
);
|
|
109
|
-
if (!i.body)
|
|
110
|
-
throw new Error("Apple SRP init response did not include a body.");
|
|
111
|
-
const h = await p.complete(r, i.body), u = await P(n, {
|
|
112
|
-
...h,
|
|
113
|
-
rememberMe: !1,
|
|
114
|
-
trustTokens: []
|
|
115
|
-
}), y = u.status === 409;
|
|
116
|
-
let s, l = { type: "trustedDevice" };
|
|
117
|
-
if (y) {
|
|
118
|
-
s = await S(n);
|
|
119
|
-
const a = q(s.body);
|
|
120
|
-
if (s.status === 412) {
|
|
121
|
-
if (!a)
|
|
122
|
-
throw new Error("Apple requested phone verification but did not include a trusted phone number.");
|
|
123
|
-
l = {
|
|
124
|
-
type: "phone",
|
|
125
|
-
phoneNumberId: a.id,
|
|
126
|
-
mode: a.pushMode ?? "sms"
|
|
127
|
-
}, s = await k(n, a.id, a.pushMode ?? "sms");
|
|
128
|
-
}
|
|
129
|
-
if (s.status < 200 || s.status >= 300)
|
|
130
|
-
throw new Error(
|
|
131
|
-
`Apple two-factor challenge failed: HTTP ${s.status} ${s.rawBody ?? ""}`.trim()
|
|
132
|
-
);
|
|
133
|
-
} else if (u.status < 200 || u.status >= 300)
|
|
134
|
-
throw new Error(
|
|
135
|
-
`Apple SRP complete failed: HTTP ${u.status} ${u.rawBody ?? ""}`.trim()
|
|
136
|
-
);
|
|
137
|
-
return {
|
|
138
|
-
relay: n,
|
|
139
|
-
completeResponse: u,
|
|
140
|
-
twoFactorChallengeResponse: s,
|
|
141
|
-
requiresTwoFactor: y,
|
|
142
|
-
finishTwoFactor: async (a) => {
|
|
143
|
-
const d = l.type === "phone" ? await v(n, l.phoneNumberId, a, l.mode) : await T(n, a);
|
|
144
|
-
if (d.status < 200 || d.status >= 300)
|
|
145
|
-
throw new Error(
|
|
146
|
-
`Apple two-factor code failed: HTTP ${d.status} ${d.rawBody ?? ""}`.trim()
|
|
147
|
-
);
|
|
148
|
-
return d;
|
|
149
|
-
},
|
|
150
|
-
finalize: async () => E(n),
|
|
151
|
-
close: async () => n.close()
|
|
152
|
-
};
|
|
153
|
-
} catch (p) {
|
|
154
|
-
throw n.close(), p;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function q(e) {
|
|
158
|
-
if (!f(e)) return;
|
|
159
|
-
const t = f(e.phoneNumberVerification) ? e.phoneNumberVerification : void 0, r = w(t?.trustedPhoneNumber) ?? w(e.trustedPhoneNumber) ?? w(e.phoneNumber);
|
|
160
|
-
if (!r) return;
|
|
161
|
-
const o = r.id;
|
|
162
|
-
if (typeof o != "number") return;
|
|
163
|
-
const c = typeof r.pushMode == "string" ? r.pushMode : typeof e.mode == "string" ? e.mode : void 0;
|
|
164
|
-
return { id: o, pushMode: c };
|
|
165
|
-
}
|
|
166
|
-
function w(e) {
|
|
167
|
-
return f(e) ? e : void 0;
|
|
168
|
-
}
|
|
169
|
-
function f(e) {
|
|
170
|
-
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
171
|
-
}
|
|
172
|
-
export {
|
|
173
|
-
g as A,
|
|
174
|
-
v as a,
|
|
175
|
-
P as b,
|
|
176
|
-
A as c,
|
|
177
|
-
T as d,
|
|
178
|
-
S as e,
|
|
179
|
-
E as f,
|
|
180
|
-
b as o,
|
|
181
|
-
W as p,
|
|
182
|
-
M as s,
|
|
183
|
-
k as t
|
|
184
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { AppleRelayWebSocketClient, AppleRelayResponse } from './relay';
|
|
2
|
-
export type AppleIDLoginInput = {
|
|
3
|
-
registryApiUrl: string;
|
|
4
|
-
accountName: string;
|
|
5
|
-
password: string;
|
|
6
|
-
token?: string;
|
|
7
|
-
organizationId?: string;
|
|
8
|
-
};
|
|
9
|
-
export type AppleIDLoginResult = {
|
|
10
|
-
relay: AppleRelayWebSocketClient;
|
|
11
|
-
completeResponse: AppleRelayResponse;
|
|
12
|
-
twoFactorChallengeResponse?: AppleRelayResponse;
|
|
13
|
-
requiresTwoFactor: boolean;
|
|
14
|
-
finishTwoFactor: (code: string) => Promise<AppleRelayResponse>;
|
|
15
|
-
finalize: () => Promise<AppleRelayResponse>;
|
|
16
|
-
close: () => Promise<void>;
|
|
17
|
-
};
|
|
18
|
-
export declare function startBrowserOwnedAppleIDLogin({ registryApiUrl, accountName, password, token, organizationId, }: AppleIDLoginInput): Promise<AppleIDLoginResult>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export type AppleSigningKeyMaterial = {
|
|
2
|
-
privateKey: CryptoKey;
|
|
3
|
-
privateKeyPKCS8Base64: string;
|
|
4
|
-
publicKeySPKIBase64: string;
|
|
5
|
-
csrPEM: string;
|
|
6
|
-
csrBase64: string;
|
|
7
|
-
};
|
|
8
|
-
export type AppleCSRInput = {
|
|
9
|
-
commonName: string;
|
|
10
|
-
emailAddress?: string;
|
|
11
|
-
};
|
|
12
|
-
export type ExportP12Input = {
|
|
13
|
-
privateKeyPKCS8Base64: string;
|
|
14
|
-
certificateBase64?: string;
|
|
15
|
-
certificatePEM?: string;
|
|
16
|
-
password: string;
|
|
17
|
-
friendlyName?: string;
|
|
18
|
-
};
|
|
19
|
-
export declare function generateAppleSigningKeyAndCSR(input: AppleCSRInput): Promise<AppleSigningKeyMaterial>;
|
|
20
|
-
export declare function exportAppleCertificateP12(input: ExportP12Input): string;
|