@limrun/ui 0.14.0-rc.5 → 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 -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,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-C9z_sgOf.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const R=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:w=>p(x(w)),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 q(e,t){return e.request("provisioning",t)}async function F(e,t){return e.request("appstoreconnect",t)}function x(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 R.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 w=await p.complete(r,i.body),u=await A(n,{...w,rememberMe:!1,trustTokens:[]}),y=u.status===409;let s,d={type:"trustedDevice"};if(y){s=await P(n);const c=W(s.body);if(s.status===412||C(s.body)){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 C(e){return h(e)&&e.noTrustedDevices===!0}function W(e){if(!h(e))return;const t=h(e.phoneNumberVerification)?e.phoneNumberVerification:void 0,r=f(t?.trustedPhoneNumber)??f(e.trustedPhoneNumber)??f(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 f(e){return h(e)?e:void 0}function h(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}exports.AppleRelayWebSocketClient=g;exports.fetchAppleAccountSession=v;exports.openAppleRelayWebSocket=m;exports.proxyAppStoreConnectRequest=F;exports.proxyPhoneTwoFactorCode=T;exports.proxyProvisioningRequest=q;exports.proxySrpComplete=A;exports.proxySrpInit=S;exports.proxyTwoFactorCode=k;exports.startBrowserOwnedAppleIDLogin=N;exports.triggerPhoneTwoFactor=b;exports.triggerTrustedDeviceTwoFactor=P;
|
package/dist/client-CFDB4mX5.mjs
DELETED
|
@@ -1,191 +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(N(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: (f) => p(E(f)),
|
|
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 A(e, t, r) {
|
|
52
|
-
const o = new g(e, t, r);
|
|
53
|
-
return await o.connect(), o;
|
|
54
|
-
}
|
|
55
|
-
async function b(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 q(e) {
|
|
74
|
-
return e.request("finalize");
|
|
75
|
-
}
|
|
76
|
-
async function x(e, t) {
|
|
77
|
-
return e.request("provisioning", t);
|
|
78
|
-
}
|
|
79
|
-
async function M(e, t) {
|
|
80
|
-
return e.request("appstoreconnect", t);
|
|
81
|
-
}
|
|
82
|
-
function E(e) {
|
|
83
|
-
if (e.body !== void 0 || !e.rawBody)
|
|
84
|
-
return e;
|
|
85
|
-
try {
|
|
86
|
-
return {
|
|
87
|
-
...e,
|
|
88
|
-
body: JSON.parse(e.rawBody)
|
|
89
|
-
};
|
|
90
|
-
} catch {
|
|
91
|
-
return e;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function N(e, t, r) {
|
|
95
|
-
const o = new URL(e);
|
|
96
|
-
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();
|
|
97
|
-
}
|
|
98
|
-
async function $({
|
|
99
|
-
registryApiUrl: e,
|
|
100
|
-
accountName: t,
|
|
101
|
-
password: r,
|
|
102
|
-
token: o,
|
|
103
|
-
organizationId: c
|
|
104
|
-
}) {
|
|
105
|
-
const n = await A(e, o, c);
|
|
106
|
-
try {
|
|
107
|
-
const p = new m(t), i = await b(n, await p.init());
|
|
108
|
-
if (i.status < 200 || i.status >= 300)
|
|
109
|
-
throw new Error(
|
|
110
|
-
`Apple SRP init failed: HTTP ${i.status} ${i.rawBody ?? ""}`.trim()
|
|
111
|
-
);
|
|
112
|
-
if (!i.body)
|
|
113
|
-
throw new Error("Apple SRP init response did not include a body.");
|
|
114
|
-
const f = await p.complete(r, i.body), u = await P(n, {
|
|
115
|
-
...f,
|
|
116
|
-
rememberMe: !1,
|
|
117
|
-
trustTokens: []
|
|
118
|
-
}), y = u.status === 409;
|
|
119
|
-
let s, l = { type: "trustedDevice" };
|
|
120
|
-
if (y) {
|
|
121
|
-
s = await S(n);
|
|
122
|
-
const a = F(s.body);
|
|
123
|
-
if (s.status === 412 || R(s.body)) {
|
|
124
|
-
if (!a)
|
|
125
|
-
throw new Error("Apple requested phone verification but did not include a trusted phone number.");
|
|
126
|
-
l = {
|
|
127
|
-
type: "phone",
|
|
128
|
-
phoneNumberId: a.id,
|
|
129
|
-
mode: a.pushMode ?? "sms"
|
|
130
|
-
}, s = await k(n, a.id, a.pushMode ?? "sms");
|
|
131
|
-
}
|
|
132
|
-
if (s.status < 200 || s.status >= 300)
|
|
133
|
-
throw new Error(
|
|
134
|
-
`Apple two-factor challenge failed: HTTP ${s.status} ${s.rawBody ?? ""}`.trim()
|
|
135
|
-
);
|
|
136
|
-
} else if (u.status < 200 || u.status >= 300)
|
|
137
|
-
throw new Error(
|
|
138
|
-
`Apple SRP complete failed: HTTP ${u.status} ${u.rawBody ?? ""}`.trim()
|
|
139
|
-
);
|
|
140
|
-
return {
|
|
141
|
-
relay: n,
|
|
142
|
-
completeResponse: u,
|
|
143
|
-
twoFactorChallengeResponse: s,
|
|
144
|
-
requiresTwoFactor: y,
|
|
145
|
-
finishTwoFactor: async (a) => {
|
|
146
|
-
const d = l.type === "phone" ? await v(n, l.phoneNumberId, a, l.mode) : await T(n, a);
|
|
147
|
-
if (d.status < 200 || d.status >= 300)
|
|
148
|
-
throw new Error(
|
|
149
|
-
`Apple two-factor code failed: HTTP ${d.status} ${d.rawBody ?? ""}`.trim()
|
|
150
|
-
);
|
|
151
|
-
return d;
|
|
152
|
-
},
|
|
153
|
-
finalize: async () => q(n),
|
|
154
|
-
close: async () => n.close()
|
|
155
|
-
};
|
|
156
|
-
} catch (p) {
|
|
157
|
-
throw n.close(), p;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
function R(e) {
|
|
161
|
-
return h(e) && e.noTrustedDevices === !0;
|
|
162
|
-
}
|
|
163
|
-
function F(e) {
|
|
164
|
-
if (!h(e)) return;
|
|
165
|
-
const t = h(e.phoneNumberVerification) ? e.phoneNumberVerification : void 0, r = w(t?.trustedPhoneNumber) ?? w(e.trustedPhoneNumber) ?? w(e.phoneNumber);
|
|
166
|
-
if (!r) return;
|
|
167
|
-
const o = r.id;
|
|
168
|
-
if (typeof o != "number") return;
|
|
169
|
-
const c = typeof r.pushMode == "string" ? r.pushMode : typeof e.mode == "string" ? e.mode : void 0;
|
|
170
|
-
return { id: o, pushMode: c };
|
|
171
|
-
}
|
|
172
|
-
function w(e) {
|
|
173
|
-
return h(e) ? e : void 0;
|
|
174
|
-
}
|
|
175
|
-
function h(e) {
|
|
176
|
-
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
177
|
-
}
|
|
178
|
-
export {
|
|
179
|
-
g as A,
|
|
180
|
-
M as a,
|
|
181
|
-
v as b,
|
|
182
|
-
P as c,
|
|
183
|
-
b as d,
|
|
184
|
-
T as e,
|
|
185
|
-
q as f,
|
|
186
|
-
S as g,
|
|
187
|
-
A as o,
|
|
188
|
-
x as p,
|
|
189
|
-
$ as s,
|
|
190
|
-
k as t
|
|
191
|
-
};
|
|
@@ -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;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export type AppleSRPProtocol = 's2k' | 's2k_fo';
|
|
2
|
-
export type AppleSRPInitRequest = {
|
|
3
|
-
a: string;
|
|
4
|
-
accountName: string;
|
|
5
|
-
protocols: AppleSRPProtocol[];
|
|
6
|
-
};
|
|
7
|
-
export type AppleSRPInitResponse = {
|
|
8
|
-
iteration: number;
|
|
9
|
-
salt: string;
|
|
10
|
-
protocol: AppleSRPProtocol;
|
|
11
|
-
b: string;
|
|
12
|
-
c: string;
|
|
13
|
-
};
|
|
14
|
-
export type AppleSRPCompleteProof = {
|
|
15
|
-
accountName: string;
|
|
16
|
-
m1: string;
|
|
17
|
-
m2: string;
|
|
18
|
-
c: string;
|
|
19
|
-
};
|
|
20
|
-
export declare class AppleGsaSrpClient {
|
|
21
|
-
private readonly accountName;
|
|
22
|
-
private srpClient?;
|
|
23
|
-
constructor(accountName: string);
|
|
24
|
-
init(): Promise<AppleSRPInitRequest>;
|
|
25
|
-
complete(password: string, serverData: AppleSRPInitResponse): Promise<AppleSRPCompleteProof>;
|
|
26
|
-
}
|