@hot-updater/console 1.2.0-rc.3 → 1.2.0-rc.30
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/.output/nitro.json +1 -1
- package/.output/public/assets/{-native-builds-search-C-TGpFAm.js → -native-builds-search-DdHwfe4q.js} +1 -1
- package/.output/public/assets/BundleIdDisplay-CTBdtFQ8.js +1 -0
- package/.output/public/assets/ChannelBadge-CEabmopB.js +1 -0
- package/.output/public/assets/CompositeItem-KUM5yQVr.js +1 -0
- package/.output/public/assets/{ConsoleFeatureUnavailable-CUtcXuY2.js → ConsoleFeatureUnavailable-Be-0iTww.js} +1 -1
- package/.output/public/assets/{EventDetails-Dl2RvPAk.js → EventDetails-bDOYte1z.js} +1 -1
- package/.output/public/assets/HashValueDisplay-D2f0HmyU.js +1 -0
- package/.output/public/assets/{InsightsPageHeader-DHhqY3DT.js → InsightsPageHeader-Cj2ROSQO.js} +1 -1
- package/.output/public/assets/IosInstall-CHI2C4Yd.js +1 -0
- package/.output/public/assets/NativeBuildsNav-DaqxQPnG.js +1 -0
- package/.output/public/assets/{NotFoundPage-DZ3DxyRA.js → NotFoundPage-CVBtl68B.js} +1 -1
- package/.output/public/assets/{PlatformIcon-BBWQlWm9.js → PlatformIcon-DVnzzGqM.js} +1 -1
- package/.output/public/assets/RelativeTime-B4PK8qDw.js +1 -0
- package/.output/public/assets/RolloutPercentageBadge-D_I0Raj2.js +1 -0
- package/.output/public/assets/RowReason-B7VM1ztc.js +1 -0
- package/.output/public/assets/SandboxBadge-BVxHg_HF.js +1 -0
- package/.output/public/assets/TargetDisplay-KU7JhIWG.js +1 -0
- package/.output/public/assets/{alert-dialog-BqYScr9y.js → alert-dialog-Ch0QxRsa.js} +1 -1
- package/.output/public/assets/api-C1OPeiG1.js +1 -0
- package/.output/public/assets/api-keys-DLC8jjaM.js +1 -0
- package/.output/public/assets/api-keys-eDnzgFAf.js +1 -0
- package/.output/public/assets/arrow-left-DQjHJAnT.js +1 -0
- package/.output/public/assets/arrow-right-CXp_K3xK.js +1 -0
- package/.output/public/assets/arrow-up-right-BFafIOrq.js +1 -0
- package/.output/public/assets/badge-FZMD5vvS.js +1 -0
- package/.output/public/assets/card-CyHYmHue.js +1 -0
- package/.output/public/assets/check-CqWNyG93.js +1 -0
- package/.output/public/assets/chevron-right-DNbYTBX1.js +1 -0
- package/.output/public/assets/{circle-off-C7Muo0ss.js → circle-off-BCkZpskJ.js} +1 -1
- package/.output/public/assets/{clipboard-DQbOcrL7.js → clipboard-DZrZK5gR.js} +1 -1
- package/.output/public/assets/{console-features-api-DEXSwFtc.js → console-features-api-BO5V64P3.js} +1 -1
- package/.output/public/assets/{copy-DsuLj3oj.js → copy-CH1__JAW.js} +1 -1
- package/.output/public/assets/dialog-BLj71-Nf.js +1 -0
- package/.output/public/assets/{dist-CPlO6ko9.js → dist-DAM__Tdz.js} +1 -1
- package/.output/public/assets/{download-Cf24LBde.js → download-B2GjTySo.js} +1 -1
- package/.output/public/assets/empty--YaE5Z4p.js +1 -0
- package/.output/public/assets/field-CdhSgWhI.js +1 -0
- package/.output/public/assets/git-branch-DG1VDaKq.js +1 -0
- package/.output/public/assets/history-C0wv4htz.js +1 -0
- package/.output/public/assets/index-CgwVUC2n.js +10 -0
- package/.output/public/assets/{input-group-D3OUBk4n.js → input-group-XKLcUGoa.js} +1 -1
- package/.output/public/assets/insights-C94CdeAA.js +1 -0
- package/.output/public/assets/insights-DILMVpk8.js +2 -0
- package/.output/public/assets/insights-_j_ieOyh.js +42 -0
- package/.output/public/assets/insights-api-B6Gj74n5.js +1 -0
- package/.output/public/assets/{insights-search-DghCbEnk.js → insights-search-Bgvg6wSP.js} +1 -1
- package/.output/public/assets/insights-usage-rpc-BUCinjSN.js +1 -0
- package/.output/public/assets/insights_.distribution-Bb6_S-hD.js +2 -0
- package/.output/public/assets/insights_.distribution-CRkGNelG.js +1 -0
- package/.output/public/assets/insights_.distribution-CyAu3RN3.js +1 -0
- package/.output/public/assets/installations-BA01mqJE.js +1 -0
- package/.output/public/assets/installations-BsD6LgNc.js +2 -0
- package/.output/public/assets/installations-CYTzndfP.js +1 -0
- package/.output/public/assets/{key-round-DwNKkHhy.js → key-round-D7UgdXyA.js} +1 -1
- package/.output/public/assets/{link-DTEyW70e.js → link-CN3iHC4A.js} +2 -2
- package/.output/public/assets/{list--NIee1FZ.js → list-Bm-CfN5g.js} +1 -1
- package/.output/public/assets/loader-circle-iMqC-8ZE.js +1 -0
- package/.output/public/assets/native-builds-BMbws1g5.js +2 -0
- package/.output/public/assets/native-builds-xgHiHQML.js +1 -0
- package/.output/public/assets/native-builds_._buildId-B04z9yfk.js +1 -0
- package/.output/public/assets/native-builds_._buildId-DaMmTcHo.js +2 -0
- package/.output/public/assets/native-builds_.devices-CTzpCVsb.js +1 -0
- package/.output/public/assets/native-builds_.devices-D_kl2-bc.js +2 -0
- package/.output/public/assets/package-BmfoZ5Zj.js +1 -0
- package/.output/public/assets/plus-Db0KxLZp.js +1 -0
- package/.output/public/assets/preload-helper-CRQjUQaZ.js +1 -0
- package/.output/public/assets/{refresh-cw-B9HHjLej.js → refresh-cw-BHhBYjS8.js} +1 -1
- package/.output/public/assets/{relativeTime-YQt84dYr.js → relativeTime-BYRt19mj.js} +1 -1
- package/.output/public/assets/remote-config-Cxkr7_BP.js +1 -0
- package/.output/public/assets/remote-config-DAOyn5xL.js +1 -0
- package/.output/public/assets/remote-config-DXv25LX1.js +6 -0
- package/.output/public/assets/{rotate-cw-Cv2aVbYr.js → rotate-cw-Ba-slJea.js} +1 -1
- package/.output/public/assets/routes-DM3TyTLW.js +2 -0
- package/.output/public/assets/routes-Des97uK_.js +1 -0
- package/.output/public/assets/search-dJG2BYmx.js +1 -0
- package/.output/public/assets/select-CA8r-UUe.js +1 -0
- package/.output/public/assets/send-DuMOCzbD.js +1 -0
- package/.output/public/assets/{sidebar-Di9SN47G.js → sidebar-yC7KdImc.js} +1 -1
- package/.output/public/assets/smartphone-D1C6BRd_.js +1 -0
- package/.output/public/assets/styles-BHLI87EH.css +2 -0
- package/.output/public/assets/switch-BsV3d4km.js +1 -0
- package/.output/public/assets/table-D8YjT_ht.js +1 -0
- package/.output/public/assets/tabs-RdhEl9sE.js +1 -0
- package/.output/public/assets/trash-2-B5KIvrXy.js +1 -0
- package/.output/public/assets/{undo-2-CUX96_BG.js → undo-2-CFcU9dIB.js} +1 -1
- package/.output/public/assets/{useCompositeListItem-JmyDfo3-.js → useCompositeListItem-lAmUsXcc.js} +1 -1
- package/.output/public/assets/{useMutation-DbYw7boA.js → useMutation-w3qYaU2L.js} +1 -1
- package/.output/public/assets/valueToPercent-Bn8p2lng.js +1 -0
- package/.output/server/{__23tanstack-start-server-fn-resolver-DJQS4eWX.mjs → __23tanstack-start-server-fn-resolver-q4YFIDyr.mjs} +94 -46
- package/.output/server/_chunks/ssr-renderer.mjs +2 -2
- package/.output/server/_libs/@base-ui/react+[...].mjs +1488 -183
- package/.output/server/_libs/@tanstack/react-router+[...].mjs +1 -1
- package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +1 -1
- package/.output/server/_libs/_.mjs +2 -0
- package/.output/server/_libs/lucide-react.mjs +22 -28
- package/.output/server/_libs/next-themes.mjs +1 -1
- package/.output/server/_libs/react-redux+[...].mjs +1 -1
- package/.output/server/_libs/recharts+[...].mjs +1 -1
- package/.output/server/_libs/sonner.mjs +1 -1
- package/.output/server/_libs/tanstack__react-query.mjs +1 -1
- package/.output/server/_ssr/{-native-builds-search-CwNcoXf4.mjs → -native-builds-search-Mm_AZoRU.mjs} +9 -3
- package/.output/server/_ssr/{BundleIdDisplay-LdRkYdnN.mjs → BundleIdDisplay-DvzlYWq8.mjs} +3 -3
- package/.output/server/_ssr/ChannelBadge-qF_Pc5Ud.mjs +23 -0
- package/.output/server/_ssr/{ConsoleFeatureUnavailable-BN-FZ8eG.mjs → ConsoleFeatureUnavailable-DKUgr0N_.mjs} +7 -7
- package/.output/server/_ssr/{EventDetails-B77sWxgh.mjs → EventDetails-T1XtYEDD.mjs} +8 -8
- package/.output/server/_ssr/{HashValueDisplay-C4Vs4cmO.mjs → HashValueDisplay-Cas_zjIS.mjs} +7 -7
- package/.output/server/_ssr/{InsightsPageHeader-Dx4jJ7X0.mjs → InsightsPageHeader-BrllhUl2.mjs} +8 -8
- package/.output/server/_ssr/IosInstall-CEHI8F2M.mjs +615 -0
- package/.output/server/_ssr/NativeBuildsNav-2xSHyA1a.mjs +38 -0
- package/.output/server/_ssr/{NotFoundPage-DB5cXeVZ.mjs → NotFoundPage-D6H9vxj_.mjs} +3 -3
- package/.output/server/_ssr/{PlatformIcon-CFLiTjh1.mjs → PlatformIcon-BpGOEXjU.mjs} +13 -3
- package/.output/server/_ssr/RelativeTime-DpEVzDP9.mjs +237 -0
- package/.output/server/_ssr/{git-CTA8Aqr0.mjs → RolloutPercentageBadge-DW8-_w30.mjs} +20 -4
- package/.output/server/_ssr/RowReason-C-PjIxzq.mjs +186 -0
- package/.output/server/_ssr/SandboxBadge-CDdNew0R.mjs +97 -0
- package/.output/server/_ssr/TargetDisplay-BBsP7IaZ.mjs +83 -0
- package/.output/server/_ssr/{alert-dialog-DxboqQmd.mjs → alert-dialog-Bd4E9xdw.mjs} +2 -2
- package/.output/server/_ssr/{api-cvzOLlTy.mjs → api-BT7aA8UM.mjs} +167 -33
- package/.output/server/_ssr/{api-keys-C3QCQvpV.mjs → api-keys-D2NvcQZv.mjs} +2 -2
- package/.output/server/_ssr/{api-keys-CrbGr02t.mjs → api-keys-DjWpM20P.mjs} +11 -10
- package/.output/server/_ssr/{api-keys-rpc-BcTQzRLj.mjs → api-keys-rpc-nM5H7V7f.mjs} +4 -4
- package/.output/server/_ssr/{api-rpc-B48nsUak.mjs → api-rpc-DX4HynbW.mjs} +83 -35
- package/.output/server/_ssr/{auth-rpc-C0gtG9nJ.mjs → auth-rpc-LCxTtYz2.mjs} +5 -5
- package/.output/server/_ssr/{auth.server-B0JikHOQ.mjs → auth.server-CERo_xef.mjs} +797 -174
- package/.output/server/_ssr/{badge-oO-0mLsr.mjs → badge-Dpp4q7sD.mjs} +4 -45
- package/.output/server/_ssr/{bundleActivity-MLrjNJCT.mjs → bundleActivity-BP40zYSt.mjs} +1 -1
- package/.output/server/_ssr/card-CFCftDfI.mjs +49 -0
- package/.output/server/_ssr/{config.server-CJVHGJtr.mjs → config.server-5W5WD8x2.mjs} +4 -4
- package/.output/server/_ssr/{console-access-4TW5Af_n.mjs → console-access-B0S5YFUa.mjs} +2 -2
- package/.output/server/_ssr/{console-features-api-DfzZRyXa.mjs → console-features-api-CV_EReEj.mjs} +4 -4
- package/.output/server/_ssr/{console-features-rpc-DqNpa3U9.mjs → console-features-rpc-D3xlQsuy.mjs} +4 -4
- package/.output/server/_ssr/{console-features-BTV-XuhQ.mjs → console-features-xaGDhRC9.mjs} +1 -1
- package/.output/server/_ssr/{createServerRpc-BVvRVOz5.mjs → createServerRpc-DJZel12M.mjs} +1 -1
- package/.output/server/_ssr/{databaseConfig-B_Bg7qS5.mjs → databaseConfig-XAvDetmn.mjs} +1 -1
- package/.output/server/_ssr/{databaseJsonValue-kS7cvEtz.mjs → databaseJsonValue-DuUoft8j.mjs} +1 -1
- package/.output/server/_ssr/{databaseRows-B6H8Cmgq.mjs → databaseRows-BtRVBD0C.mjs} +3 -3
- package/.output/server/_ssr/deviceProfileToken-CwWb1lPq.mjs +82 -0
- package/.output/server/_ssr/{dialog-DsuMZ5oh.mjs → dialog-DQR_QI_X.mjs} +2 -2
- package/.output/server/_ssr/{dist-TEpM_UAD.mjs → dist-B6-irDRA.mjs} +1 -1
- package/.output/server/_ssr/{downloadBundle-DCmr7vsj.mjs → downloadBundle-DnoYpi36.mjs} +1 -1
- package/.output/server/_ssr/{empty-r4kJO91t.mjs → empty-C7PFnkCH.mjs} +3 -3
- package/.output/server/_ssr/{empty-plugin-adapters-zrZ0xs6n.mjs → empty-plugin-adapters-BYBYBaxo.mjs} +1 -1
- package/.output/server/_ssr/{failureReports-Cn_zU9S8.mjs → failureReports-BA2eg11O.mjs} +3 -3
- package/.output/server/_ssr/{field-DfXmt9CS.mjs → field-BqYN8sZT.mjs} +3 -3
- package/.output/server/_ssr/foldedPage-CqpVk31Q.mjs +176 -0
- package/.output/server/_ssr/{getBundleChildren-rtkEEJw5.mjs → getBundleChildren-CdqFonhl.mjs} +2 -2
- package/.output/server/_ssr/{input-group-BCO7zTpU.mjs → input-group-Brv0mmyp.mjs} +2 -2
- package/.output/server/_ssr/{insights-CRu5FUj8.mjs → insights--xI3A0KI.mjs} +5 -5
- package/.output/server/_ssr/{insights-DrrhPDER.mjs → insights-CD1e3EnW.mjs} +2 -2
- package/.output/server/_ssr/{insights-Csqlj6u7.mjs → insights-Dd0VdO-1.mjs} +27 -26
- package/.output/server/_ssr/{insights-api-NW5VCXqg.mjs → insights-api-Bt2XVa4Y.mjs} +5 -5
- package/.output/server/_ssr/{insights-errors-7BCwFybo.mjs → insights-errors-CXHg1lLV.mjs} +2 -2
- package/.output/server/_ssr/{insights-failures-B9VPkzZE.mjs → insights-failures-7zH97WOO.mjs} +2 -2
- package/.output/server/_ssr/{insights-failures-rpc-CoFrAOK9.mjs → insights-failures-rpc-DBGzXP5A.mjs} +11 -11
- package/.output/server/_ssr/{insights-recovery-BtXVU3ro.mjs → insights-recovery-BhOg6kz2.mjs} +1 -1
- package/.output/server/_ssr/{insights-recovery-rpc-sud_FyGW.mjs → insights-recovery-rpc-C6fAh-i_.mjs} +7 -7
- package/.output/server/_ssr/{insights-rpc-Ce2Isz9q.mjs → insights-rpc-pThKC9oj.mjs} +4 -4
- package/.output/server/_ssr/{insights-search-B0O3YoO2.mjs → insights-search-iFN4UaUv.mjs} +5 -5
- package/.output/server/_ssr/{insights-usage-DiGnuxW8.mjs → insights-usage-h8fipPTv.mjs} +1 -1
- package/.output/server/_ssr/{insights-usage-rpc-Cwf1t4aW.mjs → insights-usage-rpc-B-RLvdLZ.mjs} +5 -5
- package/.output/server/_ssr/{insights-usage-rpc-C-cS2F9s.mjs → insights-usage-rpc-CGHZQ9jq.mjs} +7 -7
- package/.output/server/_ssr/{insightsUsage-ClAmoUz8.mjs → insightsUsage-BjSiV_X_.mjs} +3 -3
- package/.output/server/_ssr/{insights_.distribution-DIkh5VqM.mjs → insights_.distribution-C6iXJ93Y.mjs} +15 -14
- package/.output/server/_ssr/{insights_.distribution-D52TkQ2V.mjs → insights_.distribution-E6Ns2aN7.mjs} +2 -2
- package/.output/server/_ssr/{insights_.distribution--3aR6Kpy.mjs → insights_.distribution-xHmfwwa5.mjs} +5 -5
- package/.output/server/_ssr/{installations-Bu4Lb0x9.mjs → installations-7V-Xyui8.mjs} +12 -12
- package/.output/server/_ssr/{installations-DftevpDt.mjs → installations-CZnN6slr.mjs} +4 -4
- package/.output/server/_ssr/{installations-C818mFCp.mjs → installations-D6Upc9Rt.mjs} +2 -2
- package/.output/server/_ssr/ios-devices-rpc-CXuHk24G.mjs +139 -0
- package/.output/server/_ssr/iosDeviceProfile-BESi_onx.mjs +176 -0
- package/.output/server/_ssr/iosDevices-BmvvvZRo.mjs +129 -0
- package/.output/server/_ssr/listReleases-DYYA5alS.mjs +94 -0
- package/.output/server/_ssr/{request-guard-CPdRBuGW.mjs → local-console-Dtxlsav0.mjs} +2 -9
- package/.output/server/_ssr/{native-builds-DOASMwGh.mjs → native-builds-BUojmVWC.mjs} +3 -3
- package/.output/server/_ssr/native-builds-BXBkklfA.mjs +197 -0
- package/.output/server/_ssr/native-builds-BhDCE89P.mjs +717 -0
- package/.output/server/_ssr/{native-builds_._buildId-CTytnLBB.mjs → native-builds_._buildId-DRiCNDdO.mjs} +3 -3
- package/.output/server/_ssr/native-builds_._buildId-DkMpG-OB.mjs +1176 -0
- package/.output/server/_ssr/native-builds_.devices-DSideebA.mjs +10 -0
- package/.output/server/_ssr/native-builds_.devices-DsOx1R36.mjs +702 -0
- package/.output/server/_ssr/nativeBuildDownloadLink-DDAUVU8q.mjs +96 -0
- package/.output/server/_ssr/nativeBuildInstall-CcBrfTsc.mjs +250 -0
- package/.output/server/_ssr/nativeBuilds-Cub0EUGN.mjs +287 -0
- package/.output/server/_ssr/{plugins-RIryUNWj.mjs → plugins-CX7wutet.mjs} +6 -6
- package/.output/server/_ssr/publicConsoleBase-f67NLLXZ.mjs +610 -0
- package/.output/server/_ssr/{release-adoption-DoAtNPED.mjs → release-adoption-DeICczY7.mjs} +2 -2
- package/.output/server/_ssr/{release-adoption-rpc-OizwttJD.mjs → release-adoption-rpc-BjMXMi9A.mjs} +9 -9
- package/.output/server/_ssr/{releaseAdoption-a2byXMfz.mjs → releaseAdoption-kHZo8P90.mjs} +4 -4
- package/.output/server/_ssr/{releaseCatalogCompiler-DLcean2k.mjs → releaseCatalogCompiler-D9dAMI17.mjs} +3 -3
- package/.output/server/_ssr/{releaseManagement-DHUux2az.mjs → releaseManagement-EPhok_Py.mjs} +1 -1
- package/.output/server/_ssr/{releaseReachability-DZOK_dH-.mjs → releaseReachability-DaZ7ifUF.mjs} +2 -2
- package/.output/server/_ssr/{remote-config-DaBgnVnL.mjs → remote-config-B1iZuZOF.mjs} +2 -2
- package/.output/server/_ssr/{remote-config-Dypc_nuk.mjs → remote-config-C_DprbJz.mjs} +23 -22
- package/.output/server/_ssr/{remote-config-DZu7gJLL.mjs → remote-config-C_q6FBE4.mjs} +3 -3
- package/.output/server/_ssr/{remote-config-rpc-DOfPhqli.mjs → remote-config-rpc-BFTPcMfZ.mjs} +5 -5
- package/.output/server/_ssr/request-guard-BPLyogIN.mjs +11 -0
- package/.output/server/_ssr/{router-BkRbvels.mjs → router-BDXPwfwl.mjs} +92 -59
- package/.output/server/_ssr/{routes-D9JnXVWL.mjs → routes-BJeztqpQ.mjs} +388 -432
- package/.output/server/_ssr/{routes-BeTsUkNX.mjs → routes-DpapxHLc.mjs} +14 -17
- package/.output/server/_ssr/{runtime.server-BdMY1blX.mjs → runtime.server-CkSbWaZm.mjs} +4 -4
- package/.output/server/_ssr/{schema-ChlRtZIo.mjs → schema-3oDJJFWa.mjs} +1 -1
- package/.output/server/_ssr/{schema-migration-rpc-B2VGxRY6.mjs → schema-migration-rpc-a4bLEdaP.mjs} +4 -4
- package/.output/server/_ssr/{select-Cywc0NmT.mjs → select-C9HpIZxd.mjs} +2 -2
- package/.output/server/_ssr/{server-Ds-fU1zf.mjs → server-C8ZmMWnn.mjs} +7 -7
- package/.output/server/_ssr/{sidebar-t0NiN0-2.mjs → sidebar-BrVL3L7R.mjs} +3 -3
- package/.output/server/_ssr/ssr.mjs +1 -1
- package/.output/server/_ssr/{start-BvDsQehg.mjs → start-D3noqqOK.mjs} +2 -2
- package/.output/server/_ssr/{switch-D1T38CnM.mjs → switch-DtnsoZHO.mjs} +3 -3
- package/.output/server/_ssr/{table-L9ZQgxNF.mjs → table-Bg7nCnct.mjs} +2 -2
- package/.output/server/_ssr/{tabs-BiByrAnU.mjs → tabs-BEIoGLTL.mjs} +4 -4
- package/.output/server/_ssr/{updateFailures-n-tGv90S.mjs → updateFailures-D0bP_Ume.mjs} +3 -3
- package/.output/server/_ssr/{uuidv7-BIF4nb_q.mjs → uuidv7-CmHbryZT.mjs} +2 -2
- package/.output/server/_ssr/{version-CQ98ZBpL-CWSkTT9J.mjs → version-CQ98ZBpL-NmbU0MD2.mjs} +1 -1
- package/.output/server/_tanstack-start-manifest_v-C_TPyfFP.mjs +225 -0
- package/.output/server/index.mjs +479 -381
- package/lib/index.d.mts +9 -0
- package/package.json +7 -30
- package/src/components/ChannelBadge.tsx +9 -9
- package/src/components/DataTable.tsx +347 -0
- package/src/components/FoldedRows.tsx +219 -0
- package/src/components/HashValueDisplay.tsx +6 -3
- package/src/components/PlatformIcon.tsx +10 -0
- package/src/components/RelativeTime.tsx +31 -0
- package/src/components/RowReason.tsx +56 -0
- package/src/components/TargetDisplay.tsx +69 -0
- package/src/components/ThemeProvider.tsx +11 -2
- package/src/components/features/api-keys/ApiKeysPage.tsx +1 -1
- package/src/components/features/channels/ChannelManagementDialog.tsx +5 -10
- package/src/components/features/insights/ReleaseActivity.tsx +1 -1
- package/src/components/features/native-builds/BuiltInBundleCard.tsx +108 -58
- package/src/components/features/native-builds/CommitLink.tsx +3 -2
- package/src/components/features/native-builds/ImportBuild.tsx +1 -1
- package/src/components/features/native-builds/InstallCard.tsx +310 -67
- package/src/components/features/native-builds/IosDevicesPage.tsx +944 -0
- package/src/components/features/native-builds/IosInstall.tsx +632 -0
- package/src/components/features/native-builds/IpaDevicesCard.tsx +111 -0
- package/src/components/features/native-builds/NativeBuildDetailPage.tsx +21 -4
- package/src/components/features/native-builds/NativeBuildsNav.tsx +44 -0
- package/src/components/features/native-builds/NativeBuildsPage.tsx +65 -76
- package/src/components/features/native-builds/NativeBuildsTable.tsx +668 -318
- package/src/components/features/native-builds/OlderBuildLabel.tsx +61 -0
- package/src/components/features/native-builds/PatchesCard.tsx +3 -2
- package/src/components/features/native-builds/ReleaseNativeBuildLink.tsx +4 -4
- package/src/components/features/native-builds/SandboxBadge.tsx +21 -0
- package/src/components/features/native-builds/ServedNowCard.tsx +33 -1
- package/src/components/features/native-builds/ShortHash.tsx +6 -3
- package/src/components/features/native-builds/StoreSubmission.tsx +18 -12
- package/src/components/features/native-builds/playTracks.ts +19 -0
- package/src/components/features/remote-config/PublishDialog.tsx +4 -1
- package/src/components/features/remote-config/VersionsCard.tsx +5 -2
- package/src/components/ui/badge.tsx +2 -0
- package/src/components/ui/sonner.tsx +3 -1
- package/src/index.ts +9 -0
- package/src/lib/api-rpc.ts +124 -35
- package/src/lib/api.ts +150 -14
- package/src/lib/ios-devices-api.ts +110 -0
- package/src/lib/ios-devices-rpc.ts +183 -0
- package/src/lib/native-builds.ts +160 -17
- package/src/lib/server/console-runtime.server.ts +9 -2
- package/src/lib/server/deviceProfileToken.ts +187 -0
- package/src/lib/server/foldedPage.ts +360 -0
- package/src/lib/server/iosDeviceProfile.ts +230 -0
- package/src/lib/server/iosDevices.ts +223 -0
- package/src/lib/server/listReleases.ts +101 -62
- package/src/lib/server/local-console.ts +1 -1
- package/src/lib/server/nativeBuildDownloadLink.ts +193 -0
- package/src/lib/server/nativeBuildInstall.ts +495 -0
- package/src/lib/server/nativeBuilds.ts +308 -59
- package/src/lib/server/plistText.ts +17 -0
- package/src/lib/server/publicConsoleBase.ts +17 -0
- package/src/routeTree.gen.ts +85 -18
- package/src/routes/-native-builds-search.ts +20 -0
- package/src/routes/[_]hot-updater/devices/device-response.ts +21 -0
- package/src/routes/[_]hot-updater/devices/device[.]mobileconfig.ts +17 -0
- package/src/routes/[_]hot-updater/native-builds/$buildId/manifest[.]plist.ts +22 -0
- package/src/routes/api/native-builds/$buildId/download.ts +22 -1
- package/src/routes/index.tsx +541 -532
- package/src/routes/native-builds_.devices.tsx +21 -0
- package/src/styles.css +24 -0
- package/.output/public/assets/HashValueDisplay-6lNRxDJX.js +0 -1
- package/.output/public/assets/RolloutPercentageBadge-Cxogpi8F.js +0 -1
- package/.output/public/assets/StoreSubmission-ViTkW4eJ.js +0 -1
- package/.output/public/assets/api-P2g8dCNg.js +0 -1
- package/.output/public/assets/api-keys-DWQC2q6y.js +0 -1
- package/.output/public/assets/api-keys-FueRkF9q.js +0 -1
- package/.output/public/assets/arrow-left-g9cKqXuC.js +0 -1
- package/.output/public/assets/arrow-right-CNII8TYn.js +0 -1
- package/.output/public/assets/arrow-up-right-DK8Zdg40.js +0 -1
- package/.output/public/assets/badge-DWFcDWho.js +0 -1
- package/.output/public/assets/check-CXVR3s3X.js +0 -1
- package/.output/public/assets/chevron-right-BoUXo82O.js +0 -1
- package/.output/public/assets/dialog-CNUPxNxH.js +0 -1
- package/.output/public/assets/empty-B3Uwdd6k.js +0 -1
- package/.output/public/assets/field-D-2-mnNh.js +0 -1
- package/.output/public/assets/history-DqHlgSuV.js +0 -1
- package/.output/public/assets/index-CqP5HPV6.js +0 -10
- package/.output/public/assets/insights-B-0odqpt.js +0 -42
- package/.output/public/assets/insights-BSVGfxSL.js +0 -1
- package/.output/public/assets/insights-NK5B6ReS.js +0 -2
- package/.output/public/assets/insights-api-BVCXJsoV.js +0 -1
- package/.output/public/assets/insights-usage-rpc-CKQH0pUS.js +0 -1
- package/.output/public/assets/insights_.distribution-CJvgwcVZ.js +0 -2
- package/.output/public/assets/insights_.distribution-DblZM0mO.js +0 -1
- package/.output/public/assets/insights_.distribution-dvk6vYDM.js +0 -1
- package/.output/public/assets/installations-B674P5Z5.js +0 -2
- package/.output/public/assets/installations-BWxczZ2t.js +0 -1
- package/.output/public/assets/installations-Dv4kWQYz.js +0 -1
- package/.output/public/assets/native-builds-BOC71grI.js +0 -1
- package/.output/public/assets/native-builds-D6rldpSh.js +0 -2
- package/.output/public/assets/native-builds-DAy2678K.js +0 -1
- package/.output/public/assets/native-builds_._buildId-DD58_Phd.js +0 -1
- package/.output/public/assets/native-builds_._buildId-DvQDKnUQ.js +0 -2
- package/.output/public/assets/plus-BReVKct-.js +0 -1
- package/.output/public/assets/preload-helper-B44EvKhG.js +0 -1
- package/.output/public/assets/remote-config-B7ujqhLa.js +0 -6
- package/.output/public/assets/remote-config-WjpozBG5.js +0 -1
- package/.output/public/assets/remote-config-gXeH6PBW.js +0 -1
- package/.output/public/assets/routes-BDdBIxYS.js +0 -1
- package/.output/public/assets/routes-CCD33Azv.js +0 -2
- package/.output/public/assets/search-BCel4Oy6.js +0 -1
- package/.output/public/assets/select-CBIU0_M1.js +0 -1
- package/.output/public/assets/smartphone-CMaSy_ir.js +0 -1
- package/.output/public/assets/styles-uK-0vUMk.css +0 -2
- package/.output/public/assets/switch-BpdiHL_t.js +0 -1
- package/.output/public/assets/table-Bpy3SvSo.js +0 -1
- package/.output/public/assets/tabs-Xmt7tZeG.js +0 -1
- package/.output/public/assets/useInfiniteQuery-DX4WpBRG.js +0 -1
- package/.output/public/assets/valueToPercent-BLwGy_xK.js +0 -1
- package/.output/server/_ssr/RolloutPercentageBadge-vmwE8iae.mjs +0 -21
- package/.output/server/_ssr/StoreSubmission-DE4vgy5B.mjs +0 -139
- package/.output/server/_ssr/listReleases-D_GY00SQ.mjs +0 -79
- package/.output/server/_ssr/native-builds-CWjU--fI.mjs +0 -510
- package/.output/server/_ssr/native-builds-DhXL5zf_.mjs +0 -137
- package/.output/server/_ssr/native-builds_._buildId-D4lYJLIU.mjs +0 -813
- package/.output/server/_ssr/nativeBuildQr-84cnFQPX.mjs +0 -59
- package/.output/server/_ssr/nativeBuilds-B_7BPjt_.mjs +0 -133
- package/.output/server/_ssr/qr-code-C7kNRIDX.mjs +0 -22
- package/.output/server/_tanstack-start-manifest_v-B5nsO5L4.mjs +0 -184
- package/src/lib/server/nativeBuildQr.ts +0 -73
- package/src/routes/[_]hot-updater/native-builds/qr.ts +0 -14
- /package/.output/public/assets/{uuidv7-zXMtwR9Q.js → uuidv7-DAoOOpz9.js} +0 -0
package/src/lib/native-builds.ts
CHANGED
|
@@ -23,18 +23,173 @@ export const nativeBuildArtifacts: Record<
|
|
|
23
23
|
ipa: { label: "IPA", installs: "registered iOS devices" },
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* How a native build reaches people: the store track it was submitted to,
|
|
28
|
+
* else its artifact, an `.ipa` by its export method when the registry has
|
|
29
|
+
* it. Builds of one channel, platform and sandbox flag with one
|
|
30
|
+
* distribution form a distribution path; a newer build on it is the one
|
|
31
|
+
* people get there.
|
|
32
|
+
*/
|
|
33
|
+
export type NativeBuildDistribution =
|
|
34
|
+
| NonNullable<NativeBuildRow["submitted_to"]>
|
|
35
|
+
| NativeBuildArtifactKind
|
|
36
|
+
| `ipa-${NonNullable<NativeBuildRow["export_method"]>}`;
|
|
37
|
+
|
|
38
|
+
/** A build's distribution, from its row. */
|
|
39
|
+
export const nativeBuildDistribution = (
|
|
40
|
+
build: Pick<
|
|
41
|
+
NativeBuildRow,
|
|
42
|
+
"submitted_to" | "artifact_kind" | "export_method"
|
|
43
|
+
>,
|
|
44
|
+
): NativeBuildDistribution =>
|
|
45
|
+
build.submitted_to ??
|
|
46
|
+
(build.artifact_kind === "ipa" && build.export_method !== null
|
|
47
|
+
? `ipa-${build.export_method}`
|
|
48
|
+
: build.artifact_kind);
|
|
49
|
+
|
|
50
|
+
/** The distribution path a build is on, as one key. */
|
|
51
|
+
export const nativeBuildPathKey = (
|
|
52
|
+
build: Pick<
|
|
53
|
+
NativeBuildRow,
|
|
54
|
+
| "channel_id"
|
|
55
|
+
| "platform"
|
|
56
|
+
| "is_sandbox"
|
|
57
|
+
| "submitted_to"
|
|
58
|
+
| "artifact_kind"
|
|
59
|
+
| "export_method"
|
|
60
|
+
>,
|
|
61
|
+
): string =>
|
|
62
|
+
JSON.stringify([
|
|
63
|
+
build.channel_id,
|
|
64
|
+
build.platform,
|
|
65
|
+
build.is_sandbox,
|
|
66
|
+
nativeBuildDistribution(build),
|
|
67
|
+
]);
|
|
68
|
+
|
|
26
69
|
/** A platform's name as the console shows it. */
|
|
27
70
|
export const platformLabel = (platform: "ios" | "android") =>
|
|
28
71
|
platform === "ios" ? "iOS" : "Android";
|
|
29
72
|
|
|
73
|
+
/**
|
|
74
|
+
* A build as the CLI names it, such as `iOS 1.7.0 (66)`: the store's label
|
|
75
|
+
* when a store took it, else its app version and build number. Null when it
|
|
76
|
+
* reports neither, for the caller to name it another way.
|
|
77
|
+
*/
|
|
78
|
+
export const nativeBuildLabel = (
|
|
79
|
+
build: Pick<
|
|
80
|
+
NativeBuildRow,
|
|
81
|
+
"platform" | "submitted_version" | "app_version" | "build_number"
|
|
82
|
+
>,
|
|
83
|
+
): string | null => {
|
|
84
|
+
const label =
|
|
85
|
+
build.submitted_version ??
|
|
86
|
+
[
|
|
87
|
+
build.app_version,
|
|
88
|
+
build.build_number === null ? null : `(${build.build_number})`,
|
|
89
|
+
]
|
|
90
|
+
.filter((part) => part !== null)
|
|
91
|
+
.join(" ");
|
|
92
|
+
return label === "" ? null : `${platformLabel(build.platform)} ${label}`;
|
|
93
|
+
};
|
|
94
|
+
|
|
30
95
|
/** The console route that redirects to a build's artifact in storage. */
|
|
31
96
|
export const nativeBuildDownloadPath = (id: string) =>
|
|
32
97
|
`/api/native-builds/${encodeURIComponent(id)}/download`;
|
|
33
98
|
|
|
99
|
+
/** The query parameter of a signed download link: its token. */
|
|
100
|
+
export const NATIVE_BUILD_DOWNLOAD_TOKEN_PARAM = "t";
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* A build's signed download link, under the console's path on the page's own
|
|
104
|
+
* address, whatever the page, so it opens where the person who copied it
|
|
105
|
+
* reached the console.
|
|
106
|
+
*/
|
|
107
|
+
export const nativeBuildSignedDownloadUrl = (
|
|
108
|
+
location: { readonly origin: string; readonly pathname: string },
|
|
109
|
+
id: string,
|
|
110
|
+
token: string,
|
|
111
|
+
) => {
|
|
112
|
+
return `${location.origin}${consolePathOf(location, id)}${nativeBuildDownloadPath(id)}?${NATIVE_BUILD_DOWNLOAD_TOKEN_PARAM}=${encodeURIComponent(token)}`;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The console's own path, from a page of build `id` under it: empty at the
|
|
117
|
+
* root of its host.
|
|
118
|
+
*/
|
|
119
|
+
export const consolePathOf = (
|
|
120
|
+
location: { readonly pathname: string },
|
|
121
|
+
id: string,
|
|
122
|
+
) => {
|
|
123
|
+
const page = nativeBuildDetailPath(id);
|
|
124
|
+
return location.pathname.endsWith(page)
|
|
125
|
+
? location.pathname.slice(0, -page.length)
|
|
126
|
+
: "";
|
|
127
|
+
};
|
|
128
|
+
|
|
34
129
|
/** The console page of one native build. */
|
|
35
130
|
export const nativeBuildDetailPath = (id: string) =>
|
|
36
131
|
`/native-builds/${encodeURIComponent(id)}`;
|
|
37
132
|
|
|
133
|
+
/**
|
|
134
|
+
* How long an Install button's link works. It sits in the `itms-services` URL,
|
|
135
|
+
* Safari's history and the installer's logs, and its holder can fetch the IPA
|
|
136
|
+
* with every UDID in its profile, so it lasts only as long as an install takes.
|
|
137
|
+
*/
|
|
138
|
+
export const NATIVE_BUILD_INSTALL_LINK_TTL_MS = 60 * 60 * 1000;
|
|
139
|
+
|
|
140
|
+
/** This iPhone's own copy of its UDID, as its profile reported it. */
|
|
141
|
+
export const IOS_UDID_STORAGE_KEY = "hot-updater-ios-udid";
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* This iPhone's receipt of its UDID: what its profile's answer signed for the
|
|
145
|
+
* signed-in person, which Request access takes.
|
|
146
|
+
*/
|
|
147
|
+
export const IOS_DEVICE_RECEIPT_STORAGE_KEY = "hot-updater-ios-device-receipt";
|
|
148
|
+
|
|
149
|
+
/** A device's UDID: 40 hex digits, or 8 and 16 joined by a hyphen. */
|
|
150
|
+
export const IOS_UDID_PATTERN = /^(?:[0-9a-f]{40}|[0-9a-f]{8}-[0-9a-f]{16})$/iu;
|
|
151
|
+
|
|
152
|
+
/** The Console page of the iOS device registry, inside Native builds. */
|
|
153
|
+
export const IOS_DEVICES_PATH = "/native-builds/devices";
|
|
154
|
+
|
|
155
|
+
/** The route that hands an iPhone the profile that reads its UDID. */
|
|
156
|
+
export const IOS_DEVICE_PROFILE_PATH =
|
|
157
|
+
"/_hot-updater/devices/device.mobileconfig";
|
|
158
|
+
|
|
159
|
+
/** Where iOS posts the profile's answer. */
|
|
160
|
+
export const IOS_DEVICE_RESPONSE_PATH = "/_hot-updater/devices/device-response";
|
|
161
|
+
|
|
162
|
+
/** The query parameter of the profile routes: the capability that signs them. */
|
|
163
|
+
export const IOS_DEVICE_TOKEN_PARAM = "t";
|
|
164
|
+
|
|
165
|
+
/** A device profile's link, under the Console's path on the page's own address. */
|
|
166
|
+
export const iosDeviceProfileUrl = (consolePath: string, token: string) =>
|
|
167
|
+
`${consolePath}${IOS_DEVICE_PROFILE_PATH}?${IOS_DEVICE_TOKEN_PARAM}=${encodeURIComponent(token)}`;
|
|
168
|
+
|
|
169
|
+
/** The command that registers requested iPhones from a terminal. */
|
|
170
|
+
export const IOS_DEVICES_ADD_COMMAND =
|
|
171
|
+
"npx hot-updater native-build devices add";
|
|
172
|
+
|
|
173
|
+
/** The UDID as the iOS devices page shows it: its last six characters. */
|
|
174
|
+
export const maskIosUdid = (udid: string) => `…${udid.slice(-6)}`;
|
|
175
|
+
|
|
176
|
+
/** The route of a build's install manifest, as `itms-services` opens it. */
|
|
177
|
+
export const nativeBuildManifestPath = (id: string) =>
|
|
178
|
+
`/_hot-updater/native-builds/${encodeURIComponent(id)}/manifest.plist`;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* What an iPhone opens to install a build: the manifest's URL, signed with a
|
|
182
|
+
* token that also lets the installer download the IPA.
|
|
183
|
+
*/
|
|
184
|
+
export const nativeBuildItmsUrl = (
|
|
185
|
+
location: { readonly origin: string; readonly pathname: string },
|
|
186
|
+
id: string,
|
|
187
|
+
token: string,
|
|
188
|
+
) => {
|
|
189
|
+
const manifest = `${location.origin}${consolePathOf(location, id)}${nativeBuildManifestPath(id)}?${NATIVE_BUILD_DOWNLOAD_TOKEN_PARAM}=${encodeURIComponent(token)}`;
|
|
190
|
+
return `itms-services://?action=download-manifest&url=${encodeURIComponent(manifest)}`;
|
|
191
|
+
};
|
|
192
|
+
|
|
38
193
|
const CHANNEL_ID_PREFIX = "channel:";
|
|
39
194
|
|
|
40
195
|
/** A channel row's ID, `channel:` and its channel key. */
|
|
@@ -128,12 +283,6 @@ export const nativeBuildFileName = (build: NativeBuildRow): string => {
|
|
|
128
283
|
}
|
|
129
284
|
};
|
|
130
285
|
|
|
131
|
-
/** What the build compiled in: its app version, or its fingerprint. */
|
|
132
|
-
export const nativeBuildTarget = (build: NativeBuildRow) =>
|
|
133
|
-
build.app_version === null
|
|
134
|
-
? { label: "Fingerprint", value: build.fingerprint_hash ?? "" }
|
|
135
|
-
: { label: "App version", value: build.app_version };
|
|
136
|
-
|
|
137
286
|
const UNITS = ["B", "KB", "MB", "GB"] as const;
|
|
138
287
|
|
|
139
288
|
/** A byte count in the largest unit that keeps it at or above 1. */
|
|
@@ -148,15 +297,9 @@ export const formatByteSize = (bytes: number): string => {
|
|
|
148
297
|
};
|
|
149
298
|
|
|
150
299
|
/**
|
|
151
|
-
* The
|
|
152
|
-
*
|
|
300
|
+
* The command that downloads a simulator build or an APK, installs it on the
|
|
301
|
+
* booted simulator or the connected device, and opens it, in the project with
|
|
302
|
+
* its `hot-updater.config.ts`.
|
|
153
303
|
*/
|
|
154
|
-
export const
|
|
155
|
-
|
|
156
|
-
const app = archive.replace(/\.zip$/, "");
|
|
157
|
-
return `unzip -o ${shellQuote(archive)} && xcrun simctl install booted ${shellQuote(app)}`;
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
/** The command that installs a downloaded APK on an Android device or emulator. */
|
|
161
|
-
export const apkInstallCommand = (build: NativeBuildRow) =>
|
|
162
|
-
`adb install -r ${shellQuote(nativeBuildFileName(build))}`;
|
|
304
|
+
export const nativeBuildInstallCommand = (build: NativeBuildRow) =>
|
|
305
|
+
`npx hot-updater native-build install ${shellQuote(build.id)}`;
|
|
@@ -17,6 +17,8 @@ import type {
|
|
|
17
17
|
/** What the console runs on, assembled from its config as the server is. */
|
|
18
18
|
export interface ResolvedConsoleConfig {
|
|
19
19
|
readonly gitUrl?: string;
|
|
20
|
+
/** Who may approve iOS devices, trimmed and lower-cased: none when empty. */
|
|
21
|
+
readonly deviceApprovers: readonly string[];
|
|
20
22
|
/** The server's database, or its admin API. */
|
|
21
23
|
readonly database: ConfiguredDatabase;
|
|
22
24
|
/**
|
|
@@ -72,8 +74,13 @@ export const resolveConsoleConfig = async (
|
|
|
72
74
|
|
|
73
75
|
const config = typeof source === "function" ? await source(request) : source;
|
|
74
76
|
const { database, storage, plugins = [] } = config;
|
|
75
|
-
const { gitUrl } = config.console ?? {};
|
|
76
|
-
const consoleOptions =
|
|
77
|
+
const { gitUrl, deviceApprovers = [] } = config.console ?? {};
|
|
78
|
+
const consoleOptions = {
|
|
79
|
+
...(gitUrl === undefined ? {} : { gitUrl }),
|
|
80
|
+
deviceApprovers: deviceApprovers
|
|
81
|
+
.map((email) => email.trim().toLowerCase())
|
|
82
|
+
.filter((email) => email.length > 0),
|
|
83
|
+
};
|
|
77
84
|
// A self-hosted server runs the plugins itself: core is its admin API.
|
|
78
85
|
// The plugins are still checked as the server checks them, on a database
|
|
79
86
|
// nothing reads, so one the server would refuse is refused here too.
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { sameSecret } from "./local-console";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Signed, short-lived tokens for an iPhone's profile flow, which runs where
|
|
5
|
+
* the Console's session isn't: Safari's profile download and the Settings app's
|
|
6
|
+
* answer carry no cookie. A token holds what it grants and its expiry, and the
|
|
7
|
+
* Console stores nothing.
|
|
8
|
+
*
|
|
9
|
+
* - The capability (`t`) lets the profile routes serve one profile and take
|
|
10
|
+
* one answer for a signed-in person: `register` saves the iPhone as
|
|
11
|
+
* requested, `identify` only tells the build page which iPhone it is.
|
|
12
|
+
* - The receipt (`r`) is what `identify` hands back: it names the UDID the
|
|
13
|
+
* profile read and whose session asked, so Request access takes the UDID
|
|
14
|
+
* from it, never from a link anyone can craft.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** Separates these tokens' key from every other use of the Console's secret. */
|
|
18
|
+
const KEY_CONTEXT = "hot-updater/console/device-profile/v1";
|
|
19
|
+
|
|
20
|
+
/** How long a capability works: one profile install. */
|
|
21
|
+
export const DEVICE_PROFILE_TOKEN_TTL_MS = 15 * 60 * 1000;
|
|
22
|
+
|
|
23
|
+
/** How long a receipt works, from the profile's answer to Request access. */
|
|
24
|
+
export const DEVICE_RECEIPT_TTL_MS = 60 * 60 * 1000;
|
|
25
|
+
|
|
26
|
+
/** What a capability lets its bearer do. */
|
|
27
|
+
export interface DeviceProfileGrant {
|
|
28
|
+
readonly m: "register" | "identify";
|
|
29
|
+
/** The signed-in email that asked, lower-cased. */
|
|
30
|
+
readonly e: string;
|
|
31
|
+
/** The device name a `register` saves. */
|
|
32
|
+
readonly n?: string;
|
|
33
|
+
/** The build page an `identify` returns to. */
|
|
34
|
+
readonly b?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** What a receipt says: this UDID answered this person's profile. */
|
|
38
|
+
export interface DeviceReceipt {
|
|
39
|
+
readonly u: string;
|
|
40
|
+
readonly e: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type Signed<T> = T & { readonly p: string; readonly x: number };
|
|
44
|
+
|
|
45
|
+
const encoder = new TextEncoder();
|
|
46
|
+
|
|
47
|
+
const base64Url = (bytes: Uint8Array) =>
|
|
48
|
+
btoa(String.fromCharCode(...bytes))
|
|
49
|
+
.replaceAll("+", "-")
|
|
50
|
+
.replaceAll("/", "_")
|
|
51
|
+
.replaceAll("=", "");
|
|
52
|
+
|
|
53
|
+
const fromBase64Url = (text: string) =>
|
|
54
|
+
Uint8Array.from(
|
|
55
|
+
atob(text.replaceAll("-", "+").replaceAll("_", "/")),
|
|
56
|
+
(char) => char.charCodeAt(0),
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const hmac = async (key: BufferSource, message: string) =>
|
|
60
|
+
new Uint8Array(
|
|
61
|
+
await crypto.subtle.sign(
|
|
62
|
+
"HMAC",
|
|
63
|
+
await crypto.subtle.importKey(
|
|
64
|
+
"raw",
|
|
65
|
+
key,
|
|
66
|
+
{ name: "HMAC", hash: "SHA-256" },
|
|
67
|
+
false,
|
|
68
|
+
["sign"],
|
|
69
|
+
),
|
|
70
|
+
encoder.encode(message),
|
|
71
|
+
),
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const signatureOf = async (secret: string, body: string) =>
|
|
75
|
+
base64Url(await hmac(await hmac(encoder.encode(secret), KEY_CONTEXT), body));
|
|
76
|
+
|
|
77
|
+
const sign = async <T extends object>(
|
|
78
|
+
secret: string,
|
|
79
|
+
purpose: string,
|
|
80
|
+
payload: T,
|
|
81
|
+
expiresAtMs: number,
|
|
82
|
+
): Promise<string> => {
|
|
83
|
+
const body = base64Url(
|
|
84
|
+
encoder.encode(
|
|
85
|
+
JSON.stringify({ ...payload, p: purpose, x: Math.floor(expiresAtMs) }),
|
|
86
|
+
),
|
|
87
|
+
);
|
|
88
|
+
return `${body}.${await signatureOf(secret, body)}`;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const TOKEN = /^([A-Za-z0-9_-]{1,2048})\.([A-Za-z0-9_-]{43})$/u;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The payload of a token signed for `purpose`, `expired`, or `invalid`. The
|
|
95
|
+
* expiry counts only under a signature that holds.
|
|
96
|
+
*/
|
|
97
|
+
const verify = async <T extends object>(
|
|
98
|
+
secret: string,
|
|
99
|
+
purpose: string,
|
|
100
|
+
token: string,
|
|
101
|
+
now: number,
|
|
102
|
+
): Promise<Signed<T> | "expired" | "invalid"> => {
|
|
103
|
+
const match = TOKEN.exec(token);
|
|
104
|
+
if (match === null) return "invalid";
|
|
105
|
+
const [, body, signature] = match as unknown as [string, string, string];
|
|
106
|
+
if (!sameSecret(signature, await signatureOf(secret, body))) {
|
|
107
|
+
return "invalid";
|
|
108
|
+
}
|
|
109
|
+
let payload: unknown;
|
|
110
|
+
try {
|
|
111
|
+
payload = JSON.parse(new TextDecoder().decode(fromBase64Url(body)));
|
|
112
|
+
} catch {
|
|
113
|
+
return "invalid";
|
|
114
|
+
}
|
|
115
|
+
if (
|
|
116
|
+
typeof payload !== "object" ||
|
|
117
|
+
payload === null ||
|
|
118
|
+
(payload as { p?: unknown }).p !== purpose ||
|
|
119
|
+
typeof (payload as { x?: unknown }).x !== "number"
|
|
120
|
+
) {
|
|
121
|
+
return "invalid";
|
|
122
|
+
}
|
|
123
|
+
return now >= (payload as { x: number }).x
|
|
124
|
+
? "expired"
|
|
125
|
+
: (payload as Signed<T>);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const PROFILE_PURPOSE = "device-profile";
|
|
129
|
+
const RECEIPT_PURPOSE = "device-receipt";
|
|
130
|
+
|
|
131
|
+
export const createDeviceProfileToken = (
|
|
132
|
+
secret: string,
|
|
133
|
+
grant: DeviceProfileGrant,
|
|
134
|
+
now: number = Date.now(),
|
|
135
|
+
) => sign(secret, PROFILE_PURPOSE, grant, now + DEVICE_PROFILE_TOKEN_TTL_MS);
|
|
136
|
+
|
|
137
|
+
export const verifyDeviceProfileToken = async (
|
|
138
|
+
secret: string,
|
|
139
|
+
token: string,
|
|
140
|
+
now: number = Date.now(),
|
|
141
|
+
): Promise<DeviceProfileGrant | "expired" | "invalid"> => {
|
|
142
|
+
const verified = await verify<DeviceProfileGrant>(
|
|
143
|
+
secret,
|
|
144
|
+
PROFILE_PURPOSE,
|
|
145
|
+
token,
|
|
146
|
+
now,
|
|
147
|
+
);
|
|
148
|
+
if (typeof verified === "string") return verified;
|
|
149
|
+
if (
|
|
150
|
+
(verified.m !== "register" && verified.m !== "identify") ||
|
|
151
|
+
typeof verified.e !== "string" ||
|
|
152
|
+
(verified.n !== undefined && typeof verified.n !== "string") ||
|
|
153
|
+
(verified.b !== undefined && typeof verified.b !== "string")
|
|
154
|
+
) {
|
|
155
|
+
return "invalid";
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
m: verified.m,
|
|
159
|
+
e: verified.e,
|
|
160
|
+
...(verified.n === undefined ? {} : { n: verified.n }),
|
|
161
|
+
...(verified.b === undefined ? {} : { b: verified.b }),
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export const createDeviceReceipt = (
|
|
166
|
+
secret: string,
|
|
167
|
+
receipt: DeviceReceipt,
|
|
168
|
+
now: number = Date.now(),
|
|
169
|
+
) => sign(secret, RECEIPT_PURPOSE, receipt, now + DEVICE_RECEIPT_TTL_MS);
|
|
170
|
+
|
|
171
|
+
export const verifyDeviceReceipt = async (
|
|
172
|
+
secret: string,
|
|
173
|
+
token: string,
|
|
174
|
+
now: number = Date.now(),
|
|
175
|
+
): Promise<DeviceReceipt | "expired" | "invalid"> => {
|
|
176
|
+
const verified = await verify<DeviceReceipt>(
|
|
177
|
+
secret,
|
|
178
|
+
RECEIPT_PURPOSE,
|
|
179
|
+
token,
|
|
180
|
+
now,
|
|
181
|
+
);
|
|
182
|
+
if (typeof verified === "string") return verified;
|
|
183
|
+
if (typeof verified.u !== "string" || typeof verified.e !== "string") {
|
|
184
|
+
return "invalid";
|
|
185
|
+
}
|
|
186
|
+
return { u: verified.u, e: verified.e };
|
|
187
|
+
};
|