@limrun/ui 0.13.3-rc.1 → 0.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-store-relay/index.cjs +4 -4
- package/dist/app-store-relay/index.js +175 -119
- package/dist/app-store-relay/react.cjs +1 -1
- package/dist/app-store-relay/react.js +2 -2
- package/dist/{browser-storage-BJ__DGJ6.mjs → browser-storage-Cx9eW-bm.mjs} +48 -45
- package/dist/browser-storage-jJaIht4K.js +1 -0
- package/dist/{client-CnbCWvCs.js → client-ASLtHFLh.js} +1 -1
- package/dist/{client-Bk1N3XIF.mjs → client-CGdh8yoJ.mjs} +33 -27
- package/dist/core/device-install/apple/provisioning.d.ts +4 -4
- package/dist/device-build/index.cjs +1 -1
- package/dist/device-build/index.js +5 -5
- package/dist/device-build/react.cjs +1 -1
- package/dist/device-build/react.js +15 -13
- package/dist/device-install/demo/demo.d.ts +0 -0
- package/dist/device-install/index.cjs +1 -1
- package/dist/device-install/index.d.ts +1 -1
- package/dist/device-install/index.js +134 -121
- package/dist/device-install/react.cjs +1 -1
- package/dist/device-install/react.js +55 -50
- package/dist/{index-BXg7HdIs.mjs → index-DFdCvi2_.mjs} +3 -7
- package/dist/limbuild-client-CgEncrgx.js +1 -0
- package/dist/{limbuild-client-CFJhYsRx.mjs → limbuild-client-D7U7w342.mjs} +4 -2
- package/dist/{provisioning-CdseoMJQ.mjs → provisioning-DKbkBO-p.mjs} +11 -11
- package/dist/{provisioning-D2ZZQeyX.js → provisioning-Va0PH4Kk.js} +1 -1
- package/package.json +1 -1
- package/src/app-store-relay/index.test.ts +1 -5
- package/src/app-store-relay/index.ts +109 -42
- package/src/app-store-relay/react.ts +6 -2
- package/src/core/device-install/apple/client.ts +29 -22
- package/src/core/device-install/apple/crypto.ts +9 -6
- package/src/core/device-install/apple/gsa-srp.ts +3 -7
- package/src/core/device-install/apple/provisioning.ts +16 -18
- package/src/core/device-install/apple/relay.ts +5 -1
- package/src/core/device-install/operations/limbuild-client.ts +8 -1
- package/src/core/device-install/operations/operations.ts +3 -1
- package/src/core/device-install/operations/relay-client.ts +57 -27
- package/src/core/device-install/operations/usbmux.ts +3 -3
- package/src/core/device-install/operations/webusb.ts +9 -4
- package/src/core/device-install/storage/browser-storage.ts +20 -6
- package/src/core/device-install/types.ts +1 -7
- package/src/device-build/react.ts +4 -1
- package/src/device-install/README.md +423 -0
- package/src/device-install/demo/demo.css +493 -0
- package/src/device-install/demo/demo.tsx +1069 -0
- package/src/device-install/demo/index.html +12 -0
- package/src/device-install/index.ts +7 -7
- package/src/device-install/react.ts +26 -17
- package/src/index.ts +1 -1
- package/dist/browser-storage-C1jQLXat.js +0 -1
- package/dist/limbuild-client-C_CMNLYV.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
${
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../client-ASLtHFLh.js"),u=require("../index-CMeQfhYy.js"),p=require("../provisioning-Va0PH4Kk.js"),P={name:"RSASSA-PKCS1-v1_5",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:"SHA-256"};async function I(e){if(!crypto.subtle)throw new Error("WebCrypto is not available in this browser.");const t=await crypto.subtle.generateKey(P,!0,["sign","verify"]),r=new Uint8Array(await crypto.subtle.exportKey("spki",t.publicKey)),n=f(C(0),h(e),r,B(0,new Uint8Array)),i=new Uint8Array(await crypto.subtle.sign("RSASSA-PKCS1-v1_5",t.privateKey,N(n))),o=f(n,f(g("1.2.840.113549.1.1.11"),R()),E(i)),s=new Uint8Array(await crypto.subtle.exportKey("pkcs8",t.privateKey));return{privateKey:t.privateKey,privateKeyPKCS8Base64:y(s),publicKeySPKIBase64:y(r),csrPEM:U("CERTIFICATE REQUEST",o),csrBase64:y(o)}}function S(e){if(!e.certificateBase64&&!e.certificatePEM)throw new Error("certificateBase64 or certificatePEM is required.");const t=u.forge.pki.privateKeyFromPem(F("PRIVATE KEY",e.privateKeyPKCS8Base64)),r=e.certificatePEM?u.forge.pki.certificateFromPem(e.certificatePEM):u.forge.pki.certificateFromAsn1(u.forge.asn1.fromDer(u.forge.util.createBuffer(k(e.certificateBase64)))),n=u.forge.pkcs12.toPkcs12Asn1(t,[r],e.password,{algorithm:"3des",friendlyName:e.friendlyName}),i=u.forge.asn1.toDer(n).getBytes();return O(i)}function h(e){const t=[v("2.5.4.3",T(e.commonName))];return e.emailAddress&&t.push(v("1.2.840.113549.1.9.1",K(e.emailAddress))),f(...t)}function v(e,t){return q(f(g(e),t))}function f(...e){return d(48,A(...e))}function q(...e){return d(49,A(...e))}function B(e,t){return d(160+e,t)}function C(e){return d(2,new Uint8Array([e]))}function R(){return new Uint8Array([5,0])}function T(e){return d(12,new TextEncoder().encode(e))}function K(e){return d(22,new TextEncoder().encode(e))}function E(e){return d(3,A(new Uint8Array([0]),e))}function g(e){const t=e.split(".").map(n=>parseInt(n,10));if(t.length<2||t.some(n=>!Number.isFinite(n)))throw new Error(`Invalid OID: ${e}`);const r=[t[0]*40+t[1]];for(const n of t.slice(2)){const i=[n&127];let o=n>>7;for(;o>0;)i.unshift(o&127|128),o>>=7;r.push(...i)}return d(6,new Uint8Array(r))}function d(e,t){return A(new Uint8Array([e]),x(t.byteLength),t)}function x(e){if(e<128)return new Uint8Array([e]);const t=[];let r=e;for(;r>0;)t.unshift(r&255),r>>=8;return new Uint8Array([128|t.length,...t])}function A(...e){const t=e.reduce((i,o)=>i+o.byteLength,0),r=new Uint8Array(t);let n=0;for(const i of e)r.set(i,n),n+=i.byteLength;return r}function U(e,t){const n=y(t).match(/.{1,64}/g)??[];return`-----BEGIN ${e}-----
|
|
2
|
+
${n.join(`
|
|
3
3
|
`)}
|
|
4
4
|
-----END ${e}-----
|
|
5
|
-
`}function
|
|
5
|
+
`}function F(e,t){const r=t.match(/.{1,64}/g)??[];return`-----BEGIN ${e}-----
|
|
6
6
|
${r.join(`
|
|
7
7
|
`)}
|
|
8
8
|
-----END ${e}-----
|
|
9
|
-
`}function y(e){let t="";for(const r of e)t+=String.fromCharCode(r);return btoa(t)}function
|
|
9
|
+
`}function y(e){let t="";for(const r of e)t+=String.fromCharCode(r);return btoa(t)}function O(e){return btoa(e)}function k(e){return atob(e)}function N(e){const t=new Uint8Array(e.byteLength);return t.set(e),t.buffer}async function a({apiUrl:e,token:t,appleSessionId:r,request:n,label:i="Apple Developer Portal request",validatePortalResponse:o=!0,mapBody:s}){const c=await l.proxyProvisioningRequest(e,r,n,t);return o&&b(c.body,i),s?s(c.body,c):c}async function L(e){return a({...e,request:p.listTeamsRequest(),label:"Apple Developer team list",mapBody:t=>re([...t?.teams??[],...t?.availableProviders??[],...t?.provider?[t.provider]:[]])})}async function $({certificateKind:e="development",teamId:t="",...r}){return a({...r,request:e==="distribution"?p.findDistributionCertificatesRequest(t):p.findDevelopmentCertificatesRequest(t),label:"Apple Developer certificate list",mapBody:n=>n?.certRequests??[]})}async function G({certificateKind:e="development",teamId:t="",csrPEM:r,...n}){return a({...n,request:e==="distribution"?p.submitDistributionCSRRequest({csrPEM:r,teamID:t}):p.submitDevelopmentCSRRequest({csrPEM:r,teamID:t}),label:e==="distribution"?"Apple Distribution certificate creation":"Apple Development certificate creation",mapBody:i=>i?.certRequest})}async function H({certificateKind:e="development",certificateId:t,teamId:r="",...n}){return a({...n,request:e==="distribution"?p.downloadDistributionCertificateRequest(t,r):p.downloadCertificateRequest(t,r),label:"Apple certificate download",validatePortalResponse:!1,mapBody:(i,o)=>o})}async function M({certificateKind:e="development",certificateId:t,teamId:r="",...n}){return a({...n,request:{method:"POST",path:"/account/ios/certificate/revokeCertificate.action",payload:{teamId:r,certificateId:t,type:e==="distribution"?"WXV89964HE":"83Q87W3TGH"}},label:"Apple certificate deletion",mapBody:i=>i})}async function _({teamId:e="",search:t="",...r}){const n=t.trim().toLowerCase();return a({...r,request:p.findBundleIDRequest({bundleID:t,teamID:e}),label:"Apple bundle ID list",mapBody:i=>{const o=i?.appIds??[];return n?o.filter(s=>[s.identifier,s.bundleId,s.name].some(c=>typeof c=="string"&&c.toLowerCase().includes(n))):o}})}async function j({teamId:e="",bundleId:t,name:r,...n}){return a({...n,request:p.createBundleIDRequest({bundleID:t,teamID:e,name:r}),label:"Apple bundle ID creation",mapBody:i=>i?.appId})}async function V({teamId:e="",appIdId:t,bundleId:r,name:n,...i}){return a({...i,request:{method:"POST",path:"/account/ios/identifiers/updateAppId.action",payload:{teamId:e,appIdId:t,...r?{identifier:r}:{},...n?{name:n}:{}}},label:"Apple bundle ID update",mapBody:o=>o?.appId})}async function W({teamId:e="",appIdId:t,...r}){return a({...r,request:{method:"POST",path:"/account/ios/identifiers/deleteAppId.action",payload:{teamId:e,appIdId:t}},label:"Apple bundle ID deletion",mapBody:n=>n})}async function Q({teamId:e="",deviceUDID:t="",...r}){const n=D(t);return a({...r,request:p.findDeviceRequest({deviceUDID:t,teamID:e}),label:"Apple device list",mapBody:i=>{const o=i?.devices??[];return n?o.filter(s=>D(s.deviceNumber)===n):o}})}function D(e){return(e??"").replace(/-/g,"").replace(/[^a-fA-F0-9]/g,"").toUpperCase()}async function z({teamId:e="",deviceUDID:t,name:r,...n}){return a({...n,request:p.registerDeviceRequest({deviceUDID:t,teamID:e,name:r}),label:"Apple device registration",mapBody:i=>i?.device})}async function J({teamId:e="",deviceId:t,name:r,...n}){return a({...n,request:{method:"POST",path:"/account/ios/device/updateDevice.action",payload:{teamId:e,deviceId:t,...r?{name:r}:{}}},label:"Apple device update",mapBody:i=>i?.device})}async function X({teamId:e="",deviceId:t,...r}){return a({...r,request:{method:"POST",path:"/account/ios/device/deleteDevice.action",payload:{teamId:e,deviceId:t}},label:"Apple device deletion",mapBody:n=>n})}async function Y({profileKind:e="development",teamId:t="",bundleId:r="",...n}){return a({...n,request:e==="adhoc"?p.findAdHocProfilesRequest({bundleID:r,teamID:t}):p.findDevelopmentProfilesRequest({bundleID:r,teamID:t}),label:"Apple provisioning profile list",mapBody:i=>i?.provisioningProfiles??[]})}async function Z({profileKind:e="development",teamId:t="",bundleId:r,appIdId:n,certificateIds:i,deviceIds:o,name:s,...c}){const[m]=i;if(!m)throw new Error("At least one certificate ID is required to create an Apple provisioning profile.");return a({...c,request:e==="adhoc"?p.createAdHocProfileRequest({bundleID:r,teamID:t,appIDID:n,certificateID:m,deviceIDs:o,name:s}):p.createDevelopmentProfileRequest({bundleID:r,teamID:t,appIDID:n,certificateID:m,deviceIDs:o,name:s}),label:"Apple provisioning profile creation",mapBody:w=>w?.provisioningProfile})}async function ee({teamId:e="",profileId:t,...r}){return a({...r,request:p.downloadProfileRequest(t,e),label:"Apple provisioning profile download",validatePortalResponse:!1,mapBody:(n,i)=>i})}async function te({teamId:e="",profileId:t,...r}){return a({...r,request:{method:"POST",path:"/account/ios/profile/deleteProvisioningProfile.action",payload:{teamId:e,provisioningProfileId:t}},label:"Apple provisioning profile deletion",mapBody:n=>n})}function b(e,t){if(!e)throw new Error(`${t} returned an empty response.`);if(e.resultCode!==void 0&&e.resultCode!==0)throw new Error(`${t} failed: ${e.userString??e.resultString??e.resultCode}`)}function re(e){const t=new Set,r=[];for(const n of e){const i=String(n.teamId??n.providerId??n.publicProviderId??n.name??JSON.stringify(n));t.has(i)||(t.add(i),r.push(n))}return r}exports.createAppleRelaySession=l.createAppleRelaySession;exports.deleteAppleRelaySession=l.deleteAppleRelaySession;exports.fetchAppleAccountSession=l.fetchAppleAccountSession;exports.proxyPhoneTwoFactorCode=l.proxyPhoneTwoFactorCode;exports.proxySrpComplete=l.proxySrpComplete;exports.proxySrpInit=l.proxySrpInit;exports.proxyTwoFactorCode=l.proxyTwoFactorCode;exports.startBrowserOwnedAppleIDLogin=l.startBrowserOwnedAppleIDLogin;exports.triggerPhoneTwoFactor=l.triggerPhoneTwoFactor;exports.triggerTrustedDeviceTwoFactor=l.triggerTrustedDeviceTwoFactor;exports.AppleGsaSrpClient=u.AppleGsaSrpClient;exports.assertAppleDeveloperPortalResponseOK=b;exports.createAppleBundleID=j;exports.createAppleCertificate=G;exports.createAppleProfile=Z;exports.deleteAppleBundleID=W;exports.deleteAppleCertificate=M;exports.deleteAppleDevice=X;exports.deleteAppleProfile=te;exports.downloadAppleCertificate=H;exports.downloadAppleProfile=ee;exports.exportAppleCertificateP12=S;exports.generateAppleSigningKeyAndCSR=I;exports.listAppleBundleIDs=_;exports.listAppleCertificates=$;exports.listAppleDevices=Q;exports.listAppleProfiles=Y;exports.listAppleTeams=L;exports.registerAppleDevice=z;exports.requestAppleProvisioning=a;exports.updateAppleBundleID=V;exports.updateAppleDevice=J;
|
|
@@ -1,82 +1,84 @@
|
|
|
1
|
-
import { p as
|
|
2
|
-
import { c as
|
|
3
|
-
import { f as
|
|
4
|
-
import { A as
|
|
5
|
-
import { l as
|
|
6
|
-
const
|
|
1
|
+
import { p as D } from "../client-CGdh8yoJ.mjs";
|
|
2
|
+
import { c as he, d as Pe, f as qe, a as Be, b as Se, e as Ce, g as Re, s as Te, t as Ee, h as Ke } from "../client-CGdh8yoJ.mjs";
|
|
3
|
+
import { f as l } from "../index-DFdCvi2_.mjs";
|
|
4
|
+
import { A as xe } from "../index-DFdCvi2_.mjs";
|
|
5
|
+
import { l as w, f as g, a as I, s as h, b as P, d as q, c as B, e as S, g as C, h as R, r as T, i as E, j as K, k as U, m as x, n as k } from "../provisioning-DKbkBO-p.mjs";
|
|
6
|
+
const F = {
|
|
7
7
|
name: "RSASSA-PKCS1-v1_5",
|
|
8
8
|
modulusLength: 2048,
|
|
9
9
|
publicExponent: new Uint8Array([1, 0, 1]),
|
|
10
10
|
hash: "SHA-256"
|
|
11
11
|
};
|
|
12
|
-
async function
|
|
12
|
+
async function re(e) {
|
|
13
13
|
if (!crypto.subtle)
|
|
14
14
|
throw new Error("WebCrypto is not available in this browser.");
|
|
15
|
-
const t = await crypto.subtle.generateKey(
|
|
15
|
+
const t = await crypto.subtle.generateKey(F, !0, ["sign", "verify"]), r = new Uint8Array(await crypto.subtle.exportKey("spki", t.publicKey)), n = u(
|
|
16
16
|
$(0),
|
|
17
|
-
|
|
17
|
+
N(e),
|
|
18
18
|
r,
|
|
19
|
-
|
|
19
|
+
L(0, new Uint8Array())
|
|
20
20
|
), i = new Uint8Array(
|
|
21
|
-
await crypto.subtle.sign(
|
|
21
|
+
await crypto.subtle.sign(
|
|
22
|
+
"RSASSA-PKCS1-v1_5",
|
|
23
|
+
t.privateKey,
|
|
24
|
+
J(n)
|
|
25
|
+
)
|
|
22
26
|
), o = u(
|
|
23
27
|
n,
|
|
24
|
-
u(
|
|
25
|
-
|
|
26
|
-
),
|
|
28
|
+
u(v("1.2.840.113549.1.1.11"), H()),
|
|
29
|
+
_(i)
|
|
30
|
+
), s = new Uint8Array(await crypto.subtle.exportKey("pkcs8", t.privateKey));
|
|
27
31
|
return {
|
|
28
32
|
privateKey: t.privateKey,
|
|
29
|
-
privateKeyPKCS8Base64: d(
|
|
33
|
+
privateKeyPKCS8Base64: d(s),
|
|
30
34
|
publicKeySPKIBase64: d(r),
|
|
31
|
-
csrPEM:
|
|
35
|
+
csrPEM: V("CERTIFICATE REQUEST", o),
|
|
32
36
|
csrBase64: d(o)
|
|
33
37
|
};
|
|
34
38
|
}
|
|
35
|
-
function
|
|
39
|
+
function ne(e) {
|
|
36
40
|
if (!e.certificateBase64 && !e.certificatePEM)
|
|
37
41
|
throw new Error("certificateBase64 or certificatePEM is required.");
|
|
38
|
-
const t =
|
|
39
|
-
|
|
40
|
-
),
|
|
41
|
-
p.asn1.fromDer(p.util.createBuffer(Q(e.certificateBase64)))
|
|
42
|
-
), n = p.pkcs12.toPkcs12Asn1(t, [r], e.password, {
|
|
42
|
+
const t = l.pki.privateKeyFromPem(W("PRIVATE KEY", e.privateKeyPKCS8Base64)), r = e.certificatePEM ? l.pki.certificateFromPem(e.certificatePEM) : l.pki.certificateFromAsn1(
|
|
43
|
+
l.asn1.fromDer(l.util.createBuffer(z(e.certificateBase64)))
|
|
44
|
+
), n = l.pkcs12.toPkcs12Asn1(t, [r], e.password, {
|
|
43
45
|
algorithm: "3des",
|
|
44
46
|
friendlyName: e.friendlyName
|
|
45
|
-
}), i =
|
|
46
|
-
return
|
|
47
|
+
}), i = l.asn1.toDer(n).getBytes();
|
|
48
|
+
return Q(i);
|
|
47
49
|
}
|
|
48
|
-
function
|
|
49
|
-
const t = [
|
|
50
|
-
return e.emailAddress && t.push(
|
|
50
|
+
function N(e) {
|
|
51
|
+
const t = [m("2.5.4.3", G(e.commonName))];
|
|
52
|
+
return e.emailAddress && t.push(m("1.2.840.113549.1.9.1", M(e.emailAddress))), u(...t);
|
|
51
53
|
}
|
|
52
|
-
function
|
|
53
|
-
return
|
|
54
|
+
function m(e, t) {
|
|
55
|
+
return O(u(v(e), t));
|
|
54
56
|
}
|
|
55
57
|
function u(...e) {
|
|
56
|
-
return
|
|
58
|
+
return p(48, f(...e));
|
|
57
59
|
}
|
|
58
|
-
function
|
|
59
|
-
return
|
|
60
|
+
function O(...e) {
|
|
61
|
+
return p(49, f(...e));
|
|
60
62
|
}
|
|
61
|
-
function
|
|
62
|
-
return
|
|
63
|
+
function L(e, t) {
|
|
64
|
+
return p(160 + e, t);
|
|
63
65
|
}
|
|
64
66
|
function $(e) {
|
|
65
|
-
return
|
|
67
|
+
return p(2, new Uint8Array([e]));
|
|
66
68
|
}
|
|
67
|
-
function
|
|
69
|
+
function H() {
|
|
68
70
|
return new Uint8Array([5, 0]);
|
|
69
71
|
}
|
|
70
|
-
function H(e) {
|
|
71
|
-
return s(12, new TextEncoder().encode(e));
|
|
72
|
-
}
|
|
73
72
|
function G(e) {
|
|
74
|
-
return
|
|
73
|
+
return p(12, new TextEncoder().encode(e));
|
|
75
74
|
}
|
|
76
75
|
function M(e) {
|
|
77
|
-
return
|
|
76
|
+
return p(22, new TextEncoder().encode(e));
|
|
77
|
+
}
|
|
78
|
+
function _(e) {
|
|
79
|
+
return p(3, f(new Uint8Array([0]), e));
|
|
78
80
|
}
|
|
79
|
-
function
|
|
81
|
+
function v(e) {
|
|
80
82
|
const t = e.split(".").map((n) => parseInt(n, 10));
|
|
81
83
|
if (t.length < 2 || t.some((n) => !Number.isFinite(n)))
|
|
82
84
|
throw new Error(`Invalid OID: ${e}`);
|
|
@@ -88,12 +90,12 @@ function m(e) {
|
|
|
88
90
|
i.unshift(o & 127 | 128), o >>= 7;
|
|
89
91
|
r.push(...i);
|
|
90
92
|
}
|
|
91
|
-
return
|
|
93
|
+
return p(6, new Uint8Array(r));
|
|
92
94
|
}
|
|
93
|
-
function
|
|
94
|
-
return f(new Uint8Array([e]),
|
|
95
|
+
function p(e, t) {
|
|
96
|
+
return f(new Uint8Array([e]), j(t.byteLength), t);
|
|
95
97
|
}
|
|
96
|
-
function
|
|
98
|
+
function j(e) {
|
|
97
99
|
if (e < 128)
|
|
98
100
|
return new Uint8Array([e]);
|
|
99
101
|
const t = [];
|
|
@@ -109,7 +111,7 @@ function f(...e) {
|
|
|
109
111
|
r.set(i, n), n += i.byteLength;
|
|
110
112
|
return r;
|
|
111
113
|
}
|
|
112
|
-
function
|
|
114
|
+
function V(e, t) {
|
|
113
115
|
const n = d(t).match(/.{1,64}/g) ?? [];
|
|
114
116
|
return `-----BEGIN ${e}-----
|
|
115
117
|
${n.join(`
|
|
@@ -117,7 +119,7 @@ ${n.join(`
|
|
|
117
119
|
-----END ${e}-----
|
|
118
120
|
`;
|
|
119
121
|
}
|
|
120
|
-
function
|
|
122
|
+
function W(e, t) {
|
|
121
123
|
const r = t.match(/.{1,64}/g) ?? [];
|
|
122
124
|
return `-----BEGIN ${e}-----
|
|
123
125
|
${r.join(`
|
|
@@ -131,10 +133,10 @@ function d(e) {
|
|
|
131
133
|
t += String.fromCharCode(r);
|
|
132
134
|
return btoa(t);
|
|
133
135
|
}
|
|
134
|
-
function
|
|
136
|
+
function Q(e) {
|
|
135
137
|
return btoa(e);
|
|
136
138
|
}
|
|
137
|
-
function
|
|
139
|
+
function z(e) {
|
|
138
140
|
return atob(e);
|
|
139
141
|
}
|
|
140
142
|
function J(e) {
|
|
@@ -148,32 +150,36 @@ async function a({
|
|
|
148
150
|
request: n,
|
|
149
151
|
label: i = "Apple Developer Portal request",
|
|
150
152
|
validatePortalResponse: o = !0,
|
|
151
|
-
mapBody:
|
|
153
|
+
mapBody: s
|
|
152
154
|
}) {
|
|
153
|
-
const
|
|
154
|
-
return o && X(
|
|
155
|
+
const c = await D(e, r, n, t);
|
|
156
|
+
return o && X(c.body, i), s ? s(c.body, c) : c;
|
|
155
157
|
}
|
|
156
|
-
async function
|
|
158
|
+
async function ie(e) {
|
|
157
159
|
return a({
|
|
158
160
|
...e,
|
|
159
|
-
request:
|
|
161
|
+
request: w(),
|
|
160
162
|
label: "Apple Developer team list",
|
|
161
|
-
mapBody: (t) => Y([
|
|
163
|
+
mapBody: (t) => Y([
|
|
164
|
+
...t?.teams ?? [],
|
|
165
|
+
...t?.availableProviders ?? [],
|
|
166
|
+
...t?.provider ? [t.provider] : []
|
|
167
|
+
])
|
|
162
168
|
});
|
|
163
169
|
}
|
|
164
|
-
async function
|
|
170
|
+
async function oe({
|
|
165
171
|
certificateKind: e = "development",
|
|
166
172
|
teamId: t = "",
|
|
167
173
|
...r
|
|
168
174
|
}) {
|
|
169
175
|
return a({
|
|
170
176
|
...r,
|
|
171
|
-
request: e === "distribution" ?
|
|
177
|
+
request: e === "distribution" ? g(t) : I(t),
|
|
172
178
|
label: "Apple Developer certificate list",
|
|
173
179
|
mapBody: (n) => n?.certRequests ?? []
|
|
174
180
|
});
|
|
175
181
|
}
|
|
176
|
-
async function
|
|
182
|
+
async function ae({
|
|
177
183
|
certificateKind: e = "development",
|
|
178
184
|
teamId: t = "",
|
|
179
185
|
csrPEM: r,
|
|
@@ -181,12 +187,12 @@ async function oe({
|
|
|
181
187
|
}) {
|
|
182
188
|
return a({
|
|
183
189
|
...n,
|
|
184
|
-
request: e === "distribution" ?
|
|
190
|
+
request: e === "distribution" ? h({ csrPEM: r, teamID: t }) : P({ csrPEM: r, teamID: t }),
|
|
185
191
|
label: e === "distribution" ? "Apple Distribution certificate creation" : "Apple Development certificate creation",
|
|
186
192
|
mapBody: (i) => i?.certRequest
|
|
187
193
|
});
|
|
188
194
|
}
|
|
189
|
-
async function
|
|
195
|
+
async function se({
|
|
190
196
|
certificateKind: e = "development",
|
|
191
197
|
certificateId: t,
|
|
192
198
|
teamId: r = "",
|
|
@@ -194,13 +200,13 @@ async function ae({
|
|
|
194
200
|
}) {
|
|
195
201
|
return a({
|
|
196
202
|
...n,
|
|
197
|
-
request: e === "distribution" ?
|
|
203
|
+
request: e === "distribution" ? q(t, r) : B(t, r),
|
|
198
204
|
label: "Apple certificate download",
|
|
199
205
|
validatePortalResponse: !1,
|
|
200
206
|
mapBody: (i, o) => o
|
|
201
207
|
});
|
|
202
208
|
}
|
|
203
|
-
async function
|
|
209
|
+
async function ce({
|
|
204
210
|
certificateKind: e = "development",
|
|
205
211
|
certificateId: t,
|
|
206
212
|
teamId: r = "",
|
|
@@ -221,23 +227,42 @@ async function se({
|
|
|
221
227
|
mapBody: (i) => i
|
|
222
228
|
});
|
|
223
229
|
}
|
|
224
|
-
async function
|
|
230
|
+
async function pe({
|
|
231
|
+
teamId: e = "",
|
|
232
|
+
search: t = "",
|
|
233
|
+
...r
|
|
234
|
+
}) {
|
|
235
|
+
const n = t.trim().toLowerCase();
|
|
225
236
|
return a({
|
|
226
237
|
...r,
|
|
227
|
-
request:
|
|
238
|
+
request: S({ bundleID: t, teamID: e }),
|
|
228
239
|
label: "Apple bundle ID list",
|
|
229
|
-
|
|
240
|
+
// Apple's listAppIds.action returns the full paginated list and does not
|
|
241
|
+
// honor a server-side search filter, so apply the `search` filter here.
|
|
242
|
+
mapBody: (i) => {
|
|
243
|
+
const o = i?.appIds ?? [];
|
|
244
|
+
return n ? o.filter(
|
|
245
|
+
(s) => [s.identifier, s.bundleId, s.name].some(
|
|
246
|
+
(c) => typeof c == "string" && c.toLowerCase().includes(n)
|
|
247
|
+
)
|
|
248
|
+
) : o;
|
|
249
|
+
}
|
|
230
250
|
});
|
|
231
251
|
}
|
|
232
|
-
async function
|
|
252
|
+
async function le({
|
|
253
|
+
teamId: e = "",
|
|
254
|
+
bundleId: t,
|
|
255
|
+
name: r,
|
|
256
|
+
...n
|
|
257
|
+
}) {
|
|
233
258
|
return a({
|
|
234
259
|
...n,
|
|
235
|
-
request:
|
|
260
|
+
request: C({ bundleID: t, teamID: e, name: r }),
|
|
236
261
|
label: "Apple bundle ID creation",
|
|
237
262
|
mapBody: (i) => i?.appId
|
|
238
263
|
});
|
|
239
264
|
}
|
|
240
|
-
async function
|
|
265
|
+
async function ue({
|
|
241
266
|
teamId: e = "",
|
|
242
267
|
appIdId: t,
|
|
243
268
|
bundleId: r,
|
|
@@ -260,7 +285,7 @@ async function le({
|
|
|
260
285
|
mapBody: (o) => o?.appId
|
|
261
286
|
});
|
|
262
287
|
}
|
|
263
|
-
async function
|
|
288
|
+
async function de({ teamId: e = "", appIdId: t, ...r }) {
|
|
264
289
|
return a({
|
|
265
290
|
...r,
|
|
266
291
|
request: {
|
|
@@ -272,23 +297,46 @@ async function ue({ teamId: e = "", appIdId: t, ...r }) {
|
|
|
272
297
|
mapBody: (n) => n
|
|
273
298
|
});
|
|
274
299
|
}
|
|
275
|
-
async function
|
|
300
|
+
async function fe({
|
|
301
|
+
teamId: e = "",
|
|
302
|
+
deviceUDID: t = "",
|
|
303
|
+
...r
|
|
304
|
+
}) {
|
|
305
|
+
const n = A(t);
|
|
276
306
|
return a({
|
|
277
307
|
...r,
|
|
278
308
|
request: R({ deviceUDID: t, teamID: e }),
|
|
279
309
|
label: "Apple device list",
|
|
280
|
-
|
|
310
|
+
// Apple's listDevices.action returns the full paginated list and does not
|
|
311
|
+
// honor a server-side UDID filter, so apply the `deviceUDID` filter here.
|
|
312
|
+
mapBody: (i) => {
|
|
313
|
+
const o = i?.devices ?? [];
|
|
314
|
+
return n ? o.filter((s) => A(s.deviceNumber) === n) : o;
|
|
315
|
+
}
|
|
281
316
|
});
|
|
282
317
|
}
|
|
283
|
-
|
|
318
|
+
function A(e) {
|
|
319
|
+
return (e ?? "").replace(/-/g, "").replace(/[^a-fA-F0-9]/g, "").toUpperCase();
|
|
320
|
+
}
|
|
321
|
+
async function ye({
|
|
322
|
+
teamId: e = "",
|
|
323
|
+
deviceUDID: t,
|
|
324
|
+
name: r,
|
|
325
|
+
...n
|
|
326
|
+
}) {
|
|
284
327
|
return a({
|
|
285
328
|
...n,
|
|
286
|
-
request:
|
|
329
|
+
request: T({ deviceUDID: t, teamID: e, name: r }),
|
|
287
330
|
label: "Apple device registration",
|
|
288
331
|
mapBody: (i) => i?.device
|
|
289
332
|
});
|
|
290
333
|
}
|
|
291
|
-
async function
|
|
334
|
+
async function me({
|
|
335
|
+
teamId: e = "",
|
|
336
|
+
deviceId: t,
|
|
337
|
+
name: r,
|
|
338
|
+
...n
|
|
339
|
+
}) {
|
|
292
340
|
return a({
|
|
293
341
|
...n,
|
|
294
342
|
request: {
|
|
@@ -312,7 +360,7 @@ async function Ae({ teamId: e = "", deviceId: t, ...r }) {
|
|
|
312
360
|
mapBody: (n) => n
|
|
313
361
|
});
|
|
314
362
|
}
|
|
315
|
-
async function
|
|
363
|
+
async function ve({
|
|
316
364
|
profileKind: e = "development",
|
|
317
365
|
teamId: t = "",
|
|
318
366
|
bundleId: r = "",
|
|
@@ -320,55 +368,59 @@ async function me({
|
|
|
320
368
|
}) {
|
|
321
369
|
return a({
|
|
322
370
|
...n,
|
|
323
|
-
request: e === "adhoc" ?
|
|
371
|
+
request: e === "adhoc" ? E({ bundleID: r, teamID: t }) : K({ bundleID: r, teamID: t }),
|
|
324
372
|
label: "Apple provisioning profile list",
|
|
325
373
|
mapBody: (i) => i?.provisioningProfiles ?? []
|
|
326
374
|
});
|
|
327
375
|
}
|
|
328
|
-
async function
|
|
376
|
+
async function be({
|
|
329
377
|
profileKind: e = "development",
|
|
330
378
|
teamId: t = "",
|
|
331
379
|
bundleId: r,
|
|
332
380
|
appIdId: n,
|
|
333
381
|
certificateIds: i,
|
|
334
382
|
deviceIds: o,
|
|
335
|
-
name:
|
|
336
|
-
...
|
|
383
|
+
name: s,
|
|
384
|
+
...c
|
|
337
385
|
}) {
|
|
338
386
|
const [y] = i;
|
|
339
387
|
if (!y)
|
|
340
388
|
throw new Error("At least one certificate ID is required to create an Apple provisioning profile.");
|
|
341
389
|
return a({
|
|
342
|
-
...
|
|
343
|
-
request: e === "adhoc" ?
|
|
390
|
+
...c,
|
|
391
|
+
request: e === "adhoc" ? U({
|
|
344
392
|
bundleID: r,
|
|
345
393
|
teamID: t,
|
|
346
394
|
appIDID: n,
|
|
347
395
|
certificateID: y,
|
|
348
396
|
deviceIDs: o,
|
|
349
|
-
name:
|
|
350
|
-
}) :
|
|
397
|
+
name: s
|
|
398
|
+
}) : x({
|
|
351
399
|
bundleID: r,
|
|
352
400
|
teamID: t,
|
|
353
401
|
appIDID: n,
|
|
354
402
|
certificateID: y,
|
|
355
403
|
deviceIDs: o,
|
|
356
|
-
name:
|
|
404
|
+
name: s
|
|
357
405
|
}),
|
|
358
406
|
label: "Apple provisioning profile creation",
|
|
359
|
-
mapBody: (
|
|
407
|
+
mapBody: (b) => b?.provisioningProfile
|
|
360
408
|
});
|
|
361
409
|
}
|
|
362
|
-
async function
|
|
410
|
+
async function De({
|
|
411
|
+
teamId: e = "",
|
|
412
|
+
profileId: t,
|
|
413
|
+
...r
|
|
414
|
+
}) {
|
|
363
415
|
return a({
|
|
364
416
|
...r,
|
|
365
|
-
request:
|
|
417
|
+
request: k(t, e),
|
|
366
418
|
label: "Apple provisioning profile download",
|
|
367
419
|
validatePortalResponse: !1,
|
|
368
420
|
mapBody: (n, i) => i
|
|
369
421
|
});
|
|
370
422
|
}
|
|
371
|
-
async function
|
|
423
|
+
async function we({ teamId: e = "", profileId: t, ...r }) {
|
|
372
424
|
return a({
|
|
373
425
|
...r,
|
|
374
426
|
request: {
|
|
@@ -384,47 +436,51 @@ function X(e, t) {
|
|
|
384
436
|
if (!e)
|
|
385
437
|
throw new Error(`${t} returned an empty response.`);
|
|
386
438
|
if (e.resultCode !== void 0 && e.resultCode !== 0)
|
|
387
|
-
throw new Error(
|
|
439
|
+
throw new Error(
|
|
440
|
+
`${t} failed: ${e.userString ?? e.resultString ?? e.resultCode}`
|
|
441
|
+
);
|
|
388
442
|
}
|
|
389
443
|
function Y(e) {
|
|
390
444
|
const t = /* @__PURE__ */ new Set(), r = [];
|
|
391
445
|
for (const n of e) {
|
|
392
|
-
const i = String(
|
|
446
|
+
const i = String(
|
|
447
|
+
n.teamId ?? n.providerId ?? n.publicProviderId ?? n.name ?? JSON.stringify(n)
|
|
448
|
+
);
|
|
393
449
|
t.has(i) || (t.add(i), r.push(n));
|
|
394
450
|
}
|
|
395
451
|
return r;
|
|
396
452
|
}
|
|
397
453
|
export {
|
|
398
|
-
|
|
454
|
+
xe as AppleGsaSrpClient,
|
|
399
455
|
X as assertAppleDeveloperPortalResponseOK,
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
456
|
+
le as createAppleBundleID,
|
|
457
|
+
ae as createAppleCertificate,
|
|
458
|
+
be as createAppleProfile,
|
|
459
|
+
he as createAppleRelaySession,
|
|
460
|
+
de as deleteAppleBundleID,
|
|
461
|
+
ce as deleteAppleCertificate,
|
|
406
462
|
Ae as deleteAppleDevice,
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
463
|
+
we as deleteAppleProfile,
|
|
464
|
+
Pe as deleteAppleRelaySession,
|
|
465
|
+
se as downloadAppleCertificate,
|
|
466
|
+
De as downloadAppleProfile,
|
|
467
|
+
ne as exportAppleCertificateP12,
|
|
468
|
+
qe as fetchAppleAccountSession,
|
|
469
|
+
re as generateAppleSigningKeyAndCSR,
|
|
470
|
+
pe as listAppleBundleIDs,
|
|
471
|
+
oe as listAppleCertificates,
|
|
472
|
+
fe as listAppleDevices,
|
|
473
|
+
ve as listAppleProfiles,
|
|
474
|
+
ie as listAppleTeams,
|
|
475
|
+
Be as proxyPhoneTwoFactorCode,
|
|
476
|
+
Se as proxySrpComplete,
|
|
477
|
+
Ce as proxySrpInit,
|
|
422
478
|
Re as proxyTwoFactorCode,
|
|
423
|
-
|
|
479
|
+
ye as registerAppleDevice,
|
|
424
480
|
a as requestAppleProvisioning,
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
481
|
+
Te as startBrowserOwnedAppleIDLogin,
|
|
482
|
+
Ee as triggerPhoneTwoFactor,
|
|
483
|
+
Ke as triggerTrustedDeviceTwoFactor,
|
|
484
|
+
ue as updateAppleBundleID,
|
|
485
|
+
me as updateAppleDevice
|
|
430
486
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),R=require("../client-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),R=require("../client-ASLtHFLh.js");require("../index-CMeQfhYy.js");function m({limbuildApiUrl:n,token:u}){const[g,o]=t.useState("idle"),[f,i]=t.useState(),[w,l]=t.useState(),[h,d]=t.useState(),[v,c]=t.useState(),r=t.useRef(void 0),S=t.useCallback(async()=>{await r.current?.close().catch(()=>{}),r.current=void 0,i(void 0),l(void 0),d(void 0),c(void 0),o("idle")},[]);t.useEffect(()=>()=>{r.current?.close(),r.current=void 0},[]);const b=t.useCallback(async({accountName:s,password:a})=>{o("authenticating"),c(void 0),await r.current?.close().catch(()=>{});try{const e=await R.startBrowserOwnedAppleIDLogin({limbuildApiUrl:n,token:u,accountName:s,password:a});return r.current=e,i(e),l(e.completeResponse),d(e.twoFactorChallengeResponse),o(e.requiresTwoFactor?"two-factor-required":"authenticated"),e}catch(e){i(void 0),r.current=void 0,c(p(e)),o("error");return}},[n,u]),C=t.useCallback(async s=>{const a=r.current;if(!a)throw new Error("Start Apple ID login before submitting a two-factor code.");o("authenticating"),c(void 0);try{const e=await a.finishTwoFactor(s);return o("authenticated"),e}catch(e){c(p(e)),o("error");return}},[]),y=t.useCallback(async()=>{const s=r.current;if(!s)throw new Error("Start Apple ID login before finalizing the Apple session.");return s.finalize()},[]);return{status:g,session:f,completeResponse:w,twoFactorChallengeResponse:h,error:v,startLogin:b,submitTwoFactorCode:C,finalize:y,close:S}}function p(n){return n instanceof Error?n.message:String(n)}exports.useAppleIDLogin=m;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState as c, useRef as S, useCallback as a, useEffect as E } from "react";
|
|
2
|
-
import { s as b } from "../client-
|
|
3
|
-
import "../index-
|
|
2
|
+
import { s as b } from "../client-CGdh8yoJ.mjs";
|
|
3
|
+
import "../index-DFdCvi2_.mjs";
|
|
4
4
|
function T({ limbuildApiUrl: r, token: l }) {
|
|
5
5
|
const [w, o] = c("idle"), [g, u] = c(), [h, d] = c(), [v, p] = c(), [m, s] = c(), e = S(void 0), R = a(async () => {
|
|
6
6
|
await e.current?.close().catch(() => {
|