@tempoxyz/id 0.0.0-stage → 0.0.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 +80 -2
- package/dist/App.d.ts +20 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/App.js +26 -0
- package/dist/App.js.map +1 -0
- package/dist/app/client/.assetsignore +2 -0
- package/dist/app/client/assets/BRLA-CZvVDNYr.png +0 -0
- package/dist/app/client/assets/CHFAU-DCedc4aH.png +0 -0
- package/dist/app/client/assets/DLUSD-BnRXm3EI.png +0 -0
- package/dist/app/client/assets/PRIME-CiFp2-3e.svg +14 -0
- package/dist/app/client/assets/Pilat-Bold-C1t1eIrF.woff2 +0 -0
- package/dist/app/client/assets/Pilat-Book-CbS8ofT8.woff2 +0 -0
- package/dist/app/client/assets/Pilat-Demi-CADSbPAt.woff2 +0 -0
- package/dist/app/client/assets/Pilat-Regular-Bx8vzE7q.woff2 +0 -0
- package/dist/app/client/assets/USD1-COVcO_PB.svg +30 -0
- package/dist/app/client/assets/YLDS-CRh8Zw0g.svg +3 -0
- package/dist/app/client/assets/ccip-Cq1mMiVl.js +1 -0
- package/dist/app/client/assets/frxUSD-n9pTpinR.svg +1 -0
- package/dist/app/client/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
- package/dist/app/client/assets/index-B7YJVP00.css +1 -0
- package/dist/app/client/assets/index-UXTxXCLk.js +55 -0
- package/dist/app/client/assets/pathUSD-BvaO6ooS.svg +25 -0
- package/dist/app/client/assets/reset-co-CHrff.css +1 -0
- package/dist/app/client/assets/wYLDS-CaCKDrO-.svg +10 -0
- package/dist/app/db/auth.d.ts +3207 -0
- package/dist/app/db/auth.d.ts.map +1 -0
- package/dist/app/db/auth.js +330 -0
- package/dist/app/db/auth.js.map +1 -0
- package/dist/app/db/schema.d.ts +932 -0
- package/dist/app/db/schema.d.ts.map +1 -0
- package/dist/app/db/schema.js +171 -0
- package/dist/app/db/schema.js.map +1 -0
- package/dist/app/server/.vite/manifest.json +489 -0
- package/dist/app/server/assets/BRLA-CZvVDNYr.png +0 -0
- package/dist/app/server/assets/CHFAU-DCedc4aH.png +0 -0
- package/dist/app/server/assets/DLUSD-BnRXm3EI.png +0 -0
- package/dist/app/server/assets/PRIME-CiFp2-3e.svg +14 -0
- package/dist/app/server/assets/Pilat-Bold-C1t1eIrF.woff2 +0 -0
- package/dist/app/server/assets/Pilat-Book-CbS8ofT8.woff2 +0 -0
- package/dist/app/server/assets/Pilat-Demi-CADSbPAt.woff2 +0 -0
- package/dist/app/server/assets/Pilat-Regular-Bx8vzE7q.woff2 +0 -0
- package/dist/app/server/assets/USD1-COVcO_PB.svg +30 -0
- package/dist/app/server/assets/YLDS-CRh8Zw0g.svg +3 -0
- package/dist/app/server/assets/_tanstack-start-manifest_v-11GtFGrq.js +1 -0
- package/dist/app/server/assets/arktype-aI7TBD0R-D1R3Byo5.js +2 -0
- package/dist/app/server/assets/arktype-aI7TBD0R-D1R3Byo5.js.map +1 -0
- package/dist/app/server/assets/authorize-C95F-9E1-CbESJKGU.js +31 -0
- package/dist/app/server/assets/authorize-C95F-9E1-CbESJKGU.js.map +1 -0
- package/dist/app/server/assets/bun-sqlite-dialect-DoOVo4ja-CtyBkVMb.js +2 -0
- package/dist/app/server/assets/bun-sqlite-dialect-DoOVo4ja-CtyBkVMb.js.map +1 -0
- package/dist/app/server/assets/call-UQamaCKN.js +32 -0
- package/dist/app/server/assets/call-UQamaCKN.js.map +1 -0
- package/dist/app/server/assets/ccip-CbNKFO4n.js +2 -0
- package/dist/app/server/assets/ccip-CbNKFO4n.js.map +1 -0
- package/dist/app/server/assets/compiled-query-Ds2NVcFT.js +2 -0
- package/dist/app/server/assets/compiled-query-Ds2NVcFT.js.map +1 -0
- package/dist/app/server/assets/convert-BIC8n32x.js +2 -0
- package/dist/app/server/assets/convert-BIC8n32x.js.map +1 -0
- package/dist/app/server/assets/cookie-CS900nSP.css +1 -0
- package/dist/app/server/assets/cookie-Cce9CrIP.js +10 -0
- package/dist/app/server/assets/cookie-Cce9CrIP.js.map +1 -0
- package/dist/app/server/assets/core-B1HCXUmx.js +56 -0
- package/dist/app/server/assets/core-B1HCXUmx.js.map +1 -0
- package/dist/app/server/assets/d1-sqlite-dialect-m0f01-4z-Cv-csE1u.js +2 -0
- package/dist/app/server/assets/d1-sqlite-dialect-m0f01-4z-Cv-csE1u.js.map +1 -0
- package/dist/app/server/assets/default-u_dwuiYb-BJJ9PwCi.js +2 -0
- package/dist/app/server/assets/default-u_dwuiYb-BJJ9PwCi.js.map +1 -0
- package/dist/app/server/assets/dist-BxSwugSY.js +1 -0
- package/dist/app/server/assets/dist-CZGFhmQd.js +2 -0
- package/dist/app/server/assets/dist-CZGFhmQd.js.map +1 -0
- package/dist/app/server/assets/dist-Dg3PQqiW.js +15 -0
- package/dist/app/server/assets/dist-Dg3PQqiW.js.map +1 -0
- package/dist/app/server/assets/effect-QlVUlMFu-2tSPDT2b.js +2 -0
- package/dist/app/server/assets/effect-QlVUlMFu-2tSPDT2b.js.map +1 -0
- package/dist/app/server/assets/empty-plugin-adapters-BaGcmrjC.js +2 -0
- package/dist/app/server/assets/empty-plugin-adapters-BaGcmrjC.js.map +1 -0
- package/dist/app/server/assets/factory-ipHlJXZY.js +5 -0
- package/dist/app/server/assets/factory-ipHlJXZY.js.map +1 -0
- package/dist/app/server/assets/frxUSD-n9pTpinR.svg +1 -0
- package/dist/app/server/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
- package/dist/app/server/assets/get-id-field-B0x109VU.js +6 -0
- package/dist/app/server/assets/get-id-field-B0x109VU.js.map +1 -0
- package/dist/app/server/assets/index-CLddUTqr-xpSuLpBt.js +2 -0
- package/dist/app/server/assets/index-CLddUTqr-xpSuLpBt.js.map +1 -0
- package/dist/app/server/assets/index-DZEfthgZ-8Uq5s5Pt.js +2 -0
- package/dist/app/server/assets/index-DZEfthgZ-8Uq5s5Pt.js.map +1 -0
- package/dist/app/server/assets/kysely-adapter-MkHAI9Jk.js +1 -0
- package/dist/app/server/assets/node-sqlite-dialect-BowWLXvK.js +2 -0
- package/dist/app/server/assets/node-sqlite-dialect-BowWLXvK.js.map +1 -0
- package/dist/app/server/assets/pathUSD-BvaO6ooS.svg +25 -0
- package/dist/app/server/assets/reset-co-CHrff.css +1 -0
- package/dist/app/server/assets/rolldown-runtime-B0Z9INg1.js +1 -0
- package/dist/app/server/assets/router-CcbyBCI4.css +1 -0
- package/dist/app/server/assets/router-xjZtEeaI.js +7 -0
- package/dist/app/server/assets/router-xjZtEeaI.js.map +1 -0
- package/dist/app/server/assets/schema-check-Cf7QOZZD.js +9 -0
- package/dist/app/server/assets/schema-check-Cf7QOZZD.js.map +1 -0
- package/dist/app/server/assets/schemas-C2lCYmR5.js +2 -0
- package/dist/app/server/assets/schemas-C2lCYmR5.js.map +1 -0
- package/dist/app/server/assets/secp256k1-buM5g4AL.js +2 -0
- package/dist/app/server/assets/secp256k1-buM5g4AL.js.map +1 -0
- package/dist/app/server/assets/sqlite-adapter-C_LAV4e3.js +2 -0
- package/dist/app/server/assets/sqlite-adapter-C_LAV4e3.js.map +1 -0
- package/dist/app/server/assets/sqlite-introspector-DSCAP82F-Crx7Ny14.js +6 -0
- package/dist/app/server/assets/sqlite-introspector-DSCAP82F-Crx7Ny14.js.map +1 -0
- package/dist/app/server/assets/standard-json-Cg1N07hM.js +2 -0
- package/dist/app/server/assets/standard-json-Cg1N07hM.js.map +1 -0
- package/dist/app/server/assets/standard-json-DY77efq0.js +2 -0
- package/dist/app/server/assets/standard-json-DY77efq0.js.map +1 -0
- package/dist/app/server/assets/standard-json-ig2t0wRt.js +2 -0
- package/dist/app/server/assets/standard-json-ig2t0wRt.js.map +1 -0
- package/dist/app/server/assets/standard-json-t-LNckA6.js +2 -0
- package/dist/app/server/assets/standard-json-t-LNckA6.js.map +1 -0
- package/dist/app/server/assets/standard-openapi-CONmVRl8.js +2 -0
- package/dist/app/server/assets/standard-openapi-CONmVRl8.js.map +1 -0
- package/dist/app/server/assets/start-C63VetBp.js +2 -0
- package/dist/app/server/assets/start-C63VetBp.js.map +1 -0
- package/dist/app/server/assets/sury-CWZTCd75-xt1mWc9f.js +2 -0
- package/dist/app/server/assets/sury-CWZTCd75-xt1mWc9f.js.map +1 -0
- package/dist/app/server/assets/typebox-Dei93FPO-D_lCVdAz.js +2 -0
- package/dist/app/server/assets/typebox-Dei93FPO-D_lCVdAz.js.map +1 -0
- package/dist/app/server/assets/utils-C4ZXZIZW.js +2 -0
- package/dist/app/server/assets/utils-C4ZXZIZW.js.map +1 -0
- package/dist/app/server/assets/valibot--1zFm7rT-NSoY2xTp.js +2 -0
- package/dist/app/server/assets/valibot--1zFm7rT-NSoY2xTp.js.map +1 -0
- package/dist/app/server/assets/valibot-D_HTw1Gn-CJwWeOUE.js +2 -0
- package/dist/app/server/assets/valibot-D_HTw1Gn-CJwWeOUE.js.map +1 -0
- package/dist/app/server/assets/wYLDS-CaCKDrO-.svg +10 -0
- package/dist/app/server/assets/zod-Bwrt9trS-CV38yPnQ.js +2 -0
- package/dist/app/server/assets/zod-Bwrt9trS-CV38yPnQ.js.map +1 -0
- package/dist/app/server/assets/zod-DSgpEGAE-BvlnBE2L.js +2 -0
- package/dist/app/server/assets/zod-DSgpEGAE-BvlnBE2L.js.map +1 -0
- package/dist/app/server/index.js +574 -0
- package/dist/app/server/index.js.map +1 -0
- package/dist/app/server/wrangler.json +1 -0
- package/dist/cli/Admin.d.ts +38 -0
- package/dist/cli/Admin.d.ts.map +1 -0
- package/dist/cli/Admin.js +62 -0
- package/dist/cli/Admin.js.map +1 -0
- package/dist/cli/Apps.d.ts +9 -0
- package/dist/cli/Apps.d.ts.map +1 -0
- package/dist/cli/Apps.js +36 -0
- package/dist/cli/Apps.js.map +1 -0
- package/dist/cli/Cli.d.ts +14 -0
- package/dist/cli/Cli.d.ts.map +1 -0
- package/dist/cli/Cli.js +27 -0
- package/dist/cli/Cli.js.map +1 -0
- package/dist/cli/Project.d.ts +20 -0
- package/dist/cli/Project.d.ts.map +1 -0
- package/dist/cli/Project.js +88 -0
- package/dist/cli/Project.js.map +1 -0
- package/dist/cli/Realms.d.ts +24 -0
- package/dist/cli/Realms.d.ts.map +1 -0
- package/dist/cli/Realms.js +49 -0
- package/dist/cli/Realms.js.map +1 -0
- package/dist/cli/Session.d.ts +85 -0
- package/dist/cli/Session.d.ts.map +1 -0
- package/dist/cli/Session.js +178 -0
- package/dist/cli/Session.js.map +1 -0
- package/dist/cli/User.d.ts +29 -0
- package/dist/cli/User.d.ts.map +1 -0
- package/dist/cli/User.js +39 -0
- package/dist/cli/User.js.map +1 -0
- package/dist/cli/V1.d.ts +35 -0
- package/dist/cli/V1.d.ts.map +1 -0
- package/dist/cli/V1.js +41 -0
- package/dist/cli/V1.js.map +1 -0
- package/dist/cli/bin.d.ts +3 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +46 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/commands/admin/apps/create.d.ts +23 -0
- package/dist/cli/commands/admin/apps/create.d.ts.map +1 -0
- package/dist/cli/commands/admin/apps/create.js +89 -0
- package/dist/cli/commands/admin/apps/create.js.map +1 -0
- package/dist/cli/commands/admin/apps/delete.d.ts +14 -0
- package/dist/cli/commands/admin/apps/delete.d.ts.map +1 -0
- package/dist/cli/commands/admin/apps/delete.js +41 -0
- package/dist/cli/commands/admin/apps/delete.js.map +1 -0
- package/dist/cli/commands/admin/apps/index.d.ts +5 -0
- package/dist/cli/commands/admin/apps/index.d.ts.map +1 -0
- package/dist/cli/commands/admin/apps/index.js +14 -0
- package/dist/cli/commands/admin/apps/index.js.map +1 -0
- package/dist/cli/commands/admin/apps/list.d.ts +9 -0
- package/dist/cli/commands/admin/apps/list.d.ts.map +1 -0
- package/dist/cli/commands/admin/apps/list.js +26 -0
- package/dist/cli/commands/admin/apps/list.js.map +1 -0
- package/dist/cli/commands/admin/apps/rotate-secret.d.ts +16 -0
- package/dist/cli/commands/admin/apps/rotate-secret.d.ts.map +1 -0
- package/dist/cli/commands/admin/apps/rotate-secret.js +47 -0
- package/dist/cli/commands/admin/apps/rotate-secret.js.map +1 -0
- package/dist/cli/commands/admin/apps/update.d.ts +20 -0
- package/dist/cli/commands/admin/apps/update.d.ts.map +1 -0
- package/dist/cli/commands/admin/apps/update.js +76 -0
- package/dist/cli/commands/admin/apps/update.js.map +1 -0
- package/dist/cli/commands/admin/index.d.ts +5 -0
- package/dist/cli/commands/admin/index.d.ts.map +1 -0
- package/dist/cli/commands/admin/index.js +13 -0
- package/dist/cli/commands/admin/index.js.map +1 -0
- package/dist/cli/commands/admin/migrate.d.ts +9 -0
- package/dist/cli/commands/admin/migrate.d.ts.map +1 -0
- package/dist/cli/commands/admin/migrate.js +17 -0
- package/dist/cli/commands/admin/migrate.js.map +1 -0
- package/dist/cli/commands/admin/realms/add.d.ts +12 -0
- package/dist/cli/commands/admin/realms/add.d.ts.map +1 -0
- package/dist/cli/commands/admin/realms/add.js +42 -0
- package/dist/cli/commands/admin/realms/add.js.map +1 -0
- package/dist/cli/commands/admin/realms/index.d.ts +5 -0
- package/dist/cli/commands/admin/realms/index.d.ts.map +1 -0
- package/dist/cli/commands/admin/realms/index.js +13 -0
- package/dist/cli/commands/admin/realms/index.js.map +1 -0
- package/dist/cli/commands/admin/realms/list.d.ts +13 -0
- package/dist/cli/commands/admin/realms/list.d.ts.map +1 -0
- package/dist/cli/commands/admin/realms/list.js +36 -0
- package/dist/cli/commands/admin/realms/list.js.map +1 -0
- package/dist/cli/commands/admin/realms/passkeys/index.d.ts +5 -0
- package/dist/cli/commands/admin/realms/passkeys/index.d.ts.map +1 -0
- package/dist/cli/commands/admin/realms/passkeys/index.js +13 -0
- package/dist/cli/commands/admin/realms/passkeys/index.js.map +1 -0
- package/dist/cli/commands/admin/realms/passkeys/set.d.ts +16 -0
- package/dist/cli/commands/admin/realms/passkeys/set.d.ts.map +1 -0
- package/dist/cli/commands/admin/realms/passkeys/set.js +46 -0
- package/dist/cli/commands/admin/realms/passkeys/set.js.map +1 -0
- package/dist/cli/commands/admin/realms/privy/index.d.ts +5 -0
- package/dist/cli/commands/admin/realms/privy/index.d.ts.map +1 -0
- package/dist/cli/commands/admin/realms/privy/index.js +13 -0
- package/dist/cli/commands/admin/realms/privy/index.js.map +1 -0
- package/dist/cli/commands/admin/realms/privy/set.d.ts +18 -0
- package/dist/cli/commands/admin/realms/privy/set.d.ts.map +1 -0
- package/dist/cli/commands/admin/realms/privy/set.js +66 -0
- package/dist/cli/commands/admin/realms/privy/set.js.map +1 -0
- package/dist/cli/commands/admin/realms/remove.d.ts +11 -0
- package/dist/cli/commands/admin/realms/remove.d.ts.map +1 -0
- package/dist/cli/commands/admin/realms/remove.js +35 -0
- package/dist/cli/commands/admin/realms/remove.js.map +1 -0
- package/dist/cli/commands/admin/realms/secp256k1/disable.d.ts +15 -0
- package/dist/cli/commands/admin/realms/secp256k1/disable.d.ts.map +1 -0
- package/dist/cli/commands/admin/realms/secp256k1/disable.js +42 -0
- package/dist/cli/commands/admin/realms/secp256k1/disable.js.map +1 -0
- package/dist/cli/commands/admin/realms/secp256k1/enable.d.ts +15 -0
- package/dist/cli/commands/admin/realms/secp256k1/enable.d.ts.map +1 -0
- package/dist/cli/commands/admin/realms/secp256k1/enable.js +42 -0
- package/dist/cli/commands/admin/realms/secp256k1/enable.js.map +1 -0
- package/dist/cli/commands/admin/realms/secp256k1/index.d.ts +9 -0
- package/dist/cli/commands/admin/realms/secp256k1/index.d.ts.map +1 -0
- package/dist/cli/commands/admin/realms/secp256k1/index.js +17 -0
- package/dist/cli/commands/admin/realms/secp256k1/index.js.map +1 -0
- package/dist/cli/commands/admin/realms/set.d.ts +16 -0
- package/dist/cli/commands/admin/realms/set.d.ts.map +1 -0
- package/dist/cli/commands/admin/realms/set.js +46 -0
- package/dist/cli/commands/admin/realms/set.js.map +1 -0
- package/dist/cli/commands/admin/rotate-key.d.ts +15 -0
- package/dist/cli/commands/admin/rotate-key.d.ts.map +1 -0
- package/dist/cli/commands/admin/rotate-key.js +46 -0
- package/dist/cli/commands/admin/rotate-key.js.map +1 -0
- package/dist/cli/commands/init.d.ts +11 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +34 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/login.d.ts +12 -0
- package/dist/cli/commands/login.d.ts.map +1 -0
- package/dist/cli/commands/login.js +29 -0
- package/dist/cli/commands/login.js.map +1 -0
- package/dist/cli/commands/logout.d.ts +8 -0
- package/dist/cli/commands/logout.d.ts.map +1 -0
- package/dist/cli/commands/logout.js +19 -0
- package/dist/cli/commands/logout.js.map +1 -0
- package/dist/cli/commands/whoami.d.ts +12 -0
- package/dist/cli/commands/whoami.d.ts.map +1 -0
- package/dist/cli/commands/whoami.js +24 -0
- package/dist/cli/commands/whoami.js.map +1 -0
- package/dist/client/Actions.d.ts +101 -0
- package/dist/client/Actions.d.ts.map +1 -0
- package/dist/client/Actions.js +90 -0
- package/dist/client/Actions.js.map +1 -0
- package/dist/client/Auth.d.ts +161 -0
- package/dist/client/Auth.d.ts.map +1 -0
- package/dist/client/Auth.js +113 -0
- package/dist/client/Auth.js.map +1 -0
- package/dist/client/Authorization.d.ts +29 -0
- package/dist/client/Authorization.d.ts.map +1 -0
- package/dist/client/Authorization.js +12 -0
- package/dist/client/Authorization.js.map +1 -0
- package/dist/client/Decorator.d.ts +170 -0
- package/dist/client/Decorator.d.ts.map +1 -0
- package/dist/client/Decorator.js +227 -0
- package/dist/client/Decorator.js.map +1 -0
- package/dist/client/Key.d.ts +85 -0
- package/dist/client/Key.d.ts.map +1 -0
- package/dist/client/Key.js +83 -0
- package/dist/client/Key.js.map +1 -0
- package/dist/client/Pending.d.ts +39 -0
- package/dist/client/Pending.d.ts.map +1 -0
- package/dist/client/Pending.js +12 -0
- package/dist/client/Pending.js.map +1 -0
- package/dist/client/Permissions.d.ts +34 -0
- package/dist/client/Permissions.d.ts.map +1 -0
- package/dist/client/Permissions.js +16 -0
- package/dist/client/Permissions.js.map +1 -0
- package/dist/client/Provider.d.ts +16 -0
- package/dist/client/Provider.d.ts.map +1 -0
- package/dist/client/Provider.js +12 -0
- package/dist/client/Provider.js.map +1 -0
- package/dist/client/Step.d.ts +21 -0
- package/dist/client/Step.d.ts.map +1 -0
- package/dist/client/Step.js +16 -0
- package/dist/client/Step.js.map +1 -0
- package/dist/client/Storage.d.ts +27 -0
- package/dist/client/Storage.d.ts.map +1 -0
- package/dist/client/Storage.js +16 -0
- package/dist/client/Storage.js.map +1 -0
- package/dist/client/TempoAccount.d.ts +40 -0
- package/dist/client/TempoAccount.d.ts.map +1 -0
- package/dist/client/TempoAccount.js +16 -0
- package/dist/client/TempoAccount.js.map +1 -0
- package/dist/client/Tokens.d.ts +25 -0
- package/dist/client/Tokens.d.ts.map +1 -0
- package/dist/client/Tokens.js +12 -0
- package/dist/client/Tokens.js.map +1 -0
- package/dist/client/User.d.ts +21 -0
- package/dist/client/User.d.ts.map +1 -0
- package/dist/client/User.js +12 -0
- package/dist/client/User.js.map +1 -0
- package/dist/client/actions/account.d.ts +25 -0
- package/dist/client/actions/account.d.ts.map +1 -0
- package/dist/client/actions/account.js +34 -0
- package/dist/client/actions/account.js.map +1 -0
- package/dist/client/actions/device.d.ts +53 -0
- package/dist/client/actions/device.d.ts.map +1 -0
- package/dist/client/actions/device.js +79 -0
- package/dist/client/actions/device.js.map +1 -0
- package/dist/client/actions/email.d.ts +84 -0
- package/dist/client/actions/email.d.ts.map +1 -0
- package/dist/client/actions/email.js +63 -0
- package/dist/client/actions/email.js.map +1 -0
- package/dist/client/actions/oauth.d.ts +115 -0
- package/dist/client/actions/oauth.d.ts.map +1 -0
- package/dist/client/actions/oauth.js +105 -0
- package/dist/client/actions/oauth.js.map +1 -0
- package/dist/client/actions/passkey.d.ts +88 -0
- package/dist/client/actions/passkey.d.ts.map +1 -0
- package/dist/client/actions/passkey.js +60 -0
- package/dist/client/actions/passkey.js.map +1 -0
- package/dist/client/actions/provider.d.ts +49 -0
- package/dist/client/actions/provider.d.ts.map +1 -0
- package/dist/client/actions/provider.js +34 -0
- package/dist/client/actions/provider.js.map +1 -0
- package/dist/client/actions/realm.d.ts +24 -0
- package/dist/client/actions/realm.d.ts.map +1 -0
- package/dist/client/actions/realm.js +15 -0
- package/dist/client/actions/realm.js.map +1 -0
- package/dist/client/actions/redirect.d.ts +153 -0
- package/dist/client/actions/redirect.d.ts.map +1 -0
- package/dist/client/actions/redirect.js +236 -0
- package/dist/client/actions/redirect.js.map +1 -0
- package/dist/client/internal/accessKey.d.ts +21 -0
- package/dist/client/internal/accessKey.d.ts.map +1 -0
- package/dist/client/internal/accessKey.js +38 -0
- package/dist/client/internal/accessKey.js.map +1 -0
- package/dist/client/internal/account.d.ts +14 -0
- package/dist/client/internal/account.d.ts.map +1 -0
- package/dist/client/internal/account.js +3 -0
- package/dist/client/internal/account.js.map +1 -0
- package/dist/client/internal/api.d.ts +106 -0
- package/dist/client/internal/api.d.ts.map +1 -0
- package/dist/client/internal/api.js +129 -0
- package/dist/client/internal/api.js.map +1 -0
- package/dist/client/internal/headless.d.ts +33 -0
- package/dist/client/internal/headless.d.ts.map +1 -0
- package/dist/client/internal/headless.js +46 -0
- package/dist/client/internal/headless.js.map +1 -0
- package/dist/client/internal/indexedDb.d.ts +9 -0
- package/dist/client/internal/indexedDb.d.ts.map +1 -0
- package/dist/client/internal/indexedDb.js +32 -0
- package/dist/client/internal/indexedDb.js.map +1 -0
- package/dist/client/internal/request.d.ts +58 -0
- package/dist/client/internal/request.d.ts.map +1 -0
- package/dist/client/internal/request.js +45 -0
- package/dist/client/internal/request.js.map +1 -0
- package/dist/client/internal/store.d.ts +12 -0
- package/dist/client/internal/store.d.ts.map +1 -0
- package/dist/client/internal/store.js +15 -0
- package/dist/client/internal/store.js.map +1 -0
- package/dist/client.d.ts +20 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +20 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/Apps.d.ts +3051 -0
- package/dist/internal/Apps.d.ts.map +1 -0
- package/dist/internal/Apps.js +472 -0
- package/dist/internal/Apps.js.map +1 -0
- package/dist/internal/Auth.d.ts +4058 -0
- package/dist/internal/Auth.d.ts.map +1 -0
- package/dist/internal/Auth.js +137 -0
- package/dist/internal/Auth.js.map +1 -0
- package/dist/internal/Authorize.d.ts +532 -0
- package/dist/internal/Authorize.d.ts.map +1 -0
- package/dist/internal/Authorize.js +326 -0
- package/dist/internal/Authorize.js.map +1 -0
- package/dist/internal/Device.d.ts +371 -0
- package/dist/internal/Device.d.ts.map +1 -0
- package/dist/internal/Device.js +271 -0
- package/dist/internal/Device.js.map +1 -0
- package/dist/internal/Env.d.ts +57 -0
- package/dist/internal/Env.d.ts.map +1 -0
- package/dist/internal/Env.js +2 -0
- package/dist/internal/Env.js.map +1 -0
- package/dist/internal/ErrorResponse.d.ts +609 -0
- package/dist/internal/ErrorResponse.d.ts.map +1 -0
- package/dist/internal/ErrorResponse.js +679 -0
- package/dist/internal/ErrorResponse.js.map +1 -0
- package/dist/internal/Id.d.ts +10 -0
- package/dist/internal/Id.d.ts.map +1 -0
- package/dist/internal/Id.js +34 -0
- package/dist/internal/Id.js.map +1 -0
- package/dist/internal/KeyAuthorization.d.ts +1456 -0
- package/dist/internal/KeyAuthorization.d.ts.map +1 -0
- package/dist/internal/KeyAuthorization.js +1030 -0
- package/dist/internal/KeyAuthorization.js.map +1 -0
- package/dist/internal/Limits.d.ts +65 -0
- package/dist/internal/Limits.d.ts.map +1 -0
- package/dist/internal/Limits.js +35 -0
- package/dist/internal/Limits.js.map +1 -0
- package/dist/internal/Log.d.ts +49 -0
- package/dist/internal/Log.d.ts.map +1 -0
- package/dist/internal/Log.js +101 -0
- package/dist/internal/Log.js.map +1 -0
- package/dist/internal/LogLine.d.ts +33 -0
- package/dist/internal/LogLine.d.ts.map +1 -0
- package/dist/internal/LogLine.js +56 -0
- package/dist/internal/LogLine.js.map +1 -0
- package/dist/internal/Migrations.d.ts +19 -0
- package/dist/internal/Migrations.d.ts.map +1 -0
- package/dist/internal/Migrations.js +57 -0
- package/dist/internal/Migrations.js.map +1 -0
- package/dist/internal/Owner.d.ts +146 -0
- package/dist/internal/Owner.d.ts.map +1 -0
- package/dist/internal/Owner.js +65 -0
- package/dist/internal/Owner.js.map +1 -0
- package/dist/internal/Passkey.d.ts +528 -0
- package/dist/internal/Passkey.d.ts.map +1 -0
- package/dist/internal/Passkey.js +658 -0
- package/dist/internal/Passkey.js.map +1 -0
- package/dist/internal/PendingKey.d.ts +49 -0
- package/dist/internal/PendingKey.d.ts.map +1 -0
- package/dist/internal/PendingKey.js +58 -0
- package/dist/internal/PendingKey.js.map +1 -0
- package/dist/internal/Privy.d.ts +105 -0
- package/dist/internal/Privy.d.ts.map +1 -0
- package/dist/internal/Privy.js +224 -0
- package/dist/internal/Privy.js.map +1 -0
- package/dist/internal/RateLimit.d.ts +190 -0
- package/dist/internal/RateLimit.d.ts.map +1 -0
- package/dist/internal/RateLimit.js +148 -0
- package/dist/internal/RateLimit.js.map +1 -0
- package/dist/internal/Realm.d.ts +281 -0
- package/dist/internal/Realm.d.ts.map +1 -0
- package/dist/internal/Realm.js +477 -0
- package/dist/internal/Realm.js.map +1 -0
- package/dist/internal/RequestId.d.ts +16 -0
- package/dist/internal/RequestId.d.ts.map +1 -0
- package/dist/internal/RequestId.js +78 -0
- package/dist/internal/RequestId.js.map +1 -0
- package/dist/internal/SigningKey.d.ts +115 -0
- package/dist/internal/SigningKey.d.ts.map +1 -0
- package/dist/internal/SigningKey.js +197 -0
- package/dist/internal/SigningKey.js.map +1 -0
- package/dist/internal/TestInbox.d.ts +42 -0
- package/dist/internal/TestInbox.d.ts.map +1 -0
- package/dist/internal/TestInbox.js +20 -0
- package/dist/internal/TestInbox.js.map +1 -0
- package/dist/internal/Timing.d.ts +51 -0
- package/dist/internal/Timing.d.ts.map +1 -0
- package/dist/internal/Timing.js +103 -0
- package/dist/internal/Timing.js.map +1 -0
- package/dist/internal/Validation.d.ts +52 -0
- package/dist/internal/Validation.d.ts.map +1 -0
- package/dist/internal/Validation.js +22 -0
- package/dist/internal/Validation.js.map +1 -0
- package/dist/internal/Wallet.d.ts +37 -0
- package/dist/internal/Wallet.d.ts.map +1 -0
- package/dist/internal/Wallet.js +43 -0
- package/dist/internal/Wallet.js.map +1 -0
- package/dist/worker.d.ts +12 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +12 -0
- package/dist/worker.js.map +1 -0
- package/package.json +79 -3
- package/src/Api.ts +151 -0
- package/src/App.ts +56 -0
- package/src/api/account.ts +311 -0
- package/src/api/authenticate.ts +1290 -0
- package/src/api/authorize.ts +1030 -0
- package/src/api/device.ts +874 -0
- package/src/api/health.ts +72 -0
- package/src/api/lib/AccountStep.ts +335 -0
- package/src/api/lib/Auth.ts +134 -0
- package/src/api/lib/Consent.ts +339 -0
- package/src/api/lib/Cors.ts +107 -0
- package/src/api/lib/Database.ts +10 -0
- package/src/api/lib/DeviceRequest.ts +265 -0
- package/src/api/lib/FirstAccount.ts +90 -0
- package/src/api/lib/KeySigner.ts +393 -0
- package/src/api/lib/PasskeyLink.ts +162 -0
- package/src/api/lib/Session.ts +34 -0
- package/src/api/lib/SignInConsent.ts +316 -0
- package/src/api/oauth.ts +1282 -0
- package/src/api/provider.ts +441 -0
- package/src/app/components/Button.tsx +128 -0
- package/src/app/components/CodeInput.tsx +186 -0
- package/src/app/components/ErrorMessage.tsx +66 -0
- package/src/app/components/Grant.tsx +323 -0
- package/src/app/components/Input.tsx +48 -0
- package/src/app/components/Tooltip.tsx +45 -0
- package/src/app/components/icons/BRLA.png +0 -0
- package/src/app/components/icons/BRZ.svg +1 -0
- package/src/app/components/icons/CHFAU.png +0 -0
- package/src/app/components/icons/DLUSD.png +0 -0
- package/src/app/components/icons/EURAU.svg +1 -0
- package/src/app/components/icons/EURC.e.svg +1 -0
- package/src/app/components/icons/GBPA.svg +4 -0
- package/src/app/components/icons/GUSD.svg +1 -0
- package/src/app/components/icons/MACH.svg +4 -0
- package/src/app/components/icons/OUSD.svg +5 -0
- package/src/app/components/icons/PRIME.svg +14 -0
- package/src/app/components/icons/SBC.svg +1 -0
- package/src/app/components/icons/SEKAU.svg +5 -0
- package/src/app/components/icons/USD1.svg +30 -0
- package/src/app/components/icons/USDB.svg +11 -0
- package/src/app/components/icons/USDC.e.svg +1 -0
- package/src/app/components/icons/USDT0.svg +1 -0
- package/src/app/components/icons/USDY.svg +16 -0
- package/src/app/components/icons/USDe.svg +1 -0
- package/src/app/components/icons/YLDS.svg +3 -0
- package/src/app/components/icons/alphaUSD.svg +1 -0
- package/src/app/components/icons/betaUSD.svg +1 -0
- package/src/app/components/icons/cUSD.svg +1 -0
- package/src/app/components/icons/cbBTC.svg +1 -0
- package/src/app/components/icons/frxUSD.svg +1 -0
- package/src/app/components/icons/goUSD.svg +5 -0
- package/src/app/components/icons/iUSD.svg +1 -0
- package/src/app/components/icons/pathUSD.svg +25 -0
- package/src/app/components/icons/rUSD.svg +1 -0
- package/src/app/components/icons/reUSD.svg +1 -0
- package/src/app/components/icons/sUSDe.svg +1 -0
- package/src/app/components/icons/siUSD.svg +1 -0
- package/src/app/components/icons/stcUSD.svg +1 -0
- package/src/app/components/icons/syrupUSDC.svg +5 -0
- package/src/app/components/icons/thetaUSD.svg +1 -0
- package/src/app/components/icons/wYLDS.svg +10 -0
- package/src/app/components/icons/wsrUSD.svg +1 -0
- package/src/app/components/logos/OUSD.dark.svg +17 -0
- package/src/app/components/logos/OUSD.light.svg +17 -0
- package/src/app/crons/cleanup.ts +42 -0
- package/src/app/db/auth.ts +416 -0
- package/src/app/db/migrations/0000_better_auth.sql +53 -0
- package/src/app/db/migrations/0001_oauth_provider.sql +162 -0
- package/src/app/db/migrations/0002_device_code.sql +17 -0
- package/src/app/db/migrations/0003_realms.sql +27 -0
- package/src/app/db/migrations/0004_default_realm.sql +2 -0
- package/src/app/db/migrations/0005_passkeys.sql +30 -0
- package/src/app/db/migrations/0006_first_accounts.sql +9 -0
- package/src/app/db/migrations/0007_pending_keys.sql +13 -0
- package/src/app/db/migrations/0008_secp256k1_owners.sql +18 -0
- package/src/app/db/migrations/0009_device_requests.sql +8 -0
- package/src/app/db/migrations/0010_device_keys.sql +4 -0
- package/src/app/db/migrations/meta/0000_snapshot.json +362 -0
- package/src/app/db/migrations/meta/0001_snapshot.json +1487 -0
- package/src/app/db/migrations/meta/0002_snapshot.json +1603 -0
- package/src/app/db/migrations/meta/0003_snapshot.json +1760 -0
- package/src/app/db/migrations/meta/0004_snapshot.json +1760 -0
- package/src/app/db/migrations/meta/0005_snapshot.json +1911 -0
- package/src/app/db/migrations/meta/0006_snapshot.json +1967 -0
- package/src/app/db/migrations/meta/0007_snapshot.json +2047 -0
- package/src/app/db/migrations/meta/0008_snapshot.json +2157 -0
- package/src/app/db/migrations/meta/0009_snapshot.json +2207 -0
- package/src/app/db/migrations/meta/0010_snapshot.json +2231 -0
- package/src/app/db/migrations/meta/_journal.json +83 -0
- package/src/app/db/schema.ts +218 -0
- package/src/app/env.ts +49 -0
- package/src/app/lib/Client.ts +82 -0
- package/src/app/lib/Loader.ts +24 -0
- package/src/app/package.json +8 -0
- package/src/app/routeTree.gen.ts +198 -0
- package/src/app/router.tsx +48 -0
- package/src/app/routes/[_].flows.tsx +3001 -0
- package/src/app/routes/__root.tsx +91 -0
- package/src/app/routes/authorize.tsx +197 -0
- package/src/app/routes/choose-account.tsx +111 -0
- package/src/app/routes/deposit.tsx +105 -0
- package/src/app/routes/device.tsx +227 -0
- package/src/app/routes/index.tsx +115 -0
- package/src/app/routes/login.tsx +506 -0
- package/src/app/screens/Account.tsx +347 -0
- package/src/app/screens/Approval.tsx +276 -0
- package/src/app/screens/ChooseAccount.tsx +240 -0
- package/src/app/screens/Deposit.tsx +762 -0
- package/src/app/screens/DeviceApproval.tsx +480 -0
- package/src/app/screens/SignIn.tsx +362 -0
- package/src/app/screens/chains/base.svg +3 -0
- package/src/app/screens/chains/ethereum.svg +11 -0
- package/src/app/screens/chains/solana.svg +4 -0
- package/src/app/screens/chains/tempo.svg +4 -0
- package/src/app/server.ts +204 -0
- package/src/app/vite.config.ts +95 -0
- package/src/app/void.config.ts +29 -0
- package/src/app/zyzz.config.ts +274 -0
- package/src/cli/Admin.ts +73 -0
- package/src/cli/Apps.ts +29 -0
- package/src/cli/Cli.ts +42 -0
- package/src/cli/Project.ts +117 -0
- package/src/cli/Realms.ts +50 -0
- package/src/cli/Session.ts +239 -0
- package/src/cli/User.ts +45 -0
- package/src/cli/V1.ts +57 -0
- package/src/cli/bin.ts +44 -0
- package/src/cli/commands/admin/apps/create.ts +101 -0
- package/src/cli/commands/admin/apps/delete.ts +38 -0
- package/src/cli/commands/admin/apps/index.ts +15 -0
- package/src/cli/commands/admin/apps/list.ts +25 -0
- package/src/cli/commands/admin/apps/rotate-secret.ts +47 -0
- package/src/cli/commands/admin/apps/update.ts +86 -0
- package/src/cli/commands/admin/index.ts +14 -0
- package/src/cli/commands/admin/migrate.ts +16 -0
- package/src/cli/commands/admin/realms/add.ts +40 -0
- package/src/cli/commands/admin/realms/index.ts +14 -0
- package/src/cli/commands/admin/realms/list.ts +38 -0
- package/src/cli/commands/admin/realms/passkeys/index.ts +15 -0
- package/src/cli/commands/admin/realms/passkeys/set.ts +44 -0
- package/src/cli/commands/admin/realms/privy/index.ts +14 -0
- package/src/cli/commands/admin/realms/privy/set.ts +69 -0
- package/src/cli/commands/admin/realms/remove.ts +33 -0
- package/src/cli/commands/admin/realms/secp256k1/disable.ts +40 -0
- package/src/cli/commands/admin/realms/secp256k1/enable.ts +40 -0
- package/src/cli/commands/admin/realms/secp256k1/index.ts +19 -0
- package/src/cli/commands/admin/realms/set.ts +46 -0
- package/src/cli/commands/admin/rotate-key.ts +47 -0
- package/src/cli/commands/init.ts +42 -0
- package/src/cli/commands/login.ts +32 -0
- package/src/cli/commands/logout.ts +19 -0
- package/src/cli/commands/whoami.ts +23 -0
- package/src/client/Actions.ts +168 -0
- package/src/client/Auth.ts +285 -0
- package/src/client/Authorization.ts +34 -0
- package/src/client/Decorator.ts +410 -0
- package/src/client/Key.ts +140 -0
- package/src/client/Pending.ts +46 -0
- package/src/client/Permissions.ts +39 -0
- package/src/client/Provider.ts +18 -0
- package/src/client/Step.ts +24 -0
- package/src/client/Storage.ts +29 -0
- package/src/client/TempoAccount.ts +42 -0
- package/src/client/Tokens.ts +27 -0
- package/src/client/User.ts +23 -0
- package/src/client/actions/account.ts +57 -0
- package/src/client/actions/device.ts +151 -0
- package/src/client/actions/email.ts +141 -0
- package/src/client/actions/oauth.ts +182 -0
- package/src/client/actions/passkey.ts +141 -0
- package/src/client/actions/provider.ts +70 -0
- package/src/client/actions/realm.ts +36 -0
- package/src/client/actions/redirect.ts +408 -0
- package/src/client/internal/accessKey.ts +54 -0
- package/src/client/internal/account.ts +15 -0
- package/src/client/internal/api.ts +224 -0
- package/src/client/internal/headless.ts +77 -0
- package/src/client/internal/indexedDb.ts +44 -0
- package/src/client/internal/request.ts +71 -0
- package/src/client/internal/store.ts +20 -0
- package/src/client.ts +19 -0
- package/src/index.ts +6 -0
- package/src/internal/Apps.ts +718 -0
- package/src/internal/Auth.ts +203 -0
- package/src/internal/Authorize.ts +424 -0
- package/src/internal/Balance.ts +168 -0
- package/src/internal/BodyLimit.ts +36 -0
- package/src/internal/Chain.ts +16 -0
- package/src/internal/Device.ts +469 -0
- package/src/internal/Env.ts +58 -0
- package/src/internal/ErrorResponse.ts +854 -0
- package/src/internal/Id.ts +41 -0
- package/src/internal/KeyAuthorization.ts +1339 -0
- package/src/internal/Limits.ts +39 -0
- package/src/internal/Log.ts +178 -0
- package/src/internal/LogLine.ts +87 -0
- package/src/internal/Logout.ts +336 -0
- package/src/internal/Migrations.ts +86 -0
- package/src/internal/OpenApi.ts +300 -0
- package/src/internal/Owner.ts +211 -0
- package/src/internal/Passkey.ts +1052 -0
- package/src/internal/PendingKey.ts +104 -0
- package/src/internal/Privy.ts +402 -0
- package/src/internal/Provider.ts +125 -0
- package/src/internal/RateLimit.ts +259 -0
- package/src/internal/Realm.ts +768 -0
- package/src/internal/RequestId.ts +118 -0
- package/src/internal/SignInGrant.ts +168 -0
- package/src/internal/SigningKey.ts +286 -0
- package/src/internal/TempoAccount.ts +342 -0
- package/src/internal/TestInbox.ts +51 -0
- package/src/internal/Timing.ts +158 -0
- package/src/internal/Validation.ts +52 -0
- package/src/internal/Wallet.ts +62 -0
- package/src/internal/owners/Passkey.ts +72 -0
- package/src/internal/owners/Privy.ts +81 -0
- package/src/internal/owners/Secp256k1.ts +143 -0
- package/src/types/app.d.ts +19 -0
- package/src/worker.ts +11 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI's stored session: the signed-in user, the tokens, and the access key that `tempo-id
|
|
3
|
+
* login` receives through Tempo ID's device grant as the `tempo-cli` app. The session lives in
|
|
4
|
+
* `id/credentials.json` under `TEMPO_HOME`, in a file only the current user can read.
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import * as Fs from 'node:fs/promises'
|
|
8
|
+
import * as Os from 'node:os'
|
|
9
|
+
import * as Path from 'node:path'
|
|
10
|
+
import * as Actions from '../client/Actions.js'
|
|
11
|
+
import * as Auth from '../client/Auth.js'
|
|
12
|
+
import type * as Authorization from '../client/Authorization.js'
|
|
13
|
+
import * as Key from '../client/Key.js'
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A stored session, as `Actions.device.authorize` returns it, without its Viem account, and with
|
|
17
|
+
* the origin of the deployment that issued it.
|
|
18
|
+
*/
|
|
19
|
+
export type Session = Omit<Authorization.Authorization, 'account'> & {
|
|
20
|
+
/** The origin of the Tempo ID deployment that issued the tokens. */
|
|
21
|
+
url: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** The client ID of Tempo ID's own device app, which every CLI shares. */
|
|
25
|
+
export const clientId = 'tempo-cli'
|
|
26
|
+
|
|
27
|
+
/** Returns the client of Tempo ID at `url`, or at `https://id.tempo.xyz`, as `tempo-cli`. */
|
|
28
|
+
export function auth(options: auth.Options) {
|
|
29
|
+
return Auth.create({ clientId, url: options.url })
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export declare namespace auth {
|
|
33
|
+
type Options = {
|
|
34
|
+
/** Tempo ID's origin. Defaults to `https://id.tempo.xyz`. */
|
|
35
|
+
url?: string | undefined
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Returns the stored session, with its access token refreshed when it expires within 30 seconds.
|
|
41
|
+
* Returns `undefined` without a session, for a session without a user or an access key, or for one
|
|
42
|
+
* whose key expired or whose refresh fails, so the user signs in again. A session that another
|
|
43
|
+
* deployment issued also returns `undefined`, so its tokens never reach the deployment at `url`.
|
|
44
|
+
*/
|
|
45
|
+
export async function get(options: get.Options): Promise<Session | undefined> {
|
|
46
|
+
const read = await readSession(options)
|
|
47
|
+
const saved = read.status === 'found' ? read.session : undefined
|
|
48
|
+
if (
|
|
49
|
+
saved?.url !== new URL(auth(options).url).origin ||
|
|
50
|
+
!saved.user ||
|
|
51
|
+
!saved.key?.keyAuthorization ||
|
|
52
|
+
!saved.accessToken ||
|
|
53
|
+
Key.expired(saved.key)
|
|
54
|
+
)
|
|
55
|
+
return undefined
|
|
56
|
+
if (saved.expiresAt - 30_000 > Date.now()) return saved
|
|
57
|
+
if (!saved.refreshToken) return undefined
|
|
58
|
+
|
|
59
|
+
const tokens = await Actions.refresh(auth(options), {
|
|
60
|
+
refreshToken: saved.refreshToken,
|
|
61
|
+
}).catch(() => undefined)
|
|
62
|
+
if (!tokens) return undefined
|
|
63
|
+
return await save({ ...options, session: { ...saved, ...tokens } })
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export declare namespace get {
|
|
67
|
+
type Options = {
|
|
68
|
+
/** The folder that holds the session. Defaults to `~/.tempo`. */
|
|
69
|
+
home?: string | undefined
|
|
70
|
+
/** Tempo ID's origin. Defaults to `https://id.tempo.xyz`. */
|
|
71
|
+
url?: string | undefined
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Starts Tempo ID's device grant with a new access key, and returns the code to show and `wait`.
|
|
77
|
+
* `wait` resolves once the user approves the code in a browser, stores the new session, revokes the
|
|
78
|
+
* refresh token of the session that it replaced, and returns the new session. It rejects with
|
|
79
|
+
* `Auth.RequestError` when the user denies the code or the code expires.
|
|
80
|
+
*/
|
|
81
|
+
export async function login(options: login.Options) {
|
|
82
|
+
const client = auth(options)
|
|
83
|
+
const device = await Actions.device.authorize(client)
|
|
84
|
+
return {
|
|
85
|
+
...device,
|
|
86
|
+
async wait() {
|
|
87
|
+
const { account: _, ...authorization } = await device.wait()
|
|
88
|
+
const replaced = await readSession(options)
|
|
89
|
+
// The new session is stored first, so a failed write keeps the replaced one usable.
|
|
90
|
+
const session = await save({
|
|
91
|
+
home: options.home,
|
|
92
|
+
session: { ...authorization, url: new URL(client.url).origin },
|
|
93
|
+
})
|
|
94
|
+
// The replaced session's refresh token goes only to the deployment that issued it.
|
|
95
|
+
if (
|
|
96
|
+
replaced.status === 'found' &&
|
|
97
|
+
replaced.session.refreshToken &&
|
|
98
|
+
replaced.session.url
|
|
99
|
+
)
|
|
100
|
+
await revoke({
|
|
101
|
+
token: replaced.session.refreshToken,
|
|
102
|
+
url: replaced.session.url,
|
|
103
|
+
})
|
|
104
|
+
return session
|
|
105
|
+
},
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export declare namespace login {
|
|
110
|
+
type Options = get.Options
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Revokes the stored session's refresh token at the deployment that issued it, and deletes the
|
|
115
|
+
* session. A failed revocation, such as without a network, or a file that holds no readable
|
|
116
|
+
* session, still deletes it, and returns `false`.
|
|
117
|
+
*/
|
|
118
|
+
export async function remove(options: remove.Options) {
|
|
119
|
+
const read = await readSession(options)
|
|
120
|
+
const revoked = await (async () => {
|
|
121
|
+
if (read.status === 'missing') return true
|
|
122
|
+
if (read.status === 'invalid') return false
|
|
123
|
+
const { refreshToken, url } = read.session
|
|
124
|
+
if (!refreshToken) return true
|
|
125
|
+
// A session stored before its origin was recorded names no deployment to revoke it at.
|
|
126
|
+
if (!url) return false
|
|
127
|
+
return await revoke({ token: refreshToken, url })
|
|
128
|
+
})()
|
|
129
|
+
await Fs.rm(file(options), { force: true })
|
|
130
|
+
return revoked
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export declare namespace remove {
|
|
134
|
+
type Options = get.Options
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Stores `session`, readable only by the current user, and returns it. The session replaces the
|
|
139
|
+
* stored one in one rename, so a failed write leaves the earlier session as it was.
|
|
140
|
+
*/
|
|
141
|
+
export async function save(options: save.Options) {
|
|
142
|
+
const path = file(options)
|
|
143
|
+
await Fs.mkdir(Path.dirname(path), { mode: 0o700, recursive: true })
|
|
144
|
+
const temporary = `${path}.${crypto.randomUUID()}.tmp`
|
|
145
|
+
try {
|
|
146
|
+
await Fs.writeFile(temporary, JSON.stringify(options.session), {
|
|
147
|
+
flag: 'wx',
|
|
148
|
+
mode: 0o600,
|
|
149
|
+
})
|
|
150
|
+
await Fs.rename(temporary, path)
|
|
151
|
+
} catch (error) {
|
|
152
|
+
await Fs.rm(temporary, { force: true })
|
|
153
|
+
throw error
|
|
154
|
+
}
|
|
155
|
+
return options.session
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export declare namespace save {
|
|
159
|
+
type Options = {
|
|
160
|
+
/** The folder that holds the session. Defaults to `~/.tempo`. */
|
|
161
|
+
home?: string | undefined
|
|
162
|
+
/** The session to store. */
|
|
163
|
+
session: Session
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Returns the signed-in user's email, from Tempo ID's UserInfo endpoint, and the Tempo Account that
|
|
169
|
+
* the session's access key acts for. Returns `undefined` without a session.
|
|
170
|
+
*/
|
|
171
|
+
export async function whoami(options: whoami.Options) {
|
|
172
|
+
const session = await get(options)
|
|
173
|
+
if (!session) return undefined
|
|
174
|
+
// The UserInfo endpoint accepts the access token, as any Tempo API does.
|
|
175
|
+
const user = await Actions.oauth.userInfo(auth(options), {
|
|
176
|
+
accessToken: session.accessToken,
|
|
177
|
+
})
|
|
178
|
+
return { account: session.key.account, email: user.email }
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export declare namespace whoami {
|
|
182
|
+
type Options = get.Options
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** Returns the path of the session's file under `home`, or under `~/.tempo` for an unset or empty `home`. */
|
|
186
|
+
function file(options: { home?: string | undefined }) {
|
|
187
|
+
return Path.join(
|
|
188
|
+
options.home || Path.join(Os.homedir(), '.tempo'),
|
|
189
|
+
'id',
|
|
190
|
+
'credentials.json',
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Reads the stored session. Returns `missing` without a file, and `invalid` for a file that holds
|
|
196
|
+
* no JSON object.
|
|
197
|
+
*/
|
|
198
|
+
async function readSession(options: { home?: string | undefined }) {
|
|
199
|
+
type Result =
|
|
200
|
+
| { status: 'found'; session: Session }
|
|
201
|
+
| { status: 'invalid' }
|
|
202
|
+
| { status: 'missing' }
|
|
203
|
+
return await Fs.readFile(file(options), 'utf8').then(
|
|
204
|
+
(text): Result => {
|
|
205
|
+
const session = (() => {
|
|
206
|
+
try {
|
|
207
|
+
return JSON.parse(text) as unknown
|
|
208
|
+
} catch {
|
|
209
|
+
return undefined
|
|
210
|
+
}
|
|
211
|
+
})()
|
|
212
|
+
if (typeof session !== 'object' || !session) return { status: 'invalid' }
|
|
213
|
+
return { session: session as Session, status: 'found' }
|
|
214
|
+
},
|
|
215
|
+
(error: unknown): Result => {
|
|
216
|
+
if ((error as { code?: unknown }).code === 'ENOENT')
|
|
217
|
+
return { status: 'missing' }
|
|
218
|
+
return { status: 'invalid' }
|
|
219
|
+
},
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Revokes `token` at the revocation endpoint (RFC 7009) of the deployment at `url`, and returns
|
|
225
|
+
* whether it succeeded. A deployment that does not respond within 10 seconds counts as a failure.
|
|
226
|
+
*/
|
|
227
|
+
async function revoke(options: { token: string; url: string }) {
|
|
228
|
+
const response = await fetch(new URL('/oauth2/revoke', options.url), {
|
|
229
|
+
body: new URLSearchParams({
|
|
230
|
+
client_id: clientId,
|
|
231
|
+
token: options.token,
|
|
232
|
+
token_type_hint: 'refresh_token',
|
|
233
|
+
}),
|
|
234
|
+
method: 'POST',
|
|
235
|
+
signal: AbortSignal.timeout(10_000),
|
|
236
|
+
}).catch(() => undefined)
|
|
237
|
+
await response?.body?.cancel()
|
|
238
|
+
return response?.ok ?? false
|
|
239
|
+
}
|
package/src/cli/User.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the `login`, `logout`, and `whoami` commands share: the variables that name Tempo ID and the
|
|
3
|
+
* session's folder, and the loader of the session module. incur imports every command when the CLI
|
|
4
|
+
* starts, so this module imports only incur, and the session module loads only when these commands
|
|
5
|
+
* run.
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'incur'
|
|
9
|
+
import * as Admin from './Admin.js'
|
|
10
|
+
|
|
11
|
+
/** The variables that name Tempo ID and the folder of the stored session. */
|
|
12
|
+
export const env = z.object({
|
|
13
|
+
TEMPO_HOME: z
|
|
14
|
+
.string()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe(
|
|
17
|
+
'The folder that holds the session, in id/credentials.json. Defaults to ~/.tempo.',
|
|
18
|
+
),
|
|
19
|
+
TEMPO_ID_URL: z
|
|
20
|
+
.url()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Tempo ID's origin. Defaults to https://id.tempo.xyz."),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
/** The error for a command without Viem, which creates and signs with the access key. */
|
|
26
|
+
export const missingPeers = {
|
|
27
|
+
code: 'missing_peer',
|
|
28
|
+
message:
|
|
29
|
+
'Missing peer dependency. Install viem to run login, logout, and whoami.',
|
|
30
|
+
} as const
|
|
31
|
+
|
|
32
|
+
/** The error for a command that needs a session, and finds none. */
|
|
33
|
+
export const signedOut = {
|
|
34
|
+
code: 'signed_out',
|
|
35
|
+
message: 'Not signed in. Run `tempo-id login`.',
|
|
36
|
+
} as const
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Loads the session module, or returns `undefined` when Viem, the client's optional peer, is not
|
|
40
|
+
* installed.
|
|
41
|
+
*/
|
|
42
|
+
export async function loadSession() {
|
|
43
|
+
// A dynamic import, since the module needs an optional peer that the other commands do not.
|
|
44
|
+
return await Admin.optional(import('./Session.js'))
|
|
45
|
+
}
|
package/src/cli/V1.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `tempo-id v1` command group: one command per `/v1` route of a Tempo ID deployment, which incur
|
|
3
|
+
* generates from the deployment's OpenAPI document in its namespace mode, such as `tempo-id v1 auth
|
|
4
|
+
* providers` for `GET /v1/auth/providers`. The commands send no session, so the routes that need
|
|
5
|
+
* one refuse them with status 401.
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Fetches the OpenAPI document of the deployment at `url`, and returns the `v1` group's definition.
|
|
10
|
+
* The document keeps only the `/v1` routes, without the `/v1` prefix, which the group's name and
|
|
11
|
+
* base path supply. Rejects when the deployment does not respond within 10 seconds, or responds
|
|
12
|
+
* with an error.
|
|
13
|
+
*/
|
|
14
|
+
export async function load(options: load.Options) {
|
|
15
|
+
const { url } = options
|
|
16
|
+
const fetch = options.fetch ?? globalThis.fetch
|
|
17
|
+
const response = await fetch(new URL('/openapi.json', url), {
|
|
18
|
+
signal: AbortSignal.timeout(10_000),
|
|
19
|
+
})
|
|
20
|
+
if (!response.ok)
|
|
21
|
+
throw new Error(
|
|
22
|
+
`Tempo ID at ${url} responded to /openapi.json with ${response.status}.`,
|
|
23
|
+
)
|
|
24
|
+
const document = (await response.json()) as {
|
|
25
|
+
paths?: Record<string, unknown> | undefined
|
|
26
|
+
}
|
|
27
|
+
const paths = Object.fromEntries(
|
|
28
|
+
Object.entries(document.paths ?? {}).flatMap(([path, item]) =>
|
|
29
|
+
path.startsWith('/v1/') ? [[path.slice('/v1'.length), item]] : [],
|
|
30
|
+
),
|
|
31
|
+
)
|
|
32
|
+
return {
|
|
33
|
+
basePath: '/v1',
|
|
34
|
+
description: "Call Tempo ID's /v1 API, one command per route.",
|
|
35
|
+
// Each request goes to the deployment, whatever origin incur builds it with. The path is set on
|
|
36
|
+
// the deployment's URL, never resolved against it, so a path argument such as `//host` keeps
|
|
37
|
+
// the deployment's origin.
|
|
38
|
+
fetch: (request: Request) => {
|
|
39
|
+
const source = new URL(request.url)
|
|
40
|
+
const target = new URL(url)
|
|
41
|
+
target.pathname = source.pathname
|
|
42
|
+
target.search = source.search
|
|
43
|
+
return fetch(new Request(target, request))
|
|
44
|
+
},
|
|
45
|
+
openapi: { ...document, paths },
|
|
46
|
+
openapiConfig: { mode: 'namespace' as const },
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export declare namespace load {
|
|
51
|
+
type Options = {
|
|
52
|
+
/** The fetch that reaches the deployment. Defaults to the global `fetch`. */
|
|
53
|
+
fetch?: typeof globalThis.fetch | undefined
|
|
54
|
+
/** Tempo ID's origin. */
|
|
55
|
+
url: string
|
|
56
|
+
}
|
|
57
|
+
}
|
package/src/cli/bin.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Runs the `tempo-id` CLI with the process's arguments. Only `v1` and `--mcp` load Tempo ID's
|
|
4
|
+
* OpenAPI document, so every other command starts without the network. When the deployment does not
|
|
5
|
+
* respond, a `v1` command exits with code 1, and an MCP server serves the other commands. Both warn
|
|
6
|
+
* on stderr.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import * as Cli from './Cli.js'
|
|
10
|
+
import * as V1 from './V1.js'
|
|
11
|
+
|
|
12
|
+
const argv = process.argv.slice(2)
|
|
13
|
+
const url = process.env.TEMPO_ID_URL ?? 'https://id.tempo.xyz'
|
|
14
|
+
/** incur's global options that take a value, which the command follows. */
|
|
15
|
+
const valued = [
|
|
16
|
+
'--filter-output',
|
|
17
|
+
'--format',
|
|
18
|
+
'--token-limit',
|
|
19
|
+
'--token-offset',
|
|
20
|
+
]
|
|
21
|
+
// The command is the first argument that is no option, since global options, such as
|
|
22
|
+
// `--format json`, can come before it. An argument of another command can be `v1` too.
|
|
23
|
+
const command = (() => {
|
|
24
|
+
for (let index = 0; index < argv.length; index++) {
|
|
25
|
+
const entry = argv[index]!
|
|
26
|
+
if (!entry.startsWith('-')) return entry
|
|
27
|
+
if (valued.includes(entry)) index++
|
|
28
|
+
}
|
|
29
|
+
return undefined
|
|
30
|
+
})()
|
|
31
|
+
const group = command === 'v1'
|
|
32
|
+
const v1 = await (async () => {
|
|
33
|
+
if (!group && !argv.includes('--mcp')) return undefined
|
|
34
|
+
return await V1.load({ url }).catch((error: unknown) => {
|
|
35
|
+
process.stderr.write(
|
|
36
|
+
`The v1 commands are unavailable: ${error instanceof Error ? error.message : String(error)}\n`,
|
|
37
|
+
)
|
|
38
|
+
return null
|
|
39
|
+
})
|
|
40
|
+
})()
|
|
41
|
+
|
|
42
|
+
// A `v1` command fails without its group. An MCP server serves the other commands.
|
|
43
|
+
if (v1 === null && group) process.exitCode = 1
|
|
44
|
+
else await Cli.create({ v1: v1 ?? undefined }).serve()
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `tempo-id admin apps create`: registers an OAuth app. The output holds the client secret, which no
|
|
3
|
+
* later command returns.
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { Cli, z } from 'incur'
|
|
7
|
+
import * as Admin from '../../../Admin.js'
|
|
8
|
+
|
|
9
|
+
export default Cli.command({
|
|
10
|
+
description:
|
|
11
|
+
'Register an OAuth app. The output holds its client secret, which no later command returns.',
|
|
12
|
+
env: Admin.env.extend({
|
|
13
|
+
TEMPO_ID_CLIENT_SECRET: z
|
|
14
|
+
.string()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe(
|
|
17
|
+
'Client secret to keep with --secret, such as one that another deployment issued. No flag takes it, so it stays out of the shell history.',
|
|
18
|
+
),
|
|
19
|
+
}),
|
|
20
|
+
// Hidden from MCP clients, as is every `admin apps` command, since the group returns client secrets.
|
|
21
|
+
mcp: false,
|
|
22
|
+
options: Admin.options.extend({
|
|
23
|
+
clientId: z
|
|
24
|
+
.string()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe(
|
|
27
|
+
'Client ID to keep, such as one that another deployment issued. Defaults to a random ID.',
|
|
28
|
+
),
|
|
29
|
+
device: z
|
|
30
|
+
.boolean()
|
|
31
|
+
.default(false)
|
|
32
|
+
.describe(
|
|
33
|
+
'Sign in through the device grant instead of a redirect, as a CLI does. A device app needs no redirect URI.',
|
|
34
|
+
),
|
|
35
|
+
name: z.string().describe('Display name, which the approval page shows.'),
|
|
36
|
+
native: z
|
|
37
|
+
.boolean()
|
|
38
|
+
.default(false)
|
|
39
|
+
.describe('Register a mobile app instead of a web app.'),
|
|
40
|
+
postLogoutRedirectUri: z
|
|
41
|
+
.array(z.string())
|
|
42
|
+
.default([])
|
|
43
|
+
.describe(
|
|
44
|
+
'URI that the app returns to after it ends the session. Repeat the flag for each URI.',
|
|
45
|
+
),
|
|
46
|
+
redirectUri: z
|
|
47
|
+
.array(z.string())
|
|
48
|
+
.default([])
|
|
49
|
+
.describe(
|
|
50
|
+
'Redirect URI. Repeat the flag for each URI, in each environment. Every app but a device app needs one.',
|
|
51
|
+
),
|
|
52
|
+
secret: z
|
|
53
|
+
.boolean()
|
|
54
|
+
.default(false)
|
|
55
|
+
.describe(
|
|
56
|
+
'Issue a client secret, for an app with a backend. TEMPO_ID_CLIENT_SECRET sets it instead of a new one.',
|
|
57
|
+
),
|
|
58
|
+
sign: z
|
|
59
|
+
.boolean()
|
|
60
|
+
.default(false)
|
|
61
|
+
.describe(
|
|
62
|
+
'Grant the tempo-id:sign scope, which permits the app to bind its own challenges.',
|
|
63
|
+
),
|
|
64
|
+
skipConsent: z
|
|
65
|
+
.boolean()
|
|
66
|
+
.default(false)
|
|
67
|
+
.describe('Skip the approval page for requests without a key.'),
|
|
68
|
+
}),
|
|
69
|
+
async run(c) {
|
|
70
|
+
const connectionString = c.options.databaseUrl ?? c.env.DATABASE_URL
|
|
71
|
+
if (!connectionString) return c.error(Admin.missingDatabaseUrl)
|
|
72
|
+
|
|
73
|
+
const Apps = await Admin.loadApps()
|
|
74
|
+
if (!Apps) return c.error(Admin.missingPeers)
|
|
75
|
+
|
|
76
|
+
const client = Apps.connect({ connectionString })
|
|
77
|
+
try {
|
|
78
|
+
return await Apps.Apps.create(client.db, {
|
|
79
|
+
clientId: c.options.clientId,
|
|
80
|
+
// The variable applies only with `--secret`, so an exported one never makes an app confidential.
|
|
81
|
+
clientSecret: c.options.secret
|
|
82
|
+
? c.env.TEMPO_ID_CLIENT_SECRET
|
|
83
|
+
: undefined,
|
|
84
|
+
device: c.options.device,
|
|
85
|
+
name: c.options.name,
|
|
86
|
+
postLogoutRedirectUris: c.options.postLogoutRedirectUri,
|
|
87
|
+
redirectUris: c.options.redirectUri,
|
|
88
|
+
secret: c.options.secret,
|
|
89
|
+
sign: c.options.sign,
|
|
90
|
+
skipConsent: c.options.skipConsent,
|
|
91
|
+
type: c.options.native ? 'native' : 'web',
|
|
92
|
+
})
|
|
93
|
+
} catch (error) {
|
|
94
|
+
const refusal = Apps.error(error)
|
|
95
|
+
if (refusal) return c.error(refusal)
|
|
96
|
+
throw error
|
|
97
|
+
} finally {
|
|
98
|
+
await client.end()
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
})
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `tempo-id admin apps delete`: removes an OAuth app, with its consents, tokens, and realms.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
import { Cli, z } from 'incur'
|
|
6
|
+
import * as Admin from '../../../Admin.js'
|
|
7
|
+
|
|
8
|
+
export default Cli.command({
|
|
9
|
+
args: z.object({
|
|
10
|
+
clientId: z.string().describe("OAuth app's client ID."),
|
|
11
|
+
}),
|
|
12
|
+
description: 'Remove an app, with its consents, tokens, and realms.',
|
|
13
|
+
env: Admin.env,
|
|
14
|
+
// Hidden from MCP clients, as is every `admin apps` command, since the group returns client secrets.
|
|
15
|
+
mcp: false,
|
|
16
|
+
options: Admin.options,
|
|
17
|
+
async run(c) {
|
|
18
|
+
const connectionString = c.options.databaseUrl ?? c.env.DATABASE_URL
|
|
19
|
+
if (!connectionString) return c.error(Admin.missingDatabaseUrl)
|
|
20
|
+
|
|
21
|
+
const Apps = await Admin.loadApps()
|
|
22
|
+
if (!Apps) return c.error(Admin.missingPeers)
|
|
23
|
+
|
|
24
|
+
const client = Apps.connect({ connectionString })
|
|
25
|
+
try {
|
|
26
|
+
const app = await Apps.Apps.remove(client.db, {
|
|
27
|
+
clientId: c.args.clientId,
|
|
28
|
+
})
|
|
29
|
+
return { removed: app.clientId }
|
|
30
|
+
} catch (error) {
|
|
31
|
+
const refusal = Apps.error(error)
|
|
32
|
+
if (refusal) return c.error(refusal)
|
|
33
|
+
throw error
|
|
34
|
+
} finally {
|
|
35
|
+
await client.end()
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** `tempo-id admin apps`: the commands that register and change OAuth apps. @module */
|
|
2
|
+
import { Cli } from 'incur'
|
|
3
|
+
|
|
4
|
+
export default Cli.command({
|
|
5
|
+
description: 'Manage OAuth apps, their redirect URIs, and their scopes.',
|
|
6
|
+
// Hidden from MCP clients, as is every `admin apps` command, since the group returns client secrets.
|
|
7
|
+
mcp: false,
|
|
8
|
+
run(c) {
|
|
9
|
+
return c.error({
|
|
10
|
+
code: 'missing_command',
|
|
11
|
+
message:
|
|
12
|
+
'Missing command. Run `tempo-id admin apps --help` to list the commands.',
|
|
13
|
+
})
|
|
14
|
+
},
|
|
15
|
+
})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** `tempo-id admin apps list`: lists every OAuth app, oldest first. @module */
|
|
2
|
+
import { Cli } from 'incur'
|
|
3
|
+
import * as Admin from '../../../Admin.js'
|
|
4
|
+
|
|
5
|
+
export default Cli.command({
|
|
6
|
+
description: 'List every OAuth app, oldest first.',
|
|
7
|
+
env: Admin.env,
|
|
8
|
+
// Hidden from MCP clients, as is every `admin apps` command, since the group returns client secrets.
|
|
9
|
+
mcp: false,
|
|
10
|
+
options: Admin.options,
|
|
11
|
+
async run(c) {
|
|
12
|
+
const connectionString = c.options.databaseUrl ?? c.env.DATABASE_URL
|
|
13
|
+
if (!connectionString) return c.error(Admin.missingDatabaseUrl)
|
|
14
|
+
|
|
15
|
+
const Apps = await Admin.loadApps()
|
|
16
|
+
if (!Apps) return c.error(Admin.missingPeers)
|
|
17
|
+
|
|
18
|
+
const client = Apps.connect({ connectionString })
|
|
19
|
+
try {
|
|
20
|
+
return { apps: await Apps.Apps.list(client.db) }
|
|
21
|
+
} finally {
|
|
22
|
+
await client.end()
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
})
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `tempo-id admin apps rotate-secret`: replaces an OAuth app's client secret. The earlier secret
|
|
3
|
+
* stops working at once, and the output holds the new one.
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { Cli, z } from 'incur'
|
|
7
|
+
import * as Admin from '../../../Admin.js'
|
|
8
|
+
|
|
9
|
+
export default Cli.command({
|
|
10
|
+
args: z.object({
|
|
11
|
+
clientId: z.string().describe("OAuth app's client ID."),
|
|
12
|
+
}),
|
|
13
|
+
description:
|
|
14
|
+
"Replace an app's client secret. The earlier secret stops working at once.",
|
|
15
|
+
env: Admin.env.extend({
|
|
16
|
+
TEMPO_ID_CLIENT_SECRET: z
|
|
17
|
+
.string()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe(
|
|
20
|
+
'New client secret, such as one that another deployment issued. No flag takes it, so it stays out of the shell history. Defaults to a random secret.',
|
|
21
|
+
),
|
|
22
|
+
}),
|
|
23
|
+
// Hidden from MCP clients, as is every `admin apps` command, since the group returns client secrets.
|
|
24
|
+
mcp: false,
|
|
25
|
+
options: Admin.options,
|
|
26
|
+
async run(c) {
|
|
27
|
+
const connectionString = c.options.databaseUrl ?? c.env.DATABASE_URL
|
|
28
|
+
if (!connectionString) return c.error(Admin.missingDatabaseUrl)
|
|
29
|
+
|
|
30
|
+
const Apps = await Admin.loadApps()
|
|
31
|
+
if (!Apps) return c.error(Admin.missingPeers)
|
|
32
|
+
|
|
33
|
+
const client = Apps.connect({ connectionString })
|
|
34
|
+
try {
|
|
35
|
+
return await Apps.Apps.rotateSecret(client.db, {
|
|
36
|
+
clientId: c.args.clientId,
|
|
37
|
+
clientSecret: c.env.TEMPO_ID_CLIENT_SECRET,
|
|
38
|
+
})
|
|
39
|
+
} catch (error) {
|
|
40
|
+
const refusal = Apps.error(error)
|
|
41
|
+
if (refusal) return c.error(refusal)
|
|
42
|
+
throw error
|
|
43
|
+
} finally {
|
|
44
|
+
await client.end()
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
})
|