@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,410 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `tempoId`, a Viem client extension that adds Tempo ID's actions as `client.auth`. It reads the
|
|
3
|
+
* chain from the client, and sets the client's {@link Auth.Account} at each sign-in, so the client
|
|
4
|
+
* sends with the signed-in user's access key.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { Auth, tempoId } from '@tempoxyz/id/client'
|
|
9
|
+
* import { createClient } from 'viem/tempo'
|
|
10
|
+
* import { tempoTestnet } from 'viem/tempo/chains'
|
|
11
|
+
*
|
|
12
|
+
* const client = createClient({
|
|
13
|
+
* account: Auth.account(),
|
|
14
|
+
* chain: tempoTestnet,
|
|
15
|
+
* }).extend(tempoId({ clientId: 'client_…' }))
|
|
16
|
+
*
|
|
17
|
+
* await client.auth.email.signIn({ code, email })
|
|
18
|
+
* await client.token.transferSync({ amount, to, token })
|
|
19
|
+
* ```
|
|
20
|
+
* @module
|
|
21
|
+
*/
|
|
22
|
+
import type { Chain, Client, Transport } from 'viem'
|
|
23
|
+
import type { Account as ViemAccount } from 'viem/tempo'
|
|
24
|
+
import * as Actions from './Actions.js'
|
|
25
|
+
import * as Auth from './Auth.js'
|
|
26
|
+
import type { Authorization } from './Authorization.js'
|
|
27
|
+
import * as AccountState from './internal/account.js'
|
|
28
|
+
import * as Key from './Key.js'
|
|
29
|
+
import type * as Pending from './Pending.js'
|
|
30
|
+
import type { User } from './User.js'
|
|
31
|
+
|
|
32
|
+
/** A client created without `account: Auth.account()`, which the extension sets at sign-in. */
|
|
33
|
+
export class AccountRequiredError extends Error {
|
|
34
|
+
override readonly name = 'Decorator.AccountRequiredError'
|
|
35
|
+
|
|
36
|
+
constructor() {
|
|
37
|
+
super(
|
|
38
|
+
'The client has no Tempo ID account. Create the client with `account: Auth.account()`.',
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** A client created without a chain, which the extension reads the instance's `chainId` from. */
|
|
44
|
+
export class ChainRequiredError extends Error {
|
|
45
|
+
override readonly name = 'Decorator.ChainRequiredError'
|
|
46
|
+
|
|
47
|
+
constructor() {
|
|
48
|
+
super('The client has no chain. Create the client with a Tempo `chain`.')
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A sign-in that another sign-in or a sign-out overtook. The client keeps the newer state, so the
|
|
54
|
+
* overtaken authorization is never returned to sign with.
|
|
55
|
+
*/
|
|
56
|
+
export class SupersededError extends Error {
|
|
57
|
+
override readonly name = 'Decorator.SupersededError'
|
|
58
|
+
|
|
59
|
+
constructor() {
|
|
60
|
+
super(
|
|
61
|
+
'Another sign-in or a sign-out completed while this sign-in was pending. Sign in again.',
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Returns a Viem client extension that adds Tempo ID's actions as `client.auth`. Each member calls
|
|
68
|
+
* the action of the same name in `Actions` with one instance, whose `chainId` is the client's chain.
|
|
69
|
+
* Each sign-in sets the client's account to the authorization's, and `signOut` empties it at once.
|
|
70
|
+
* A sign-in that another sign-in or a sign-out overtook throws {@link SupersededError}. Throws
|
|
71
|
+
* {@link ChainRequiredError} for a client without a chain, and {@link AccountRequiredError} for one
|
|
72
|
+
* whose account is not an `Auth.account()`.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* const client = createClient({
|
|
77
|
+
* account: Auth.account(),
|
|
78
|
+
* chain: tempoTestnet,
|
|
79
|
+
* }).extend(tempoId({ clientId: 'client_…' }))
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export function tempoId(options: tempoId.Options) {
|
|
83
|
+
return <transport extends Transport, chain extends Chain>(
|
|
84
|
+
client: Client<transport, chain, Auth.Account>,
|
|
85
|
+
): tempoId.Decorator<chain['id']> => {
|
|
86
|
+
if (!client.chain) throw new ChainRequiredError()
|
|
87
|
+
const state = (client.account as Partial<Auth.Account> | undefined)?.[
|
|
88
|
+
AccountState.key
|
|
89
|
+
]
|
|
90
|
+
if (!state) throw new AccountRequiredError()
|
|
91
|
+
|
|
92
|
+
const auth = Auth.create({ ...options, chainId: client.chain.id })
|
|
93
|
+
|
|
94
|
+
// Counts changes to the client's account. Each sign-in applies its result only when no other
|
|
95
|
+
// sign-in or sign-out completed after it began. A stale result never replaces a newer one,
|
|
96
|
+
// and a sign-in still pending at sign-out never signs the client back in.
|
|
97
|
+
let version = 0
|
|
98
|
+
// The version that the latest sign-out produced, until another change follows it.
|
|
99
|
+
let signedOut: number | undefined
|
|
100
|
+
// The redirect result that `complete` settled on this page load.
|
|
101
|
+
let completing:
|
|
102
|
+
| Promise<Actions.redirect.complete.ReturnType<boolean>>
|
|
103
|
+
| undefined
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Begins an operation that changes the client's account. `apply` applies its result: the
|
|
107
|
+
* account to sign with, or `undefined` to stop signing. `check` accepts a result that changes
|
|
108
|
+
* no account, such as a step. Applying an account, or checking a step, that a newer change
|
|
109
|
+
* overtook throws {@link SupersededError}. The caller never holds a result that the
|
|
110
|
+
* client's newer state contradicts. `settle` applies a result's account, or empties the account
|
|
111
|
+
* for a result without a key. `fail` rethrows the operation's error, or throws `SupersededError`
|
|
112
|
+
* when a newer change overtook it, so the caller never acts on a stale refusal. A refusal marked
|
|
113
|
+
* `signedIn` also empties the account, since the user whom the sign-in signed in does not hold it.
|
|
114
|
+
*/
|
|
115
|
+
const begin = () => {
|
|
116
|
+
const started = version
|
|
117
|
+
// A sign-in that finishes after sign-out can set a new server session, so it ends that
|
|
118
|
+
// session again, unless a newer change already followed the sign-out.
|
|
119
|
+
const superseded = async () => {
|
|
120
|
+
if (signedOut === version) await Actions.signOut(auth)
|
|
121
|
+
return new SupersededError()
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
async apply(account: ViemAccount.AccessKeyAccount | undefined) {
|
|
125
|
+
if (version !== started) {
|
|
126
|
+
if (account) throw await superseded()
|
|
127
|
+
return
|
|
128
|
+
}
|
|
129
|
+
state.account = account
|
|
130
|
+
version++
|
|
131
|
+
},
|
|
132
|
+
async check() {
|
|
133
|
+
if (version !== started) throw await superseded()
|
|
134
|
+
},
|
|
135
|
+
// An arrow function, which `catch` takes unbound.
|
|
136
|
+
fail: async (error: unknown): Promise<never> => {
|
|
137
|
+
if (version !== started) throw await superseded()
|
|
138
|
+
if (error instanceof Auth.RequestError && error.signedIn) {
|
|
139
|
+
state.account = undefined
|
|
140
|
+
version++
|
|
141
|
+
}
|
|
142
|
+
throw error
|
|
143
|
+
},
|
|
144
|
+
async settle(
|
|
145
|
+
result: Authorization | Actions.redirect.handleCallback.WithoutKey,
|
|
146
|
+
) {
|
|
147
|
+
if ('account' in result) return this.apply(result.account)
|
|
148
|
+
// The check and the change run with no `await` between them, so no other change lands
|
|
149
|
+
// after the check, and an overtaken result throws even without an account.
|
|
150
|
+
if (version !== started) throw await superseded()
|
|
151
|
+
state.account = undefined
|
|
152
|
+
version++
|
|
153
|
+
},
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return {
|
|
158
|
+
auth: {
|
|
159
|
+
account: {
|
|
160
|
+
get: () => Actions.account.get(auth),
|
|
161
|
+
},
|
|
162
|
+
async authorize(options = {}) {
|
|
163
|
+
const change = begin()
|
|
164
|
+
const authorization = await Actions.authorize(auth, options)
|
|
165
|
+
// Without a session, the client stops signing as the user it last authorized.
|
|
166
|
+
if (authorization) await change.settle(authorization)
|
|
167
|
+
else await change.apply(undefined)
|
|
168
|
+
return authorization
|
|
169
|
+
},
|
|
170
|
+
device: {
|
|
171
|
+
async authorize(options = {}) {
|
|
172
|
+
const change = begin()
|
|
173
|
+
const device = await Actions.device.authorize(auth, options)
|
|
174
|
+
return {
|
|
175
|
+
...device,
|
|
176
|
+
async wait() {
|
|
177
|
+
const authorization = await device.wait()
|
|
178
|
+
await change.apply(authorization.account)
|
|
179
|
+
return authorization
|
|
180
|
+
},
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
email: {
|
|
185
|
+
sendCode: (options) => Actions.email.sendCode(auth, options),
|
|
186
|
+
async signIn(options) {
|
|
187
|
+
const change = begin()
|
|
188
|
+
const authorization = await Actions.email
|
|
189
|
+
.signIn(auth, options)
|
|
190
|
+
.catch(change.fail)
|
|
191
|
+
await change.settle(authorization)
|
|
192
|
+
return authorization
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
instance: auth,
|
|
196
|
+
oauth: {
|
|
197
|
+
introspect: (options) => Actions.oauth.introspect(auth, options),
|
|
198
|
+
jwks: () => Actions.oauth.jwks(auth),
|
|
199
|
+
userInfo: (options) => Actions.oauth.userInfo(auth, options),
|
|
200
|
+
},
|
|
201
|
+
passkey: {
|
|
202
|
+
async signIn(options = {}) {
|
|
203
|
+
const change = begin()
|
|
204
|
+
const result = await Actions.passkey
|
|
205
|
+
.signIn(auth, options)
|
|
206
|
+
.catch(change.fail)
|
|
207
|
+
if ('step' in result) await change.check()
|
|
208
|
+
else await change.settle(result)
|
|
209
|
+
return result
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
provider: {
|
|
213
|
+
list: () => Actions.provider.list(auth),
|
|
214
|
+
signIn: (options) => Actions.provider.signIn(auth, options),
|
|
215
|
+
},
|
|
216
|
+
realm: {
|
|
217
|
+
list: () => Actions.realm.list(auth),
|
|
218
|
+
},
|
|
219
|
+
redirect: {
|
|
220
|
+
complete(options = {}) {
|
|
221
|
+
// A page load settles its redirect once, so a later call never applies a result that a
|
|
222
|
+
// newer sign-in replaced.
|
|
223
|
+
completing ??= (async () => {
|
|
224
|
+
const change = begin()
|
|
225
|
+
const authorization = await Actions.redirect.complete(
|
|
226
|
+
auth,
|
|
227
|
+
options,
|
|
228
|
+
)
|
|
229
|
+
// `undefined` means the page is not a callback, which shows nothing about the session.
|
|
230
|
+
if (authorization) await change.settle(authorization)
|
|
231
|
+
return authorization
|
|
232
|
+
})()
|
|
233
|
+
// The first call's `key` typed the settled result, which later calls share.
|
|
234
|
+
return completing as never
|
|
235
|
+
},
|
|
236
|
+
createUrl: (options = {}) =>
|
|
237
|
+
Actions.redirect.createUrl(auth, options),
|
|
238
|
+
async handleCallback(options) {
|
|
239
|
+
const change = begin()
|
|
240
|
+
const authorization = await Actions.redirect.handleCallback(
|
|
241
|
+
auth,
|
|
242
|
+
options,
|
|
243
|
+
)
|
|
244
|
+
await change.settle(authorization)
|
|
245
|
+
return authorization
|
|
246
|
+
},
|
|
247
|
+
start: (options = {}) => Actions.redirect.start(auth, options),
|
|
248
|
+
},
|
|
249
|
+
refresh: (options) => Actions.refresh(auth, options),
|
|
250
|
+
restore: (authorization, options = {}) => {
|
|
251
|
+
// A sign-in stored before `Key.chainId` existed gains it here.
|
|
252
|
+
const key = Key.from(authorization.key)
|
|
253
|
+
const account = Key.toAccount(key, options)
|
|
254
|
+
state.account = account
|
|
255
|
+
version++
|
|
256
|
+
return { ...authorization, account, key }
|
|
257
|
+
},
|
|
258
|
+
async signOut() {
|
|
259
|
+
// The client stops signing at once, even when the request fails, and any sign-in still
|
|
260
|
+
// pending is discarded, since the user asked to leave.
|
|
261
|
+
state.account = undefined
|
|
262
|
+
version++
|
|
263
|
+
signedOut = version
|
|
264
|
+
await Actions.signOut(auth)
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export declare namespace tempoId {
|
|
272
|
+
/** `Auth.create`'s options, without `chainId`, which the extension reads from the client. */
|
|
273
|
+
type Options = Omit<Auth.create.Options, 'chainId'>
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* What the extension adds to a client on the chain `chainId`. Each member's `permissions.chainId`
|
|
277
|
+
* defaults to `chainId`, and an override names another chain.
|
|
278
|
+
*/
|
|
279
|
+
type Decorator<chainId extends number> = {
|
|
280
|
+
/** Tempo ID's actions, with the extension's instance. */
|
|
281
|
+
auth: {
|
|
282
|
+
/** Actions for the user's Tempo Account. */
|
|
283
|
+
account: {
|
|
284
|
+
/** `Actions.account.get`. */
|
|
285
|
+
get: () => Promise<Actions.account.get.ReturnType>
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* `Actions.authorize`, which sets the client's account, or empties it for an authorization
|
|
289
|
+
* without a key or a user without a session.
|
|
290
|
+
*/
|
|
291
|
+
authorize: <
|
|
292
|
+
const id extends number = chainId,
|
|
293
|
+
const key extends boolean = true,
|
|
294
|
+
>(
|
|
295
|
+
options?: Actions.authorize.Options<id, key>,
|
|
296
|
+
) => Promise<Actions.authorize.ReturnType<id, key>>
|
|
297
|
+
/** Actions for device authorization grants. */
|
|
298
|
+
device: {
|
|
299
|
+
/** `Actions.device.authorize`, whose `wait` sets the client's account. */
|
|
300
|
+
authorize: <const id extends number = chainId>(
|
|
301
|
+
options?: Actions.device.authorize.Options<id>,
|
|
302
|
+
) => Promise<Actions.device.authorize.ReturnType<id>>
|
|
303
|
+
}
|
|
304
|
+
/** Actions for sign-in with an emailed code. */
|
|
305
|
+
email: {
|
|
306
|
+
/** `Actions.email.sendCode`. */
|
|
307
|
+
sendCode: (options: Actions.email.sendCode.Options) => Promise<void>
|
|
308
|
+
/**
|
|
309
|
+
* `Actions.email.signIn`, which sets the client's account, or empties it for a sign-in without
|
|
310
|
+
* a key, or for a refusal whose `signedIn` is `true`. A sign-in that another sign-in or a
|
|
311
|
+
* sign-out overtook throws {@link SupersededError}.
|
|
312
|
+
*/
|
|
313
|
+
signIn: <
|
|
314
|
+
const id extends number = chainId,
|
|
315
|
+
const key extends boolean = true,
|
|
316
|
+
>(
|
|
317
|
+
options: Actions.email.signIn.Options<id, key>,
|
|
318
|
+
) => Promise<Actions.email.signIn.ReturnType<id, key>>
|
|
319
|
+
}
|
|
320
|
+
/** The instance the members call `Actions` with. */
|
|
321
|
+
instance: Auth.Auth
|
|
322
|
+
/** Actions for the issuer's OAuth endpoints. */
|
|
323
|
+
oauth: {
|
|
324
|
+
/** `Actions.oauth.introspect`. */
|
|
325
|
+
introspect: (
|
|
326
|
+
options: Actions.oauth.introspect.Options,
|
|
327
|
+
) => Promise<Actions.oauth.introspect.ReturnType>
|
|
328
|
+
/** `Actions.oauth.jwks`. */
|
|
329
|
+
jwks: () => Promise<Actions.oauth.jwks.ReturnType>
|
|
330
|
+
/** `Actions.oauth.userInfo`. */
|
|
331
|
+
userInfo: (options: Actions.oauth.userInfo.Options) => Promise<User>
|
|
332
|
+
}
|
|
333
|
+
/** Actions for sign-in with a passkey. */
|
|
334
|
+
passkey: {
|
|
335
|
+
/**
|
|
336
|
+
* `Actions.passkey.signIn`, which sets the client's account unless it returns a step, as
|
|
337
|
+
* `auth.email.signIn` does. A step or sign-in that another sign-in or a sign-out overtook
|
|
338
|
+
* throws {@link SupersededError}.
|
|
339
|
+
*/
|
|
340
|
+
signIn: <
|
|
341
|
+
const id extends number = chainId,
|
|
342
|
+
const key extends boolean = true,
|
|
343
|
+
>(
|
|
344
|
+
options?: Actions.passkey.signIn.Options<id, key>,
|
|
345
|
+
) => Promise<Actions.passkey.signIn.ReturnType<id, key>>
|
|
346
|
+
}
|
|
347
|
+
/** Actions for sign-in with an identity provider, such as Google or SSO. */
|
|
348
|
+
provider: {
|
|
349
|
+
/** `Actions.provider.list`. */
|
|
350
|
+
list: () => Promise<Actions.provider.list.ReturnType>
|
|
351
|
+
/** `Actions.provider.signIn`. */
|
|
352
|
+
signIn: (options: Actions.provider.signIn.Options) => void
|
|
353
|
+
}
|
|
354
|
+
/** Actions for the realms the app reaches. */
|
|
355
|
+
realm: {
|
|
356
|
+
/** `Actions.realm.list`. */
|
|
357
|
+
list: () => Promise<Actions.realm.list.ReturnType>
|
|
358
|
+
}
|
|
359
|
+
/** Actions for sign-in through a redirect to Tempo ID's pages. */
|
|
360
|
+
redirect: {
|
|
361
|
+
/**
|
|
362
|
+
* `Actions.redirect.complete`, which sets the client's account, or empties it for a sign-in
|
|
363
|
+
* without a key. The first call settles the page load's redirect, and later calls return
|
|
364
|
+
* the same result.
|
|
365
|
+
*/
|
|
366
|
+
complete: <const key extends boolean = true>(
|
|
367
|
+
options?: Actions.redirect.complete.Options<key>,
|
|
368
|
+
) => Promise<Actions.redirect.complete.ReturnType<key>>
|
|
369
|
+
/** `Actions.redirect.createUrl`. */
|
|
370
|
+
createUrl: <const key extends boolean = true>(
|
|
371
|
+
options?: Actions.redirect.createUrl.Options<key>,
|
|
372
|
+
) => Promise<Actions.redirect.createUrl.ReturnType<key>>
|
|
373
|
+
/**
|
|
374
|
+
* `Actions.redirect.handleCallback`, which sets the client's account, or empties it for a
|
|
375
|
+
* sign-in without a key.
|
|
376
|
+
*/
|
|
377
|
+
handleCallback: <
|
|
378
|
+
const pending extends Pending.Pending | Pending.WithoutKey =
|
|
379
|
+
Pending.Pending,
|
|
380
|
+
>(
|
|
381
|
+
options: Actions.redirect.handleCallback.Options<pending>,
|
|
382
|
+
) => Promise<Actions.redirect.handleCallback.ReturnType<pending>>
|
|
383
|
+
/** `Actions.redirect.start`. */
|
|
384
|
+
start: (options?: Actions.redirect.start.Options) => Promise<void>
|
|
385
|
+
}
|
|
386
|
+
/** `Actions.refresh`. */
|
|
387
|
+
refresh: (
|
|
388
|
+
options: Actions.refresh.Options,
|
|
389
|
+
) => ReturnType<typeof Actions.refresh>
|
|
390
|
+
/**
|
|
391
|
+
* Rebuilds a stored authorization's account with `Key.toAccount`, sets the client's account to
|
|
392
|
+
* it, and returns the authorization. `Key.from` fills the key's `chainId` when a sign-in stored
|
|
393
|
+
* before it existed leaves it out. Throws `Key.AccessKeyRequiredError` for a key that carries
|
|
394
|
+
* no material without the `accessKey` the app supplied.
|
|
395
|
+
*/
|
|
396
|
+
restore: <id extends number = chainId>(
|
|
397
|
+
authorization: Omit<Authorization<id>, 'account' | 'key'> & {
|
|
398
|
+
/** The stored key, with or without its `chainId`. */
|
|
399
|
+
key: Key.from.Value<id>
|
|
400
|
+
},
|
|
401
|
+
options?: Key.toAccount.Options,
|
|
402
|
+
) => Authorization<id>
|
|
403
|
+
/**
|
|
404
|
+
* `Actions.signOut`, which empties the client's account before the request, even when it
|
|
405
|
+
* fails, and discards any sign-in still pending.
|
|
406
|
+
*/
|
|
407
|
+
signOut: () => Promise<void>
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An app's access key on a user's Tempo Account, as the app stores it: the account it acts for,
|
|
3
|
+
* the authorization Tempo ID signed for it, and the key material the library generated.
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { type Address, type Hex, PublicKey, type WebCryptoP256 } from 'ox'
|
|
7
|
+
import { KeyAuthorization } from 'ox/tempo'
|
|
8
|
+
import type { OneOf } from 'viem'
|
|
9
|
+
import { Account, KeyAuthorizationManager } from 'viem/tempo'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A stored access key. A browser key is a non-extractable WebCrypto key pair, which IndexedDB
|
|
13
|
+
* keeps without exporting. Elsewhere it is a secp256k1 private key, as JSON for a cookie or a file.
|
|
14
|
+
* A key the app supplied as `accessKey` carries no material.
|
|
15
|
+
*/
|
|
16
|
+
export type Key<chainId extends number = number> = {
|
|
17
|
+
/** The Tempo Account the key acts for. */
|
|
18
|
+
account: Address.Address
|
|
19
|
+
/** The chain the key acts on, from its authorization. */
|
|
20
|
+
chainId: chainId
|
|
21
|
+
/** The signed authorization, in the node's RPC format. */
|
|
22
|
+
keyAuthorization: KeyAuthorization.Rpc
|
|
23
|
+
} & Material
|
|
24
|
+
|
|
25
|
+
/** The key material the library generated for a sign-in. */
|
|
26
|
+
export type Material = OneOf<
|
|
27
|
+
| {
|
|
28
|
+
/** A non-extractable WebCrypto P256 key pair, in a browser. */
|
|
29
|
+
keyPair: WebCryptoP256.createKeyPair.ReturnType
|
|
30
|
+
}
|
|
31
|
+
| {
|
|
32
|
+
/** A secp256k1 private key, outside a browser. Keep it as secret as a session. */
|
|
33
|
+
privateKey: Hex.Hex
|
|
34
|
+
}
|
|
35
|
+
| {}
|
|
36
|
+
>
|
|
37
|
+
|
|
38
|
+
/** A key the app supplied as `accessKey`, which `toAccount` needs to rebuild its account. */
|
|
39
|
+
export class AccessKeyRequiredError extends Error {
|
|
40
|
+
override readonly name = 'Key.AccessKeyRequiredError'
|
|
41
|
+
|
|
42
|
+
constructor() {
|
|
43
|
+
super('The key carries no material. Pass the `accessKey` the app supplied.')
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Whether the key's authorization is expired, so a new sign-in must authorize a new key.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* if (Key.expired(saved.key)) await signInAgain()
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export function expired(key: Key) {
|
|
56
|
+
const { expiry } = KeyAuthorization.fromRpc(key.keyAuthorization)
|
|
57
|
+
return Boolean(expiry) && expiry! * 1000 <= Date.now()
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Instantiates a {@link Key}. Fills `chainId` from the key authorization when the value leaves it
|
|
62
|
+
* out, as a key stored before `chainId` existed does.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* const key = Key.from(JSON.parse(saved).key)
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export function from<chainId extends number = number>(
|
|
70
|
+
value: from.Value<chainId>,
|
|
71
|
+
): Key<chainId> {
|
|
72
|
+
if (value.chainId !== undefined) return { ...value, chainId: value.chainId }
|
|
73
|
+
// The node signs the chain ID the request named, so it is the request's literal.
|
|
74
|
+
const chainId = Number(
|
|
75
|
+
KeyAuthorization.fromRpc(value.keyAuthorization).chainId,
|
|
76
|
+
) as chainId
|
|
77
|
+
return { ...value, chainId }
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export declare namespace from {
|
|
81
|
+
type Value<chainId extends number = number> = {
|
|
82
|
+
/** The Tempo Account the key acts for. */
|
|
83
|
+
account: Address.Address
|
|
84
|
+
/** The chain the key acts on. Defaults to the key authorization's. */
|
|
85
|
+
chainId?: chainId | undefined
|
|
86
|
+
/** The signed authorization, in the node's RPC format. */
|
|
87
|
+
keyAuthorization: KeyAuthorization.Rpc
|
|
88
|
+
} & Material
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Returns the key as a Viem access key account acting for its Tempo Account. Viem attaches the
|
|
93
|
+
* authorization to transactions until the chain registers the key. A key the app supplied signs
|
|
94
|
+
* with that `accessKey`. Throws {@link AccessKeyRequiredError} when neither holds key material.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* import { Key } from '@tempoxyz/id/client'
|
|
99
|
+
*
|
|
100
|
+
* const account = Key.toAccount(key)
|
|
101
|
+
* await client.token.transferSync({ account, amount, to, token })
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export function toAccount(
|
|
105
|
+
key: Key,
|
|
106
|
+
options: toAccount.Options = {},
|
|
107
|
+
): Account.AccessKeyAccount {
|
|
108
|
+
const { accessKey } = options
|
|
109
|
+
const keyAuthorization = KeyAuthorization.fromRpc(key.keyAuthorization)
|
|
110
|
+
const keyAuthorizationManager = KeyAuthorizationManager.memory()
|
|
111
|
+
// The memory manager stores synchronously, so the authorization is in place before the account
|
|
112
|
+
// is returned.
|
|
113
|
+
void keyAuthorizationManager.set(
|
|
114
|
+
{
|
|
115
|
+
accessKey: keyAuthorization.address,
|
|
116
|
+
address: key.account,
|
|
117
|
+
chainId: Number(keyAuthorization.chainId),
|
|
118
|
+
},
|
|
119
|
+
keyAuthorization,
|
|
120
|
+
)
|
|
121
|
+
const access = { access: key.account, keyAuthorizationManager }
|
|
122
|
+
|
|
123
|
+
if (key.keyPair) return Account.fromWebCryptoP256(key.keyPair, access)
|
|
124
|
+
if (key.privateKey) return Account.fromSecp256k1(key.privateKey, access)
|
|
125
|
+
if (!accessKey) throw new AccessKeyRequiredError()
|
|
126
|
+
// A raw signature is the key's own, which the bound account wraps for the Tempo Account.
|
|
127
|
+
return Account.from({
|
|
128
|
+
...access,
|
|
129
|
+
keyType: accessKey.keyType,
|
|
130
|
+
publicKey: PublicKey.fromHex(accessKey.publicKey),
|
|
131
|
+
sign: (parameters) => accessKey.sign({ ...parameters, raw: true }),
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export declare namespace toAccount {
|
|
136
|
+
type Options = {
|
|
137
|
+
/** The key the app supplied to the sign-in, for a key that carries no material. */
|
|
138
|
+
accessKey?: Account.Account | undefined
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A sign-in redirect in progress, which an app keeps until Tempo ID redirects back.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
import type * as Key from './Key.js'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A sign-in redirect in progress: what the app keeps until Tempo ID redirects back, with the
|
|
9
|
+
* material of the new access key the callback authorizes. {@link WithoutKey} is a redirect that
|
|
10
|
+
* authorizes no key.
|
|
11
|
+
*/
|
|
12
|
+
export type Pending = Key.Material &
|
|
13
|
+
Base & {
|
|
14
|
+
/** Absent, since the redirect authorizes a key. */
|
|
15
|
+
key?: undefined
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** What every sign-in redirect keeps. */
|
|
19
|
+
type Base = {
|
|
20
|
+
/** Where Tempo ID redirects back to, which the code exchange repeats. */
|
|
21
|
+
redirectUri: string
|
|
22
|
+
/** The value the callback must echo, so a forged callback is refused. */
|
|
23
|
+
state: string
|
|
24
|
+
/** The PKCE verifier that redeems the code. */
|
|
25
|
+
verifier: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A redirect that authorizes no access key. */
|
|
29
|
+
export type WithoutKey = Base & {
|
|
30
|
+
/** `false`, since the redirect authorizes no key. */
|
|
31
|
+
key: false
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Instantiates a {@link Pending}, or a {@link WithoutKey}.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const pending = Pending.from(await unseal(c, 'oauth'))
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export function from<const value extends Pending | WithoutKey>(
|
|
43
|
+
value: value,
|
|
44
|
+
): value {
|
|
45
|
+
return value
|
|
46
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an app's access key may do: its chain, expiry, spending limits, and call scopes.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
import type { KeyAuthorization } from 'ox/tempo'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* What an app's access key may do, as Viem's `accessKey.authorize` takes it. Tempo ID fills what
|
|
9
|
+
* it leaves out with the headless ceiling. `chainId` carries the chain's ID as a literal type, which
|
|
10
|
+
* the authorization's `key.chainId` keeps.
|
|
11
|
+
*/
|
|
12
|
+
export type Permissions<chainId extends number = number> = {
|
|
13
|
+
/** The chain the key acts on, such as `tempoTestnet.id`. Defaults to the instance's `chainId`. */
|
|
14
|
+
chainId?: chainId | undefined
|
|
15
|
+
/** Unix seconds. Viem's `Expiry` builds one, such as `Expiry.days(1)`. Defaults to a year from now. */
|
|
16
|
+
expiry?: number | undefined
|
|
17
|
+
/** How much of each token the key may spend, in total or, with a `period` in seconds, per period. Defaults to about $1,000 of each token it calls, or of OUSD. */
|
|
18
|
+
limits?: KeyAuthorization.KeyAuthorization['limits']
|
|
19
|
+
/** The calls the key may make. Defaults to transfers of each token it limits. */
|
|
20
|
+
scopes?: KeyAuthorization.KeyAuthorization['scopes']
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Instantiates a {@link Permissions}, keeping `chainId` as a literal type.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const permissions = Permissions.from({
|
|
29
|
+
* expiry: Expiry.days(1),
|
|
30
|
+
* limits: [{ limit: 10_000_000n, token: ousd }],
|
|
31
|
+
* scopes: [Scopes.tip20(ousd).transfer()],
|
|
32
|
+
* })
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export function from<const chainId extends number = number>(
|
|
36
|
+
value: Permissions<chainId>,
|
|
37
|
+
): Permissions<chainId> {
|
|
38
|
+
return value
|
|
39
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The OAuth providers Tempo ID can offer.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
/** An OAuth provider's short name, as `Actions.provider.list` lists them. */
|
|
6
|
+
export type Provider = 'google'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Instantiates a {@link Provider}.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const provider = Provider.from('google')
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export function from(value: Provider): Provider {
|
|
17
|
+
return value
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A step a sign-in needs before it finishes, such as the SSO connection an address requires.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** A step that a sign-in needs before it finishes: the SSO connection that an address requires. */
|
|
7
|
+
export type Step = {
|
|
8
|
+
/** The kind of step. */
|
|
9
|
+
type: 'sso'
|
|
10
|
+
/** Where `Actions.provider.signIn` sends the browser to take the step. */
|
|
11
|
+
url: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Instantiates a {@link Step}.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const step = Step.from({ type: 'sso', url })
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function from(value: Step): Step {
|
|
23
|
+
return value
|
|
24
|
+
}
|