From ebedfada5cfce5b55ec6a9c38e69f08aaed76c39 Mon Sep 17 00:00:00 2001 From: WillODR Date: Mon, 21 Jul 2025 17:56:22 +0100 Subject: [PATCH 1/7] Refactor code structure for improved readability and maintainability --- package.json | 7 +- pnpm-lock.yaml | 1328 +++++++++++++++++ src/core/endpoints.ts | 9 +- .../protocols/oauth/oauth2_authorization.ts | 14 +- src/core/protocols/oauth/oauth2_callback.ts | 91 +- .../protocols/oauth/oauth_authentication.ts | 73 +- .../protocols/oauth/oidc_authorization.ts | 18 +- src/core/protocols/oauth/oidc_callback.ts | 91 +- src/core/protocols/password.ts | 20 +- src/core/routeHandlers/oauth.ts | 121 +- src/providers/oauth2/discord.ts | 2 +- src/types.ts | 37 + tsconfig.json | 95 +- 13 files changed, 1743 insertions(+), 163 deletions(-) create mode 100644 pnpm-lock.yaml diff --git a/package.json b/package.json index bca7d90..0af0f98 100644 --- a/package.json +++ b/package.json @@ -65,13 +65,11 @@ "dist" ], "scripts": { - "build": "bun run ./script/build.ts", + "build:bun": "bun run ./script/build.ts", + "build": "tsc && tsc-alias", "format": "bun x prettier --write '**/*.{js,jsx,ts,tsx,json,md,yaml,yml}'", "release": "bun run build && changeset publish" }, - "peerDependencies": { - "payload": "latest" - }, "devDependencies": { "@changesets/cli": "2.27.10", "@tsconfig/node22": "^22.0.0", @@ -82,6 +80,7 @@ "git-cliff": "2.7.0", "globals": "^15.14.0", "prettier": "3.4.2", + "tsc-alias": "^1.8.16", "typescript": "^5.7.3" }, "dependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..b68220b --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,1328 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + '@simplewebauthn/browser': + specifier: ^13.1.0 + version: 13.1.2 + '@simplewebauthn/server': + specifier: ^13.1.0 + version: 13.1.2 + jose: + specifier: 6.0.8 + version: 6.0.8 + oauth4webapi: + specifier: ^3.1.4 + version: 3.6.0 + qs-esm: + specifier: 7.0.2 + version: 7.0.2 + uuid: + specifier: 11.1.0 + version: 11.1.0 + devDependencies: + '@changesets/cli': + specifier: 2.27.10 + version: 2.27.10 + '@tsconfig/node22': + specifier: ^22.0.0 + version: 22.0.2 + '@tsconfig/strictest': + specifier: ^2.0.5 + version: 2.0.5 + '@types/bun': + specifier: latest + version: 1.2.19(@types/react@19.1.8) + '@types/jsonwebtoken': + specifier: ^9.0.7 + version: 9.0.10 + cross-env: + specifier: ^7.0.3 + version: 7.0.3 + git-cliff: + specifier: 2.7.0 + version: 2.7.0 + globals: + specifier: ^15.14.0 + version: 15.15.0 + prettier: + specifier: 3.4.2 + version: 3.4.2 + tsc-alias: + specifier: ^1.8.16 + version: 1.8.16 + typescript: + specifier: ^5.7.3 + version: 5.8.3 + +packages: + + '@babel/runtime@7.27.6': + resolution: {integrity: sha512-vbavdySgbTTrmFE+EsiqUTzlOr5bzlnJtUv9PynGCAKvfQqjIXbvFdumPM/GxMDfyuGMJaJAU6TO4zc1Jf1i8Q==} + engines: {node: '>=6.9.0'} + + '@changesets/apply-release-plan@7.0.12': + resolution: {integrity: sha512-EaET7As5CeuhTzvXTQCRZeBUcisoYPDDcXvgTE/2jmmypKp0RC7LxKj/yzqeh/1qFTZI7oDGFcL1PHRuQuketQ==} + + '@changesets/assemble-release-plan@6.0.9': + resolution: {integrity: sha512-tPgeeqCHIwNo8sypKlS3gOPmsS3wP0zHt67JDuL20P4QcXiw/O4Hl7oXiuLnP9yg+rXLQ2sScdV1Kkzde61iSQ==} + + '@changesets/changelog-git@0.2.1': + resolution: {integrity: sha512-x/xEleCFLH28c3bQeQIyeZf8lFXyDFVn1SgcBiR2Tw/r4IAWlk1fzxCEZ6NxQAjF2Nwtczoen3OA2qR+UawQ8Q==} + + '@changesets/cli@2.27.10': + resolution: {integrity: sha512-PfeXjvs9OfQJV8QSFFHjwHX3QnUL9elPEQ47SgkiwzLgtKGyuikWjrdM+lO9MXzOE22FO9jEGkcs4b+B6D6X0Q==} + hasBin: true + + '@changesets/config@3.1.1': + resolution: {integrity: sha512-bd+3Ap2TKXxljCggI0mKPfzCQKeV/TU4yO2h2C6vAihIo8tzseAn2e7klSuiyYYXvgu53zMN1OeYMIQkaQoWnA==} + + '@changesets/errors@0.2.0': + resolution: {integrity: sha512-6BLOQUscTpZeGljvyQXlWOItQyU71kCdGz7Pi8H8zdw6BI0g3m43iL4xKUVPWtG+qrrL9DTjpdn8eYuCQSRpow==} + + '@changesets/get-dependents-graph@2.1.3': + resolution: {integrity: sha512-gphr+v0mv2I3Oxt19VdWRRUxq3sseyUpX9DaHpTUmLj92Y10AGy+XOtV+kbM6L/fDcpx7/ISDFK6T8A/P3lOdQ==} + + '@changesets/get-release-plan@4.0.13': + resolution: {integrity: sha512-DWG1pus72FcNeXkM12tx+xtExyH/c9I1z+2aXlObH3i9YA7+WZEVaiHzHl03thpvAgWTRaH64MpfHxozfF7Dvg==} + + '@changesets/get-version-range-type@0.4.0': + resolution: {integrity: sha512-hwawtob9DryoGTpixy1D3ZXbGgJu1Rhr+ySH2PvTLHvkZuQ7sRT4oQwMh0hbqZH1weAooedEjRsbrWcGLCeyVQ==} + + '@changesets/git@3.0.4': + resolution: {integrity: sha512-BXANzRFkX+XcC1q/d27NKvlJ1yf7PSAgi8JG6dt8EfbHFHi4neau7mufcSca5zRhwOL8j9s6EqsxmT+s+/E6Sw==} + + '@changesets/logger@0.1.1': + resolution: {integrity: sha512-OQtR36ZlnuTxKqoW4Sv6x5YIhOmClRd5pWsjZsddYxpWs517R0HkyiefQPIytCVh4ZcC5x9XaG8KTdd5iRQUfg==} + + '@changesets/parse@0.4.1': + resolution: {integrity: sha512-iwksMs5Bf/wUItfcg+OXrEpravm5rEd9Bf4oyIPL4kVTmJQ7PNDSd6MDYkpSJR1pn7tz/k8Zf2DhTCqX08Ou+Q==} + + '@changesets/pre@2.0.2': + resolution: {integrity: sha512-HaL/gEyFVvkf9KFg6484wR9s0qjAXlZ8qWPDkTyKF6+zqjBe/I2mygg3MbpZ++hdi0ToqNUF8cjj7fBy0dg8Ug==} + + '@changesets/read@0.6.5': + resolution: {integrity: sha512-UPzNGhsSjHD3Veb0xO/MwvasGe8eMyNrR/sT9gR8Q3DhOQZirgKhhXv/8hVsI0QpPjR004Z9iFxoJU6in3uGMg==} + + '@changesets/should-skip-package@0.1.2': + resolution: {integrity: sha512-qAK/WrqWLNCP22UDdBTMPH5f41elVDlsNyat180A33dWxuUDyNpg6fPi/FyTZwRriVjg0L8gnjJn2F9XAoF0qw==} + + '@changesets/types@4.1.0': + resolution: {integrity: sha512-LDQvVDv5Kb50ny2s25Fhm3d9QSZimsoUGBsUioj6MC3qbMUCuC8GPIvk/M6IvXx3lYhAs0lwWUQLb+VIEUCECw==} + + '@changesets/types@6.1.0': + resolution: {integrity: sha512-rKQcJ+o1nKNgeoYRHKOS07tAMNd3YSN0uHaJOZYjBAgxfV7TUE7JE+z4BzZdQwb5hKaYbayKN5KrYV7ODb2rAA==} + + '@changesets/write@0.3.2': + resolution: {integrity: sha512-kDxDrPNpUgsjDbWBvUo27PzKX4gqeKOlhibaOXDJA6kuBisGqNHv/HwGJrAu8U/dSf8ZEFIeHIPtvSlZI1kULw==} + + '@hexagon/base64@1.1.28': + resolution: {integrity: sha512-lhqDEAvWixy3bZ+UOYbPwUbBkwBq5C1LAJ/xPC8Oi+lL54oyakv/npbA0aU2hgCsx/1NUd4IBvV03+aUBWxerw==} + + '@levischuck/tiny-cbor@0.2.11': + resolution: {integrity: sha512-llBRm4dT4Z89aRsm6u2oEZ8tfwL/2l6BwpZ7JcyieouniDECM5AqNgr/y08zalEIvW3RSK4upYyybDcmjXqAow==} + + '@manypkg/find-root@1.1.0': + resolution: {integrity: sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA==} + + '@manypkg/get-packages@1.1.3': + resolution: {integrity: sha512-fo+QhuU3qE/2TQMQmbVMqaQ6EWbMhi4ABWP+O4AM1NqPBuy0OrApV5LO6BrrgnhtAHS2NH6RrVk9OL181tTi8A==} + + '@nodelib/fs.scandir@2.1.5': + resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} + engines: {node: '>= 8'} + + '@nodelib/fs.stat@2.0.5': + resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} + engines: {node: '>= 8'} + + '@nodelib/fs.walk@1.2.8': + resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} + engines: {node: '>= 8'} + + '@peculiar/asn1-android@2.4.0': + resolution: {integrity: sha512-YFueREq97CLslZZBI8dKzis7jMfEHSLxM+nr0Zdx1POiXFLjqqwoY5s0F1UimdBiEw/iKlHey2m56MRDv7Jtyg==} + + '@peculiar/asn1-ecc@2.4.0': + resolution: {integrity: sha512-fJiYUBCJBDkjh347zZe5H81BdJ0+OGIg0X9z06v8xXUoql3MFeENUX0JsjCaVaU9A0L85PefLPGYkIoGpTnXLQ==} + + '@peculiar/asn1-rsa@2.4.0': + resolution: {integrity: sha512-6PP75voaEnOSlWR9sD25iCQyLgFZHXbmxvUfnnDcfL6Zh5h2iHW38+bve4LfH7a60x7fkhZZNmiYqAlAff9Img==} + + '@peculiar/asn1-schema@2.4.0': + resolution: {integrity: sha512-umbembjIWOrPSOzEGG5vxFLkeM8kzIhLkgigtsOrfLKnuzxWxejAcUX+q/SoZCdemlODOcr5WiYa7+dIEzBXZQ==} + + '@peculiar/asn1-x509@2.4.0': + resolution: {integrity: sha512-F7mIZY2Eao2TaoVqigGMLv+NDdpwuBKU1fucHPONfzaBS4JXXCNCmfO0Z3dsy7JzKGqtDcYC1mr9JjaZQZNiuw==} + + '@simplewebauthn/browser@13.1.2': + resolution: {integrity: sha512-aZnW0KawAM83fSBUgglP5WofbrLbLyr7CoPqYr66Eppm7zO86YX6rrCjRB3hQKPrL7ATvY4FVXlykZ6w6FwYYw==} + + '@simplewebauthn/server@13.1.2': + resolution: {integrity: sha512-VwoDfvLXSCaRiD+xCIuyslU0HLxVggeE5BL06+GbsP2l1fGf5op8e0c3ZtKoi+vSg1q4ikjtAghC23ze2Q3H9g==} + engines: {node: '>=20.0.0'} + + '@tsconfig/node22@22.0.2': + resolution: {integrity: sha512-Kmwj4u8sDRDrMYRoN9FDEcXD8UpBSaPQQ24Gz+Gamqfm7xxn+GBR7ge/Z7pK8OXNGyUzbSwJj+TH6B+DS/epyA==} + + '@tsconfig/strictest@2.0.5': + resolution: {integrity: sha512-ec4tjL2Rr0pkZ5hww65c+EEPYwxOi4Ryv+0MtjeaSQRJyq322Q27eOQiFbuNgw2hpL4hB1/W/HBGk3VKS43osg==} + + '@types/bun@1.2.19': + resolution: {integrity: sha512-d9ZCmrH3CJ2uYKXQIUuZ/pUnTqIvLDS0SK7pFmbx8ma+ziH/FRMoAq5bYpRG7y+w1gl+HgyNZbtqgMq4W4e2Lg==} + + '@types/jsonwebtoken@9.0.10': + resolution: {integrity: sha512-asx5hIG9Qmf/1oStypjanR7iKTv0gXQ1Ov/jfrX6kS/EO0OFni8orbmGCn0672NHR3kXHwpAwR+B368ZGN/2rA==} + + '@types/ms@2.1.0': + resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==} + + '@types/node@12.20.55': + resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} + + '@types/node@24.0.15': + resolution: {integrity: sha512-oaeTSbCef7U/z7rDeJA138xpG3NuKc64/rZ2qmUFkFJmnMsAPaluIifqyWd8hSSMxyP9oie3dLAqYPblag9KgA==} + + '@types/react@19.1.8': + resolution: {integrity: sha512-AwAfQ2Wa5bCx9WP8nZL2uMZWod7J7/JSplxbTmBQ5ms6QpqNYm672H0Vu9ZVKVngQ+ii4R/byguVEUZQyeg44g==} + + ansi-colors@4.1.3: + resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} + engines: {node: '>=6'} + + ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + + anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + + argparse@1.0.10: + resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} + + array-union@2.1.0: + resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} + engines: {node: '>=8'} + + asn1js@3.0.6: + resolution: {integrity: sha512-UOCGPYbl0tv8+006qks/dTgV9ajs97X2p0FAbyS2iyCRrmLSRolDaHdp+v/CLgnzHc3fVB+CwYiUmei7ndFcgA==} + engines: {node: '>=12.0.0'} + + better-path-resolve@1.0.0: + resolution: {integrity: sha512-pbnl5XzGBdrFU/wT4jqmJVPn2B6UHPBOhzMQkY/SPUPB6QtUXtmBHBIwCbXJol93mOpGMnQyP/+BB19q04xj7g==} + engines: {node: '>=4'} + + binary-extensions@2.3.0: + resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} + engines: {node: '>=8'} + + braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} + + bun-types@1.2.19: + resolution: {integrity: sha512-uAOTaZSPuYsWIXRpj7o56Let0g/wjihKCkeRqUBhlLVM/Bt+Fj9xTo+LhC1OV1XDaGkz4hNC80et5xgy+9KTHQ==} + peerDependencies: + '@types/react': ^19 + + chardet@0.7.0: + resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} + + chokidar@3.6.0: + resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} + engines: {node: '>= 8.10.0'} + + ci-info@3.9.0: + resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} + engines: {node: '>=8'} + + commander@9.5.0: + resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==} + engines: {node: ^12.20.0 || >=14} + + cross-env@7.0.3: + resolution: {integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==} + engines: {node: '>=10.14', npm: '>=6', yarn: '>=1'} + hasBin: true + + cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} + engines: {node: '>= 8'} + + csstype@3.1.3: + resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} + + detect-indent@6.1.0: + resolution: {integrity: sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==} + engines: {node: '>=8'} + + dir-glob@3.0.1: + resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} + engines: {node: '>=8'} + + enquirer@2.4.1: + resolution: {integrity: sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==} + engines: {node: '>=8.6'} + + esprima@4.0.1: + resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} + engines: {node: '>=4'} + hasBin: true + + execa@8.0.1: + resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} + engines: {node: '>=16.17'} + + extendable-error@0.1.7: + resolution: {integrity: sha512-UOiS2in6/Q0FK0R0q6UY9vYpQ21mr/Qn1KOnte7vsACuNJf514WvCCUHSRCPcgjPT2bAhNIJdlE6bVap1GKmeg==} + + external-editor@3.1.0: + resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==} + engines: {node: '>=4'} + + fast-glob@3.3.3: + resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} + engines: {node: '>=8.6.0'} + + fastq@1.19.1: + resolution: {integrity: sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==} + + fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} + + find-up@4.1.0: + resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} + engines: {node: '>=8'} + + fs-extra@7.0.1: + resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==} + engines: {node: '>=6 <7 || >=8'} + + fs-extra@8.1.0: + resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==} + engines: {node: '>=6 <7 || >=8'} + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + get-stream@8.0.1: + resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==} + engines: {node: '>=16'} + + get-tsconfig@4.10.1: + resolution: {integrity: sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ==} + + git-cliff-darwin-arm64@2.7.0: + resolution: {integrity: sha512-8D6Zxk9onts9r16yzuJEUq4ixGMJYvUI47GujUbs3ifsXB7x8SCOX7QCwmylRkZKnRC95fZ3jwi+gy95SwVaPQ==} + cpu: [arm64] + os: [darwin] + + git-cliff-darwin-x64@2.7.0: + resolution: {integrity: sha512-CkADqy5hif6P6rrTIWkkSkrsQzbcTv1kr5dAIpRq9SkjWVpRHQftouhNyB2qfNe0SH73R9N9oCIocIA1bSnVeQ==} + cpu: [x64] + os: [darwin] + + git-cliff-linux-arm64@2.7.0: + resolution: {integrity: sha512-kuJz+hL+nDqmK2E3/uahufdAHKjn76F0rv/oZpaQgUSmdE8vy9x1J28YSoXTlXIr0BfuzZjxCKrrfr8b7wU/Xw==} + cpu: [arm64] + os: [linux] + + git-cliff-linux-x64@2.7.0: + resolution: {integrity: sha512-0qHHPEsAo9HQZpifM9wdnjot90yB7C+LIHSFfGhkTsmzr/Daxnekt0um6mb3yEA7YuFnE9+c8mvLDoXlgJ5eaA==} + cpu: [x64] + os: [linux] + + git-cliff-windows-arm64@2.7.0: + resolution: {integrity: sha512-uq5qGuWkO6YCEGg9nDk3butX0F80hfICsBh6LWicL9bfpyfEzdSbuv4AS1hJ2jTIjqRMOP2NRSii4pM9bqjfsw==} + cpu: [arm64] + os: [win32] + + git-cliff-windows-x64@2.7.0: + resolution: {integrity: sha512-WOoKrlYvRMaWcEdQZD1I+Pg+W6yjztxzUkid7qqyum6J2e21kfw8asL5gDnTX9rZAKu+MV29/zG7RdFqKD2qsA==} + cpu: [x64] + os: [win32] + + git-cliff@2.7.0: + resolution: {integrity: sha512-gO4rb3VCAvzv+vWPPspxSCAeDAQbvknYioO43Wb+Dn0MWFC3zc89uwkxx36yAmCa7qui9TL2E3vSz6j9GbbzqA==} + engines: {node: '>=18.19 || >=20.6 || >=21'} + hasBin: true + + glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + + globals@15.15.0: + resolution: {integrity: sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==} + engines: {node: '>=18'} + + globby@11.1.0: + resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} + engines: {node: '>=10'} + + graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + + human-id@1.0.2: + resolution: {integrity: sha512-UNopramDEhHJD+VR+ehk8rOslwSfByxPIZyJRfV739NDhN5LF1fa1MqnzKm2lGTQRjNrjK19Q5fhkgIfjlVUKw==} + + human-signals@5.0.0: + resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} + engines: {node: '>=16.17.0'} + + iconv-lite@0.4.24: + resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} + engines: {node: '>=0.10.0'} + + ignore@5.3.2: + resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} + engines: {node: '>= 4'} + + is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + + is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + + is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + + is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + + is-stream@3.0.0: + resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + + is-subdir@1.2.0: + resolution: {integrity: sha512-2AT6j+gXe/1ueqbW6fLZJiIw3F8iXGJtt0yDrZaBhAZEG1raiTxKWU+IPqMCzQAXOUCKdA4UDMgacKH25XG2Cw==} + engines: {node: '>=4'} + + is-windows@1.0.2: + resolution: {integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==} + engines: {node: '>=0.10.0'} + + isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + + jose@6.0.8: + resolution: {integrity: sha512-EyUPtOKyTYq+iMOszO42eobQllaIjJnwkZ2U93aJzNyPibCy7CEvT9UQnaCVB51IAd49gbNdCew1c0LcLTCB2g==} + + js-yaml@3.14.1: + resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} + hasBin: true + + jsonfile@4.0.0: + resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==} + + locate-path@5.0.0: + resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} + engines: {node: '>=8'} + + lodash.startcase@4.4.0: + resolution: {integrity: sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==} + + merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + + merge2@1.4.1: + resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} + engines: {node: '>= 8'} + + micromatch@4.0.8: + resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} + engines: {node: '>=8.6'} + + mimic-fn@4.0.0: + resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} + engines: {node: '>=12'} + + mri@1.2.0: + resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} + engines: {node: '>=4'} + + mylas@2.1.13: + resolution: {integrity: sha512-+MrqnJRtxdF+xngFfUUkIMQrUUL0KsxbADUkn23Z/4ibGg192Q+z+CQyiYwvWTsYjJygmMR8+w3ZDa98Zh6ESg==} + engines: {node: '>=12.0.0'} + + normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + + npm-run-path@5.3.0: + resolution: {integrity: sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + + oauth4webapi@3.6.0: + resolution: {integrity: sha512-OwXPTXjKPOldTpAa19oksrX9TYHA0rt+VcUFTkJ7QKwgmevPpNm9Cn5vFZUtIo96FiU6AfPuUUGzoXqgOzibWg==} + + onetime@6.0.0: + resolution: {integrity: sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==} + engines: {node: '>=12'} + + os-tmpdir@1.0.2: + resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} + engines: {node: '>=0.10.0'} + + outdent@0.5.0: + resolution: {integrity: sha512-/jHxFIzoMXdqPzTaCpFzAAWhpkSjZPF4Vsn6jAfNpmbH/ymsmd7Qc6VE9BGn0L6YMj6uwpQLxCECpus4ukKS9Q==} + + p-filter@2.1.0: + resolution: {integrity: sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw==} + engines: {node: '>=8'} + + p-limit@2.3.0: + resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} + engines: {node: '>=6'} + + p-locate@4.1.0: + resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} + engines: {node: '>=8'} + + p-map@2.1.0: + resolution: {integrity: sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==} + engines: {node: '>=6'} + + p-try@2.2.0: + resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} + engines: {node: '>=6'} + + package-manager-detector@0.2.11: + resolution: {integrity: sha512-BEnLolu+yuz22S56CU1SUKq3XC3PkwD5wv4ikR4MfGvnRVcmzXR9DwSlW2fEamyTPyXHomBJRzgapeuBvRNzJQ==} + + path-exists@4.0.0: + resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} + engines: {node: '>=8'} + + path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + + path-key@4.0.0: + resolution: {integrity: sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==} + engines: {node: '>=12'} + + path-type@4.0.0: + resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} + engines: {node: '>=8'} + + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + + picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + + pify@4.0.1: + resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} + engines: {node: '>=6'} + + plimit-lit@1.6.1: + resolution: {integrity: sha512-B7+VDyb8Tl6oMJT9oSO2CW8XC/T4UcJGrwOVoNGwOQsQYhlpfajmrMj5xeejqaASq3V/EqThyOeATEOMuSEXiA==} + engines: {node: '>=12'} + + prettier@2.8.8: + resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} + engines: {node: '>=10.13.0'} + hasBin: true + + prettier@3.4.2: + resolution: {integrity: sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==} + engines: {node: '>=14'} + hasBin: true + + pvtsutils@1.3.6: + resolution: {integrity: sha512-PLgQXQ6H2FWCaeRak8vvk1GW462lMxB5s3Jm673N82zI4vqtVUPuZdffdZbPDFRoU8kAhItWFtPCWiPpp4/EDg==} + + pvutils@1.1.3: + resolution: {integrity: sha512-pMpnA0qRdFp32b1sJl1wOJNxZLQ2cbQx+k6tjNtZ8CpvVhNqEPRgivZ2WOUev2YMajecdH7ctUPDvEe87nariQ==} + engines: {node: '>=6.0.0'} + + qs-esm@7.0.2: + resolution: {integrity: sha512-D8NAthKSD7SGn748v+GLaaO6k08Mvpoqroa35PqIQC4gtUa8/Pb/k+r0m0NnGBVbHDP1gKZ2nVywqfMisRhV5A==} + engines: {node: '>=18'} + + quansync@0.2.10: + resolution: {integrity: sha512-t41VRkMYbkHyCYmOvx/6URnN80H7k4X0lLdBMGsz+maAwrJQYB1djpV6vHrQIBE0WBSGqhtEHrK9U3DWWH8v7A==} + + queue-lit@1.5.2: + resolution: {integrity: sha512-tLc36IOPeMAubu8BkW8YDBV+WyIgKlYU7zUNs0J5Vk9skSZ4JfGlPOqplP0aHdfv7HL0B2Pg6nwiq60Qc6M2Hw==} + engines: {node: '>=12'} + + queue-microtask@1.2.3: + resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + + read-yaml-file@1.1.0: + resolution: {integrity: sha512-VIMnQi/Z4HT2Fxuwg5KrY174U1VdUIASQVWXXyqtNRtxSr9IYkn1rsI6Tb6HsrHCmB7gVpNwX6JxPTHcH6IoTA==} + engines: {node: '>=6'} + + readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + + resolve-from@5.0.0: + resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} + engines: {node: '>=8'} + + resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + + reusify@1.1.0: + resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} + engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + + run-parallel@1.2.0: + resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + + safer-buffer@2.1.2: + resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + + semver@7.7.2: + resolution: {integrity: sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==} + engines: {node: '>=10'} + hasBin: true + + shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + + shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + + signal-exit@4.1.0: + resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} + engines: {node: '>=14'} + + slash@3.0.0: + resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} + engines: {node: '>=8'} + + spawndamnit@3.0.1: + resolution: {integrity: sha512-MmnduQUuHCoFckZoWnXsTg7JaiLBJrKFj9UI2MbRPGaJeVpsLcVBu6P/IGZovziM/YBsellCmsprgNA+w0CzVg==} + + sprintf-js@1.0.3: + resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} + + strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + + strip-bom@3.0.0: + resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} + engines: {node: '>=4'} + + strip-final-newline@3.0.0: + resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==} + engines: {node: '>=12'} + + term-size@2.2.1: + resolution: {integrity: sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==} + engines: {node: '>=8'} + + tmp@0.0.33: + resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} + engines: {node: '>=0.6.0'} + + to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + + tsc-alias@1.8.16: + resolution: {integrity: sha512-QjCyu55NFyRSBAl6+MTFwplpFcnm2Pq01rR/uxfqJoLMm6X3O14KEGtaSDZpJYaE1bJBGDjD0eSuiIWPe2T58g==} + engines: {node: '>=16.20.2'} + hasBin: true + + tslib@2.8.1: + resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + + typescript@5.8.3: + resolution: {integrity: sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==} + engines: {node: '>=14.17'} + hasBin: true + + undici-types@7.8.0: + resolution: {integrity: sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==} + + universalify@0.1.2: + resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} + engines: {node: '>= 4.0.0'} + + uuid@11.1.0: + resolution: {integrity: sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==} + hasBin: true + + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + +snapshots: + + '@babel/runtime@7.27.6': {} + + '@changesets/apply-release-plan@7.0.12': + dependencies: + '@changesets/config': 3.1.1 + '@changesets/get-version-range-type': 0.4.0 + '@changesets/git': 3.0.4 + '@changesets/should-skip-package': 0.1.2 + '@changesets/types': 6.1.0 + '@manypkg/get-packages': 1.1.3 + detect-indent: 6.1.0 + fs-extra: 7.0.1 + lodash.startcase: 4.4.0 + outdent: 0.5.0 + prettier: 2.8.8 + resolve-from: 5.0.0 + semver: 7.7.2 + + '@changesets/assemble-release-plan@6.0.9': + dependencies: + '@changesets/errors': 0.2.0 + '@changesets/get-dependents-graph': 2.1.3 + '@changesets/should-skip-package': 0.1.2 + '@changesets/types': 6.1.0 + '@manypkg/get-packages': 1.1.3 + semver: 7.7.2 + + '@changesets/changelog-git@0.2.1': + dependencies: + '@changesets/types': 6.1.0 + + '@changesets/cli@2.27.10': + dependencies: + '@changesets/apply-release-plan': 7.0.12 + '@changesets/assemble-release-plan': 6.0.9 + '@changesets/changelog-git': 0.2.1 + '@changesets/config': 3.1.1 + '@changesets/errors': 0.2.0 + '@changesets/get-dependents-graph': 2.1.3 + '@changesets/get-release-plan': 4.0.13 + '@changesets/git': 3.0.4 + '@changesets/logger': 0.1.1 + '@changesets/pre': 2.0.2 + '@changesets/read': 0.6.5 + '@changesets/should-skip-package': 0.1.2 + '@changesets/types': 6.1.0 + '@changesets/write': 0.3.2 + '@manypkg/get-packages': 1.1.3 + ansi-colors: 4.1.3 + ci-info: 3.9.0 + enquirer: 2.4.1 + external-editor: 3.1.0 + fs-extra: 7.0.1 + mri: 1.2.0 + p-limit: 2.3.0 + package-manager-detector: 0.2.11 + picocolors: 1.1.1 + resolve-from: 5.0.0 + semver: 7.7.2 + spawndamnit: 3.0.1 + term-size: 2.2.1 + + '@changesets/config@3.1.1': + dependencies: + '@changesets/errors': 0.2.0 + '@changesets/get-dependents-graph': 2.1.3 + '@changesets/logger': 0.1.1 + '@changesets/types': 6.1.0 + '@manypkg/get-packages': 1.1.3 + fs-extra: 7.0.1 + micromatch: 4.0.8 + + '@changesets/errors@0.2.0': + dependencies: + extendable-error: 0.1.7 + + '@changesets/get-dependents-graph@2.1.3': + dependencies: + '@changesets/types': 6.1.0 + '@manypkg/get-packages': 1.1.3 + picocolors: 1.1.1 + semver: 7.7.2 + + '@changesets/get-release-plan@4.0.13': + dependencies: + '@changesets/assemble-release-plan': 6.0.9 + '@changesets/config': 3.1.1 + '@changesets/pre': 2.0.2 + '@changesets/read': 0.6.5 + '@changesets/types': 6.1.0 + '@manypkg/get-packages': 1.1.3 + + '@changesets/get-version-range-type@0.4.0': {} + + '@changesets/git@3.0.4': + dependencies: + '@changesets/errors': 0.2.0 + '@manypkg/get-packages': 1.1.3 + is-subdir: 1.2.0 + micromatch: 4.0.8 + spawndamnit: 3.0.1 + + '@changesets/logger@0.1.1': + dependencies: + picocolors: 1.1.1 + + '@changesets/parse@0.4.1': + dependencies: + '@changesets/types': 6.1.0 + js-yaml: 3.14.1 + + '@changesets/pre@2.0.2': + dependencies: + '@changesets/errors': 0.2.0 + '@changesets/types': 6.1.0 + '@manypkg/get-packages': 1.1.3 + fs-extra: 7.0.1 + + '@changesets/read@0.6.5': + dependencies: + '@changesets/git': 3.0.4 + '@changesets/logger': 0.1.1 + '@changesets/parse': 0.4.1 + '@changesets/types': 6.1.0 + fs-extra: 7.0.1 + p-filter: 2.1.0 + picocolors: 1.1.1 + + '@changesets/should-skip-package@0.1.2': + dependencies: + '@changesets/types': 6.1.0 + '@manypkg/get-packages': 1.1.3 + + '@changesets/types@4.1.0': {} + + '@changesets/types@6.1.0': {} + + '@changesets/write@0.3.2': + dependencies: + '@changesets/types': 6.1.0 + fs-extra: 7.0.1 + human-id: 1.0.2 + prettier: 2.8.8 + + '@hexagon/base64@1.1.28': {} + + '@levischuck/tiny-cbor@0.2.11': {} + + '@manypkg/find-root@1.1.0': + dependencies: + '@babel/runtime': 7.27.6 + '@types/node': 12.20.55 + find-up: 4.1.0 + fs-extra: 8.1.0 + + '@manypkg/get-packages@1.1.3': + dependencies: + '@babel/runtime': 7.27.6 + '@changesets/types': 4.1.0 + '@manypkg/find-root': 1.1.0 + fs-extra: 8.1.0 + globby: 11.1.0 + read-yaml-file: 1.1.0 + + '@nodelib/fs.scandir@2.1.5': + dependencies: + '@nodelib/fs.stat': 2.0.5 + run-parallel: 1.2.0 + + '@nodelib/fs.stat@2.0.5': {} + + '@nodelib/fs.walk@1.2.8': + dependencies: + '@nodelib/fs.scandir': 2.1.5 + fastq: 1.19.1 + + '@peculiar/asn1-android@2.4.0': + dependencies: + '@peculiar/asn1-schema': 2.4.0 + asn1js: 3.0.6 + tslib: 2.8.1 + + '@peculiar/asn1-ecc@2.4.0': + dependencies: + '@peculiar/asn1-schema': 2.4.0 + '@peculiar/asn1-x509': 2.4.0 + asn1js: 3.0.6 + tslib: 2.8.1 + + '@peculiar/asn1-rsa@2.4.0': + dependencies: + '@peculiar/asn1-schema': 2.4.0 + '@peculiar/asn1-x509': 2.4.0 + asn1js: 3.0.6 + tslib: 2.8.1 + + '@peculiar/asn1-schema@2.4.0': + dependencies: + asn1js: 3.0.6 + pvtsutils: 1.3.6 + tslib: 2.8.1 + + '@peculiar/asn1-x509@2.4.0': + dependencies: + '@peculiar/asn1-schema': 2.4.0 + asn1js: 3.0.6 + pvtsutils: 1.3.6 + tslib: 2.8.1 + + '@simplewebauthn/browser@13.1.2': {} + + '@simplewebauthn/server@13.1.2': + dependencies: + '@hexagon/base64': 1.1.28 + '@levischuck/tiny-cbor': 0.2.11 + '@peculiar/asn1-android': 2.4.0 + '@peculiar/asn1-ecc': 2.4.0 + '@peculiar/asn1-rsa': 2.4.0 + '@peculiar/asn1-schema': 2.4.0 + '@peculiar/asn1-x509': 2.4.0 + + '@tsconfig/node22@22.0.2': {} + + '@tsconfig/strictest@2.0.5': {} + + '@types/bun@1.2.19(@types/react@19.1.8)': + dependencies: + bun-types: 1.2.19(@types/react@19.1.8) + transitivePeerDependencies: + - '@types/react' + + '@types/jsonwebtoken@9.0.10': + dependencies: + '@types/ms': 2.1.0 + '@types/node': 24.0.15 + + '@types/ms@2.1.0': {} + + '@types/node@12.20.55': {} + + '@types/node@24.0.15': + dependencies: + undici-types: 7.8.0 + + '@types/react@19.1.8': + dependencies: + csstype: 3.1.3 + + ansi-colors@4.1.3: {} + + ansi-regex@5.0.1: {} + + anymatch@3.1.3: + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.1 + + argparse@1.0.10: + dependencies: + sprintf-js: 1.0.3 + + array-union@2.1.0: {} + + asn1js@3.0.6: + dependencies: + pvtsutils: 1.3.6 + pvutils: 1.1.3 + tslib: 2.8.1 + + better-path-resolve@1.0.0: + dependencies: + is-windows: 1.0.2 + + binary-extensions@2.3.0: {} + + braces@3.0.3: + dependencies: + fill-range: 7.1.1 + + bun-types@1.2.19(@types/react@19.1.8): + dependencies: + '@types/node': 24.0.15 + '@types/react': 19.1.8 + + chardet@0.7.0: {} + + chokidar@3.6.0: + dependencies: + anymatch: 3.1.3 + braces: 3.0.3 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.3 + + ci-info@3.9.0: {} + + commander@9.5.0: {} + + cross-env@7.0.3: + dependencies: + cross-spawn: 7.0.6 + + cross-spawn@7.0.6: + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + + csstype@3.1.3: {} + + detect-indent@6.1.0: {} + + dir-glob@3.0.1: + dependencies: + path-type: 4.0.0 + + enquirer@2.4.1: + dependencies: + ansi-colors: 4.1.3 + strip-ansi: 6.0.1 + + esprima@4.0.1: {} + + execa@8.0.1: + dependencies: + cross-spawn: 7.0.6 + get-stream: 8.0.1 + human-signals: 5.0.0 + is-stream: 3.0.0 + merge-stream: 2.0.0 + npm-run-path: 5.3.0 + onetime: 6.0.0 + signal-exit: 4.1.0 + strip-final-newline: 3.0.0 + + extendable-error@0.1.7: {} + + external-editor@3.1.0: + dependencies: + chardet: 0.7.0 + iconv-lite: 0.4.24 + tmp: 0.0.33 + + fast-glob@3.3.3: + dependencies: + '@nodelib/fs.stat': 2.0.5 + '@nodelib/fs.walk': 1.2.8 + glob-parent: 5.1.2 + merge2: 1.4.1 + micromatch: 4.0.8 + + fastq@1.19.1: + dependencies: + reusify: 1.1.0 + + fill-range@7.1.1: + dependencies: + to-regex-range: 5.0.1 + + find-up@4.1.0: + dependencies: + locate-path: 5.0.0 + path-exists: 4.0.0 + + fs-extra@7.0.1: + dependencies: + graceful-fs: 4.2.11 + jsonfile: 4.0.0 + universalify: 0.1.2 + + fs-extra@8.1.0: + dependencies: + graceful-fs: 4.2.11 + jsonfile: 4.0.0 + universalify: 0.1.2 + + fsevents@2.3.3: + optional: true + + get-stream@8.0.1: {} + + get-tsconfig@4.10.1: + dependencies: + resolve-pkg-maps: 1.0.0 + + git-cliff-darwin-arm64@2.7.0: + optional: true + + git-cliff-darwin-x64@2.7.0: + optional: true + + git-cliff-linux-arm64@2.7.0: + optional: true + + git-cliff-linux-x64@2.7.0: + optional: true + + git-cliff-windows-arm64@2.7.0: + optional: true + + git-cliff-windows-x64@2.7.0: + optional: true + + git-cliff@2.7.0: + dependencies: + execa: 8.0.1 + optionalDependencies: + git-cliff-darwin-arm64: 2.7.0 + git-cliff-darwin-x64: 2.7.0 + git-cliff-linux-arm64: 2.7.0 + git-cliff-linux-x64: 2.7.0 + git-cliff-windows-arm64: 2.7.0 + git-cliff-windows-x64: 2.7.0 + + glob-parent@5.1.2: + dependencies: + is-glob: 4.0.3 + + globals@15.15.0: {} + + globby@11.1.0: + dependencies: + array-union: 2.1.0 + dir-glob: 3.0.1 + fast-glob: 3.3.3 + ignore: 5.3.2 + merge2: 1.4.1 + slash: 3.0.0 + + graceful-fs@4.2.11: {} + + human-id@1.0.2: {} + + human-signals@5.0.0: {} + + iconv-lite@0.4.24: + dependencies: + safer-buffer: 2.1.2 + + ignore@5.3.2: {} + + is-binary-path@2.1.0: + dependencies: + binary-extensions: 2.3.0 + + is-extglob@2.1.1: {} + + is-glob@4.0.3: + dependencies: + is-extglob: 2.1.1 + + is-number@7.0.0: {} + + is-stream@3.0.0: {} + + is-subdir@1.2.0: + dependencies: + better-path-resolve: 1.0.0 + + is-windows@1.0.2: {} + + isexe@2.0.0: {} + + jose@6.0.8: {} + + js-yaml@3.14.1: + dependencies: + argparse: 1.0.10 + esprima: 4.0.1 + + jsonfile@4.0.0: + optionalDependencies: + graceful-fs: 4.2.11 + + locate-path@5.0.0: + dependencies: + p-locate: 4.1.0 + + lodash.startcase@4.4.0: {} + + merge-stream@2.0.0: {} + + merge2@1.4.1: {} + + micromatch@4.0.8: + dependencies: + braces: 3.0.3 + picomatch: 2.3.1 + + mimic-fn@4.0.0: {} + + mri@1.2.0: {} + + mylas@2.1.13: {} + + normalize-path@3.0.0: {} + + npm-run-path@5.3.0: + dependencies: + path-key: 4.0.0 + + oauth4webapi@3.6.0: {} + + onetime@6.0.0: + dependencies: + mimic-fn: 4.0.0 + + os-tmpdir@1.0.2: {} + + outdent@0.5.0: {} + + p-filter@2.1.0: + dependencies: + p-map: 2.1.0 + + p-limit@2.3.0: + dependencies: + p-try: 2.2.0 + + p-locate@4.1.0: + dependencies: + p-limit: 2.3.0 + + p-map@2.1.0: {} + + p-try@2.2.0: {} + + package-manager-detector@0.2.11: + dependencies: + quansync: 0.2.10 + + path-exists@4.0.0: {} + + path-key@3.1.1: {} + + path-key@4.0.0: {} + + path-type@4.0.0: {} + + picocolors@1.1.1: {} + + picomatch@2.3.1: {} + + pify@4.0.1: {} + + plimit-lit@1.6.1: + dependencies: + queue-lit: 1.5.2 + + prettier@2.8.8: {} + + prettier@3.4.2: {} + + pvtsutils@1.3.6: + dependencies: + tslib: 2.8.1 + + pvutils@1.1.3: {} + + qs-esm@7.0.2: {} + + quansync@0.2.10: {} + + queue-lit@1.5.2: {} + + queue-microtask@1.2.3: {} + + read-yaml-file@1.1.0: + dependencies: + graceful-fs: 4.2.11 + js-yaml: 3.14.1 + pify: 4.0.1 + strip-bom: 3.0.0 + + readdirp@3.6.0: + dependencies: + picomatch: 2.3.1 + + resolve-from@5.0.0: {} + + resolve-pkg-maps@1.0.0: {} + + reusify@1.1.0: {} + + run-parallel@1.2.0: + dependencies: + queue-microtask: 1.2.3 + + safer-buffer@2.1.2: {} + + semver@7.7.2: {} + + shebang-command@2.0.0: + dependencies: + shebang-regex: 3.0.0 + + shebang-regex@3.0.0: {} + + signal-exit@4.1.0: {} + + slash@3.0.0: {} + + spawndamnit@3.0.1: + dependencies: + cross-spawn: 7.0.6 + signal-exit: 4.1.0 + + sprintf-js@1.0.3: {} + + strip-ansi@6.0.1: + dependencies: + ansi-regex: 5.0.1 + + strip-bom@3.0.0: {} + + strip-final-newline@3.0.0: {} + + term-size@2.2.1: {} + + tmp@0.0.33: + dependencies: + os-tmpdir: 1.0.2 + + to-regex-range@5.0.1: + dependencies: + is-number: 7.0.0 + + tsc-alias@1.8.16: + dependencies: + chokidar: 3.6.0 + commander: 9.5.0 + get-tsconfig: 4.10.1 + globby: 11.1.0 + mylas: 2.1.13 + normalize-path: 3.0.0 + plimit-lit: 1.6.1 + + tslib@2.8.1: {} + + typescript@5.8.3: {} + + undici-types@7.8.0: {} + + universalify@0.1.2: {} + + uuid@11.1.0: {} + + which@2.0.2: + dependencies: + isexe: 2.0.0 diff --git a/src/core/endpoints.ts b/src/core/endpoints.ts index 40fac53..b4dd265 100644 --- a/src/core/endpoints.ts +++ b/src/core/endpoints.ts @@ -59,17 +59,20 @@ export class OAuthEndpointStrategy implements EndpointStrategy { request.routeParams?.provider as string ] as OAuthProviderConfig - return OAuthHandlers( + const state = request.searchParams.get("state") ?? undefined + + return OAuthHandlers({ pluginType, collections, allowOAuthAutoSignUp, - request.payload.secret, + secret: request.payload.secret, useAdmin, request, provider, successRedirectPath, errorRedirectPath, - ) + state, + }) }, }, ] diff --git a/src/core/protocols/oauth/oauth2_authorization.ts b/src/core/protocols/oauth/oauth2_authorization.ts index d0303ec..fb185d7 100644 --- a/src/core/protocols/oauth/oauth2_authorization.ts +++ b/src/core/protocols/oauth/oauth2_authorization.ts @@ -1,6 +1,7 @@ +import { createOAuthState } from "@/core/routeHandlers/oauth" +import { getCallbackURL } from "@/core/utils/cb" +import { OAuth2ProviderConfig, ParsedOAuthState } from "@/types" import * as oauth from "oauth4webapi" -import type { OAuth2ProviderConfig } from "../../../types.js" -import { getCallbackURL } from "../../utils/cb.js" import type { PayloadRequest } from "payload" export async function OAuth2Authorization( @@ -8,13 +9,16 @@ export async function OAuth2Authorization( request: PayloadRequest, providerConfig: OAuth2ProviderConfig, clientOrigin?: string | undefined, + parsedState?: ParsedOAuthState | null, ): Promise { const callback_url = getCallbackURL( request.payload.config.serverURL, pluginType, providerConfig.id, ) - const code_verifier = oauth.generateRandomCodeVerifier() + const code_verifier = + parsedState?.codeVerifier || oauth.generateRandomCodeVerifier() + const code_challenge = await oauth.calculatePKCECodeChallenge(code_verifier) const code_challenge_method = "S256" const { authorization_server, client_id, scope, params } = providerConfig @@ -39,6 +43,10 @@ export async function OAuth2Authorization( code_challenge_method, ) + if (parsedState) { + authorizationURL.searchParams.set("state", createOAuthState(parsedState)) + } + if (params) { Object.entries(params).map(([key, value]) => { authorizationURL.searchParams.set(key, value) diff --git a/src/core/protocols/oauth/oauth2_callback.ts b/src/core/protocols/oauth/oauth2_callback.ts index 521a637..c4bb130 100644 --- a/src/core/protocols/oauth/oauth2_callback.ts +++ b/src/core/protocols/oauth/oauth2_callback.ts @@ -1,35 +1,53 @@ import * as oauth from "oauth4webapi" -import { parseCookies, type PayloadRequest } from "payload" -import type { OAuth2ProviderConfig } from "../../../types.js" -import { MissingOrInvalidSession } from "../../errors/consoleErrors.js" -import { getCallbackURL } from "../../utils/cb.js" -import { OAuthAuthentication } from "./oauth_authentication.js" +import { parseCookies } from "payload" +import { OAuthAuthentication } from "./oauth_authentication" +import { MissingOrInvalidSession } from "@/core/errors/consoleErrors" +import { createOAuthState } from "@/core/routeHandlers/oauth" +import { getCallbackURL } from "@/core/utils/cb" +import { + OAuthCallbackParams, + ParsedOAuthState, + OAuth2ProviderConfig, + AccountInfo, + OAuthAccountData, +} from "@/types" export async function OAuth2Callback( - pluginType: string, - request: PayloadRequest, - providerConfig: OAuth2ProviderConfig, - collections: { - usersCollection: string - accountsCollection: string - }, - allowOAuthAutoSignUp: boolean, - useAdmin: boolean, - secret: string, - successRedirectPath: string, - errorRedirectPath: string, + params: OAuthCallbackParams, + parsedState: ParsedOAuthState | null, ): Promise { + const { + pluginType, + request, + provider, + collections, + allowOAuthAutoSignUp, + useAdmin, + secret, + successRedirectPath, + errorRedirectPath, + } = params + + const providerConfig = provider as OAuth2ProviderConfig const parsedCookies = parseCookies(request.headers) - const code_verifier = parsedCookies.get("__session-code-verifier") - const state = parsedCookies.get("__session-oauth-state") + const code_verifier = + parsedState?.codeVerifier || parsedCookies.get("__session-code-verifier") + const state = parsedState + ? createOAuthState(parsedState) + : parsedCookies.get("__session-oauth-state") if (!code_verifier) { throw new MissingOrInvalidSession() } - const { client_id, client_secret, authorization_server, client_auth_type } = - providerConfig + const { + client_id, + client_secret, + authorization_server, + client_auth_type, + profile, + } = providerConfig const client: oauth.Client = { client_id, @@ -48,18 +66,25 @@ export async function OAuth2Callback( ) const as = authorization_server - const params = oauth.validateAuthResponse(as, client, current_url, state) + const params_oauth = oauth.validateAuthResponse( + as, + client, + current_url, + state, + ) const grantResponse = await oauth.authorizationCodeGrantRequest( as, client, clientAuth, - params, + params_oauth, callback_url.toString(), code_verifier, ) + const body = (await grantResponse.json()) as { scope: string | string[] } let response = new Response(JSON.stringify(body), grantResponse) + if (Array.isArray(body.scope)) { body.scope = body.scope.join(" ") response = new Response(JSON.stringify(body), grantResponse) @@ -78,13 +103,23 @@ export async function OAuth2Callback( ) const userInfo = (await userInfoResponse.json()) as Record - const userData = { - email: userInfo.email, - name: userInfo.name ?? "", - sub: userInfo.sub, + // Use the provider's profile callback if available + let accountInfo: AccountInfo + if (profile) { + accountInfo = profile(userInfo) + } else { + accountInfo = { + sub: userInfo.sub ?? "", + name: userInfo.name ?? "", + email: userInfo.email ?? "", + picture: userInfo.picture ?? "", + } + } + + const userData: OAuthAccountData = { + ...accountInfo, scope: providerConfig.scope, issuer: providerConfig.authorization_server.issuer, - picture: userInfo.picture ?? "", access_token: token_result.access_token, } diff --git a/src/core/protocols/oauth/oauth_authentication.ts b/src/core/protocols/oauth/oauth_authentication.ts index 09044b9..34f71a4 100644 --- a/src/core/protocols/oauth/oauth_authentication.ts +++ b/src/core/protocols/oauth/oauth_authentication.ts @@ -1,38 +1,33 @@ import * as jose from "jose" -import type { JsonObject, PayloadRequest, TypeWithID } from "payload" -import { APP_COOKIE_SUFFIX } from "../../../constants.js" +import { v4 as uuid } from "uuid" +import type { + JsonObject, + PayloadRequest, + TypeWithID, + UserSession, +} from "payload" +import { OAuthAccountData, OAuthCollections } from "@/types" +import { APP_COOKIE_SUFFIX } from "@/constants" import { - MissingCollection, UserNotFoundAPIError, -} from "../../errors/apiErrors.js" + MissingCollection, +} from "@/core/errors/apiErrors" import { createSessionCookies, invalidateOAuthCookies, -} from "../../utils/cookies.js" +} from "@/core/utils/cookies" +import { removeExpiredSessions } from "@/core/utils/session" -import { v4 as uuid } from "uuid" -import { removeExpiredSessions } from "../../utils/session.js" export async function OAuthAuthentication( pluginType: string, - collections: { - usersCollection: string - accountsCollection: string - }, + collections: OAuthCollections, allowOAuthAutoSignUp: boolean, useAdmin: boolean, secret: string, request: PayloadRequest, successRedirectPath: string, errorRedirectPath: string, - account: { - email: string - sub: string - name: string - scope: string - issuer: string - picture?: string | undefined - access_token: string - }, + userData: OAuthAccountData, ): Promise { const { email: _email, @@ -42,7 +37,7 @@ export async function OAuthAuthentication( issuer, picture, access_token, - } = account + } = userData const { payload } = request const email = _email.toLowerCase() @@ -55,8 +50,9 @@ export async function OAuthAuthentication( }, }, }) + let userRecord: JsonObject & TypeWithID - if (userRecords.docs.length === 1) { + if (userRecords.docs.length === 1 && userRecords.docs[0]) { userRecord = userRecords.docs[0] } else if (allowOAuthAutoSignUp) { const data: Record = { @@ -64,7 +60,7 @@ export async function OAuthAuthentication( name, } const hasAuthEnabled = Boolean( - payload.collections[collections.usersCollection].config.auth, + payload.collections[collections.usersCollection]?.config.auth, ) if (hasAuthEnabled) { data.password = jose.base64url.encode( @@ -80,7 +76,7 @@ export async function OAuthAuthentication( return new UserNotFoundAPIError() } - const data: Record = { + const accountData: Record = { scope, name: name, picture: picture, @@ -94,18 +90,23 @@ export async function OAuthAuthentication( sub: { equals: sub }, }, }) - if (accountRecords.docs && accountRecords.docs.length === 1) { + + if ( + accountRecords.docs && + accountRecords.docs.length === 1 && + accountRecords.docs[0] + ) { await payload.update({ collection: collections.accountsCollection, id: accountRecords.docs[0].id, - data, + data: accountData, }) } else { - data.sub = sub - data.user = userRecord.id + accountData.sub = sub + accountData.user = userRecord.id await payload.create({ collection: collections.accountsCollection, - data, + data: accountData, }) } @@ -124,13 +125,20 @@ export async function OAuthAuthentication( const now = new Date() const tokenExpInMs = collectionConfig.auth.tokenExpiration * 1000 const expiresAt = new Date(now.getTime() + tokenExpInMs) - const session = { id: sessionID, createdAt: now, expiresAt } + + const session: UserSession = { + id: sessionID!, + createdAt: now, + expiresAt, + } + if (!userRecord["sessions"]?.length) { userRecord["sessions"] = [session] } else { userRecord.sessions = removeExpiredSessions(userRecord.sessions) userRecord.sessions.push(session) } + await payload.db.updateOne({ id: userRecord.id, collection: collections.usersCollection, @@ -139,9 +147,11 @@ export async function OAuthAuthentication( returning: false, }) } + const cookieName = useAdmin ? `${payload.config.cookiePrefix}-token` : `__${pluginType}-${APP_COOKIE_SUFFIX}` + cookies = [ ...(await createSessionCookies( cookieName, @@ -155,10 +165,13 @@ export async function OAuthAuthentication( useAdmin ? collectionConfig?.auth.tokenExpiration : undefined, )), ] + cookies = invalidateOAuthCookies(cookies) + const successRedirectionURL = new URL( `${payload.config.serverURL}${successRedirectPath}`, ) + const res = new Response(null, { status: 302, headers: { diff --git a/src/core/protocols/oauth/oidc_authorization.ts b/src/core/protocols/oauth/oidc_authorization.ts index 79980a7..f0ddd84 100644 --- a/src/core/protocols/oauth/oidc_authorization.ts +++ b/src/core/protocols/oauth/oidc_authorization.ts @@ -1,19 +1,23 @@ import * as oauth from "oauth4webapi" -import type { OIDCProviderConfig } from "../../../types.js" -import { getCallbackURL } from "../../utils/cb.js" import type { PayloadRequest } from "payload" +import { createOAuthState } from "@/core/routeHandlers/oauth" +import { getCallbackURL } from "@/core/utils/cb" +import { OIDCProviderConfig, ParsedOAuthState } from "@/types" export async function OIDCAuthorization( pluginType: string, request: PayloadRequest, providerConfig: OIDCProviderConfig, + parsedState?: ParsedOAuthState | null, ): Promise { const callback_url = getCallbackURL( request.payload.config.serverURL, pluginType, providerConfig.id, ) - const code_verifier = oauth.generateRandomCodeVerifier() + + const code_verifier = + parsedState?.codeVerifier || oauth.generateRandomCodeVerifier() const code_challenge = await oauth.calculatePKCECodeChallenge(code_verifier) const code_challenge_method = "S256" const { client_id, issuer, algorithm, scope, params } = providerConfig @@ -40,6 +44,11 @@ export async function OIDCAuthorization( code_challenge_method, ) + // Add state parameter if provided + if (parsedState) { + authorizationURL.searchParams.set("state", createOAuthState(parsedState)) + } + if (params) { Object.entries(params).map(([key, value]) => { authorizationURL.searchParams.set(key, value) @@ -47,12 +56,13 @@ export async function OIDCAuthorization( } if (as.code_challenge_methods_supported?.includes("S256") !== true) { - const nonce = oauth.generateRandomNonce() + const nonce = parsedState?.nonce || oauth.generateRandomNonce() authorizationURL.searchParams.set("nonce", nonce) cookies.push( `__session-oauth-nonce=${nonce};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`, ) } + cookies.push( `__session-code-verifier=${code_verifier};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`, ) diff --git a/src/core/protocols/oauth/oidc_callback.ts b/src/core/protocols/oauth/oidc_callback.ts index 5f5bcec..fd35ceb 100644 --- a/src/core/protocols/oauth/oidc_callback.ts +++ b/src/core/protocols/oauth/oidc_callback.ts @@ -1,33 +1,44 @@ import * as oauth from "oauth4webapi" -import { parseCookies, type PayloadRequest } from "payload" -import type { OIDCProviderConfig } from "../../../types.js" +import { parseCookies } from "payload" +import type { + OIDCProviderConfig, + AccountInfo, + OAuthCallbackParams, + ParsedOAuthState, + OAuthAccountData, +} from "@/types" import { InternalServerError, MissingEmailAPIError, UnVerifiedAccountAPIError, -} from "../../errors/apiErrors.js" -import { MissingOrInvalidSession } from "../../errors/consoleErrors.js" -import { getCallbackURL } from "../../utils/cb.js" -import { OAuthAuthentication } from "./oauth_authentication.js" +} from "@/errors/apiErrors" +import { MissingOrInvalidSession } from "@/errors/consoleErrors" +import { getCallbackURL } from "@/utils/cb" +import { OAuthAuthentication } from "./oauth_authentication" +import { createOAuthState } from "@/core/routeHandlers/oauth" export async function OIDCCallback( - pluginType: string, - request: PayloadRequest, - providerConfig: OIDCProviderConfig, - collections: { - usersCollection: string - accountsCollection: string - }, - allowOAuthAutoSignUp: boolean, - useAdmin: boolean, - secret: string, - successRedirectPath: string, - errorRedirectPath: string, + params: OAuthCallbackParams, + parsedState: ParsedOAuthState | null, ): Promise { + const { + pluginType, + request, + provider, + collections, + allowOAuthAutoSignUp, + useAdmin, + secret, + successRedirectPath, + errorRedirectPath, + } = params + + const providerConfig = provider as OIDCProviderConfig const parsedCookies = parseCookies(request.headers) - const code_verifier = parsedCookies.get("__session-code-verifier") - const nonce = parsedCookies.get("__session-oauth-nonce") + const code_verifier = + parsedState?.codeVerifier || parsedCookies.get("__session-code-verifier") + const nonce = parsedState?.nonce || parsedCookies.get("__session-oauth-nonce") if (!code_verifier) { throw new MissingOrInvalidSession() @@ -35,6 +46,7 @@ export async function OIDCCallback( const { client_id, client_secret, issuer, algorithm, profile } = providerConfig + const client: oauth.Client = { client_id, } @@ -53,24 +65,30 @@ export async function OIDCCallback( .discoveryRequest(issuer_url, { algorithm }) .then((response) => oauth.processDiscoveryResponse(issuer_url, response)) - const params = oauth.validateAuthResponse( + // Use parsed state for validation if available + const stateParam = parsedState + ? createOAuthState(parsedState) + : providerConfig?.params?.state || undefined + + const params_oauth = oauth.validateAuthResponse( as, client, current_url, - providerConfig?.params?.state || undefined, + stateParam, ) const grantResponse = await oauth.authorizationCodeGrantRequest( as, client, clientAuth, - params, + params_oauth, callback_url.toString(), code_verifier, ) const body = (await grantResponse.json()) as { scope: string | string[] } let response = new Response(JSON.stringify(body), grantResponse) + if (Array.isArray(body.scope)) { body.scope = body.scope.join(" ") response = new Response(JSON.stringify(body), grantResponse) @@ -108,17 +126,32 @@ export async function OIDCCallback( return new MissingEmailAPIError() } - if (!providerConfig.skip_email_verification && !result.email_verified) { + // Remove skip_email_verification check since it's not in your types + // Only check email_verified if it exists in the result + if (result.email_verified === false) { return new UnVerifiedAccountAPIError() } - const userData = { - email: result.email, - name: result.name ?? "", - sub: result.sub, + // Use the provider's profile callback if available, otherwise use direct mapping + let accountInfo: AccountInfo + if (profile) { + const filteredResult = Object.fromEntries( + Object.entries(result).filter(([_, v]) => v !== undefined), + ) as Record + accountInfo = profile(filteredResult) + } else { + accountInfo = { + sub: result.sub, + name: result.name ?? "", + email: result.email, + picture: result.picture ?? "", + } + } + + const userData: OAuthAccountData = { + ...accountInfo, scope: providerConfig.scope, issuer: providerConfig.issuer, - picture: result.picture ?? "", access_token: token_result.access_token, } diff --git a/src/core/protocols/password.ts b/src/core/protocols/password.ts index 2444c21..27ab1ed 100644 --- a/src/core/protocols/password.ts +++ b/src/core/protocols/password.ts @@ -88,6 +88,9 @@ export const PasswordSignin = async ( return new UserNotFoundAPIError() } const userRecord = docs[0] + if (!userRecord) { + return new UserNotFoundAPIError() + } if (!userRecord.hashedPassword) { return new InvalidCredentials() } @@ -116,6 +119,7 @@ export const PasswordSignin = async ( const tokenExpInMs = collectionConfig.auth.tokenExpiration * 1000 const expiresAt = new Date(now.getTime() + tokenExpInMs) const session = { id: sessionID, createdAt: now, expiresAt } + if (!userRecord["sessions"]?.length) { userRecord["sessions"] = [session] } else { @@ -316,7 +320,9 @@ export const ForgotPasswordInit = async ( ) const verification_token_expires = new Date() verification_token_expires.setDate(verification_token_expires.getDate() + 7) - + if (!docs[0]) { + return new MissingOrInvalidVerification() + } await payload.update({ collection: internal.usersCollectionSlug, id: docs[0].id, @@ -356,6 +362,9 @@ export const ForgotPasswordVerify = async ( verificationCode: { equals: body.code }, }, }) + if (docs.length === 0 || !docs[0]) { + return new MissingOrInvalidVerification() + } const currentDate = Date.now() if ( @@ -456,11 +465,14 @@ export const ResetPassword = async ( } const user = docs[0] + if (!user) { + return new UserNotFoundAPIError() + } const isVerifed = await verifyPassword( body.currentPassword, - user.hashedPassword, - user.hashSalt, - user.hashIterations, + user?.hashedPassword, + user?.hashSalt, + user?.hashIterations, ) if (!isVerifed) { return new InvalidCredentials() diff --git a/src/core/routeHandlers/oauth.ts b/src/core/routeHandlers/oauth.ts index 8cc5f92..5a29e11 100644 --- a/src/core/routeHandlers/oauth.ts +++ b/src/core/routeHandlers/oauth.ts @@ -1,72 +1,107 @@ import type { PayloadRequest } from "payload" -import type { OAuthProviderConfig } from "../../types.js" +import type { + OAuthHandlersParams, + OAuthCallbackParams, + ParsedOAuthState, +} from "@/types" import { InvalidOAuthAlgorithm, InvalidOAuthResource, InvalidProvider, -} from "../errors/consoleErrors.js" -import { OIDCAuthorization } from "../protocols/oauth/oidc_authorization.js" -import { OAuth2Authorization } from "../protocols/oauth/oauth2_authorization.js" -import { OIDCCallback } from "../protocols/oauth/oidc_callback.js" -import { OAuth2Callback } from "../protocols/oauth/oauth2_callback.js" +} from "@/errors/consoleErrors" +import { OIDCAuthorization } from "@/protocols/oauth/oidc_authorization" +import { OAuth2Authorization } from "@/protocols/oauth/oauth2_authorization" +import { OIDCCallback } from "@/protocols/oauth/oidc_callback" +import { OAuth2Callback } from "@/protocols/oauth/oauth2_callback" -export function OAuthHandlers( - pluginType: string, - collections: { - usersCollection: string - accountsCollection: string - }, - allowOAuthAutoSignUp: boolean, - secret: string, - useAdmin: boolean, - request: PayloadRequest, - provider: OAuthProviderConfig, - successRedirectPath: string, - errorRedirectPath: string, +/** + * Safely parse OAuth state parameter + */ +function parseOAuthState(state: string | undefined): ParsedOAuthState | null { + if (!state) return null + + try { + return JSON.parse(decodeURIComponent(state)) as ParsedOAuthState + } catch (error) { + console.warn("Failed to parse OAuth state:", error) + return null + } +} + +/** + * Create OAuth state parameter + */ +export function createOAuthState(data: ParsedOAuthState): string { + return encodeURIComponent( + JSON.stringify({ + ...data, + timestamp: Date.now(), + }), + ) +} + +/** + * Main OAuth handler that routes to appropriate authorization or callback handlers + */ +export async function OAuthHandlers( + params: OAuthHandlersParams, ): Promise { + const { + pluginType, + collections, + allowOAuthAutoSignUp, + secret, + useAdmin, + request, + provider, + successRedirectPath, + errorRedirectPath, + state, + } = params + if (!provider) { throw new InvalidProvider() } const resource = request.routeParams?.resource as string + const parsedState = parseOAuthState(state) + + // Create callback params with parsed state + const callbackParams: OAuthCallbackParams = { + pluginType, + collections, + allowOAuthAutoSignUp, + secret, + useAdmin, + request, + provider, + successRedirectPath: parsedState?.redirectPath || successRedirectPath, + errorRedirectPath, + } switch (resource) { case "authorization": switch (provider.algorithm) { case "oidc": - return OIDCAuthorization(pluginType, request, provider) + return OIDCAuthorization(pluginType, request, provider, parsedState) case "oauth2": - return OAuth2Authorization(pluginType, request, provider) + return OAuth2Authorization( + pluginType, + request, + provider, + undefined, + parsedState, + ) default: throw new InvalidOAuthAlgorithm() } case "callback": switch (provider.algorithm) { case "oidc": { - return OIDCCallback( - pluginType, - request, - provider, - collections, - allowOAuthAutoSignUp, - useAdmin, - secret, - successRedirectPath, - errorRedirectPath, - ) + return OIDCCallback(callbackParams, parsedState) } case "oauth2": { - return OAuth2Callback( - pluginType, - request, - provider, - collections, - allowOAuthAutoSignUp, - useAdmin, - secret, - successRedirectPath, - errorRedirectPath, - ) + return OAuth2Callback(callbackParams, parsedState) } default: throw new InvalidOAuthAlgorithm() diff --git a/src/providers/oauth2/discord.ts b/src/providers/oauth2/discord.ts index 048d6f5..7c517f8 100644 --- a/src/providers/oauth2/discord.ts +++ b/src/providers/oauth2/discord.ts @@ -53,7 +53,7 @@ function DiscordAuthProvider(config: DiscordAuthConfig): OAuth2ProviderConfig { algorithm: "oauth2", kind: "oauth", profile: (profile): AccountInfo => { - const format = profile.avatar.toString().startsWith("a_") ? "gif" : "png" + const format = profile.avatar?.toString().startsWith("a_") ? "gif" : "png" return { sub: profile.id as string, diff --git a/src/types.ts b/src/types.ts index 858e3ac..a122cff 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,4 +1,5 @@ import type { AuthorizationServer } from "oauth4webapi" +import { PayloadRequest } from "payload" export enum ErrorKind { NotFound = "NotFound", @@ -149,3 +150,39 @@ export type UserSession = { expiresAt: Date | string id: string } +export interface OAuthCollections { + usersCollection: string + accountsCollection: string +} + +export interface OAuthBaseParams { + pluginType: string + collections: OAuthCollections + allowOAuthAutoSignUp: boolean + secret: string + useAdmin: boolean + request: PayloadRequest + provider: OAuthProviderConfig + successRedirectPath: string + errorRedirectPath: string +} +export interface OAuthHandlersParams extends OAuthBaseParams { + state?: string +} + +export interface OAuthCallbackParams extends OAuthBaseParams {} + +export interface OAuthAccountData extends Omit { + scope: string + issuer: string + access_token: string +} + +export interface ParsedOAuthState { + redirectPath?: string + provider?: string + timestamp?: number + nonce?: string + codeVerifier?: string + [key: string]: unknown +} diff --git a/tsconfig.json b/tsconfig.json index 5259ebd..2b517c1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,21 +1,88 @@ { - "extends": "@tsconfig/node22/tsconfig.json", "compilerOptions": { + /* Strictness */ + "strict": true, + "noUncheckedIndexedAccess": true, + "noImplicitOverride": true, + "composite": true, + "declaration": true, + "declarationMap": true, + "target": "ES2022", + "rootDir": "${configDir}/src", + "module": "esnext", + "moduleResolution": "bundler", + "allowJs": true, + "checkJs": false, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "jsx": "preserve", + "outDir": "${configDir}/dist", + "resolveJsonModule": true, + "skipLibCheck": true, + "emitDeclarationOnly": true, + "sourceMap": true, + "baseUrl": ".", "lib": [ "DOM", "DOM.Iterable", - "ES2015", - "ES2016", - "ES2017", - "ES2018", - "ES2019", - "ES2020" + "ES2022" ], - "outDir": "dist", - "declaration": true, - "skipLibCheck": true, - "module": "NodeNext", - "moduleResolution": "NodeNext" + "types": [ + "node", + ], + "incremental": true, + "isolatedModules": true, + "plugins": [ + { + "name": "next" + } + ], + "paths": { + "@/*": [ + "src/*" + ], + "@/constants": [ + "src/constants" + ], + "@/types": [ + "src/types" + ], + "@/client/*": [ + "src/client/*" + ], + "@/collection/*": [ + "src/collection/*" + ], + "@/core/*": [ + "src/core/*" + ], + "@/providers/*": [ + "src/providers/*" + ], + "@/errors/*": [ + "src/core/errors/*" + ], + "@/utils/*": [ + "src/core/utils/*" + ], + "@/protocols/*": [ + "src/core/protocols/*" + ], + "@/routeHandlers/*": [ + "src/core/routeHandlers/*" + ], + "@/preflights/*": [ + "src/core/preflights/*" + ] + } }, - "include": ["src"] -} + "include": [ + "${configDir}/src" + ], + "exclude": [ + "${configDir}/dist", + "${configDir}/build", + "${configDir}/temp", + "**/*.spec.ts" + ] +} \ No newline at end of file From 730343ca8087015b3bc5c935cda88864b08ac293 Mon Sep 17 00:00:00 2001 From: WillODR Date: Wed, 23 Jul 2025 15:19:50 +0100 Subject: [PATCH 2/7] feat(auth): add optional redirectUrl to signin and oauth flow - Updated AuthClient to accept an optional redirectUrl in the signin method. - Modified oauth function to append redirectUrl as a state parameter in the authorization URL. - Adjusted signin function to include redirectUrl in the options interface. - Enhanced OIDCCallback to log state parameters and OAuth response for debugging. - Changed tsconfig to emit declaration files. - Added pnpm workspace configuration for only built dependencies. --- package.json | 30 +- pnpm-lock.yaml | 894 +++++++++++++++++++++- pnpm-workspace.yaml | 2 + src/client/index.ts | 4 +- src/client/oauth.ts | 3 +- src/client/signin.ts | 1 + src/core/protocols/oauth/oidc_callback.ts | 3 +- tsconfig.json | 2 +- 8 files changed, 917 insertions(+), 22 deletions(-) create mode 100644 pnpm-workspace.yaml diff --git a/package.json b/package.json index 0af0f98..ad17da5 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,8 @@ "homepage:": "https://github.com/authsmith/payload-auth-plugin", "repository": "git@github.com:authsmith/payload-auth-plugin.git", "description": "Authentication plugin for Payload CMS", - "main": "dist/esm/index.js", - "types": "dist/types/index.d.ts", + "main": "dist/index.js", + "types": "dist/index.d.ts", "keywords": [ "payload", "cms", @@ -40,24 +40,24 @@ ], "exports": { ".": { - "import": "./dist/esm/index.js", - "types": "./dist/types/index.d.ts" + "import": "./dist/index.js", + "types": "./dist/index.d.ts" }, "./providers": { - "import": "./dist/esm/providers/index.js", - "types": "./dist/types/providers/index.d.ts" + "import": "./dist/providers/index.js", + "types": "./dist/providers/index.d.ts" }, "./client": { - "import": "./dist/esm/client/index.js", - "types": "./dist/types/client/index.d.ts" + "import": "./dist/client/index.js", + "types": "./dist/client/index.d.ts" }, "./collection": { - "import": "./dist/esm/collection/index.js", - "types": "./dist/types/collection/index.d.ts" + "import": "./dist/collection/index.js", + "types": "./dist/collection/index.d.ts" }, "./collection/hooks": { - "import": "./dist/esm/collection/hooks.js", - "types": "./dist/types/collection/hooks.d.ts" + "import": "./dist/collection/hooks.js", + "types": "./dist/collection/hooks.d.ts" } }, "files": [ @@ -66,7 +66,7 @@ ], "scripts": { "build:bun": "bun run ./script/build.ts", - "build": "tsc && tsc-alias", + "build": "cross-env tsc && tsc-alias", "format": "bun x prettier --write '**/*.{js,jsx,ts,tsx,json,md,yaml,yml}'", "release": "bun run build && changeset publish" }, @@ -76,6 +76,7 @@ "@tsconfig/strictest": "^2.0.5", "@types/bun": "latest", "@types/jsonwebtoken": "^9.0.7", + "@types/node": "^22.16.5", "cross-env": "^7.0.3", "git-cliff": "2.7.0", "globals": "^15.14.0", @@ -90,5 +91,8 @@ "oauth4webapi": "^3.1.4", "qs-esm": "7.0.2", "uuid": "11.1.0" + }, + "peerDependencies": { + "payload": "^3.48.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b68220b..91944e8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ importers: oauth4webapi: specifier: ^3.1.4 version: 3.6.0 + payload: + specifier: ^3.48.0 + version: 3.48.0(graphql@16.11.0)(typescript@5.8.3) qs-esm: specifier: 7.0.2 version: 7.0.2 @@ -42,6 +45,9 @@ importers: '@types/jsonwebtoken': specifier: ^9.0.7 version: 9.0.10 + '@types/node': + specifier: ^22.16.5 + version: 22.16.5 cross-env: specifier: ^7.0.3 version: 7.0.3 @@ -63,6 +69,10 @@ importers: packages: + '@apidevtools/json-schema-ref-parser@11.9.3': + resolution: {integrity: sha512-60vepv88RwcJtSHrD6MjIL6Ta3SOYbgfnkHb+ppAVK+o9mXprRtulx7VlRl3lN3bbvysAfCS7WMVfhUYemB0IQ==} + engines: {node: '>= 16'} + '@babel/runtime@7.27.6': resolution: {integrity: sha512-vbavdySgbTTrmFE+EsiqUTzlOr5bzlnJtUv9PynGCAKvfQqjIXbvFdumPM/GxMDfyuGMJaJAU6TO4zc1Jf1i8Q==} engines: {node: '>=6.9.0'} @@ -122,9 +132,168 @@ packages: '@changesets/write@0.3.2': resolution: {integrity: sha512-kDxDrPNpUgsjDbWBvUo27PzKX4gqeKOlhibaOXDJA6kuBisGqNHv/HwGJrAu8U/dSf8ZEFIeHIPtvSlZI1kULw==} + '@esbuild/aix-ppc64@0.25.8': + resolution: {integrity: sha512-urAvrUedIqEiFR3FYSLTWQgLu5tb+m0qZw0NBEasUeo6wuqatkMDaRT+1uABiGXEu5vqgPd7FGE1BhsAIy9QVA==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.25.8': + resolution: {integrity: sha512-OD3p7LYzWpLhZEyATcTSJ67qB5D+20vbtr6vHlHWSQYhKtzUYrETuWThmzFpZtFsBIxRvhO07+UgVA9m0i/O1w==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.25.8': + resolution: {integrity: sha512-RONsAvGCz5oWyePVnLdZY/HHwA++nxYWIX1atInlaW6SEkwq6XkP3+cb825EUcRs5Vss/lGh/2YxAb5xqc07Uw==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.25.8': + resolution: {integrity: sha512-yJAVPklM5+4+9dTeKwHOaA+LQkmrKFX96BM0A/2zQrbS6ENCmxc4OVoBs5dPkCCak2roAD+jKCdnmOqKszPkjA==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.25.8': + resolution: {integrity: sha512-Jw0mxgIaYX6R8ODrdkLLPwBqHTtYHJSmzzd+QeytSugzQ0Vg4c5rDky5VgkoowbZQahCbsv1rT1KW72MPIkevw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.25.8': + resolution: {integrity: sha512-Vh2gLxxHnuoQ+GjPNvDSDRpoBCUzY4Pu0kBqMBDlK4fuWbKgGtmDIeEC081xi26PPjn+1tct+Bh8FjyLlw1Zlg==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.25.8': + resolution: {integrity: sha512-YPJ7hDQ9DnNe5vxOm6jaie9QsTwcKedPvizTVlqWG9GBSq+BuyWEDazlGaDTC5NGU4QJd666V0yqCBL2oWKPfA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.25.8': + resolution: {integrity: sha512-MmaEXxQRdXNFsRN/KcIimLnSJrk2r5H8v+WVafRWz5xdSVmWLoITZQXcgehI2ZE6gioE6HirAEToM/RvFBeuhw==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.25.8': + resolution: {integrity: sha512-WIgg00ARWv/uYLU7lsuDK00d/hHSfES5BzdWAdAig1ioV5kaFNrtK8EqGcUBJhYqotlUByUKz5Qo6u8tt7iD/w==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.25.8': + resolution: {integrity: sha512-FuzEP9BixzZohl1kLf76KEVOsxtIBFwCaLupVuk4eFVnOZfU+Wsn+x5Ryam7nILV2pkq2TqQM9EZPsOBuMC+kg==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.25.8': + resolution: {integrity: sha512-A1D9YzRX1i+1AJZuFFUMP1E9fMaYY+GnSQil9Tlw05utlE86EKTUA7RjwHDkEitmLYiFsRd9HwKBPEftNdBfjg==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.25.8': + resolution: {integrity: sha512-O7k1J/dwHkY1RMVvglFHl1HzutGEFFZ3kNiDMSOyUrB7WcoHGf96Sh+64nTRT26l3GMbCW01Ekh/ThKM5iI7hQ==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.25.8': + resolution: {integrity: sha512-uv+dqfRazte3BzfMp8PAQXmdGHQt2oC/y2ovwpTteqrMx2lwaksiFZ/bdkXJC19ttTvNXBuWH53zy/aTj1FgGw==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.25.8': + resolution: {integrity: sha512-GyG0KcMi1GBavP5JgAkkstMGyMholMDybAf8wF5A70CALlDM2p/f7YFE7H92eDeH/VBtFJA5MT4nRPDGg4JuzQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.25.8': + resolution: {integrity: sha512-rAqDYFv3yzMrq7GIcen3XP7TUEG/4LK86LUPMIz6RT8A6pRIDn0sDcvjudVZBiiTcZCY9y2SgYX2lgK3AF+1eg==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.25.8': + resolution: {integrity: sha512-Xutvh6VjlbcHpsIIbwY8GVRbwoviWT19tFhgdA7DlenLGC/mbc3lBoVb7jxj9Z+eyGqvcnSyIltYUrkKzWqSvg==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.25.8': + resolution: {integrity: sha512-ASFQhgY4ElXh3nDcOMTkQero4b1lgubskNlhIfJrsH5OKZXDpUAKBlNS0Kx81jwOBp+HCeZqmoJuihTv57/jvQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-arm64@0.25.8': + resolution: {integrity: sha512-d1KfruIeohqAi6SA+gENMuObDbEjn22olAR7egqnkCD9DGBG0wsEARotkLgXDu6c4ncgWTZJtN5vcgxzWRMzcw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.25.8': + resolution: {integrity: sha512-nVDCkrvx2ua+XQNyfrujIG38+YGyuy2Ru9kKVNyh5jAys6n+l44tTtToqHjino2My8VAY6Lw9H7RI73XFi66Cg==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.25.8': + resolution: {integrity: sha512-j8HgrDuSJFAujkivSMSfPQSAa5Fxbvk4rgNAS5i3K+r8s1X0p1uOO2Hl2xNsGFppOeHOLAVgYwDVlmxhq5h+SQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.25.8': + resolution: {integrity: sha512-1h8MUAwa0VhNCDp6Af0HToI2TJFAn1uqT9Al6DJVzdIBAd21m/G0Yfc77KDM3uF3T/YaOgQq3qTJHPbTOInaIQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openharmony-arm64@0.25.8': + resolution: {integrity: sha512-r2nVa5SIK9tSWd0kJd9HCffnDHKchTGikb//9c7HX+r+wHYCpQrSgxhlY6KWV1nFo1l4KFbsMlHk+L6fekLsUg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + + '@esbuild/sunos-x64@0.25.8': + resolution: {integrity: sha512-zUlaP2S12YhQ2UzUfcCuMDHQFJyKABkAjvO5YSndMiIkMimPmxA+BYSBikWgsRpvyxuRnow4nS5NPnf9fpv41w==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.25.8': + resolution: {integrity: sha512-YEGFFWESlPva8hGL+zvj2z/SaK+pH0SwOM0Nc/d+rVnW7GSTFlLBGzZkuSU9kFIGIo8q9X3ucpZhu8PDN5A2sQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.25.8': + resolution: {integrity: sha512-hiGgGC6KZ5LZz58OL/+qVVoZiuZlUYlYHNAmczOm7bs2oE1XriPFi5ZHHrS8ACpV5EjySrnoCKmcbQMN+ojnHg==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.25.8': + resolution: {integrity: sha512-cn3Yr7+OaaZq1c+2pe+8yxC8E144SReCQjN6/2ynubzYjvyqZjTXfQJpAcQpsdJq3My7XADANiYGHoFC69pLQw==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + '@hexagon/base64@1.1.28': resolution: {integrity: sha512-lhqDEAvWixy3bZ+UOYbPwUbBkwBq5C1LAJ/xPC8Oi+lL54oyakv/npbA0aU2hgCsx/1NUd4IBvV03+aUBWxerw==} + '@jsdevtools/ono@7.1.3': + resolution: {integrity: sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==} + '@levischuck/tiny-cbor@0.2.11': resolution: {integrity: sha512-llBRm4dT4Z89aRsm6u2oEZ8tfwL/2l6BwpZ7JcyieouniDECM5AqNgr/y08zalEIvW3RSK4upYyybDcmjXqAow==} @@ -134,6 +303,9 @@ packages: '@manypkg/get-packages@1.1.3': resolution: {integrity: sha512-fo+QhuU3qE/2TQMQmbVMqaQ6EWbMhi4ABWP+O4AM1NqPBuy0OrApV5LO6BrrgnhtAHS2NH6RrVk9OL181tTi8A==} + '@next/env@15.4.3': + resolution: {integrity: sha512-lKJ9KJAvaWzqurIsz6NWdQOLj96mdhuDMusLSYHw9HBe2On7BjUwU1WeRvq19x7NrEK3iOgMeSBV5qEhVH1cMw==} + '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -146,6 +318,9 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} + '@payloadcms/translations@3.48.0': + resolution: {integrity: sha512-YFEEyrCWK96q8uZ0OK9SU80ywSqc0S3dh+vAfI4mPzs2OPG//CHgbtz1d5X1r3e7A7CY/MzzGMVgf++fmRz2gQ==} + '@peculiar/asn1-android@2.4.0': resolution: {integrity: sha512-YFueREq97CLslZZBI8dKzis7jMfEHSLxM+nr0Zdx1POiXFLjqqwoY5s0F1UimdBiEw/iKlHey2m56MRDv7Jtyg==} @@ -168,6 +343,9 @@ packages: resolution: {integrity: sha512-VwoDfvLXSCaRiD+xCIuyslU0HLxVggeE5BL06+GbsP2l1fGf5op8e0c3ZtKoi+vSg1q4ikjtAghC23ze2Q3H9g==} engines: {node: '>=20.0.0'} + '@tokenizer/token@0.3.0': + resolution: {integrity: sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==} + '@tsconfig/node22@22.0.2': resolution: {integrity: sha512-Kmwj4u8sDRDrMYRoN9FDEcXD8UpBSaPQQ24Gz+Gamqfm7xxn+GBR7ge/Z7pK8OXNGyUzbSwJj+TH6B+DS/epyA==} @@ -177,21 +355,36 @@ packages: '@types/bun@1.2.19': resolution: {integrity: sha512-d9ZCmrH3CJ2uYKXQIUuZ/pUnTqIvLDS0SK7pFmbx8ma+ziH/FRMoAq5bYpRG7y+w1gl+HgyNZbtqgMq4W4e2Lg==} + '@types/busboy@1.5.4': + resolution: {integrity: sha512-kG7WrUuAKK0NoyxfQHsVE6j1m01s6kMma64E+OZenQABMQyTJop1DumUWcLwAQ2JzpefU7PDYoRDKl8uZosFjw==} + + '@types/json-schema@7.0.15': + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + '@types/jsonwebtoken@9.0.10': resolution: {integrity: sha512-asx5hIG9Qmf/1oStypjanR7iKTv0gXQ1Ov/jfrX6kS/EO0OFni8orbmGCn0672NHR3kXHwpAwR+B368ZGN/2rA==} + '@types/lodash@4.17.20': + resolution: {integrity: sha512-H3MHACvFUEiujabxhaI/ImO6gUrd8oOurg7LQtS7mbwIXA/cUqWrvBsaeJ23aZEPk1TAYkurjfMbSELfoCXlGA==} + '@types/ms@2.1.0': resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==} '@types/node@12.20.55': resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} - '@types/node@24.0.15': - resolution: {integrity: sha512-oaeTSbCef7U/z7rDeJA138xpG3NuKc64/rZ2qmUFkFJmnMsAPaluIifqyWd8hSSMxyP9oie3dLAqYPblag9KgA==} + '@types/node@22.16.5': + resolution: {integrity: sha512-bJFoMATwIGaxxx8VJPeM8TonI8t579oRvgAuT8zFugJsJZgzqv0Fu8Mhp68iecjzG7cnN3mO2dJQ5uUM2EFrgQ==} + + '@types/node@24.1.0': + resolution: {integrity: sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==} '@types/react@19.1.8': resolution: {integrity: sha512-AwAfQ2Wa5bCx9WP8nZL2uMZWod7J7/JSplxbTmBQ5ms6QpqNYm672H0Vu9ZVKVngQ+ii4R/byguVEUZQyeg44g==} + ajv@8.17.1: + resolution: {integrity: sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==} + ansi-colors@4.1.3: resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} engines: {node: '>=6'} @@ -207,6 +400,9 @@ packages: argparse@1.0.10: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} + argparse@2.0.1: + resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + array-union@2.1.0: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} @@ -215,6 +411,10 @@ packages: resolution: {integrity: sha512-UOCGPYbl0tv8+006qks/dTgV9ajs97X2p0FAbyS2iyCRrmLSRolDaHdp+v/CLgnzHc3fVB+CwYiUmei7ndFcgA==} engines: {node: '>=12.0.0'} + atomic-sleep@1.0.0: + resolution: {integrity: sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==} + engines: {node: '>=8.0.0'} + better-path-resolve@1.0.0: resolution: {integrity: sha512-pbnl5XzGBdrFU/wT4jqmJVPn2B6UHPBOhzMQkY/SPUPB6QtUXtmBHBIwCbXJol93mOpGMnQyP/+BB19q04xj7g==} engines: {node: '>=4'} @@ -227,11 +427,18 @@ packages: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} + bson-objectid@2.0.4: + resolution: {integrity: sha512-vgnKAUzcDoa+AeyYwXCoHyF2q6u/8H46dxu5JN+4/TZeq/Dlinn0K6GvxsCLb3LHUJl0m/TLiEK31kUwtgocMQ==} + bun-types@1.2.19: resolution: {integrity: sha512-uAOTaZSPuYsWIXRpj7o56Let0g/wjihKCkeRqUBhlLVM/Bt+Fj9xTo+LhC1OV1XDaGkz4hNC80et5xgy+9KTHQ==} peerDependencies: '@types/react': ^19 + busboy@1.6.0: + resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==} + engines: {node: '>=10.16.0'} + chardet@0.7.0: resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} @@ -243,10 +450,24 @@ packages: resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} engines: {node: '>=8'} + ci-info@4.3.0: + resolution: {integrity: sha512-l+2bNRMiQgcfILUi33labAZYIWlH1kWDp+ecNo5iisRKrbm0xcRyCww71/YU0Fkw0mAFpz9bJayXPjey6vkmaQ==} + engines: {node: '>=8'} + + colorette@2.0.20: + resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} + commander@9.5.0: resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==} engines: {node: ^12.20.0 || >=14} + console-table-printer@2.12.1: + resolution: {integrity: sha512-wKGOQRRvdnd89pCeH96e2Fn4wkbenSP6LMHfjfyNLMbGuHEFbMqQNuxXqd0oXG9caIOQ1FTvc5Uijp9/4jujnQ==} + + croner@9.0.0: + resolution: {integrity: sha512-onMB0OkDjkXunhdW9htFjEhqrD54+M94i6ackoUkjHKbRnXdyEyKRelp4nJ1kAz32+s27jP1FsebpJCVl0BsvA==} + engines: {node: '>=18.0'} + cross-env@7.0.3: resolution: {integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==} engines: {node: '>=10.14', npm: '>=6', yarn: '>=1'} @@ -259,6 +480,19 @@ packages: csstype@3.1.3: resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} + dataloader@2.2.3: + resolution: {integrity: sha512-y2krtASINtPFS1rSDjacrFgn1dcUuoREVabwlOGOe4SdxenREqwjwjElAdwvbGM7kgZz9a3KVicWR7vcz8rnzA==} + + date-fns@4.1.0: + resolution: {integrity: sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==} + + dateformat@4.6.3: + resolution: {integrity: sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==} + + deepmerge@4.3.1: + resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} + engines: {node: '>=0.10.0'} + detect-indent@6.1.0: resolution: {integrity: sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==} engines: {node: '>=8'} @@ -267,10 +501,18 @@ packages: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} + end-of-stream@1.4.5: + resolution: {integrity: sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==} + enquirer@2.4.1: resolution: {integrity: sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==} engines: {node: '>=8.6'} + esbuild@0.25.8: + resolution: {integrity: sha512-vVC0USHGtMi8+R4Kz8rt6JhEWLxsv9Rnu/lGYbPR8u47B+DCBksq9JarW0zOO7bs37hyOK1l2/oqtbciutL5+Q==} + engines: {node: '>=18'} + hasBin: true + esprima@4.0.1: resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} engines: {node: '>=4'} @@ -287,13 +529,41 @@ packages: resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==} engines: {node: '>=4'} + fast-copy@3.0.2: + resolution: {integrity: sha512-dl0O9Vhju8IrcLndv2eU4ldt1ftXMqqfgN4H1cpmGV7P6jeB9FwpN9a2c8DPGE1Ys88rNUJVYDHq73CGAGOPfQ==} + + fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + fast-glob@3.3.3: resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} engines: {node: '>=8.6.0'} + fast-redact@3.5.0: + resolution: {integrity: sha512-dwsoQlS7h9hMeYUq1W++23NDcBLV4KqONnITDV9DjfS3q1SgDGVrBdvvTLUotWtPSD7asWDV9/CmsZPy8Hf70A==} + engines: {node: '>=6'} + + fast-safe-stringify@2.1.1: + resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} + + fast-uri@3.0.6: + resolution: {integrity: sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw==} + fastq@1.19.1: resolution: {integrity: sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==} + fdir@6.4.6: + resolution: {integrity: sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + + file-type@19.3.0: + resolution: {integrity: sha512-mROwiKLZf/Kwa/2Rol+OOZQn1eyTkPB3ZTwC0ExY6OLFCbgxHYZvBm7xI77NvfZFMKBsmuXfmLJnD4eEftEhrA==} + engines: {node: '>=18'} + fill-range@7.1.1: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} @@ -322,6 +592,9 @@ packages: get-tsconfig@4.10.1: resolution: {integrity: sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ==} + get-tsconfig@4.8.1: + resolution: {integrity: sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==} + git-cliff-darwin-arm64@2.7.0: resolution: {integrity: sha512-8D6Zxk9onts9r16yzuJEUq4ixGMJYvUI47GujUbs3ifsXB7x8SCOX7QCwmylRkZKnRC95fZ3jwi+gy95SwVaPQ==} cpu: [arm64] @@ -372,6 +645,17 @@ packages: graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + graphql@16.11.0: + resolution: {integrity: sha512-mS1lbMsxgQj6hge1XZ6p7GPhbrtFwUFYi3wRzXAC/FmYnyXMTvvI3td3rjmQ2u8ewXueaSvRPWaEcgVVOT9Jnw==} + engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0} + + help-me@5.0.0: + resolution: {integrity: sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg==} + + http-status@2.1.0: + resolution: {integrity: sha512-O5kPr7AW7wYd/BBiOezTwnVAnmSNFY+J7hlZD2X5IOxVBetjcHAiTXhzj0gMrnojQlwy+UT1/Y3H3vJ3UlmvLA==} + engines: {node: '>= 0.4.0'} + human-id@1.0.2: resolution: {integrity: sha512-UNopramDEhHJD+VR+ehk8rOslwSfByxPIZyJRfV739NDhN5LF1fa1MqnzKm2lGTQRjNrjK19Q5fhkgIfjlVUKw==} @@ -383,10 +667,22 @@ packages: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} engines: {node: '>=0.10.0'} + ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + ignore@5.3.2: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} + image-size@2.0.2: + resolution: {integrity: sha512-IRqXKlaXwgSMAMtpNzZa1ZAe8m+Sa1770Dhk8VkSsP9LS+iHD62Zd8FQKs8fbPiagBE7BzoFX23cxFnwshpV6w==} + engines: {node: '>=16.x'} + hasBin: true + + ipaddr.js@2.2.0: + resolution: {integrity: sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA==} + engines: {node: '>= 10'} + is-binary-path@2.1.0: resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} engines: {node: '>=8'} @@ -418,13 +714,32 @@ packages: isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + jose@5.9.6: + resolution: {integrity: sha512-AMlnetc9+CV9asI19zHmrgS/WYsWUwCn2R7RzlbJWD7F9eWYUTGyBmU9o6PxngtLGOiDGPRu+Uc4fhKzbpteZQ==} + jose@6.0.8: resolution: {integrity: sha512-EyUPtOKyTYq+iMOszO42eobQllaIjJnwkZ2U93aJzNyPibCy7CEvT9UQnaCVB51IAd49gbNdCew1c0LcLTCB2g==} + joycon@3.1.1: + resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} + engines: {node: '>=10'} + js-yaml@3.14.1: resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} hasBin: true + js-yaml@4.1.0: + resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} + hasBin: true + + json-schema-to-typescript@15.0.3: + resolution: {integrity: sha512-iOKdzTUWEVM4nlxpFudFsWyUiu/Jakkga4OZPEt7CGoSEsAsUgdOZqR6pcgx2STBek9Gm4hcarJpXSzIvZ/hKA==} + engines: {node: '>=16.0.0'} + hasBin: true + + json-schema-traverse@1.0.0: + resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} + jsonfile@4.0.0: resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==} @@ -435,6 +750,9 @@ packages: lodash.startcase@4.4.0: resolution: {integrity: sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==} + lodash@4.17.21: + resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + merge-stream@2.0.0: resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} @@ -450,6 +768,9 @@ packages: resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} engines: {node: '>=12'} + minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + mri@1.2.0: resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} engines: {node: '>=4'} @@ -469,6 +790,13 @@ packages: oauth4webapi@3.6.0: resolution: {integrity: sha512-OwXPTXjKPOldTpAa19oksrX9TYHA0rt+VcUFTkJ7QKwgmevPpNm9Cn5vFZUtIo96FiU6AfPuUUGzoXqgOzibWg==} + on-exit-leak-free@2.1.2: + resolution: {integrity: sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==} + engines: {node: '>=14.0.0'} + + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + onetime@6.0.0: resolution: {integrity: sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==} engines: {node: '>=12'} @@ -515,10 +843,24 @@ packages: resolution: {integrity: sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==} engines: {node: '>=12'} + path-to-regexp@6.3.0: + resolution: {integrity: sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==} + path-type@4.0.0: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} + payload@3.48.0: + resolution: {integrity: sha512-4XG3fGI3Y7mYFz0hBShielwYsUCnI5ilmgBvRH6SZJ0sDUHsok3uTQn91QBRusRDjqk+Ml/dHpHWqSbZR/+GaQ==} + engines: {node: ^18.20.2 || >=20.9.0} + hasBin: true + peerDependencies: + graphql: ^16.8.1 + + peek-readable@5.4.2: + resolution: {integrity: sha512-peBp3qZyuS6cNIJ2akRNG1uo1WJ1d0wTxg/fxMdZ0BqCVhx242bSFHM9eNqflfJVS9SsgkzgT/1UgnsurBOTMg==} + engines: {node: '>=14.16'} + picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} @@ -526,14 +868,36 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + picomatch@4.0.3: + resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==} + engines: {node: '>=12'} + pify@4.0.1: resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} engines: {node: '>=6'} + pino-abstract-transport@2.0.0: + resolution: {integrity: sha512-F63x5tizV6WCh4R6RHyi2Ml+M70DNRXt/+HANowMflpgGFMAym/VKm6G7ZOQRjqN7XbGxK1Lg9t6ZrtzOaivMw==} + + pino-pretty@13.0.0: + resolution: {integrity: sha512-cQBBIVG3YajgoUjo1FdKVRX6t9XPxwB9lcNJVD5GCnNM4Y6T12YYx8c6zEejxQsU0wrg9TwmDulcE9LR7qcJqA==} + hasBin: true + + pino-std-serializers@7.0.0: + resolution: {integrity: sha512-e906FRY0+tV27iq4juKzSYPbUj2do2X2JX4EzSca1631EB2QJQUqGbDuERal7LCtOpxl6x3+nvo9NPZcmjkiFA==} + + pino@9.5.0: + resolution: {integrity: sha512-xSEmD4pLnV54t0NOUN16yCl7RIB1c5UUOse5HSyEXtBp+FgFQyPeDutc+Q2ZO7/22vImV7VfEjH/1zV2QuqvYw==} + hasBin: true + plimit-lit@1.6.1: resolution: {integrity: sha512-B7+VDyb8Tl6oMJT9oSO2CW8XC/T4UcJGrwOVoNGwOQsQYhlpfajmrMj5xeejqaASq3V/EqThyOeATEOMuSEXiA==} engines: {node: '>=12'} + pluralize@8.0.0: + resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} + engines: {node: '>=4'} + prettier@2.8.8: resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} engines: {node: '>=10.13.0'} @@ -544,6 +908,12 @@ packages: engines: {node: '>=14'} hasBin: true + process-warning@4.0.1: + resolution: {integrity: sha512-3c2LzQ3rY9d0hc1emcsHhfT9Jwz0cChib/QN89oME2R451w5fy3f0afAhERFZAwrbDU43wk12d0ORBpDVME50Q==} + + pump@3.0.3: + resolution: {integrity: sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==} + pvtsutils@1.3.6: resolution: {integrity: sha512-PLgQXQ6H2FWCaeRak8vvk1GW462lMxB5s3Jm673N82zI4vqtVUPuZdffdZbPDFRoU8kAhItWFtPCWiPpp4/EDg==} @@ -565,6 +935,9 @@ packages: queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + quick-format-unescaped@4.0.4: + resolution: {integrity: sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==} + read-yaml-file@1.1.0: resolution: {integrity: sha512-VIMnQi/Z4HT2Fxuwg5KrY174U1VdUIASQVWXXyqtNRtxSr9IYkn1rsI6Tb6HsrHCmB7gVpNwX6JxPTHcH6IoTA==} engines: {node: '>=6'} @@ -573,6 +946,14 @@ packages: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} engines: {node: '>=8.10.0'} + real-require@0.2.0: + resolution: {integrity: sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==} + engines: {node: '>= 12.13.0'} + + require-from-string@2.0.2: + resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} + engines: {node: '>=0.10.0'} + resolve-from@5.0.0: resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} engines: {node: '>=8'} @@ -587,9 +968,22 @@ packages: run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + safe-stable-stringify@2.5.0: + resolution: {integrity: sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==} + engines: {node: '>=10'} + safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + sanitize-filename@1.6.3: + resolution: {integrity: sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==} + + scmp@2.1.0: + resolution: {integrity: sha512-o/mRQGk9Rcer/jEEw/yw4mwo3EU/NvYvp577/Btqrym9Qy5/MdWGBqipbALgd2lrdWTJ5/gqDusxfnQBxOxT2Q==} + + secure-json-parse@2.7.0: + resolution: {integrity: sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==} + semver@7.7.2: resolution: {integrity: sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==} engines: {node: '>=10'} @@ -607,16 +1001,30 @@ packages: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} + simple-wcswidth@1.1.2: + resolution: {integrity: sha512-j7piyCjAeTDSjzTSQ7DokZtMNwNlEAyxqSZeCS+CXH7fJ4jx3FuJ/mTW3mE+6JLs4VJBbcll0Kjn+KXI5t21Iw==} + slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} + sonic-boom@4.2.0: + resolution: {integrity: sha512-INb7TM37/mAcsGmc9hyyI6+QR3rR1zVRu36B0NeGXKnOOLiZOfER5SA+N7X7k3yUYRzLWafduTDvJAfDswwEww==} + spawndamnit@3.0.1: resolution: {integrity: sha512-MmnduQUuHCoFckZoWnXsTg7JaiLBJrKFj9UI2MbRPGaJeVpsLcVBu6P/IGZovziM/YBsellCmsprgNA+w0CzVg==} + split2@4.2.0: + resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==} + engines: {node: '>= 10.x'} + sprintf-js@1.0.3: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} + streamsearch@1.1.0: + resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==} + engines: {node: '>=10.0.0'} + strip-ansi@6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} engines: {node: '>=8'} @@ -629,10 +1037,25 @@ packages: resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==} engines: {node: '>=12'} + strip-json-comments@3.1.1: + resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} + engines: {node: '>=8'} + + strtok3@8.1.0: + resolution: {integrity: sha512-ExzDvHYPj6F6QkSNe/JxSlBxTh3OrI6wrAIz53ulxo1c4hBJ1bT9C/JrAthEKHWG9riVH3Xzg7B03Oxty6S2Lw==} + engines: {node: '>=16'} + term-size@2.2.1: resolution: {integrity: sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==} engines: {node: '>=8'} + thread-stream@3.1.0: + resolution: {integrity: sha512-OqyPZ9u96VohAyMfJykzmivOrY2wfMSf3C5TtFJVgN+Hm6aj+voFhlK+kZEIv2FBh1X6Xp3DlnCOfEQ3B2J86A==} + + tinyglobby@0.2.14: + resolution: {integrity: sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==} + engines: {node: '>=12.0.0'} + tmp@0.0.33: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} engines: {node: '>=0.6.0'} @@ -641,6 +1064,21 @@ packages: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} + token-types@6.0.3: + resolution: {integrity: sha512-IKJ6EzuPPWtKtEIEPpIdXv9j5j2LGJEYk0CKY2efgKoYKLBiZdh6iQkLVBow/CB3phyWAWCyk+bZeaimJn6uRQ==} + engines: {node: '>=14.16'} + + truncate-utf8-bytes@1.0.2: + resolution: {integrity: sha512-95Pu1QXQvruGEhv62XCMO3Mm90GscOCClvrIUwCM0PYOXK3kaF3l3sIHxx71ThJfcbM2O5Au6SO3AWCSEfW4mQ==} + + ts-essentials@10.0.3: + resolution: {integrity: sha512-/FrVAZ76JLTWxJOERk04fm8hYENDo0PWSP3YLQKxevLwWtxemGcl5JJEzN4iqfDlRve0ckyfFaOBu4xbNH/wZw==} + peerDependencies: + typescript: '>=4.5.0' + peerDependenciesMeta: + typescript: + optional: true + tsc-alias@1.8.16: resolution: {integrity: sha512-QjCyu55NFyRSBAl6+MTFwplpFcnm2Pq01rR/uxfqJoLMm6X3O14KEGtaSDZpJYaE1bJBGDjD0eSuiIWPe2T58g==} engines: {node: '>=16.20.2'} @@ -649,18 +1087,41 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + tsx@4.20.3: + resolution: {integrity: sha512-qjbnuR9Tr+FJOMBqJCW5ehvIo/buZq7vH7qD7JziU98h6l3qGy0a/yPFjwO+y0/T7GFpNgNAvEcPPVfyT8rrPQ==} + engines: {node: '>=18.0.0'} + hasBin: true + typescript@5.8.3: resolution: {integrity: sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==} engines: {node: '>=14.17'} hasBin: true + uint8array-extras@1.4.0: + resolution: {integrity: sha512-ZPtzy0hu4cZjv3z5NW9gfKnNLjoz4y6uv4HlelAjDK7sY/xOkKZv9xK/WQpcsBB3jEybChz9DPC2U/+cusjJVQ==} + engines: {node: '>=18'} + + undici-types@6.21.0: + resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} + undici-types@7.8.0: resolution: {integrity: sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==} + undici@7.10.0: + resolution: {integrity: sha512-u5otvFBOBZvmdjWLVW+5DAc9Nkq8f24g0O9oY7qw2JVIF1VocIFoyz9JFkuVOS2j41AufeO0xnlweJ2RLT8nGw==} + engines: {node: '>=20.18.1'} + universalify@0.1.2: resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} engines: {node: '>= 4.0.0'} + utf8-byte-length@1.0.5: + resolution: {integrity: sha512-Xn0w3MtiQ6zoz2vFyUVruaCL53O/DwUvkEeOvj+uulMm0BkUGYWmBYVyElqZaSLhY6ZD0ulfU3aBra2aVT4xfA==} + + uuid@10.0.0: + resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==} + hasBin: true + uuid@11.1.0: resolution: {integrity: sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==} hasBin: true @@ -670,8 +1131,29 @@ packages: engines: {node: '>= 8'} hasBin: true + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + + ws@8.18.3: + resolution: {integrity: sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + snapshots: + '@apidevtools/json-schema-ref-parser@11.9.3': + dependencies: + '@jsdevtools/ono': 7.1.3 + '@types/json-schema': 7.0.15 + js-yaml: 4.1.0 + '@babel/runtime@7.27.6': {} '@changesets/apply-release-plan@7.0.12': @@ -816,8 +1298,88 @@ snapshots: human-id: 1.0.2 prettier: 2.8.8 + '@esbuild/aix-ppc64@0.25.8': + optional: true + + '@esbuild/android-arm64@0.25.8': + optional: true + + '@esbuild/android-arm@0.25.8': + optional: true + + '@esbuild/android-x64@0.25.8': + optional: true + + '@esbuild/darwin-arm64@0.25.8': + optional: true + + '@esbuild/darwin-x64@0.25.8': + optional: true + + '@esbuild/freebsd-arm64@0.25.8': + optional: true + + '@esbuild/freebsd-x64@0.25.8': + optional: true + + '@esbuild/linux-arm64@0.25.8': + optional: true + + '@esbuild/linux-arm@0.25.8': + optional: true + + '@esbuild/linux-ia32@0.25.8': + optional: true + + '@esbuild/linux-loong64@0.25.8': + optional: true + + '@esbuild/linux-mips64el@0.25.8': + optional: true + + '@esbuild/linux-ppc64@0.25.8': + optional: true + + '@esbuild/linux-riscv64@0.25.8': + optional: true + + '@esbuild/linux-s390x@0.25.8': + optional: true + + '@esbuild/linux-x64@0.25.8': + optional: true + + '@esbuild/netbsd-arm64@0.25.8': + optional: true + + '@esbuild/netbsd-x64@0.25.8': + optional: true + + '@esbuild/openbsd-arm64@0.25.8': + optional: true + + '@esbuild/openbsd-x64@0.25.8': + optional: true + + '@esbuild/openharmony-arm64@0.25.8': + optional: true + + '@esbuild/sunos-x64@0.25.8': + optional: true + + '@esbuild/win32-arm64@0.25.8': + optional: true + + '@esbuild/win32-ia32@0.25.8': + optional: true + + '@esbuild/win32-x64@0.25.8': + optional: true + '@hexagon/base64@1.1.28': {} + '@jsdevtools/ono@7.1.3': {} + '@levischuck/tiny-cbor@0.2.11': {} '@manypkg/find-root@1.1.0': @@ -836,6 +1398,8 @@ snapshots: globby: 11.1.0 read-yaml-file: 1.1.0 + '@next/env@15.4.3': {} + '@nodelib/fs.scandir@2.1.5': dependencies: '@nodelib/fs.stat': 2.0.5 @@ -848,6 +1412,10 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.19.1 + '@payloadcms/translations@3.48.0': + dependencies: + date-fns: 4.1.0 + '@peculiar/asn1-android@2.4.0': dependencies: '@peculiar/asn1-schema': 2.4.0 @@ -893,6 +1461,8 @@ snapshots: '@peculiar/asn1-schema': 2.4.0 '@peculiar/asn1-x509': 2.4.0 + '@tokenizer/token@0.3.0': {} + '@tsconfig/node22@22.0.2': {} '@tsconfig/strictest@2.0.5': {} @@ -903,16 +1473,28 @@ snapshots: transitivePeerDependencies: - '@types/react' + '@types/busboy@1.5.4': + dependencies: + '@types/node': 22.16.5 + + '@types/json-schema@7.0.15': {} + '@types/jsonwebtoken@9.0.10': dependencies: '@types/ms': 2.1.0 - '@types/node': 24.0.15 + '@types/node': 24.1.0 + + '@types/lodash@4.17.20': {} '@types/ms@2.1.0': {} '@types/node@12.20.55': {} - '@types/node@24.0.15': + '@types/node@22.16.5': + dependencies: + undici-types: 6.21.0 + + '@types/node@24.1.0': dependencies: undici-types: 7.8.0 @@ -920,6 +1502,13 @@ snapshots: dependencies: csstype: 3.1.3 + ajv@8.17.1: + dependencies: + fast-deep-equal: 3.1.3 + fast-uri: 3.0.6 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + ansi-colors@4.1.3: {} ansi-regex@5.0.1: {} @@ -933,6 +1522,8 @@ snapshots: dependencies: sprintf-js: 1.0.3 + argparse@2.0.1: {} + array-union@2.1.0: {} asn1js@3.0.6: @@ -941,6 +1532,8 @@ snapshots: pvutils: 1.1.3 tslib: 2.8.1 + atomic-sleep@1.0.0: {} + better-path-resolve@1.0.0: dependencies: is-windows: 1.0.2 @@ -951,11 +1544,17 @@ snapshots: dependencies: fill-range: 7.1.1 + bson-objectid@2.0.4: {} + bun-types@1.2.19(@types/react@19.1.8): dependencies: - '@types/node': 24.0.15 + '@types/node': 24.1.0 '@types/react': 19.1.8 + busboy@1.6.0: + dependencies: + streamsearch: 1.1.0 + chardet@0.7.0: {} chokidar@3.6.0: @@ -972,8 +1571,18 @@ snapshots: ci-info@3.9.0: {} + ci-info@4.3.0: {} + + colorette@2.0.20: {} + commander@9.5.0: {} + console-table-printer@2.12.1: + dependencies: + simple-wcswidth: 1.1.2 + + croner@9.0.0: {} + cross-env@7.0.3: dependencies: cross-spawn: 7.0.6 @@ -986,17 +1595,58 @@ snapshots: csstype@3.1.3: {} + dataloader@2.2.3: {} + + date-fns@4.1.0: {} + + dateformat@4.6.3: {} + + deepmerge@4.3.1: {} + detect-indent@6.1.0: {} dir-glob@3.0.1: dependencies: path-type: 4.0.0 + end-of-stream@1.4.5: + dependencies: + once: 1.4.0 + enquirer@2.4.1: dependencies: ansi-colors: 4.1.3 strip-ansi: 6.0.1 + esbuild@0.25.8: + optionalDependencies: + '@esbuild/aix-ppc64': 0.25.8 + '@esbuild/android-arm': 0.25.8 + '@esbuild/android-arm64': 0.25.8 + '@esbuild/android-x64': 0.25.8 + '@esbuild/darwin-arm64': 0.25.8 + '@esbuild/darwin-x64': 0.25.8 + '@esbuild/freebsd-arm64': 0.25.8 + '@esbuild/freebsd-x64': 0.25.8 + '@esbuild/linux-arm': 0.25.8 + '@esbuild/linux-arm64': 0.25.8 + '@esbuild/linux-ia32': 0.25.8 + '@esbuild/linux-loong64': 0.25.8 + '@esbuild/linux-mips64el': 0.25.8 + '@esbuild/linux-ppc64': 0.25.8 + '@esbuild/linux-riscv64': 0.25.8 + '@esbuild/linux-s390x': 0.25.8 + '@esbuild/linux-x64': 0.25.8 + '@esbuild/netbsd-arm64': 0.25.8 + '@esbuild/netbsd-x64': 0.25.8 + '@esbuild/openbsd-arm64': 0.25.8 + '@esbuild/openbsd-x64': 0.25.8 + '@esbuild/openharmony-arm64': 0.25.8 + '@esbuild/sunos-x64': 0.25.8 + '@esbuild/win32-arm64': 0.25.8 + '@esbuild/win32-ia32': 0.25.8 + '@esbuild/win32-x64': 0.25.8 + esprima@4.0.1: {} execa@8.0.1: @@ -1019,6 +1669,10 @@ snapshots: iconv-lite: 0.4.24 tmp: 0.0.33 + fast-copy@3.0.2: {} + + fast-deep-equal@3.1.3: {} + fast-glob@3.3.3: dependencies: '@nodelib/fs.stat': 2.0.5 @@ -1027,10 +1681,26 @@ snapshots: merge2: 1.4.1 micromatch: 4.0.8 + fast-redact@3.5.0: {} + + fast-safe-stringify@2.1.1: {} + + fast-uri@3.0.6: {} + fastq@1.19.1: dependencies: reusify: 1.1.0 + fdir@6.4.6(picomatch@4.0.3): + optionalDependencies: + picomatch: 4.0.3 + + file-type@19.3.0: + dependencies: + strtok3: 8.1.0 + token-types: 6.0.3 + uint8array-extras: 1.4.0 + fill-range@7.1.1: dependencies: to-regex-range: 5.0.1 @@ -1061,6 +1731,10 @@ snapshots: dependencies: resolve-pkg-maps: 1.0.0 + get-tsconfig@4.8.1: + dependencies: + resolve-pkg-maps: 1.0.0 + git-cliff-darwin-arm64@2.7.0: optional: true @@ -1107,6 +1781,12 @@ snapshots: graceful-fs@4.2.11: {} + graphql@16.11.0: {} + + help-me@5.0.0: {} + + http-status@2.1.0: {} + human-id@1.0.2: {} human-signals@5.0.0: {} @@ -1115,8 +1795,14 @@ snapshots: dependencies: safer-buffer: 2.1.2 + ieee754@1.2.1: {} + ignore@5.3.2: {} + image-size@2.0.2: {} + + ipaddr.js@2.2.0: {} + is-binary-path@2.1.0: dependencies: binary-extensions: 2.3.0 @@ -1139,13 +1825,35 @@ snapshots: isexe@2.0.0: {} + jose@5.9.6: {} + jose@6.0.8: {} + joycon@3.1.1: {} + js-yaml@3.14.1: dependencies: argparse: 1.0.10 esprima: 4.0.1 + js-yaml@4.1.0: + dependencies: + argparse: 2.0.1 + + json-schema-to-typescript@15.0.3: + dependencies: + '@apidevtools/json-schema-ref-parser': 11.9.3 + '@types/json-schema': 7.0.15 + '@types/lodash': 4.17.20 + is-glob: 4.0.3 + js-yaml: 4.1.0 + lodash: 4.17.21 + minimist: 1.2.8 + prettier: 3.4.2 + tinyglobby: 0.2.14 + + json-schema-traverse@1.0.0: {} + jsonfile@4.0.0: optionalDependencies: graceful-fs: 4.2.11 @@ -1156,6 +1864,8 @@ snapshots: lodash.startcase@4.4.0: {} + lodash@4.17.21: {} + merge-stream@2.0.0: {} merge2@1.4.1: {} @@ -1167,6 +1877,8 @@ snapshots: mimic-fn@4.0.0: {} + minimist@1.2.8: {} + mri@1.2.0: {} mylas@2.1.13: {} @@ -1179,6 +1891,12 @@ snapshots: oauth4webapi@3.6.0: {} + on-exit-leak-free@2.1.2: {} + + once@1.4.0: + dependencies: + wrappy: 1.0.2 + onetime@6.0.0: dependencies: mimic-fn: 4.0.0 @@ -1213,22 +1931,112 @@ snapshots: path-key@4.0.0: {} + path-to-regexp@6.3.0: {} + path-type@4.0.0: {} + payload@3.48.0(graphql@16.11.0)(typescript@5.8.3): + dependencies: + '@next/env': 15.4.3 + '@payloadcms/translations': 3.48.0 + '@types/busboy': 1.5.4 + ajv: 8.17.1 + bson-objectid: 2.0.4 + busboy: 1.6.0 + ci-info: 4.3.0 + console-table-printer: 2.12.1 + croner: 9.0.0 + dataloader: 2.2.3 + deepmerge: 4.3.1 + file-type: 19.3.0 + get-tsconfig: 4.8.1 + graphql: 16.11.0 + http-status: 2.1.0 + image-size: 2.0.2 + ipaddr.js: 2.2.0 + jose: 5.9.6 + json-schema-to-typescript: 15.0.3 + minimist: 1.2.8 + path-to-regexp: 6.3.0 + pino: 9.5.0 + pino-pretty: 13.0.0 + pluralize: 8.0.0 + qs-esm: 7.0.2 + sanitize-filename: 1.6.3 + scmp: 2.1.0 + ts-essentials: 10.0.3(typescript@5.8.3) + tsx: 4.20.3 + undici: 7.10.0 + uuid: 10.0.0 + ws: 8.18.3 + transitivePeerDependencies: + - bufferutil + - typescript + - utf-8-validate + + peek-readable@5.4.2: {} + picocolors@1.1.1: {} picomatch@2.3.1: {} + picomatch@4.0.3: {} + pify@4.0.1: {} + pino-abstract-transport@2.0.0: + dependencies: + split2: 4.2.0 + + pino-pretty@13.0.0: + dependencies: + colorette: 2.0.20 + dateformat: 4.6.3 + fast-copy: 3.0.2 + fast-safe-stringify: 2.1.1 + help-me: 5.0.0 + joycon: 3.1.1 + minimist: 1.2.8 + on-exit-leak-free: 2.1.2 + pino-abstract-transport: 2.0.0 + pump: 3.0.3 + secure-json-parse: 2.7.0 + sonic-boom: 4.2.0 + strip-json-comments: 3.1.1 + + pino-std-serializers@7.0.0: {} + + pino@9.5.0: + dependencies: + atomic-sleep: 1.0.0 + fast-redact: 3.5.0 + on-exit-leak-free: 2.1.2 + pino-abstract-transport: 2.0.0 + pino-std-serializers: 7.0.0 + process-warning: 4.0.1 + quick-format-unescaped: 4.0.4 + real-require: 0.2.0 + safe-stable-stringify: 2.5.0 + sonic-boom: 4.2.0 + thread-stream: 3.1.0 + plimit-lit@1.6.1: dependencies: queue-lit: 1.5.2 + pluralize@8.0.0: {} + prettier@2.8.8: {} prettier@3.4.2: {} + process-warning@4.0.1: {} + + pump@3.0.3: + dependencies: + end-of-stream: 1.4.5 + once: 1.4.0 + pvtsutils@1.3.6: dependencies: tslib: 2.8.1 @@ -1243,6 +2051,8 @@ snapshots: queue-microtask@1.2.3: {} + quick-format-unescaped@4.0.4: {} + read-yaml-file@1.1.0: dependencies: graceful-fs: 4.2.11 @@ -1254,6 +2064,10 @@ snapshots: dependencies: picomatch: 2.3.1 + real-require@0.2.0: {} + + require-from-string@2.0.2: {} + resolve-from@5.0.0: {} resolve-pkg-maps@1.0.0: {} @@ -1264,8 +2078,18 @@ snapshots: dependencies: queue-microtask: 1.2.3 + safe-stable-stringify@2.5.0: {} + safer-buffer@2.1.2: {} + sanitize-filename@1.6.3: + dependencies: + truncate-utf8-bytes: 1.0.2 + + scmp@2.1.0: {} + + secure-json-parse@2.7.0: {} + semver@7.7.2: {} shebang-command@2.0.0: @@ -1276,15 +2100,25 @@ snapshots: signal-exit@4.1.0: {} + simple-wcswidth@1.1.2: {} + slash@3.0.0: {} + sonic-boom@4.2.0: + dependencies: + atomic-sleep: 1.0.0 + spawndamnit@3.0.1: dependencies: cross-spawn: 7.0.6 signal-exit: 4.1.0 + split2@4.2.0: {} + sprintf-js@1.0.3: {} + streamsearch@1.1.0: {} + strip-ansi@6.0.1: dependencies: ansi-regex: 5.0.1 @@ -1293,8 +2127,24 @@ snapshots: strip-final-newline@3.0.0: {} + strip-json-comments@3.1.1: {} + + strtok3@8.1.0: + dependencies: + '@tokenizer/token': 0.3.0 + peek-readable: 5.4.2 + term-size@2.2.1: {} + thread-stream@3.1.0: + dependencies: + real-require: 0.2.0 + + tinyglobby@0.2.14: + dependencies: + fdir: 6.4.6(picomatch@4.0.3) + picomatch: 4.0.3 + tmp@0.0.33: dependencies: os-tmpdir: 1.0.2 @@ -1303,6 +2153,19 @@ snapshots: dependencies: is-number: 7.0.0 + token-types@6.0.3: + dependencies: + '@tokenizer/token': 0.3.0 + ieee754: 1.2.1 + + truncate-utf8-bytes@1.0.2: + dependencies: + utf8-byte-length: 1.0.5 + + ts-essentials@10.0.3(typescript@5.8.3): + optionalDependencies: + typescript: 5.8.3 + tsc-alias@1.8.16: dependencies: chokidar: 3.6.0 @@ -1315,14 +2178,35 @@ snapshots: tslib@2.8.1: {} + tsx@4.20.3: + dependencies: + esbuild: 0.25.8 + get-tsconfig: 4.10.1 + optionalDependencies: + fsevents: 2.3.3 + typescript@5.8.3: {} + uint8array-extras@1.4.0: {} + + undici-types@6.21.0: {} + undici-types@7.8.0: {} + undici@7.10.0: {} + universalify@0.1.2: {} + utf8-byte-length@1.0.5: {} + + uuid@10.0.0: {} + uuid@11.1.0: {} which@2.0.2: dependencies: isexe: 2.0.0 + + wrappy@1.0.2: {} + + ws@8.18.3: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..efc037a --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +onlyBuiltDependencies: + - esbuild diff --git a/src/client/index.ts b/src/client/index.ts index 95107a9..b9dd643 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -32,10 +32,12 @@ class AuthClient { (process.env.NEXT_PUBLIC_PAYLOAD_AUTH_URL as string) } - signin() { + signin(redirectUrl?: string) { + console.error("the redirectUrl is: " + redirectUrl) return signin({ name: this.name, baseURL: this.baseURL, + redirectUrl, }) } register() { diff --git a/src/client/oauth.ts b/src/client/oauth.ts index 0c6c5f0..87e17ac 100644 --- a/src/client/oauth.ts +++ b/src/client/oauth.ts @@ -3,6 +3,7 @@ type BaseOptions = { name: string baseURL: string + redirectUrl?: string } export type OauthProvider = @@ -22,6 +23,6 @@ export type OauthProvider = | "okta" export const oauth = (options: BaseOptions, provider: OauthProvider): void => { - const oauthURL = `${options.baseURL}/api/${options.name}/oauth/authorization/${provider}` + const oauthURL = `${options.baseURL}/api/${options.name}/oauth/authorization/${provider}${options.redirectUrl ? `?state=${encodeURIComponent(JSON.stringify({ redirectUrl: options.redirectUrl }))}` : ""}` window.location.href = oauthURL } diff --git a/src/client/signin.ts b/src/client/signin.ts index af6ff46..881bfb4 100644 --- a/src/client/signin.ts +++ b/src/client/signin.ts @@ -3,6 +3,7 @@ import { oauth, type OauthProvider } from "./oauth.js" interface BaseOptions { name: string baseURL: string + redirectUrl?: string } export const signin = (options: BaseOptions) => { diff --git a/src/core/protocols/oauth/oidc_callback.ts b/src/core/protocols/oauth/oidc_callback.ts index fd35ceb..2b86330 100644 --- a/src/core/protocols/oauth/oidc_callback.ts +++ b/src/core/protocols/oauth/oidc_callback.ts @@ -69,13 +69,14 @@ export async function OIDCCallback( const stateParam = parsedState ? createOAuthState(parsedState) : providerConfig?.params?.state || undefined - + console.error("OIDC Callback state parameter:", stateParam) const params_oauth = oauth.validateAuthResponse( as, client, current_url, stateParam, ) + console.error("OIDC Callback params_oauth:", params_oauth) const grantResponse = await oauth.authorizationCodeGrantRequest( as, diff --git a/tsconfig.json b/tsconfig.json index 2b517c1..e04c066 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,7 +19,7 @@ "outDir": "${configDir}/dist", "resolveJsonModule": true, "skipLibCheck": true, - "emitDeclarationOnly": true, + "emitDeclarationOnly": false, "sourceMap": true, "baseUrl": ".", "lib": [ From f5714027d626764fe14f6c5ad9f596fa52379ef6 Mon Sep 17 00:00:00 2001 From: WillODR Date: Thu, 24 Jul 2025 12:22:18 +0100 Subject: [PATCH 3/7] use cookie for state passing in between authorisation and callback --- package-lock.json | 3537 +++++++++++++++++ .../protocols/oauth/oauth_authentication.ts | 32 +- .../protocols/oauth/oidc_authorization.ts | 23 +- src/core/protocols/oauth/oidc_callback.ts | 28 +- 4 files changed, 3609 insertions(+), 11 deletions(-) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..6fd99d1 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,3537 @@ +{ + "name": "payload-auth-plugin", + "version": "0.7.4", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "payload-auth-plugin", + "version": "0.7.4", + "license": "MIT", + "dependencies": { + "@simplewebauthn/browser": "^13.1.0", + "@simplewebauthn/server": "^13.1.0", + "jose": "6.0.8", + "oauth4webapi": "^3.1.4", + "qs-esm": "7.0.2", + "uuid": "11.1.0" + }, + "devDependencies": { + "@changesets/cli": "2.27.10", + "@tsconfig/node22": "^22.0.0", + "@tsconfig/strictest": "^2.0.5", + "@types/bun": "latest", + "@types/jsonwebtoken": "^9.0.7", + "@types/node": "^22.16.5", + "cross-env": "^7.0.3", + "git-cliff": "2.7.0", + "globals": "^15.14.0", + "prettier": "3.4.2", + "tsc-alias": "^1.8.16", + "typescript": "^5.7.3" + }, + "peerDependencies": { + "payload": "^3.48.0" + } + }, + "node_modules/@apidevtools/json-schema-ref-parser": { + "version": "11.9.3", + "resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-11.9.3.tgz", + "integrity": "sha512-60vepv88RwcJtSHrD6MjIL6Ta3SOYbgfnkHb+ppAVK+o9mXprRtulx7VlRl3lN3bbvysAfCS7WMVfhUYemB0IQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@jsdevtools/ono": "^7.1.3", + "@types/json-schema": "^7.0.15", + "js-yaml": "^4.1.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/philsturgeon" + } + }, + "node_modules/@apidevtools/json-schema-ref-parser/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0", + "peer": true + }, + "node_modules/@apidevtools/json-schema-ref-parser/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "license": "MIT", + "peer": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@babel/runtime": { + "version": "7.28.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.2.tgz", + "integrity": "sha512-KHp2IflsnGywDjBWDkR9iEqiWSpc8GIi0lgTT3mOElT0PP1tG26P4tmFI2YvAdzgq9RGyoHZQEIEdZy6Ec5xCA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@changesets/apply-release-plan": { + "version": "7.0.12", + "resolved": "https://registry.npmjs.org/@changesets/apply-release-plan/-/apply-release-plan-7.0.12.tgz", + "integrity": "sha512-EaET7As5CeuhTzvXTQCRZeBUcisoYPDDcXvgTE/2jmmypKp0RC7LxKj/yzqeh/1qFTZI7oDGFcL1PHRuQuketQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@changesets/config": "^3.1.1", + "@changesets/get-version-range-type": "^0.4.0", + "@changesets/git": "^3.0.4", + "@changesets/should-skip-package": "^0.1.2", + "@changesets/types": "^6.1.0", + "@manypkg/get-packages": "^1.1.3", + "detect-indent": "^6.0.0", + "fs-extra": "^7.0.1", + "lodash.startcase": "^4.4.0", + "outdent": "^0.5.0", + "prettier": "^2.7.1", + "resolve-from": "^5.0.0", + "semver": "^7.5.3" + } + }, + "node_modules/@changesets/apply-release-plan/node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/@changesets/assemble-release-plan": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@changesets/assemble-release-plan/-/assemble-release-plan-6.0.9.tgz", + "integrity": "sha512-tPgeeqCHIwNo8sypKlS3gOPmsS3wP0zHt67JDuL20P4QcXiw/O4Hl7oXiuLnP9yg+rXLQ2sScdV1Kkzde61iSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@changesets/errors": "^0.2.0", + "@changesets/get-dependents-graph": "^2.1.3", + "@changesets/should-skip-package": "^0.1.2", + "@changesets/types": "^6.1.0", + "@manypkg/get-packages": "^1.1.3", + "semver": "^7.5.3" + } + }, + "node_modules/@changesets/changelog-git": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@changesets/changelog-git/-/changelog-git-0.2.1.tgz", + "integrity": "sha512-x/xEleCFLH28c3bQeQIyeZf8lFXyDFVn1SgcBiR2Tw/r4IAWlk1fzxCEZ6NxQAjF2Nwtczoen3OA2qR+UawQ8Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@changesets/types": "^6.1.0" + } + }, + "node_modules/@changesets/cli": { + "version": "2.27.10", + "resolved": "https://registry.npmjs.org/@changesets/cli/-/cli-2.27.10.tgz", + "integrity": "sha512-PfeXjvs9OfQJV8QSFFHjwHX3QnUL9elPEQ47SgkiwzLgtKGyuikWjrdM+lO9MXzOE22FO9jEGkcs4b+B6D6X0Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@changesets/apply-release-plan": "^7.0.6", + "@changesets/assemble-release-plan": "^6.0.5", + "@changesets/changelog-git": "^0.2.0", + "@changesets/config": "^3.0.4", + "@changesets/errors": "^0.2.0", + "@changesets/get-dependents-graph": "^2.1.2", + "@changesets/get-release-plan": "^4.0.5", + "@changesets/git": "^3.0.2", + "@changesets/logger": "^0.1.1", + "@changesets/pre": "^2.0.1", + "@changesets/read": "^0.6.2", + "@changesets/should-skip-package": "^0.1.1", + "@changesets/types": "^6.0.0", + "@changesets/write": "^0.3.2", + "@manypkg/get-packages": "^1.1.3", + "ansi-colors": "^4.1.3", + "ci-info": "^3.7.0", + "enquirer": "^2.3.0", + "external-editor": "^3.1.0", + "fs-extra": "^7.0.1", + "mri": "^1.2.0", + "p-limit": "^2.2.0", + "package-manager-detector": "^0.2.0", + "picocolors": "^1.1.0", + "resolve-from": "^5.0.0", + "semver": "^7.5.3", + "spawndamnit": "^3.0.1", + "term-size": "^2.1.0" + }, + "bin": { + "changeset": "bin.js" + } + }, + "node_modules/@changesets/config": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@changesets/config/-/config-3.1.1.tgz", + "integrity": "sha512-bd+3Ap2TKXxljCggI0mKPfzCQKeV/TU4yO2h2C6vAihIo8tzseAn2e7klSuiyYYXvgu53zMN1OeYMIQkaQoWnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@changesets/errors": "^0.2.0", + "@changesets/get-dependents-graph": "^2.1.3", + "@changesets/logger": "^0.1.1", + "@changesets/types": "^6.1.0", + "@manypkg/get-packages": "^1.1.3", + "fs-extra": "^7.0.1", + "micromatch": "^4.0.8" + } + }, + "node_modules/@changesets/errors": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@changesets/errors/-/errors-0.2.0.tgz", + "integrity": "sha512-6BLOQUscTpZeGljvyQXlWOItQyU71kCdGz7Pi8H8zdw6BI0g3m43iL4xKUVPWtG+qrrL9DTjpdn8eYuCQSRpow==", + "dev": true, + "license": "MIT", + "dependencies": { + "extendable-error": "^0.1.5" + } + }, + "node_modules/@changesets/get-dependents-graph": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@changesets/get-dependents-graph/-/get-dependents-graph-2.1.3.tgz", + "integrity": "sha512-gphr+v0mv2I3Oxt19VdWRRUxq3sseyUpX9DaHpTUmLj92Y10AGy+XOtV+kbM6L/fDcpx7/ISDFK6T8A/P3lOdQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@changesets/types": "^6.1.0", + "@manypkg/get-packages": "^1.1.3", + "picocolors": "^1.1.0", + "semver": "^7.5.3" + } + }, + "node_modules/@changesets/get-release-plan": { + "version": "4.0.13", + "resolved": "https://registry.npmjs.org/@changesets/get-release-plan/-/get-release-plan-4.0.13.tgz", + "integrity": "sha512-DWG1pus72FcNeXkM12tx+xtExyH/c9I1z+2aXlObH3i9YA7+WZEVaiHzHl03thpvAgWTRaH64MpfHxozfF7Dvg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@changesets/assemble-release-plan": "^6.0.9", + "@changesets/config": "^3.1.1", + "@changesets/pre": "^2.0.2", + "@changesets/read": "^0.6.5", + "@changesets/types": "^6.1.0", + "@manypkg/get-packages": "^1.1.3" + } + }, + "node_modules/@changesets/get-version-range-type": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@changesets/get-version-range-type/-/get-version-range-type-0.4.0.tgz", + "integrity": "sha512-hwawtob9DryoGTpixy1D3ZXbGgJu1Rhr+ySH2PvTLHvkZuQ7sRT4oQwMh0hbqZH1weAooedEjRsbrWcGLCeyVQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@changesets/git": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@changesets/git/-/git-3.0.4.tgz", + "integrity": "sha512-BXANzRFkX+XcC1q/d27NKvlJ1yf7PSAgi8JG6dt8EfbHFHi4neau7mufcSca5zRhwOL8j9s6EqsxmT+s+/E6Sw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@changesets/errors": "^0.2.0", + "@manypkg/get-packages": "^1.1.3", + "is-subdir": "^1.1.1", + "micromatch": "^4.0.8", + "spawndamnit": "^3.0.1" + } + }, + "node_modules/@changesets/logger": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@changesets/logger/-/logger-0.1.1.tgz", + "integrity": "sha512-OQtR36ZlnuTxKqoW4Sv6x5YIhOmClRd5pWsjZsddYxpWs517R0HkyiefQPIytCVh4ZcC5x9XaG8KTdd5iRQUfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "picocolors": "^1.1.0" + } + }, + "node_modules/@changesets/parse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@changesets/parse/-/parse-0.4.1.tgz", + "integrity": "sha512-iwksMs5Bf/wUItfcg+OXrEpravm5rEd9Bf4oyIPL4kVTmJQ7PNDSd6MDYkpSJR1pn7tz/k8Zf2DhTCqX08Ou+Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@changesets/types": "^6.1.0", + "js-yaml": "^3.13.1" + } + }, + "node_modules/@changesets/pre": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@changesets/pre/-/pre-2.0.2.tgz", + "integrity": "sha512-HaL/gEyFVvkf9KFg6484wR9s0qjAXlZ8qWPDkTyKF6+zqjBe/I2mygg3MbpZ++hdi0ToqNUF8cjj7fBy0dg8Ug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@changesets/errors": "^0.2.0", + "@changesets/types": "^6.1.0", + "@manypkg/get-packages": "^1.1.3", + "fs-extra": "^7.0.1" + } + }, + "node_modules/@changesets/read": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/@changesets/read/-/read-0.6.5.tgz", + "integrity": "sha512-UPzNGhsSjHD3Veb0xO/MwvasGe8eMyNrR/sT9gR8Q3DhOQZirgKhhXv/8hVsI0QpPjR004Z9iFxoJU6in3uGMg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@changesets/git": "^3.0.4", + "@changesets/logger": "^0.1.1", + "@changesets/parse": "^0.4.1", + "@changesets/types": "^6.1.0", + "fs-extra": "^7.0.1", + "p-filter": "^2.1.0", + "picocolors": "^1.1.0" + } + }, + "node_modules/@changesets/should-skip-package": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@changesets/should-skip-package/-/should-skip-package-0.1.2.tgz", + "integrity": "sha512-qAK/WrqWLNCP22UDdBTMPH5f41elVDlsNyat180A33dWxuUDyNpg6fPi/FyTZwRriVjg0L8gnjJn2F9XAoF0qw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@changesets/types": "^6.1.0", + "@manypkg/get-packages": "^1.1.3" + } + }, + "node_modules/@changesets/types": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@changesets/types/-/types-6.1.0.tgz", + "integrity": "sha512-rKQcJ+o1nKNgeoYRHKOS07tAMNd3YSN0uHaJOZYjBAgxfV7TUE7JE+z4BzZdQwb5hKaYbayKN5KrYV7ODb2rAA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@changesets/write": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@changesets/write/-/write-0.3.2.tgz", + "integrity": "sha512-kDxDrPNpUgsjDbWBvUo27PzKX4gqeKOlhibaOXDJA6kuBisGqNHv/HwGJrAu8U/dSf8ZEFIeHIPtvSlZI1kULw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@changesets/types": "^6.0.0", + "fs-extra": "^7.0.1", + "human-id": "^1.0.2", + "prettier": "^2.7.1" + } + }, + "node_modules/@changesets/write/node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.8.tgz", + "integrity": "sha512-urAvrUedIqEiFR3FYSLTWQgLu5tb+m0qZw0NBEasUeo6wuqatkMDaRT+1uABiGXEu5vqgPd7FGE1BhsAIy9QVA==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.8.tgz", + "integrity": "sha512-RONsAvGCz5oWyePVnLdZY/HHwA++nxYWIX1atInlaW6SEkwq6XkP3+cb825EUcRs5Vss/lGh/2YxAb5xqc07Uw==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.8.tgz", + "integrity": "sha512-OD3p7LYzWpLhZEyATcTSJ67qB5D+20vbtr6vHlHWSQYhKtzUYrETuWThmzFpZtFsBIxRvhO07+UgVA9m0i/O1w==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.8.tgz", + "integrity": "sha512-yJAVPklM5+4+9dTeKwHOaA+LQkmrKFX96BM0A/2zQrbS6ENCmxc4OVoBs5dPkCCak2roAD+jKCdnmOqKszPkjA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.8.tgz", + "integrity": "sha512-Jw0mxgIaYX6R8ODrdkLLPwBqHTtYHJSmzzd+QeytSugzQ0Vg4c5rDky5VgkoowbZQahCbsv1rT1KW72MPIkevw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.8.tgz", + "integrity": "sha512-Vh2gLxxHnuoQ+GjPNvDSDRpoBCUzY4Pu0kBqMBDlK4fuWbKgGtmDIeEC081xi26PPjn+1tct+Bh8FjyLlw1Zlg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.8.tgz", + "integrity": "sha512-YPJ7hDQ9DnNe5vxOm6jaie9QsTwcKedPvizTVlqWG9GBSq+BuyWEDazlGaDTC5NGU4QJd666V0yqCBL2oWKPfA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.8.tgz", + "integrity": "sha512-MmaEXxQRdXNFsRN/KcIimLnSJrk2r5H8v+WVafRWz5xdSVmWLoITZQXcgehI2ZE6gioE6HirAEToM/RvFBeuhw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.8.tgz", + "integrity": "sha512-FuzEP9BixzZohl1kLf76KEVOsxtIBFwCaLupVuk4eFVnOZfU+Wsn+x5Ryam7nILV2pkq2TqQM9EZPsOBuMC+kg==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.8.tgz", + "integrity": "sha512-WIgg00ARWv/uYLU7lsuDK00d/hHSfES5BzdWAdAig1ioV5kaFNrtK8EqGcUBJhYqotlUByUKz5Qo6u8tt7iD/w==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.8.tgz", + "integrity": "sha512-A1D9YzRX1i+1AJZuFFUMP1E9fMaYY+GnSQil9Tlw05utlE86EKTUA7RjwHDkEitmLYiFsRd9HwKBPEftNdBfjg==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.8.tgz", + "integrity": "sha512-O7k1J/dwHkY1RMVvglFHl1HzutGEFFZ3kNiDMSOyUrB7WcoHGf96Sh+64nTRT26l3GMbCW01Ekh/ThKM5iI7hQ==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.8.tgz", + "integrity": "sha512-uv+dqfRazte3BzfMp8PAQXmdGHQt2oC/y2ovwpTteqrMx2lwaksiFZ/bdkXJC19ttTvNXBuWH53zy/aTj1FgGw==", + "cpu": [ + "mips64el" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.8.tgz", + "integrity": "sha512-GyG0KcMi1GBavP5JgAkkstMGyMholMDybAf8wF5A70CALlDM2p/f7YFE7H92eDeH/VBtFJA5MT4nRPDGg4JuzQ==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.8.tgz", + "integrity": "sha512-rAqDYFv3yzMrq7GIcen3XP7TUEG/4LK86LUPMIz6RT8A6pRIDn0sDcvjudVZBiiTcZCY9y2SgYX2lgK3AF+1eg==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.8.tgz", + "integrity": "sha512-Xutvh6VjlbcHpsIIbwY8GVRbwoviWT19tFhgdA7DlenLGC/mbc3lBoVb7jxj9Z+eyGqvcnSyIltYUrkKzWqSvg==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.8.tgz", + "integrity": "sha512-ASFQhgY4ElXh3nDcOMTkQero4b1lgubskNlhIfJrsH5OKZXDpUAKBlNS0Kx81jwOBp+HCeZqmoJuihTv57/jvQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.8.tgz", + "integrity": "sha512-d1KfruIeohqAi6SA+gENMuObDbEjn22olAR7egqnkCD9DGBG0wsEARotkLgXDu6c4ncgWTZJtN5vcgxzWRMzcw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.8.tgz", + "integrity": "sha512-nVDCkrvx2ua+XQNyfrujIG38+YGyuy2Ru9kKVNyh5jAys6n+l44tTtToqHjino2My8VAY6Lw9H7RI73XFi66Cg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.8.tgz", + "integrity": "sha512-j8HgrDuSJFAujkivSMSfPQSAa5Fxbvk4rgNAS5i3K+r8s1X0p1uOO2Hl2xNsGFppOeHOLAVgYwDVlmxhq5h+SQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.8.tgz", + "integrity": "sha512-1h8MUAwa0VhNCDp6Af0HToI2TJFAn1uqT9Al6DJVzdIBAd21m/G0Yfc77KDM3uF3T/YaOgQq3qTJHPbTOInaIQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.8.tgz", + "integrity": "sha512-r2nVa5SIK9tSWd0kJd9HCffnDHKchTGikb//9c7HX+r+wHYCpQrSgxhlY6KWV1nFo1l4KFbsMlHk+L6fekLsUg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.8.tgz", + "integrity": "sha512-zUlaP2S12YhQ2UzUfcCuMDHQFJyKABkAjvO5YSndMiIkMimPmxA+BYSBikWgsRpvyxuRnow4nS5NPnf9fpv41w==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.8.tgz", + "integrity": "sha512-YEGFFWESlPva8hGL+zvj2z/SaK+pH0SwOM0Nc/d+rVnW7GSTFlLBGzZkuSU9kFIGIo8q9X3ucpZhu8PDN5A2sQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.8.tgz", + "integrity": "sha512-hiGgGC6KZ5LZz58OL/+qVVoZiuZlUYlYHNAmczOm7bs2oE1XriPFi5ZHHrS8ACpV5EjySrnoCKmcbQMN+ojnHg==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.8.tgz", + "integrity": "sha512-cn3Yr7+OaaZq1c+2pe+8yxC8E144SReCQjN6/2ynubzYjvyqZjTXfQJpAcQpsdJq3My7XADANiYGHoFC69pLQw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@hexagon/base64": { + "version": "1.1.28", + "resolved": "https://registry.npmjs.org/@hexagon/base64/-/base64-1.1.28.tgz", + "integrity": "sha512-lhqDEAvWixy3bZ+UOYbPwUbBkwBq5C1LAJ/xPC8Oi+lL54oyakv/npbA0aU2hgCsx/1NUd4IBvV03+aUBWxerw==", + "license": "MIT" + }, + "node_modules/@jsdevtools/ono": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", + "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==", + "license": "MIT", + "peer": true + }, + "node_modules/@levischuck/tiny-cbor": { + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/@levischuck/tiny-cbor/-/tiny-cbor-0.2.11.tgz", + "integrity": "sha512-llBRm4dT4Z89aRsm6u2oEZ8tfwL/2l6BwpZ7JcyieouniDECM5AqNgr/y08zalEIvW3RSK4upYyybDcmjXqAow==", + "license": "MIT" + }, + "node_modules/@manypkg/find-root": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@manypkg/find-root/-/find-root-1.1.0.tgz", + "integrity": "sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.5.5", + "@types/node": "^12.7.1", + "find-up": "^4.1.0", + "fs-extra": "^8.1.0" + } + }, + "node_modules/@manypkg/find-root/node_modules/@types/node": { + "version": "12.20.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@manypkg/find-root/node_modules/fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/@manypkg/get-packages": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@manypkg/get-packages/-/get-packages-1.1.3.tgz", + "integrity": "sha512-fo+QhuU3qE/2TQMQmbVMqaQ6EWbMhi4ABWP+O4AM1NqPBuy0OrApV5LO6BrrgnhtAHS2NH6RrVk9OL181tTi8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.5.5", + "@changesets/types": "^4.0.1", + "@manypkg/find-root": "^1.1.0", + "fs-extra": "^8.1.0", + "globby": "^11.0.0", + "read-yaml-file": "^1.1.0" + } + }, + "node_modules/@manypkg/get-packages/node_modules/@changesets/types": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@changesets/types/-/types-4.1.0.tgz", + "integrity": "sha512-LDQvVDv5Kb50ny2s25Fhm3d9QSZimsoUGBsUioj6MC3qbMUCuC8GPIvk/M6IvXx3lYhAs0lwWUQLb+VIEUCECw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@manypkg/get-packages/node_modules/fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/@next/env": { + "version": "15.4.3", + "resolved": "https://registry.npmjs.org/@next/env/-/env-15.4.3.tgz", + "integrity": "sha512-lKJ9KJAvaWzqurIsz6NWdQOLj96mdhuDMusLSYHw9HBe2On7BjUwU1WeRvq19x7NrEK3iOgMeSBV5qEhVH1cMw==", + "license": "MIT", + "peer": true + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@payloadcms/translations": { + "version": "3.48.0", + "resolved": "https://registry.npmjs.org/@payloadcms/translations/-/translations-3.48.0.tgz", + "integrity": "sha512-YFEEyrCWK96q8uZ0OK9SU80ywSqc0S3dh+vAfI4mPzs2OPG//CHgbtz1d5X1r3e7A7CY/MzzGMVgf++fmRz2gQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "date-fns": "4.1.0" + } + }, + "node_modules/@peculiar/asn1-android": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-android/-/asn1-android-2.4.0.tgz", + "integrity": "sha512-YFueREq97CLslZZBI8dKzis7jMfEHSLxM+nr0Zdx1POiXFLjqqwoY5s0F1UimdBiEw/iKlHey2m56MRDv7Jtyg==", + "license": "MIT", + "dependencies": { + "@peculiar/asn1-schema": "^2.4.0", + "asn1js": "^3.0.6", + "tslib": "^2.8.1" + } + }, + "node_modules/@peculiar/asn1-ecc": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-ecc/-/asn1-ecc-2.4.0.tgz", + "integrity": "sha512-fJiYUBCJBDkjh347zZe5H81BdJ0+OGIg0X9z06v8xXUoql3MFeENUX0JsjCaVaU9A0L85PefLPGYkIoGpTnXLQ==", + "license": "MIT", + "dependencies": { + "@peculiar/asn1-schema": "^2.4.0", + "@peculiar/asn1-x509": "^2.4.0", + "asn1js": "^3.0.6", + "tslib": "^2.8.1" + } + }, + "node_modules/@peculiar/asn1-rsa": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-rsa/-/asn1-rsa-2.4.0.tgz", + "integrity": "sha512-6PP75voaEnOSlWR9sD25iCQyLgFZHXbmxvUfnnDcfL6Zh5h2iHW38+bve4LfH7a60x7fkhZZNmiYqAlAff9Img==", + "license": "MIT", + "dependencies": { + "@peculiar/asn1-schema": "^2.4.0", + "@peculiar/asn1-x509": "^2.4.0", + "asn1js": "^3.0.6", + "tslib": "^2.8.1" + } + }, + "node_modules/@peculiar/asn1-schema": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-2.4.0.tgz", + "integrity": "sha512-umbembjIWOrPSOzEGG5vxFLkeM8kzIhLkgigtsOrfLKnuzxWxejAcUX+q/SoZCdemlODOcr5WiYa7+dIEzBXZQ==", + "license": "MIT", + "dependencies": { + "asn1js": "^3.0.6", + "pvtsutils": "^1.3.6", + "tslib": "^2.8.1" + } + }, + "node_modules/@peculiar/asn1-x509": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-x509/-/asn1-x509-2.4.0.tgz", + "integrity": "sha512-F7mIZY2Eao2TaoVqigGMLv+NDdpwuBKU1fucHPONfzaBS4JXXCNCmfO0Z3dsy7JzKGqtDcYC1mr9JjaZQZNiuw==", + "license": "MIT", + "dependencies": { + "@peculiar/asn1-schema": "^2.4.0", + "asn1js": "^3.0.6", + "pvtsutils": "^1.3.6", + "tslib": "^2.8.1" + } + }, + "node_modules/@simplewebauthn/browser": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/@simplewebauthn/browser/-/browser-13.1.2.tgz", + "integrity": "sha512-aZnW0KawAM83fSBUgglP5WofbrLbLyr7CoPqYr66Eppm7zO86YX6rrCjRB3hQKPrL7ATvY4FVXlykZ6w6FwYYw==", + "license": "MIT" + }, + "node_modules/@simplewebauthn/server": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/@simplewebauthn/server/-/server-13.1.2.tgz", + "integrity": "sha512-VwoDfvLXSCaRiD+xCIuyslU0HLxVggeE5BL06+GbsP2l1fGf5op8e0c3ZtKoi+vSg1q4ikjtAghC23ze2Q3H9g==", + "license": "MIT", + "dependencies": { + "@hexagon/base64": "^1.1.27", + "@levischuck/tiny-cbor": "^0.2.2", + "@peculiar/asn1-android": "^2.3.10", + "@peculiar/asn1-ecc": "^2.3.8", + "@peculiar/asn1-rsa": "^2.3.8", + "@peculiar/asn1-schema": "^2.3.8", + "@peculiar/asn1-x509": "^2.3.8" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@tokenizer/token": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", + "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==", + "license": "MIT", + "peer": true + }, + "node_modules/@tsconfig/node22": { + "version": "22.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node22/-/node22-22.0.2.tgz", + "integrity": "sha512-Kmwj4u8sDRDrMYRoN9FDEcXD8UpBSaPQQ24Gz+Gamqfm7xxn+GBR7ge/Z7pK8OXNGyUzbSwJj+TH6B+DS/epyA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/strictest": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@tsconfig/strictest/-/strictest-2.0.5.tgz", + "integrity": "sha512-ec4tjL2Rr0pkZ5hww65c+EEPYwxOi4Ryv+0MtjeaSQRJyq322Q27eOQiFbuNgw2hpL4hB1/W/HBGk3VKS43osg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/bun": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@types/bun/-/bun-1.2.19.tgz", + "integrity": "sha512-d9ZCmrH3CJ2uYKXQIUuZ/pUnTqIvLDS0SK7pFmbx8ma+ziH/FRMoAq5bYpRG7y+w1gl+HgyNZbtqgMq4W4e2Lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "bun-types": "1.2.19" + } + }, + "node_modules/@types/busboy": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@types/busboy/-/busboy-1.5.4.tgz", + "integrity": "sha512-kG7WrUuAKK0NoyxfQHsVE6j1m01s6kMma64E+OZenQABMQyTJop1DumUWcLwAQ2JzpefU7PDYoRDKl8uZosFjw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "license": "MIT", + "peer": true + }, + "node_modules/@types/jsonwebtoken": { + "version": "9.0.10", + "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.10.tgz", + "integrity": "sha512-asx5hIG9Qmf/1oStypjanR7iKTv0gXQ1Ov/jfrX6kS/EO0OFni8orbmGCn0672NHR3kXHwpAwR+B368ZGN/2rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/ms": "*", + "@types/node": "*" + } + }, + "node_modules/@types/lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-H3MHACvFUEiujabxhaI/ImO6gUrd8oOurg7LQtS7mbwIXA/cUqWrvBsaeJ23aZEPk1TAYkurjfMbSELfoCXlGA==", + "license": "MIT", + "peer": true + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "22.16.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.16.5.tgz", + "integrity": "sha512-bJFoMATwIGaxxx8VJPeM8TonI8t579oRvgAuT8zFugJsJZgzqv0Fu8Mhp68iecjzG7cnN3mO2dJQ5uUM2EFrgQ==", + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/@types/react": { + "version": "19.1.8", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.8.tgz", + "integrity": "sha512-AwAfQ2Wa5bCx9WP8nZL2uMZWod7J7/JSplxbTmBQ5ms6QpqNYm672H0Vu9ZVKVngQ+ii4R/byguVEUZQyeg44g==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "csstype": "^3.0.2" + } + }, + "node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "license": "MIT", + "peer": true, + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/asn1js": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/asn1js/-/asn1js-3.0.6.tgz", + "integrity": "sha512-UOCGPYbl0tv8+006qks/dTgV9ajs97X2p0FAbyS2iyCRrmLSRolDaHdp+v/CLgnzHc3fVB+CwYiUmei7ndFcgA==", + "license": "BSD-3-Clause", + "dependencies": { + "pvtsutils": "^1.3.6", + "pvutils": "^1.1.3", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/atomic-sleep": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", + "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/better-path-resolve": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/better-path-resolve/-/better-path-resolve-1.0.0.tgz", + "integrity": "sha512-pbnl5XzGBdrFU/wT4jqmJVPn2B6UHPBOhzMQkY/SPUPB6QtUXtmBHBIwCbXJol93mOpGMnQyP/+BB19q04xj7g==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-windows": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/bson-objectid": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/bson-objectid/-/bson-objectid-2.0.4.tgz", + "integrity": "sha512-vgnKAUzcDoa+AeyYwXCoHyF2q6u/8H46dxu5JN+4/TZeq/Dlinn0K6GvxsCLb3LHUJl0m/TLiEK31kUwtgocMQ==", + "license": "Apache-2.0", + "peer": true + }, + "node_modules/bun-types": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/bun-types/-/bun-types-1.2.19.tgz", + "integrity": "sha512-uAOTaZSPuYsWIXRpj7o56Let0g/wjihKCkeRqUBhlLVM/Bt+Fj9xTo+LhC1OV1XDaGkz4hNC80et5xgy+9KTHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + }, + "peerDependencies": { + "@types/react": "^19" + } + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "peer": true, + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, + "node_modules/chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true, + "license": "MIT" + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "license": "MIT", + "peer": true + }, + "node_modules/commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || >=14" + } + }, + "node_modules/console-table-printer": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/console-table-printer/-/console-table-printer-2.12.1.tgz", + "integrity": "sha512-wKGOQRRvdnd89pCeH96e2Fn4wkbenSP6LMHfjfyNLMbGuHEFbMqQNuxXqd0oXG9caIOQ1FTvc5Uijp9/4jujnQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "simple-wcswidth": "^1.0.1" + } + }, + "node_modules/croner": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/croner/-/croner-9.0.0.tgz", + "integrity": "sha512-onMB0OkDjkXunhdW9htFjEhqrD54+M94i6ackoUkjHKbRnXdyEyKRelp4nJ1kAz32+s27jP1FsebpJCVl0BsvA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=18.0" + } + }, + "node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/csstype": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/dataloader": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/dataloader/-/dataloader-2.2.3.tgz", + "integrity": "sha512-y2krtASINtPFS1rSDjacrFgn1dcUuoREVabwlOGOe4SdxenREqwjwjElAdwvbGM7kgZz9a3KVicWR7vcz8rnzA==", + "license": "MIT", + "peer": true + }, + "node_modules/date-fns": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz", + "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, + "node_modules/dateformat": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz", + "integrity": "sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==", + "license": "MIT", + "peer": true, + "engines": { + "node": "*" + } + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/detect-indent": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.1.0.tgz", + "integrity": "sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "license": "MIT", + "peer": true, + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/enquirer": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz", + "integrity": "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-colors": "^4.1.1", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/esbuild": { + "version": "0.25.8", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.8.tgz", + "integrity": "sha512-vVC0USHGtMi8+R4Kz8rt6JhEWLxsv9Rnu/lGYbPR8u47B+DCBksq9JarW0zOO7bs37hyOK1l2/oqtbciutL5+Q==", + "hasInstallScript": true, + "license": "MIT", + "peer": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.8", + "@esbuild/android-arm": "0.25.8", + "@esbuild/android-arm64": "0.25.8", + "@esbuild/android-x64": "0.25.8", + "@esbuild/darwin-arm64": "0.25.8", + "@esbuild/darwin-x64": "0.25.8", + "@esbuild/freebsd-arm64": "0.25.8", + "@esbuild/freebsd-x64": "0.25.8", + "@esbuild/linux-arm": "0.25.8", + "@esbuild/linux-arm64": "0.25.8", + "@esbuild/linux-ia32": "0.25.8", + "@esbuild/linux-loong64": "0.25.8", + "@esbuild/linux-mips64el": "0.25.8", + "@esbuild/linux-ppc64": "0.25.8", + "@esbuild/linux-riscv64": "0.25.8", + "@esbuild/linux-s390x": "0.25.8", + "@esbuild/linux-x64": "0.25.8", + "@esbuild/netbsd-arm64": "0.25.8", + "@esbuild/netbsd-x64": "0.25.8", + "@esbuild/openbsd-arm64": "0.25.8", + "@esbuild/openbsd-x64": "0.25.8", + "@esbuild/openharmony-arm64": "0.25.8", + "@esbuild/sunos-x64": "0.25.8", + "@esbuild/win32-arm64": "0.25.8", + "@esbuild/win32-ia32": "0.25.8", + "@esbuild/win32-x64": "0.25.8" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/extendable-error": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/extendable-error/-/extendable-error-0.1.7.tgz", + "integrity": "sha512-UOiS2in6/Q0FK0R0q6UY9vYpQ21mr/Qn1KOnte7vsACuNJf514WvCCUHSRCPcgjPT2bAhNIJdlE6bVap1GKmeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dev": true, + "license": "MIT", + "dependencies": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/fast-copy": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/fast-copy/-/fast-copy-3.0.2.tgz", + "integrity": "sha512-dl0O9Vhju8IrcLndv2eU4ldt1ftXMqqfgN4H1cpmGV7P6jeB9FwpN9a2c8DPGE1Ys88rNUJVYDHq73CGAGOPfQ==", + "license": "MIT", + "peer": true + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT", + "peer": true + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-redact": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.5.0.tgz", + "integrity": "sha512-dwsoQlS7h9hMeYUq1W++23NDcBLV4KqONnITDV9DjfS3q1SgDGVrBdvvTLUotWtPSD7asWDV9/CmsZPy8Hf70A==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", + "license": "MIT", + "peer": true + }, + "node_modules/fast-uri": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.6.tgz", + "integrity": "sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause", + "peer": true + }, + "node_modules/fastq": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-type": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-19.3.0.tgz", + "integrity": "sha512-mROwiKLZf/Kwa/2Rol+OOZQn1eyTkPB3ZTwC0ExY6OLFCbgxHYZvBm7xI77NvfZFMKBsmuXfmLJnD4eEftEhrA==", + "license": "MIT", + "peer": true, + "dependencies": { + "strtok3": "^8.0.0", + "token-types": "^6.0.0", + "uint8array-extras": "^1.3.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sindresorhus/file-type?sponsor=1" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-tsconfig": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.8.1.tgz", + "integrity": "sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==", + "license": "MIT", + "peer": true, + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/git-cliff": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/git-cliff/-/git-cliff-2.7.0.tgz", + "integrity": "sha512-gO4rb3VCAvzv+vWPPspxSCAeDAQbvknYioO43Wb+Dn0MWFC3zc89uwkxx36yAmCa7qui9TL2E3vSz6j9GbbzqA==", + "dev": true, + "license": "MIT OR Apache-2.0", + "dependencies": { + "execa": "^8.0.1" + }, + "bin": { + "git-cliff": "lib/cli/cli.js" + }, + "engines": { + "node": ">=18.19 || >=20.6 || >=21" + }, + "optionalDependencies": { + "git-cliff-darwin-arm64": "2.7.0", + "git-cliff-darwin-x64": "2.7.0", + "git-cliff-linux-arm64": "2.7.0", + "git-cliff-linux-x64": "2.7.0", + "git-cliff-windows-arm64": "2.7.0", + "git-cliff-windows-x64": "2.7.0" + } + }, + "node_modules/git-cliff-darwin-arm64": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/git-cliff-darwin-arm64/-/git-cliff-darwin-arm64-2.7.0.tgz", + "integrity": "sha512-8D6Zxk9onts9r16yzuJEUq4ixGMJYvUI47GujUbs3ifsXB7x8SCOX7QCwmylRkZKnRC95fZ3jwi+gy95SwVaPQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/git-cliff-darwin-x64": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/git-cliff-darwin-x64/-/git-cliff-darwin-x64-2.7.0.tgz", + "integrity": "sha512-CkADqy5hif6P6rrTIWkkSkrsQzbcTv1kr5dAIpRq9SkjWVpRHQftouhNyB2qfNe0SH73R9N9oCIocIA1bSnVeQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/git-cliff-linux-arm64": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/git-cliff-linux-arm64/-/git-cliff-linux-arm64-2.7.0.tgz", + "integrity": "sha512-kuJz+hL+nDqmK2E3/uahufdAHKjn76F0rv/oZpaQgUSmdE8vy9x1J28YSoXTlXIr0BfuzZjxCKrrfr8b7wU/Xw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/git-cliff-linux-x64": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/git-cliff-linux-x64/-/git-cliff-linux-x64-2.7.0.tgz", + "integrity": "sha512-0qHHPEsAo9HQZpifM9wdnjot90yB7C+LIHSFfGhkTsmzr/Daxnekt0um6mb3yEA7YuFnE9+c8mvLDoXlgJ5eaA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/git-cliff-windows-arm64": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/git-cliff-windows-arm64/-/git-cliff-windows-arm64-2.7.0.tgz", + "integrity": "sha512-uq5qGuWkO6YCEGg9nDk3butX0F80hfICsBh6LWicL9bfpyfEzdSbuv4AS1hJ2jTIjqRMOP2NRSii4pM9bqjfsw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/git-cliff-windows-x64": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/git-cliff-windows-x64/-/git-cliff-windows-x64-2.7.0.tgz", + "integrity": "sha512-WOoKrlYvRMaWcEdQZD1I+Pg+W6yjztxzUkid7qqyum6J2e21kfw8asL5gDnTX9rZAKu+MV29/zG7RdFqKD2qsA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globals": { + "version": "15.15.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz", + "integrity": "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/graphql": { + "version": "16.11.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.11.0.tgz", + "integrity": "sha512-mS1lbMsxgQj6hge1XZ6p7GPhbrtFwUFYi3wRzXAC/FmYnyXMTvvI3td3rjmQ2u8ewXueaSvRPWaEcgVVOT9Jnw==", + "license": "MIT", + "peer": true, + "engines": { + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" + } + }, + "node_modules/help-me": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/help-me/-/help-me-5.0.0.tgz", + "integrity": "sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg==", + "license": "MIT", + "peer": true + }, + "node_modules/http-status": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/http-status/-/http-status-2.1.0.tgz", + "integrity": "sha512-O5kPr7AW7wYd/BBiOezTwnVAnmSNFY+J7hlZD2X5IOxVBetjcHAiTXhzj0gMrnojQlwy+UT1/Y3H3vJ3UlmvLA==", + "license": "BSD-3-Clause", + "peer": true, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/human-id": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/human-id/-/human-id-1.0.2.tgz", + "integrity": "sha512-UNopramDEhHJD+VR+ehk8rOslwSfByxPIZyJRfV739NDhN5LF1fa1MqnzKm2lGTQRjNrjK19Q5fhkgIfjlVUKw==", + "dev": true, + "license": "MIT" + }, + "node_modules/human-signals": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause", + "peer": true + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/image-size": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/image-size/-/image-size-2.0.2.tgz", + "integrity": "sha512-IRqXKlaXwgSMAMtpNzZa1ZAe8m+Sa1770Dhk8VkSsP9LS+iHD62Zd8FQKs8fbPiagBE7BzoFX23cxFnwshpV6w==", + "license": "MIT", + "peer": true, + "bin": { + "image-size": "bin/image-size.js" + }, + "engines": { + "node": ">=16.x" + } + }, + "node_modules/ipaddr.js": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.2.0.tgz", + "integrity": "sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-subdir": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-subdir/-/is-subdir-1.2.0.tgz", + "integrity": "sha512-2AT6j+gXe/1ueqbW6fLZJiIw3F8iXGJtt0yDrZaBhAZEG1raiTxKWU+IPqMCzQAXOUCKdA4UDMgacKH25XG2Cw==", + "dev": true, + "license": "MIT", + "dependencies": { + "better-path-resolve": "1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/jose": { + "version": "6.0.8", + "resolved": "https://registry.npmjs.org/jose/-/jose-6.0.8.tgz", + "integrity": "sha512-EyUPtOKyTYq+iMOszO42eobQllaIjJnwkZ2U93aJzNyPibCy7CEvT9UQnaCVB51IAd49gbNdCew1c0LcLTCB2g==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/joycon": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", + "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-schema-to-typescript": { + "version": "15.0.3", + "resolved": "https://registry.npmjs.org/json-schema-to-typescript/-/json-schema-to-typescript-15.0.3.tgz", + "integrity": "sha512-iOKdzTUWEVM4nlxpFudFsWyUiu/Jakkga4OZPEt7CGoSEsAsUgdOZqR6pcgx2STBek9Gm4hcarJpXSzIvZ/hKA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@apidevtools/json-schema-ref-parser": "^11.5.5", + "@types/json-schema": "^7.0.15", + "@types/lodash": "^4.17.7", + "is-glob": "^4.0.3", + "js-yaml": "^4.1.0", + "lodash": "^4.17.21", + "minimist": "^1.2.8", + "prettier": "^3.2.5", + "tinyglobby": "^0.2.9" + }, + "bin": { + "json2ts": "dist/src/cli.js" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/json-schema-to-typescript/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0", + "peer": true + }, + "node_modules/json-schema-to-typescript/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "license": "MIT", + "peer": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT", + "peer": true + }, + "node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "dev": true, + "license": "MIT", + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "license": "MIT", + "peer": true + }, + "node_modules/lodash.startcase": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.startcase/-/lodash.startcase-4.4.0.tgz", + "integrity": "sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==", + "dev": true, + "license": "MIT" + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true, + "license": "MIT" + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/mylas": { + "version": "2.1.13", + "resolved": "https://registry.npmjs.org/mylas/-/mylas-2.1.13.tgz", + "integrity": "sha512-+MrqnJRtxdF+xngFfUUkIMQrUUL0KsxbADUkn23Z/4ibGg192Q+z+CQyiYwvWTsYjJygmMR8+w3ZDa98Zh6ESg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/raouldeheer" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/oauth4webapi": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/oauth4webapi/-/oauth4webapi-3.6.0.tgz", + "integrity": "sha512-OwXPTXjKPOldTpAa19oksrX9TYHA0rt+VcUFTkJ7QKwgmevPpNm9Cn5vFZUtIo96FiU6AfPuUUGzoXqgOzibWg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/on-exit-leak-free": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz", + "integrity": "sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "peer": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/outdent": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/outdent/-/outdent-0.5.0.tgz", + "integrity": "sha512-/jHxFIzoMXdqPzTaCpFzAAWhpkSjZPF4Vsn6jAfNpmbH/ymsmd7Qc6VE9BGn0L6YMj6uwpQLxCECpus4ukKS9Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/p-filter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-filter/-/p-filter-2.1.0.tgz", + "integrity": "sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-map": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-map": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz", + "integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/package-manager-detector": { + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/package-manager-detector/-/package-manager-detector-0.2.11.tgz", + "integrity": "sha512-BEnLolu+yuz22S56CU1SUKq3XC3PkwD5wv4ikR4MfGvnRVcmzXR9DwSlW2fEamyTPyXHomBJRzgapeuBvRNzJQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "quansync": "^0.2.7" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-to-regexp": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", + "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==", + "license": "MIT", + "peer": true + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/payload": { + "version": "3.48.0", + "resolved": "https://registry.npmjs.org/payload/-/payload-3.48.0.tgz", + "integrity": "sha512-4XG3fGI3Y7mYFz0hBShielwYsUCnI5ilmgBvRH6SZJ0sDUHsok3uTQn91QBRusRDjqk+Ml/dHpHWqSbZR/+GaQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@next/env": "^15.1.5", + "@payloadcms/translations": "3.48.0", + "@types/busboy": "1.5.4", + "ajv": "8.17.1", + "bson-objectid": "2.0.4", + "busboy": "^1.6.0", + "ci-info": "^4.1.0", + "console-table-printer": "2.12.1", + "croner": "9.0.0", + "dataloader": "2.2.3", + "deepmerge": "4.3.1", + "file-type": "19.3.0", + "get-tsconfig": "4.8.1", + "http-status": "2.1.0", + "image-size": "2.0.2", + "ipaddr.js": "2.2.0", + "jose": "5.9.6", + "json-schema-to-typescript": "15.0.3", + "minimist": "1.2.8", + "path-to-regexp": "6.3.0", + "pino": "9.5.0", + "pino-pretty": "13.0.0", + "pluralize": "8.0.0", + "qs-esm": "7.0.2", + "sanitize-filename": "1.6.3", + "scmp": "2.1.0", + "ts-essentials": "10.0.3", + "tsx": "4.20.3", + "undici": "7.10.0", + "uuid": "10.0.0", + "ws": "^8.16.0" + }, + "bin": { + "payload": "bin.js" + }, + "engines": { + "node": "^18.20.2 || >=20.9.0" + }, + "peerDependencies": { + "graphql": "^16.8.1" + } + }, + "node_modules/payload/node_modules/ci-info": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.3.0.tgz", + "integrity": "sha512-l+2bNRMiQgcfILUi33labAZYIWlH1kWDp+ecNo5iisRKrbm0xcRyCww71/YU0Fkw0mAFpz9bJayXPjey6vkmaQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/payload/node_modules/jose": { + "version": "5.9.6", + "resolved": "https://registry.npmjs.org/jose/-/jose-5.9.6.tgz", + "integrity": "sha512-AMlnetc9+CV9asI19zHmrgS/WYsWUwCn2R7RzlbJWD7F9eWYUTGyBmU9o6PxngtLGOiDGPRu+Uc4fhKzbpteZQ==", + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/payload/node_modules/uuid": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz", + "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "peer": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/peek-readable": { + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.4.2.tgz", + "integrity": "sha512-peBp3qZyuS6cNIJ2akRNG1uo1WJ1d0wTxg/fxMdZ0BqCVhx242bSFHM9eNqflfJVS9SsgkzgT/1UgnsurBOTMg==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/pino": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/pino/-/pino-9.5.0.tgz", + "integrity": "sha512-xSEmD4pLnV54t0NOUN16yCl7RIB1c5UUOse5HSyEXtBp+FgFQyPeDutc+Q2ZO7/22vImV7VfEjH/1zV2QuqvYw==", + "license": "MIT", + "peer": true, + "dependencies": { + "atomic-sleep": "^1.0.0", + "fast-redact": "^3.1.1", + "on-exit-leak-free": "^2.1.0", + "pino-abstract-transport": "^2.0.0", + "pino-std-serializers": "^7.0.0", + "process-warning": "^4.0.0", + "quick-format-unescaped": "^4.0.3", + "real-require": "^0.2.0", + "safe-stable-stringify": "^2.3.1", + "sonic-boom": "^4.0.1", + "thread-stream": "^3.0.0" + }, + "bin": { + "pino": "bin.js" + } + }, + "node_modules/pino-abstract-transport": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-2.0.0.tgz", + "integrity": "sha512-F63x5tizV6WCh4R6RHyi2Ml+M70DNRXt/+HANowMflpgGFMAym/VKm6G7ZOQRjqN7XbGxK1Lg9t6ZrtzOaivMw==", + "license": "MIT", + "peer": true, + "dependencies": { + "split2": "^4.0.0" + } + }, + "node_modules/pino-pretty": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-13.0.0.tgz", + "integrity": "sha512-cQBBIVG3YajgoUjo1FdKVRX6t9XPxwB9lcNJVD5GCnNM4Y6T12YYx8c6zEejxQsU0wrg9TwmDulcE9LR7qcJqA==", + "license": "MIT", + "peer": true, + "dependencies": { + "colorette": "^2.0.7", + "dateformat": "^4.6.3", + "fast-copy": "^3.0.2", + "fast-safe-stringify": "^2.1.1", + "help-me": "^5.0.0", + "joycon": "^3.1.1", + "minimist": "^1.2.6", + "on-exit-leak-free": "^2.1.0", + "pino-abstract-transport": "^2.0.0", + "pump": "^3.0.0", + "secure-json-parse": "^2.4.0", + "sonic-boom": "^4.0.1", + "strip-json-comments": "^3.1.1" + }, + "bin": { + "pino-pretty": "bin.js" + } + }, + "node_modules/pino-std-serializers": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-7.0.0.tgz", + "integrity": "sha512-e906FRY0+tV27iq4juKzSYPbUj2do2X2JX4EzSca1631EB2QJQUqGbDuERal7LCtOpxl6x3+nvo9NPZcmjkiFA==", + "license": "MIT", + "peer": true + }, + "node_modules/plimit-lit": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/plimit-lit/-/plimit-lit-1.6.1.tgz", + "integrity": "sha512-B7+VDyb8Tl6oMJT9oSO2CW8XC/T4UcJGrwOVoNGwOQsQYhlpfajmrMj5xeejqaASq3V/EqThyOeATEOMuSEXiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "queue-lit": "^1.5.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/prettier": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz", + "integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==", + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/process-warning": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-4.0.1.tgz", + "integrity": "sha512-3c2LzQ3rY9d0hc1emcsHhfT9Jwz0cChib/QN89oME2R451w5fy3f0afAhERFZAwrbDU43wk12d0ORBpDVME50Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "peer": true + }, + "node_modules/pump": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", + "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", + "license": "MIT", + "peer": true, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/pvtsutils": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/pvtsutils/-/pvtsutils-1.3.6.tgz", + "integrity": "sha512-PLgQXQ6H2FWCaeRak8vvk1GW462lMxB5s3Jm673N82zI4vqtVUPuZdffdZbPDFRoU8kAhItWFtPCWiPpp4/EDg==", + "license": "MIT", + "dependencies": { + "tslib": "^2.8.1" + } + }, + "node_modules/pvutils": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/pvutils/-/pvutils-1.1.3.tgz", + "integrity": "sha512-pMpnA0qRdFp32b1sJl1wOJNxZLQ2cbQx+k6tjNtZ8CpvVhNqEPRgivZ2WOUev2YMajecdH7ctUPDvEe87nariQ==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/qs-esm": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/qs-esm/-/qs-esm-7.0.2.tgz", + "integrity": "sha512-D8NAthKSD7SGn748v+GLaaO6k08Mvpoqroa35PqIQC4gtUa8/Pb/k+r0m0NnGBVbHDP1gKZ2nVywqfMisRhV5A==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/quansync": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/quansync/-/quansync-0.2.10.tgz", + "integrity": "sha512-t41VRkMYbkHyCYmOvx/6URnN80H7k4X0lLdBMGsz+maAwrJQYB1djpV6vHrQIBE0WBSGqhtEHrK9U3DWWH8v7A==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/antfu" + }, + { + "type": "individual", + "url": "https://github.com/sponsors/sxzz" + } + ], + "license": "MIT" + }, + "node_modules/queue-lit": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/queue-lit/-/queue-lit-1.5.2.tgz", + "integrity": "sha512-tLc36IOPeMAubu8BkW8YDBV+WyIgKlYU7zUNs0J5Vk9skSZ4JfGlPOqplP0aHdfv7HL0B2Pg6nwiq60Qc6M2Hw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/quick-format-unescaped": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz", + "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==", + "license": "MIT", + "peer": true + }, + "node_modules/read-yaml-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-yaml-file/-/read-yaml-file-1.1.0.tgz", + "integrity": "sha512-VIMnQi/Z4HT2Fxuwg5KrY174U1VdUIASQVWXXyqtNRtxSr9IYkn1rsI6Tb6HsrHCmB7gVpNwX6JxPTHcH6IoTA==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.5", + "js-yaml": "^3.6.1", + "pify": "^4.0.1", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/real-require": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz", + "integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 12.13.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-stable-stringify": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", + "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "license": "MIT" + }, + "node_modules/sanitize-filename": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.3.tgz", + "integrity": "sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==", + "license": "WTFPL OR ISC", + "peer": true, + "dependencies": { + "truncate-utf8-bytes": "^1.0.0" + } + }, + "node_modules/scmp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/scmp/-/scmp-2.1.0.tgz", + "integrity": "sha512-o/mRQGk9Rcer/jEEw/yw4mwo3EU/NvYvp577/Btqrym9Qy5/MdWGBqipbALgd2lrdWTJ5/gqDusxfnQBxOxT2Q==", + "license": "BSD-3-Clause", + "peer": true + }, + "node_modules/secure-json-parse": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.7.0.tgz", + "integrity": "sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==", + "license": "BSD-3-Clause", + "peer": true + }, + "node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/simple-wcswidth": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/simple-wcswidth/-/simple-wcswidth-1.1.2.tgz", + "integrity": "sha512-j7piyCjAeTDSjzTSQ7DokZtMNwNlEAyxqSZeCS+CXH7fJ4jx3FuJ/mTW3mE+6JLs4VJBbcll0Kjn+KXI5t21Iw==", + "license": "MIT", + "peer": true + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/sonic-boom": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.2.0.tgz", + "integrity": "sha512-INb7TM37/mAcsGmc9hyyI6+QR3rR1zVRu36B0NeGXKnOOLiZOfER5SA+N7X7k3yUYRzLWafduTDvJAfDswwEww==", + "license": "MIT", + "peer": true, + "dependencies": { + "atomic-sleep": "^1.0.0" + } + }, + "node_modules/spawndamnit": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spawndamnit/-/spawndamnit-3.0.1.tgz", + "integrity": "sha512-MmnduQUuHCoFckZoWnXsTg7JaiLBJrKFj9UI2MbRPGaJeVpsLcVBu6P/IGZovziM/YBsellCmsprgNA+w0CzVg==", + "dev": true, + "license": "SEE LICENSE IN LICENSE", + "dependencies": { + "cross-spawn": "^7.0.5", + "signal-exit": "^4.0.1" + } + }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "license": "ISC", + "peer": true, + "engines": { + "node": ">= 10.x" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "peer": true, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strtok3": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-8.1.0.tgz", + "integrity": "sha512-ExzDvHYPj6F6QkSNe/JxSlBxTh3OrI6wrAIz53ulxo1c4hBJ1bT9C/JrAthEKHWG9riVH3Xzg7B03Oxty6S2Lw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@tokenizer/token": "^0.3.0", + "peek-readable": "^5.1.4" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/term-size": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.1.tgz", + "integrity": "sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/thread-stream": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-3.1.0.tgz", + "integrity": "sha512-OqyPZ9u96VohAyMfJykzmivOrY2wfMSf3C5TtFJVgN+Hm6aj+voFhlK+kZEIv2FBh1X6Xp3DlnCOfEQ3B2J86A==", + "license": "MIT", + "peer": true, + "dependencies": { + "real-require": "^0.2.0" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz", + "integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "fdir": "^6.4.4", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz", + "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==", + "license": "MIT", + "peer": true, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "os-tmpdir": "~1.0.2" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/token-types": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-6.0.3.tgz", + "integrity": "sha512-IKJ6EzuPPWtKtEIEPpIdXv9j5j2LGJEYk0CKY2efgKoYKLBiZdh6iQkLVBow/CB3phyWAWCyk+bZeaimJn6uRQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/truncate-utf8-bytes": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", + "integrity": "sha512-95Pu1QXQvruGEhv62XCMO3Mm90GscOCClvrIUwCM0PYOXK3kaF3l3sIHxx71ThJfcbM2O5Au6SO3AWCSEfW4mQ==", + "license": "WTFPL", + "peer": true, + "dependencies": { + "utf8-byte-length": "^1.0.1" + } + }, + "node_modules/ts-essentials": { + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-10.0.3.tgz", + "integrity": "sha512-/FrVAZ76JLTWxJOERk04fm8hYENDo0PWSP3YLQKxevLwWtxemGcl5JJEzN4iqfDlRve0ckyfFaOBu4xbNH/wZw==", + "license": "MIT", + "peer": true, + "peerDependencies": { + "typescript": ">=4.5.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/tsc-alias": { + "version": "1.8.16", + "resolved": "https://registry.npmjs.org/tsc-alias/-/tsc-alias-1.8.16.tgz", + "integrity": "sha512-QjCyu55NFyRSBAl6+MTFwplpFcnm2Pq01rR/uxfqJoLMm6X3O14KEGtaSDZpJYaE1bJBGDjD0eSuiIWPe2T58g==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.3", + "commander": "^9.0.0", + "get-tsconfig": "^4.10.0", + "globby": "^11.0.4", + "mylas": "^2.1.9", + "normalize-path": "^3.0.0", + "plimit-lit": "^1.2.6" + }, + "bin": { + "tsc-alias": "dist/bin/index.js" + }, + "engines": { + "node": ">=16.20.2" + } + }, + "node_modules/tsc-alias/node_modules/get-tsconfig": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.1.tgz", + "integrity": "sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/tsx": { + "version": "4.20.3", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.20.3.tgz", + "integrity": "sha512-qjbnuR9Tr+FJOMBqJCW5ehvIo/buZq7vH7qD7JziU98h6l3qGy0a/yPFjwO+y0/T7GFpNgNAvEcPPVfyT8rrPQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "esbuild": "~0.25.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "devOptional": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/uint8array-extras": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/uint8array-extras/-/uint8array-extras-1.4.0.tgz", + "integrity": "sha512-ZPtzy0hu4cZjv3z5NW9gfKnNLjoz4y6uv4HlelAjDK7sY/xOkKZv9xK/WQpcsBB3jEybChz9DPC2U/+cusjJVQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/undici": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.10.0.tgz", + "integrity": "sha512-u5otvFBOBZvmdjWLVW+5DAc9Nkq8f24g0O9oY7qw2JVIF1VocIFoyz9JFkuVOS2j41AufeO0xnlweJ2RLT8nGw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=20.18.1" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "license": "MIT" + }, + "node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/utf8-byte-length": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.5.tgz", + "integrity": "sha512-Xn0w3MtiQ6zoz2vFyUVruaCL53O/DwUvkEeOvj+uulMm0BkUGYWmBYVyElqZaSLhY6ZD0ulfU3aBra2aVT4xfA==", + "license": "(WTFPL OR MIT)", + "peer": true + }, + "node_modules/uuid": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", + "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/esm/bin/uuid" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC", + "peer": true + }, + "node_modules/ws": { + "version": "8.18.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", + "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/src/core/protocols/oauth/oauth_authentication.ts b/src/core/protocols/oauth/oauth_authentication.ts index 34f71a4..92042cf 100644 --- a/src/core/protocols/oauth/oauth_authentication.ts +++ b/src/core/protocols/oauth/oauth_authentication.ts @@ -1,5 +1,6 @@ import * as jose from "jose" import { v4 as uuid } from "uuid" +import { parseCookies } from "payload" import type { JsonObject, PayloadRequest, @@ -168,8 +169,37 @@ export async function OAuthAuthentication( cookies = invalidateOAuthCookies(cookies) + // Get the intended redirect URL from the state or cookies + const parsedCookies = parseCookies(request.headers) + let redirectUrl = successRedirectPath + + // Option 1: If you're using the manual state validation approach + const cookieState = parsedCookies.get("__session-oauth-state") + if (cookieState) { + try { + const stateData = JSON.parse(cookieState) + if (stateData.redirectUrl) { + redirectUrl = stateData.redirectUrl + } + } catch (error) { + console.error("Failed to parse state data:", error) + // Fall back to default redirect path + } + } + + console.log("Redirecting user to:", redirectUrl) + + // Ensure the redirect URL is safe (starts with / or is a relative path) + if ( + !redirectUrl.startsWith("/") && + !redirectUrl.startsWith(payload.config.serverURL) + ) { + console.warn("Unsafe redirect URL detected, using default:", redirectUrl) + redirectUrl = successRedirectPath + } + const successRedirectionURL = new URL( - `${payload.config.serverURL}${successRedirectPath}`, + `${payload.config.serverURL}${redirectUrl}`, ) const res = new Response(null, { diff --git a/src/core/protocols/oauth/oidc_authorization.ts b/src/core/protocols/oauth/oidc_authorization.ts index f0ddd84..cfd2b90 100644 --- a/src/core/protocols/oauth/oidc_authorization.ts +++ b/src/core/protocols/oauth/oidc_authorization.ts @@ -44,14 +44,31 @@ export async function OIDCAuthorization( code_challenge_method, ) - // Add state parameter if provided + // Create and store state parameter + let stateValue: string | undefined if (parsedState) { - authorizationURL.searchParams.set("state", createOAuthState(parsedState)) + stateValue = createOAuthState(parsedState) + authorizationURL.searchParams.set("state", stateValue) + + // Store the state in a cookie for callback validation + cookies.push( + `__session-oauth-state=${stateValue};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`, + ) } if (params) { Object.entries(params).map(([key, value]) => { - authorizationURL.searchParams.set(key, value) + // Don't override the state if we already set it + if (key !== "state" || !stateValue) { + authorizationURL.searchParams.set(key, value) + + // If state comes from params and we haven't set it yet, store it in cookie + if (key === "state" && !stateValue) { + cookies.push( + `__session-oauth-state=${value};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`, + ) + } + } }) } diff --git a/src/core/protocols/oauth/oidc_callback.ts b/src/core/protocols/oauth/oidc_callback.ts index 2b86330..2c7e599 100644 --- a/src/core/protocols/oauth/oidc_callback.ts +++ b/src/core/protocols/oauth/oidc_callback.ts @@ -65,16 +65,30 @@ export async function OIDCCallback( .discoveryRequest(issuer_url, { algorithm }) .then((response) => oauth.processDiscoveryResponse(issuer_url, response)) - // Use parsed state for validation if available - const stateParam = parsedState - ? createOAuthState(parsedState) - : providerConfig?.params?.state || undefined - console.error("OIDC Callback state parameter:", stateParam) + // Handle state validation manually since we're using it for redirect logic + const cookieState = parsedCookies.get("__session-oauth-state") + const urlState = current_url.searchParams.get("state") + const urlStateDecoded = urlState ? decodeURIComponent(urlState) : null + + console.error("Cookie state:", cookieState) + console.error("URL state (from callback):", urlState) + console.error("URL state decoded:", urlStateDecoded) + + // Validate state manually for security + if (cookieState && urlStateDecoded && cookieState !== urlStateDecoded) { + throw new Error("State parameter mismatch - possible CSRF attack") + } + + // Remove state from URL for OAuth validation since we handle it separately + const urlWithoutState = new URL(current_url.toString()) + urlWithoutState.searchParams.delete("state") + + // Pass undefined for state since we're handling it manually const params_oauth = oauth.validateAuthResponse( as, client, - current_url, - stateParam, + urlWithoutState, // URL without state parameter + undefined, // No state validation by oauth4webapi ) console.error("OIDC Callback params_oauth:", params_oauth) From ca858ec81002e157da47073b66b4dcc8d7104af8 Mon Sep 17 00:00:00 2001 From: WillODR Date: Thu, 24 Jul 2025 12:50:08 +0100 Subject: [PATCH 4/7] Add OIDC Providers for Okta and Slack, implement Passkey and Password providers - Introduced OktaAuthProvider and SlackAuthProvider with necessary configurations and callback setups. - Implemented PasskeyAuthProvider for passkey authentication. - Added PasswordProvider for password-based authentication with customizable email templates. - Updated type definitions and source maps for all new providers. - Enhanced utility functions to manage OAuth providers effectively. --- .gitignore | 2 +- dist/client/index.d.ts | 40 +++ dist/client/index.d.ts.map | 1 + dist/client/index.js | 80 +++++ dist/client/index.js.map | 1 + dist/client/oauth.d.ts | 9 + dist/client/oauth.d.ts.map | 1 + dist/client/oauth.js | 7 + dist/client/oauth.js.map | 1 + dist/client/passkey/authentication.d.ts | 10 + dist/client/passkey/authentication.d.ts.map | 1 + dist/client/passkey/authentication.js | 30 ++ dist/client/passkey/authentication.js.map | 1 + dist/client/passkey/index.d.ts | 2 + dist/client/passkey/index.d.ts.map | 1 + dist/client/passkey/index.js | 36 ++ dist/client/passkey/index.js.map | 1 + dist/client/passkey/registration.d.ts | 2 + dist/client/passkey/registration.d.ts.map | 1 + dist/client/passkey/registration.js | 28 ++ dist/client/passkey/registration.js.map | 1 + dist/client/password.d.ts | 33 ++ dist/client/password.d.ts.map | 1 + dist/client/password.js | 92 +++++ dist/client/password.js.map | 1 + dist/client/refresh.d.ts | 8 + dist/client/refresh.d.ts.map | 1 + dist/client/refresh.js | 16 + dist/client/refresh.js.map | 1 + dist/client/register.d.ts | 10 + dist/client/register.d.ts.map | 1 + dist/client/register.js | 7 + dist/client/register.js.map | 1 + dist/client/session.d.ts | 16 + dist/client/session.d.ts.map | 1 + dist/client/session.js | 30 ++ dist/client/session.js.map | 1 + dist/client/signin.d.ts | 13 + dist/client/signin.d.ts.map | 1 + dist/client/signin.js | 10 + dist/client/signin.js.map | 1 + dist/client/signout.d.ts | 15 + dist/client/signout.d.ts.map | 1 + dist/client/signout.js | 32 ++ dist/client/signout.js.map | 1 + dist/collection/hooks.d.ts | 3 + dist/collection/hooks.d.ts.map | 1 + dist/collection/hooks.js | 11 + dist/collection/hooks.js.map | 1 + dist/collection/index.d.ts | 19 + dist/collection/index.d.ts.map | 1 + dist/collection/index.js | 197 +++++++++++ dist/collection/index.js.map | 1 + dist/constants.d.ts | 3 + dist/constants.d.ts.map | 1 + dist/constants.js | 3 + dist/constants.js.map | 1 + dist/core/endpoints.d.ts | 111 ++++++ dist/core/endpoints.d.ts.map | 1 + dist/core/endpoints.js | 145 ++++++++ dist/core/endpoints.js.map | 1 + dist/core/errors/apiErrors.d.ts | 47 +++ dist/core/errors/apiErrors.d.ts.map | 1 + dist/core/errors/apiErrors.js | 93 +++++ dist/core/errors/apiErrors.js.map | 1 + dist/core/errors/consoleErrors.d.ts | 65 ++++ dist/core/errors/consoleErrors.d.ts.map | 1 + dist/core/errors/consoleErrors.js | 110 ++++++ dist/core/errors/consoleErrors.js.map | 1 + dist/core/preflights/collections.d.ts | 3 + dist/core/preflights/collections.d.ts.map | 1 + dist/core/preflights/collections.js | 13 + dist/core/preflights/collections.js.map | 1 + .../protocols/oauth/oauth2_authorization.d.ts | 4 + .../oauth/oauth2_authorization.d.ts.map | 1 + .../protocols/oauth/oauth2_authorization.js | 51 +++ .../oauth/oauth2_authorization.js.map | 1 + .../core/protocols/oauth/oauth2_callback.d.ts | 3 + .../protocols/oauth/oauth2_callback.d.ts.map | 1 + dist/core/protocols/oauth/oauth2_callback.js | 60 ++++ .../protocols/oauth/oauth2_callback.js.map | 1 + .../protocols/oauth/oauth_authentication.d.ts | 4 + .../oauth/oauth_authentication.d.ts.map | 1 + .../protocols/oauth/oauth_authentication.js | 142 ++++++++ .../oauth/oauth_authentication.js.map | 1 + .../protocols/oauth/oidc_authorization.d.ts | 4 + .../oauth/oidc_authorization.d.ts.map | 1 + .../protocols/oauth/oidc_authorization.js | 63 ++++ .../protocols/oauth/oidc_authorization.js.map | 1 + dist/core/protocols/oauth/oidc_callback.d.ts | 3 + .../protocols/oauth/oidc_callback.d.ts.map | 1 + dist/core/protocols/oauth/oidc_callback.js | 92 +++++ .../core/protocols/oauth/oidc_callback.js.map | 1 + .../protocols/passkey/authentication.d.ts | 5 + .../protocols/passkey/authentication.d.ts.map | 1 + dist/core/protocols/passkey/authentication.js | 73 ++++ .../protocols/passkey/authentication.js.map | 1 + dist/core/protocols/passkey/index.d.ts | 3 + dist/core/protocols/passkey/index.d.ts.map | 1 + dist/core/protocols/passkey/index.js | 24 ++ dist/core/protocols/passkey/index.js.map | 1 + dist/core/protocols/passkey/registration.d.ts | 5 + .../protocols/passkey/registration.d.ts.map | 1 + dist/core/protocols/passkey/registration.js | 70 ++++ .../protocols/passkey/registration.js.map | 1 + dist/core/protocols/password.d.ts | 17 + dist/core/protocols/password.d.ts.map | 1 + dist/core/protocols/password.js | 326 ++++++++++++++++++ dist/core/protocols/password.js.map | 1 + dist/core/protocols/session.d.ts | 7 + dist/core/protocols/session.d.ts.map | 1 + dist/core/protocols/session.js | 110 ++++++ dist/core/protocols/session.js.map | 1 + dist/core/routeHandlers/oauth.d.ts | 10 + dist/core/routeHandlers/oauth.d.ts.map | 1 + dist/core/routeHandlers/oauth.js | 76 ++++ dist/core/routeHandlers/oauth.js.map | 1 + dist/core/routeHandlers/passkey.d.ts | 4 + dist/core/routeHandlers/passkey.d.ts.map | 1 + dist/core/routeHandlers/passkey.js | 21 ++ dist/core/routeHandlers/passkey.js.map | 1 + dist/core/routeHandlers/password.d.ts | 6 + dist/core/routeHandlers/password.d.ts.map | 1 + dist/core/routeHandlers/password.js | 25 ++ dist/core/routeHandlers/password.js.map | 1 + dist/core/routeHandlers/session.d.ts | 5 + dist/core/routeHandlers/session.d.ts.map | 1 + dist/core/routeHandlers/session.js | 21 ++ dist/core/routeHandlers/session.js.map | 1 + dist/core/utils/cb.d.ts | 2 + dist/core/utils/cb.d.ts.map | 1 + dist/core/utils/cb.js | 7 + dist/core/utils/cb.js.map | 1 + dist/core/utils/cookies.d.ts | 12 + dist/core/utils/cookies.d.ts.map | 1 + dist/core/utils/cookies.js | 37 ++ dist/core/utils/cookies.js.map | 1 + dist/core/utils/hash.d.ts | 7 + dist/core/utils/hash.d.ts.map | 1 + dist/core/utils/hash.js | 54 +++ dist/core/utils/hash.js.map | 1 + dist/core/utils/password.d.ts | 7 + dist/core/utils/password.d.ts.map | 1 + dist/core/utils/password.js | 37 ++ dist/core/utils/password.js.map | 1 + dist/core/utils/session.d.ts | 3 + dist/core/utils/session.d.ts.map | 1 + dist/core/utils/session.js | 8 + dist/core/utils/session.js.map | 1 + dist/core/utils/slug.d.ts | 2 + dist/core/utils/slug.d.ts.map | 1 + dist/core/utils/slug.js | 5 + dist/core/utils/slug.js.map | 1 + dist/index.d.ts | 2 + dist/index.d.ts.map | 1 + dist/index.js | 2 + dist/index.js.map | 1 + dist/plugin.d.ts | 90 +++++ dist/plugin.d.ts.map | 1 + dist/plugin.js | 78 +++++ dist/plugin.js.map | 1 + dist/providers/index.d.ts | 20 ++ dist/providers/index.d.ts.map | 1 + dist/providers/index.js | 20 ++ dist/providers/index.js.map | 1 + dist/providers/magiclink.d.ts | 1 + dist/providers/magiclink.d.ts.map | 1 + dist/providers/magiclink.js | 3 + dist/providers/magiclink.js.map | 1 + dist/providers/oauth2/apple.d.ts | 35 ++ dist/providers/oauth2/apple.d.ts.map | 1 + dist/providers/oauth2/apple.js | 61 ++++ dist/providers/oauth2/apple.js.map | 1 + dist/providers/oauth2/atlassian.d.ts | 35 ++ dist/providers/oauth2/atlassian.d.ts.map | 1 + dist/providers/oauth2/atlassian.js | 59 ++++ dist/providers/oauth2/atlassian.js.map | 1 + dist/providers/oauth2/auth0.d.ts | 37 ++ dist/providers/oauth2/auth0.d.ts.map | 1 + dist/providers/oauth2/auth0.js | 58 ++++ dist/providers/oauth2/auth0.js.map | 1 + dist/providers/oauth2/discord.d.ts | 32 ++ dist/providers/oauth2/discord.d.ts.map | 1 + dist/providers/oauth2/discord.js | 56 +++ dist/providers/oauth2/discord.js.map | 1 + dist/providers/oauth2/facebook.d.ts | 33 ++ dist/providers/oauth2/facebook.d.ts.map | 1 + dist/providers/oauth2/facebook.js | 64 ++++ dist/providers/oauth2/facebook.js.map | 1 + dist/providers/oauth2/github.d.ts | 34 ++ dist/providers/oauth2/github.d.ts.map | 1 + dist/providers/oauth2/github.js | 57 +++ dist/providers/oauth2/github.js.map | 1 + dist/providers/oauth2/jumpcloud.d.ts | 32 ++ dist/providers/oauth2/jumpcloud.d.ts.map | 1 + dist/providers/oauth2/jumpcloud.js | 55 +++ dist/providers/oauth2/jumpcloud.js.map | 1 + dist/providers/oauth2/twitch.d.ts | 33 ++ dist/providers/oauth2/twitch.d.ts.map | 1 + dist/providers/oauth2/twitch.js | 63 ++++ dist/providers/oauth2/twitch.js.map | 1 + dist/providers/oidc/apple.d.ts | 35 ++ dist/providers/oidc/apple.d.ts.map | 1 + dist/providers/oidc/apple.js | 49 +++ dist/providers/oidc/apple.js.map | 1 + dist/providers/oidc/cognito.d.ts | 35 ++ dist/providers/oidc/cognito.d.ts.map | 1 + dist/providers/oidc/cognito.js | 50 +++ dist/providers/oidc/cognito.js.map | 1 + dist/providers/oidc/gitlab.d.ts | 34 ++ dist/providers/oidc/gitlab.d.ts.map | 1 + dist/providers/oidc/gitlab.js | 51 +++ dist/providers/oidc/gitlab.js.map | 1 + dist/providers/oidc/google.d.ts | 31 ++ dist/providers/oidc/google.d.ts.map | 1 + dist/providers/oidc/google.js | 48 +++ dist/providers/oidc/google.js.map | 1 + dist/providers/oidc/keycloak.d.ts | 43 +++ dist/providers/oidc/keycloak.d.ts.map | 1 + dist/providers/oidc/keycloak.js | 55 +++ dist/providers/oidc/keycloak.js.map | 1 + dist/providers/oidc/microsoft-entra.d.ts | 38 ++ dist/providers/oidc/microsoft-entra.d.ts.map | 1 + dist/providers/oidc/microsoft-entra.js | 53 +++ dist/providers/oidc/microsoft-entra.js.map | 1 + dist/providers/oidc/okta.d.ts | 7 + dist/providers/oidc/okta.d.ts.map | 1 + dist/providers/oidc/okta.js | 67 ++++ dist/providers/oidc/okta.js.map | 1 + dist/providers/oidc/slack.d.ts | 34 ++ dist/providers/oidc/slack.d.ts.map | 1 + dist/providers/oidc/slack.js | 51 +++ dist/providers/oidc/slack.js.map | 1 + dist/providers/passkey.d.ts | 4 + dist/providers/passkey.d.ts.map | 1 + dist/providers/passkey.js | 8 + dist/providers/passkey.js.map | 1 + dist/providers/password.d.ts | 12 + dist/providers/password.d.ts.map | 1 + dist/providers/password.js | 9 + dist/providers/password.js.map | 1 + dist/providers/utils.d.ts | 24 ++ dist/providers/utils.d.ts.map | 1 + dist/providers/utils.js | 47 +++ dist/providers/utils.js.map | 1 + dist/types.d.ts | 151 ++++++++ dist/types.d.ts.map | 1 + dist/types.js | 17 + dist/types.js.map | 1 + .../protocols/oauth/oauth_authentication.ts | 44 +-- 250 files changed, 4821 insertions(+), 26 deletions(-) create mode 100644 dist/client/index.d.ts create mode 100644 dist/client/index.d.ts.map create mode 100644 dist/client/index.js create mode 100644 dist/client/index.js.map create mode 100644 dist/client/oauth.d.ts create mode 100644 dist/client/oauth.d.ts.map create mode 100644 dist/client/oauth.js create mode 100644 dist/client/oauth.js.map create mode 100644 dist/client/passkey/authentication.d.ts create mode 100644 dist/client/passkey/authentication.d.ts.map create mode 100644 dist/client/passkey/authentication.js create mode 100644 dist/client/passkey/authentication.js.map create mode 100644 dist/client/passkey/index.d.ts create mode 100644 dist/client/passkey/index.d.ts.map create mode 100644 dist/client/passkey/index.js create mode 100644 dist/client/passkey/index.js.map create mode 100644 dist/client/passkey/registration.d.ts create mode 100644 dist/client/passkey/registration.d.ts.map create mode 100644 dist/client/passkey/registration.js create mode 100644 dist/client/passkey/registration.js.map create mode 100644 dist/client/password.d.ts create mode 100644 dist/client/password.d.ts.map create mode 100644 dist/client/password.js create mode 100644 dist/client/password.js.map create mode 100644 dist/client/refresh.d.ts create mode 100644 dist/client/refresh.d.ts.map create mode 100644 dist/client/refresh.js create mode 100644 dist/client/refresh.js.map create mode 100644 dist/client/register.d.ts create mode 100644 dist/client/register.d.ts.map create mode 100644 dist/client/register.js create mode 100644 dist/client/register.js.map create mode 100644 dist/client/session.d.ts create mode 100644 dist/client/session.d.ts.map create mode 100644 dist/client/session.js create mode 100644 dist/client/session.js.map create mode 100644 dist/client/signin.d.ts create mode 100644 dist/client/signin.d.ts.map create mode 100644 dist/client/signin.js create mode 100644 dist/client/signin.js.map create mode 100644 dist/client/signout.d.ts create mode 100644 dist/client/signout.d.ts.map create mode 100644 dist/client/signout.js create mode 100644 dist/client/signout.js.map create mode 100644 dist/collection/hooks.d.ts create mode 100644 dist/collection/hooks.d.ts.map create mode 100644 dist/collection/hooks.js create mode 100644 dist/collection/hooks.js.map create mode 100644 dist/collection/index.d.ts create mode 100644 dist/collection/index.d.ts.map create mode 100644 dist/collection/index.js create mode 100644 dist/collection/index.js.map create mode 100644 dist/constants.d.ts create mode 100644 dist/constants.d.ts.map create mode 100644 dist/constants.js create mode 100644 dist/constants.js.map create mode 100644 dist/core/endpoints.d.ts create mode 100644 dist/core/endpoints.d.ts.map create mode 100644 dist/core/endpoints.js create mode 100644 dist/core/endpoints.js.map create mode 100644 dist/core/errors/apiErrors.d.ts create mode 100644 dist/core/errors/apiErrors.d.ts.map create mode 100644 dist/core/errors/apiErrors.js create mode 100644 dist/core/errors/apiErrors.js.map create mode 100644 dist/core/errors/consoleErrors.d.ts create mode 100644 dist/core/errors/consoleErrors.d.ts.map create mode 100644 dist/core/errors/consoleErrors.js create mode 100644 dist/core/errors/consoleErrors.js.map create mode 100644 dist/core/preflights/collections.d.ts create mode 100644 dist/core/preflights/collections.d.ts.map create mode 100644 dist/core/preflights/collections.js create mode 100644 dist/core/preflights/collections.js.map create mode 100644 dist/core/protocols/oauth/oauth2_authorization.d.ts create mode 100644 dist/core/protocols/oauth/oauth2_authorization.d.ts.map create mode 100644 dist/core/protocols/oauth/oauth2_authorization.js create mode 100644 dist/core/protocols/oauth/oauth2_authorization.js.map create mode 100644 dist/core/protocols/oauth/oauth2_callback.d.ts create mode 100644 dist/core/protocols/oauth/oauth2_callback.d.ts.map create mode 100644 dist/core/protocols/oauth/oauth2_callback.js create mode 100644 dist/core/protocols/oauth/oauth2_callback.js.map create mode 100644 dist/core/protocols/oauth/oauth_authentication.d.ts create mode 100644 dist/core/protocols/oauth/oauth_authentication.d.ts.map create mode 100644 dist/core/protocols/oauth/oauth_authentication.js create mode 100644 dist/core/protocols/oauth/oauth_authentication.js.map create mode 100644 dist/core/protocols/oauth/oidc_authorization.d.ts create mode 100644 dist/core/protocols/oauth/oidc_authorization.d.ts.map create mode 100644 dist/core/protocols/oauth/oidc_authorization.js create mode 100644 dist/core/protocols/oauth/oidc_authorization.js.map create mode 100644 dist/core/protocols/oauth/oidc_callback.d.ts create mode 100644 dist/core/protocols/oauth/oidc_callback.d.ts.map create mode 100644 dist/core/protocols/oauth/oidc_callback.js create mode 100644 dist/core/protocols/oauth/oidc_callback.js.map create mode 100644 dist/core/protocols/passkey/authentication.d.ts create mode 100644 dist/core/protocols/passkey/authentication.d.ts.map create mode 100644 dist/core/protocols/passkey/authentication.js create mode 100644 dist/core/protocols/passkey/authentication.js.map create mode 100644 dist/core/protocols/passkey/index.d.ts create mode 100644 dist/core/protocols/passkey/index.d.ts.map create mode 100644 dist/core/protocols/passkey/index.js create mode 100644 dist/core/protocols/passkey/index.js.map create mode 100644 dist/core/protocols/passkey/registration.d.ts create mode 100644 dist/core/protocols/passkey/registration.d.ts.map create mode 100644 dist/core/protocols/passkey/registration.js create mode 100644 dist/core/protocols/passkey/registration.js.map create mode 100644 dist/core/protocols/password.d.ts create mode 100644 dist/core/protocols/password.d.ts.map create mode 100644 dist/core/protocols/password.js create mode 100644 dist/core/protocols/password.js.map create mode 100644 dist/core/protocols/session.d.ts create mode 100644 dist/core/protocols/session.d.ts.map create mode 100644 dist/core/protocols/session.js create mode 100644 dist/core/protocols/session.js.map create mode 100644 dist/core/routeHandlers/oauth.d.ts create mode 100644 dist/core/routeHandlers/oauth.d.ts.map create mode 100644 dist/core/routeHandlers/oauth.js create mode 100644 dist/core/routeHandlers/oauth.js.map create mode 100644 dist/core/routeHandlers/passkey.d.ts create mode 100644 dist/core/routeHandlers/passkey.d.ts.map create mode 100644 dist/core/routeHandlers/passkey.js create mode 100644 dist/core/routeHandlers/passkey.js.map create mode 100644 dist/core/routeHandlers/password.d.ts create mode 100644 dist/core/routeHandlers/password.d.ts.map create mode 100644 dist/core/routeHandlers/password.js create mode 100644 dist/core/routeHandlers/password.js.map create mode 100644 dist/core/routeHandlers/session.d.ts create mode 100644 dist/core/routeHandlers/session.d.ts.map create mode 100644 dist/core/routeHandlers/session.js create mode 100644 dist/core/routeHandlers/session.js.map create mode 100644 dist/core/utils/cb.d.ts create mode 100644 dist/core/utils/cb.d.ts.map create mode 100644 dist/core/utils/cb.js create mode 100644 dist/core/utils/cb.js.map create mode 100644 dist/core/utils/cookies.d.ts create mode 100644 dist/core/utils/cookies.d.ts.map create mode 100644 dist/core/utils/cookies.js create mode 100644 dist/core/utils/cookies.js.map create mode 100644 dist/core/utils/hash.d.ts create mode 100644 dist/core/utils/hash.d.ts.map create mode 100644 dist/core/utils/hash.js create mode 100644 dist/core/utils/hash.js.map create mode 100644 dist/core/utils/password.d.ts create mode 100644 dist/core/utils/password.d.ts.map create mode 100644 dist/core/utils/password.js create mode 100644 dist/core/utils/password.js.map create mode 100644 dist/core/utils/session.d.ts create mode 100644 dist/core/utils/session.d.ts.map create mode 100644 dist/core/utils/session.js create mode 100644 dist/core/utils/session.js.map create mode 100644 dist/core/utils/slug.d.ts create mode 100644 dist/core/utils/slug.d.ts.map create mode 100644 dist/core/utils/slug.js create mode 100644 dist/core/utils/slug.js.map create mode 100644 dist/index.d.ts create mode 100644 dist/index.d.ts.map create mode 100644 dist/index.js create mode 100644 dist/index.js.map create mode 100644 dist/plugin.d.ts create mode 100644 dist/plugin.d.ts.map create mode 100644 dist/plugin.js create mode 100644 dist/plugin.js.map create mode 100644 dist/providers/index.d.ts create mode 100644 dist/providers/index.d.ts.map create mode 100644 dist/providers/index.js create mode 100644 dist/providers/index.js.map create mode 100644 dist/providers/magiclink.d.ts create mode 100644 dist/providers/magiclink.d.ts.map create mode 100644 dist/providers/magiclink.js create mode 100644 dist/providers/magiclink.js.map create mode 100644 dist/providers/oauth2/apple.d.ts create mode 100644 dist/providers/oauth2/apple.d.ts.map create mode 100644 dist/providers/oauth2/apple.js create mode 100644 dist/providers/oauth2/apple.js.map create mode 100644 dist/providers/oauth2/atlassian.d.ts create mode 100644 dist/providers/oauth2/atlassian.d.ts.map create mode 100644 dist/providers/oauth2/atlassian.js create mode 100644 dist/providers/oauth2/atlassian.js.map create mode 100644 dist/providers/oauth2/auth0.d.ts create mode 100644 dist/providers/oauth2/auth0.d.ts.map create mode 100644 dist/providers/oauth2/auth0.js create mode 100644 dist/providers/oauth2/auth0.js.map create mode 100644 dist/providers/oauth2/discord.d.ts create mode 100644 dist/providers/oauth2/discord.d.ts.map create mode 100644 dist/providers/oauth2/discord.js create mode 100644 dist/providers/oauth2/discord.js.map create mode 100644 dist/providers/oauth2/facebook.d.ts create mode 100644 dist/providers/oauth2/facebook.d.ts.map create mode 100644 dist/providers/oauth2/facebook.js create mode 100644 dist/providers/oauth2/facebook.js.map create mode 100644 dist/providers/oauth2/github.d.ts create mode 100644 dist/providers/oauth2/github.d.ts.map create mode 100644 dist/providers/oauth2/github.js create mode 100644 dist/providers/oauth2/github.js.map create mode 100644 dist/providers/oauth2/jumpcloud.d.ts create mode 100644 dist/providers/oauth2/jumpcloud.d.ts.map create mode 100644 dist/providers/oauth2/jumpcloud.js create mode 100644 dist/providers/oauth2/jumpcloud.js.map create mode 100644 dist/providers/oauth2/twitch.d.ts create mode 100644 dist/providers/oauth2/twitch.d.ts.map create mode 100644 dist/providers/oauth2/twitch.js create mode 100644 dist/providers/oauth2/twitch.js.map create mode 100644 dist/providers/oidc/apple.d.ts create mode 100644 dist/providers/oidc/apple.d.ts.map create mode 100644 dist/providers/oidc/apple.js create mode 100644 dist/providers/oidc/apple.js.map create mode 100644 dist/providers/oidc/cognito.d.ts create mode 100644 dist/providers/oidc/cognito.d.ts.map create mode 100644 dist/providers/oidc/cognito.js create mode 100644 dist/providers/oidc/cognito.js.map create mode 100644 dist/providers/oidc/gitlab.d.ts create mode 100644 dist/providers/oidc/gitlab.d.ts.map create mode 100644 dist/providers/oidc/gitlab.js create mode 100644 dist/providers/oidc/gitlab.js.map create mode 100644 dist/providers/oidc/google.d.ts create mode 100644 dist/providers/oidc/google.d.ts.map create mode 100644 dist/providers/oidc/google.js create mode 100644 dist/providers/oidc/google.js.map create mode 100644 dist/providers/oidc/keycloak.d.ts create mode 100644 dist/providers/oidc/keycloak.d.ts.map create mode 100644 dist/providers/oidc/keycloak.js create mode 100644 dist/providers/oidc/keycloak.js.map create mode 100644 dist/providers/oidc/microsoft-entra.d.ts create mode 100644 dist/providers/oidc/microsoft-entra.d.ts.map create mode 100644 dist/providers/oidc/microsoft-entra.js create mode 100644 dist/providers/oidc/microsoft-entra.js.map create mode 100644 dist/providers/oidc/okta.d.ts create mode 100644 dist/providers/oidc/okta.d.ts.map create mode 100644 dist/providers/oidc/okta.js create mode 100644 dist/providers/oidc/okta.js.map create mode 100644 dist/providers/oidc/slack.d.ts create mode 100644 dist/providers/oidc/slack.d.ts.map create mode 100644 dist/providers/oidc/slack.js create mode 100644 dist/providers/oidc/slack.js.map create mode 100644 dist/providers/passkey.d.ts create mode 100644 dist/providers/passkey.d.ts.map create mode 100644 dist/providers/passkey.js create mode 100644 dist/providers/passkey.js.map create mode 100644 dist/providers/password.d.ts create mode 100644 dist/providers/password.d.ts.map create mode 100644 dist/providers/password.js create mode 100644 dist/providers/password.js.map create mode 100644 dist/providers/utils.d.ts create mode 100644 dist/providers/utils.d.ts.map create mode 100644 dist/providers/utils.js create mode 100644 dist/providers/utils.js.map create mode 100644 dist/types.d.ts create mode 100644 dist/types.d.ts.map create mode 100644 dist/types.js create mode 100644 dist/types.js.map diff --git a/.gitignore b/.gitignore index 6c055b2..7bac2b1 100644 --- a/.gitignore +++ b/.gitignore @@ -244,7 +244,7 @@ dev/generated-types.ts dev/generated-schema.graphql # Ignore dist, no need for git -dist +# dist .trunl dev/src/uploads diff --git a/dist/client/index.d.ts b/dist/client/index.d.ts new file mode 100644 index 0000000..5100716 --- /dev/null +++ b/dist/client/index.d.ts @@ -0,0 +1,40 @@ +import { type PasswordResetPayload, type ForgotPasswordPayload, type PasswordRecoverPayload } from "./password.js"; +declare class AuthClient { + private name; + private baseURL; + constructor(name: string, options?: { + payloadBaseURL?: string | undefined; + } | undefined); + signin(redirectUrl?: string): { + oauth: (provider: import("./oauth.js").OauthProvider) => void; + password: (payload: import("./password.js").PasswordSigninPayload) => Promise; + }; + register(): { + password: (paylaod: import("./password.js").PasswordSignupPayload) => Promise; + }; + resetPassword(payload: PasswordResetPayload): Promise; + forgotPassword(payload: ForgotPasswordPayload): Promise; + recoverPassword(payload: PasswordRecoverPayload): Promise; + getSession({ headers }: { + headers: HeadersInit; + }): Promise; + getClientSession(): Promise<{ + data: unknown; + message: string; + kind: import("../types.js").ErrorKind | import("../types.js").SuccessKind; + isError: boolean; + isSuccess: boolean; + }>; + signout({ returnTo }: { + returnTo?: string | undefined; + }): Promise<{ + data: unknown; + message: string; + kind: import("../types.js").ErrorKind | import("../types.js").SuccessKind; + isError: boolean; + isSuccess: boolean; + }>; + refreshSession(): Promise; +} +export { AuthClient }; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/client/index.d.ts.map b/dist/client/index.d.ts.map new file mode 100644 index 0000000..8fb841c --- /dev/null +++ b/dist/client/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC5B,MAAM,eAAe,CAAA;AAQtB,cAAM,UAAU;IAGZ,OAAO,CAAC,IAAI;IAFd,OAAO,CAAC,OAAO,CAAQ;gBAEb,IAAI,EAAE,MAAM,EACpB,OAAO,CAAC,EACJ;QACE,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KACpC,GACD,SAAS;IAWf,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM;;;;IAQ3B,QAAQ;;;IAMF,aAAa,CAAC,OAAO,EAAE,oBAAoB;IAS3C,cAAc,CAAC,OAAO,EAAE,qBAAqB;IAS7C,eAAe,CAAC,OAAO,EAAE,sBAAsB;IAS/C,UAAU,CAAC,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE;IAOhD,gBAAgB;;;;;;;IAMhB,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE;;;;;;;IAOvD,cAAc;CAMrB;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"} \ No newline at end of file diff --git a/dist/client/index.js b/dist/client/index.js new file mode 100644 index 0000000..5cb2cdb --- /dev/null +++ b/dist/client/index.js @@ -0,0 +1,80 @@ +import { resetPassword, forgotPassword, recoverPassword, } from "./password.js"; +import { refresh } from "./refresh.js"; +import { signin } from "./signin.js"; +import { register } from "./register.js"; +import { getSession, getClientSession } from "./session.js"; +import { signout } from "./signout.js"; +import { MissingPayloadAuthBaseURL } from "../core/errors/consoleErrors.js"; +class AuthClient { + name; + baseURL; + constructor(name, options) { + this.name = name; + if (!options?.payloadBaseURL && !process.env.NEXT_PUBLIC_PAYLOAD_AUTH_URL) { + throw new MissingPayloadAuthBaseURL(); + } + this.baseURL = + options?.payloadBaseURL ?? + process.env.NEXT_PUBLIC_PAYLOAD_AUTH_URL; + } + signin(redirectUrl) { + console.error("the redirectUrl is: " + redirectUrl); + return signin({ + name: this.name, + baseURL: this.baseURL, + redirectUrl, + }); + } + register() { + return register({ + name: this.name, + baseURL: this.baseURL, + }); + } + async resetPassword(payload) { + return await resetPassword({ + name: this.name, + baseURL: this.baseURL, + }, payload); + } + async forgotPassword(payload) { + return await forgotPassword({ + name: this.name, + baseURL: this.baseURL, + }, payload); + } + async recoverPassword(payload) { + return await recoverPassword({ + name: this.name, + baseURL: this.baseURL, + }, payload); + } + async getSession({ headers }) { + return await getSession({ + name: this.name, + baseURL: this.baseURL, + headers, + }); + } + async getClientSession() { + return await getClientSession({ + name: this.name, + baseURL: this.baseURL, + }); + } + async signout({ returnTo }) { + return await signout({ + name: this.name, + baseURL: this.baseURL, + returnTo, + }); + } + async refreshSession() { + return await refresh({ + name: this.name, + baseURL: this.baseURL, + }); + } +} +export { AuthClient }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/client/index.js.map b/dist/client/index.js.map new file mode 100644 index 0000000..44118fa --- /dev/null +++ b/dist/client/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,cAAc,EACd,eAAe,GAIhB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAE3E,MAAM,UAAU;IAGJ;IAFF,OAAO,CAAQ;IACvB,YACU,IAAY,EACpB,OAIa;QALL,SAAI,GAAJ,IAAI,CAAQ;QAOpB,IAAI,CAAC,OAAO,EAAE,cAAc,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,CAAC;YAC1E,MAAM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AC,gBAAgB;QACpB,OAAO,MAAM,gBAAgB,CAAC;YAC5B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAA;IACJ,CAAC;IACD,KAAK,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAqC;QAC3D,OAAO,MAAM,OAAO,CAAC;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ;SACT,CAAC,CAAA;IACJ,CAAC;IACD,KAAK,CAAC,cAAc;QAClB,OAAO,MAAM,OAAO,CAAC;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAA;IACJ,CAAC;CACF;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"} \ No newline at end of file diff --git a/dist/client/oauth.d.ts b/dist/client/oauth.d.ts new file mode 100644 index 0000000..02e55ba --- /dev/null +++ b/dist/client/oauth.d.ts @@ -0,0 +1,9 @@ +type BaseOptions = { + name: string; + baseURL: string; + redirectUrl?: string; +}; +export type OauthProvider = "google" | "github" | "apple" | "cognito" | "gitlab" | "msft-entra" | "slack" | "atlassian" | "auth0" | "discord" | "facebook" | "jumpcloud" | "twitch" | "okta"; +export declare const oauth: (options: BaseOptions, provider: OauthProvider) => void; +export {}; +//# sourceMappingURL=oauth.d.ts.map \ No newline at end of file diff --git a/dist/client/oauth.d.ts.map b/dist/client/oauth.d.ts.map new file mode 100644 index 0000000..a1c80cc --- /dev/null +++ b/dist/client/oauth.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/client/oauth.ts"],"names":[],"mappings":"AAEA,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,SAAS,GACT,QAAQ,GACR,YAAY,GACZ,OAAO,GACP,WAAW,GACX,OAAO,GACP,SAAS,GACT,UAAU,GACV,WAAW,GACX,QAAQ,GACR,MAAM,CAAA;AAEV,eAAO,MAAM,KAAK,GAAI,SAAS,WAAW,EAAE,UAAU,aAAa,KAAG,IAGrE,CAAA"} \ No newline at end of file diff --git a/dist/client/oauth.js b/dist/client/oauth.js new file mode 100644 index 0000000..d8734a1 --- /dev/null +++ b/dist/client/oauth.js @@ -0,0 +1,7 @@ +/// +/// +export const oauth = (options, provider) => { + const oauthURL = `${options.baseURL}/api/${options.name}/oauth/authorization/${provider}${options.redirectUrl ? `?state=${encodeURIComponent(JSON.stringify({ redirectUrl: options.redirectUrl }))}` : ""}`; + window.location.href = oauthURL; +}; +//# sourceMappingURL=oauth.js.map \ No newline at end of file diff --git a/dist/client/oauth.js.map b/dist/client/oauth.js.map new file mode 100644 index 0000000..95657bb --- /dev/null +++ b/dist/client/oauth.js.map @@ -0,0 +1 @@ +{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../src/client/oauth.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,oCAAoC;AAuBpC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAoB,EAAE,QAAuB,EAAQ,EAAE;IAC3E,MAAM,QAAQ,GAAG,GAAG,OAAO,CAAC,OAAO,QAAQ,OAAO,CAAC,IAAI,wBAAwB,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;IAC3M,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAA;AACjC,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/client/passkey/authentication.d.ts b/dist/client/passkey/authentication.d.ts new file mode 100644 index 0000000..022a9ea --- /dev/null +++ b/dist/client/passkey/authentication.d.ts @@ -0,0 +1,10 @@ +import { AuthenticatorTransportFuture } from "@simplewebauthn/server"; +export declare const authentication: (passkey: { + backedUp: boolean; + counter: 0; + credentialId: string; + deviceType: string; + publicKey: Uint8Array; + transports: AuthenticatorTransportFuture[]; +}, email: string) => Promise; +//# sourceMappingURL=authentication.d.ts.map \ No newline at end of file diff --git a/dist/client/passkey/authentication.d.ts.map b/dist/client/passkey/authentication.d.ts.map new file mode 100644 index 0000000..4e35757 --- /dev/null +++ b/dist/client/passkey/authentication.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../../src/client/passkey/authentication.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAA;AAErE,eAAO,MAAM,cAAc,GACzB,SAAS;IACP,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,CAAC,CAAA;IACV,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,UAAU,CAAA;IACrB,UAAU,EAAE,4BAA4B,EAAE,CAAA;CAC3C,EACD,OAAO,MAAM,kBA+Bd,CAAA"} \ No newline at end of file diff --git a/dist/client/passkey/authentication.js b/dist/client/passkey/authentication.js new file mode 100644 index 0000000..71e7b87 --- /dev/null +++ b/dist/client/passkey/authentication.js @@ -0,0 +1,30 @@ +import { startAuthentication } from "@simplewebauthn/browser"; +export const authentication = async (passkey, email) => { + const resp = await fetch("/api/admin/passkey/generate-authentication-options", { + method: "POST", + body: JSON.stringify({ data: { passkey } }), + }); + const optionsJSON = await resp.json(); + try { + const authenticationResp = await startAuthentication({ + optionsJSON: optionsJSON.options, + }); + const response = await fetch("/api/admin/passkey/verify-authentication", { + method: "POST", + credentials: "include", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + data: { email, authentication: authenticationResp, passkey }, + }), + }); + if (response.redirected) { + window.location.href = response.url; // Redirect the user explicitly + } + } + catch (error) { + console.log(error); + } +}; +//# sourceMappingURL=authentication.js.map \ No newline at end of file diff --git a/dist/client/passkey/authentication.js.map b/dist/client/passkey/authentication.js.map new file mode 100644 index 0000000..32e94aa --- /dev/null +++ b/dist/client/passkey/authentication.js.map @@ -0,0 +1 @@ +{"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../../src/client/passkey/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAG7D,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,OAOC,EACD,KAAa,EACb,EAAE;IACF,MAAM,IAAI,GAAG,MAAM,KAAK,CACtB,oDAAoD,EACpD;QACE,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC;KAC5C,CACF,CAAA;IACD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;IACrC,IAAI,CAAC;QACH,MAAM,kBAAkB,GAAG,MAAM,mBAAmB,CAAC;YACnD,WAAW,EAAE,WAAW,CAAC,OAAO;SACjC,CAAC,CAAA;QACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,0CAA0C,EAAE;YACvE,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,SAAS;YACtB,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,IAAI,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,OAAO,EAAE;aAC7D,CAAC;SACH,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;YACxB,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAA,CAAC,+BAA+B;QACrE,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/client/passkey/index.d.ts b/dist/client/passkey/index.d.ts new file mode 100644 index 0000000..f40ef21 --- /dev/null +++ b/dist/client/passkey/index.d.ts @@ -0,0 +1,2 @@ +export declare const init: () => Promise; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/client/passkey/index.d.ts.map b/dist/client/passkey/index.d.ts.map new file mode 100644 index 0000000..582a1ae --- /dev/null +++ b/dist/client/passkey/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/passkey/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,IAAI,qBAmChB,CAAA"} \ No newline at end of file diff --git a/dist/client/passkey/index.js b/dist/client/passkey/index.js new file mode 100644 index 0000000..ccbce74 --- /dev/null +++ b/dist/client/passkey/index.js @@ -0,0 +1,36 @@ +import { browserSupportsWebAuthn } from "@simplewebauthn/browser"; +import { registration } from "./registration.js"; +import { authentication } from "./authentication.js"; +//NOTE: EXPERIMENTAL +export const init = async () => { + if (!browserSupportsWebAuthn()) { + console.log("It seems this browser does not support WebAuthn/Passkey. Reach out to the plugin author"); + return; + } + //TODO: Need a better way to implement email vaildation + const emailInput = document.getElementById("field-email"); + const emailValue = emailInput.value; + if (!emailValue) { + alert("Enter your email"); + return; + } + const response = await fetch("/api/admin/passkey/init", { + method: "POST", + body: JSON.stringify({ data: { email: emailInput.value } }), + }); + if (response.ok) { + const { data } = await response.json(); + if (Object.entries(data).length === 0) { + return await registration(emailInput.value); + } + return await authentication({ + backedUp: data["passkey"]["backedUp"], + counter: data["passkey"]["counter"], + credentialId: data["passkey"]["credentialId"], + deviceType: data["passkey"]["deviceType"], + publicKey: data["passkey"]["publicKey"], + transports: data["passkey"]["transports"], + }, emailInput.value); + } +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/client/passkey/index.js.map b/dist/client/passkey/index.js.map new file mode 100644 index 0000000..a0de6df --- /dev/null +++ b/dist/client/passkey/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/passkey/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,oBAAoB;AAEpB,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;IAC7B,IAAI,CAAC,uBAAuB,EAAE,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,CACT,yFAAyF,CAC1F,CAAA;QACD,OAAM;IACR,CAAC;IACD,uDAAuD;IACvD,MAAM,UAAU,GAAG,QAAQ,CAAC,cAAc,CAAC,aAAa,CAAqB,CAAA;IAC7E,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAA;IACnC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,KAAK,CAAC,kBAAkB,CAAC,CAAA;QACzB,OAAM;IACR,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,yBAAyB,EAAE;QACtD,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC;KAC5D,CAAC,CAAA;IACF,IAAI,QAAQ,CAAC,EAAE,EAAE,CAAC;QAChB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QACtC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtC,OAAO,MAAM,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;QAC7C,CAAC;QACD,OAAO,MAAM,cAAc,CACzB;YACE,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC;YACrC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC;YACnC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC;YAC7C,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC;YACzC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC;YACvC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC;SAC1C,EACD,UAAU,CAAC,KAAK,CACjB,CAAA;IACH,CAAC;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/client/passkey/registration.d.ts b/dist/client/passkey/registration.d.ts new file mode 100644 index 0000000..61af640 --- /dev/null +++ b/dist/client/passkey/registration.d.ts @@ -0,0 +1,2 @@ +export declare const registration: (email: string) => Promise; +//# sourceMappingURL=registration.d.ts.map \ No newline at end of file diff --git a/dist/client/passkey/registration.d.ts.map b/dist/client/passkey/registration.d.ts.map new file mode 100644 index 0000000..dbc74e4 --- /dev/null +++ b/dist/client/passkey/registration.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../../src/client/passkey/registration.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,YAAY,GAAU,OAAO,MAAM,kBA4B/C,CAAA"} \ No newline at end of file diff --git a/dist/client/passkey/registration.js b/dist/client/passkey/registration.js new file mode 100644 index 0000000..be87975 --- /dev/null +++ b/dist/client/passkey/registration.js @@ -0,0 +1,28 @@ +import { startRegistration } from "@simplewebauthn/browser"; +export const registration = async (email) => { + try { + const resp = await fetch("/api/admin/passkey/generate-registration-options", { + method: "POST", + body: JSON.stringify({ data: { email } }), + }); + const optionsJSON = await resp.json(); + const registrationResp = await startRegistration({ + optionsJSON: optionsJSON.options, + }); + const response = await fetch("/api/admin/passkey/verify-registration", { + method: "POST", + credentials: "include", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ data: { email, registration: registrationResp } }), + }); + if (response.redirected) { + window.location.href = response.url; + } + } + catch (error) { + console.log(error); + } +}; +//# sourceMappingURL=registration.js.map \ No newline at end of file diff --git a/dist/client/passkey/registration.js.map b/dist/client/passkey/registration.js.map new file mode 100644 index 0000000..e6ada38 --- /dev/null +++ b/dist/client/passkey/registration.js.map @@ -0,0 +1 @@ +{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../src/client/passkey/registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,KAAa,EAAE,EAAE;IAClD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,KAAK,CACtB,kDAAkD,EAClD;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC;SAC1C,CACF,CAAA;QACD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;QAErC,MAAM,gBAAgB,GAAG,MAAM,iBAAiB,CAAC;YAC/C,WAAW,EAAE,WAAW,CAAC,OAAO;SACjC,CAAC,CAAA;QACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,wCAAwC,EAAE;YACrE,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,SAAS;YACtB,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,EAAE,CAAC;SAC1E,CAAC,CAAA;QACF,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;YACxB,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAA;QACrC,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/client/password.d.ts b/dist/client/password.d.ts new file mode 100644 index 0000000..de4da65 --- /dev/null +++ b/dist/client/password.d.ts @@ -0,0 +1,33 @@ +import { type AuthPluginOutput } from "../types.js"; +interface BaseOptions { + name: string; + baseURL: string; +} +export interface PasswordSigninPayload { + email: string; + password: string; +} +export declare const passwordSignin: (opts: BaseOptions, payload: PasswordSigninPayload) => Promise; +export interface PasswordSignupPayload { + email: string; + password: string; + allowAutoSignin?: boolean; + userInfo?: Record; +} +export declare const passwordSignup: (opts: BaseOptions, payload: PasswordSignupPayload) => Promise; +export interface ForgotPasswordPayload { + email: string; +} +export declare const forgotPassword: (opts: BaseOptions, payload: ForgotPasswordPayload) => Promise; +export interface PasswordRecoverPayload { + password: string; + code: string; +} +export declare const recoverPassword: (opts: BaseOptions, payload: PasswordRecoverPayload) => Promise; +export interface PasswordResetPayload { + email: string; + password: string; +} +export declare const resetPassword: (opts: BaseOptions, payload: PasswordResetPayload) => Promise; +export {}; +//# sourceMappingURL=password.d.ts.map \ No newline at end of file diff --git a/dist/client/password.d.ts.map b/dist/client/password.d.ts.map new file mode 100644 index 0000000..0253c61 --- /dev/null +++ b/dist/client/password.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../src/client/password.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEhE,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB;AACD,eAAO,MAAM,cAAc,GACzB,MAAM,WAAW,EACjB,SAAS,qBAAqB,KAC7B,OAAO,CAAC,gBAAgB,CAyB1B,CAAA;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAED,eAAO,MAAM,cAAc,GACzB,MAAM,WAAW,EACjB,SAAS,qBAAqB,KAC7B,OAAO,CAAC,gBAAgB,CAwB1B,CAAA;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAA;CACd;AACD,eAAO,MAAM,cAAc,GACzB,MAAM,WAAW,EACjB,SAAS,qBAAqB,KAC7B,OAAO,CAAC,gBAAgB,CAkB1B,CAAA;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;CACb;AACD,eAAO,MAAM,eAAe,GAC1B,MAAM,WAAW,EACjB,SAAS,sBAAsB,KAC9B,OAAO,CAAC,gBAAgB,CAkB1B,CAAA;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB;AACD,eAAO,MAAM,aAAa,GACxB,MAAM,WAAW,EACjB,SAAS,oBAAoB,KAC5B,OAAO,CAAC,gBAAgB,CAkB1B,CAAA"} \ No newline at end of file diff --git a/dist/client/password.js b/dist/client/password.js new file mode 100644 index 0000000..6a170c3 --- /dev/null +++ b/dist/client/password.js @@ -0,0 +1,92 @@ +import { SuccessKind } from "../types.js"; +export const passwordSignin = async (opts, payload) => { + const response = await fetch(`${opts.baseURL}/api/${opts.name}/auth/signin`, { + method: "POST", + body: JSON.stringify(payload), + }); + if (response.redirected) { + window.location.href = response.url; + return { + data: {}, + message: "Redirecting user...", + kind: SuccessKind.Retrieved, + isError: false, + isSuccess: true, + }; + } + const { data, message, kind, isError, isSuccess } = (await response.json()); + return { + data, + message, + kind, + isError, + isSuccess, + }; +}; +export const passwordSignup = async (opts, payload) => { + const response = await fetch(`${opts.baseURL}/api/${opts.name}/auth/signup`, { + method: "POST", + body: JSON.stringify(payload), + }); + if (response.redirected) { + window.location.href = response.url; + return { + data: {}, + message: "Redirecting user...", + kind: SuccessKind.Retrieved, + isError: false, + isSuccess: true, + }; + } + const { data, message, kind, isError, isSuccess } = (await response.json()); + return { + data, + message, + kind, + isError, + isSuccess, + }; +}; +export const forgotPassword = async (opts, payload) => { + const response = await fetch(`${opts.baseURL}/api/${opts.name}/auth/forgot-password?stage=init`, { + method: "POST", + body: JSON.stringify(payload), + }); + const { data, message, kind, isError, isSuccess } = (await response.json()); + return { + data, + message, + kind, + isError, + isSuccess, + }; +}; +export const recoverPassword = async (opts, payload) => { + const response = await fetch(`${opts.baseURL}/api/${opts.name}/auth/forgot-password?stage=verify`, { + method: "POST", + body: JSON.stringify(payload), + }); + const { data, message, kind, isError, isSuccess } = (await response.json()); + return { + data, + message, + kind, + isError, + isSuccess, + }; +}; +export const resetPassword = async (opts, payload) => { + const response = await fetch(`${opts.baseURL}/api/${opts.name}/auth/reset-password`, { + method: "POST", + body: JSON.stringify(payload), + }); + const { data, message, kind, isError, isSuccess } = (await response.json()); + return { + data, + message, + kind, + isError, + isSuccess, + }; +}; +//# sourceMappingURL=password.js.map \ No newline at end of file diff --git a/dist/client/password.js.map b/dist/client/password.js.map new file mode 100644 index 0000000..e6d5625 --- /dev/null +++ b/dist/client/password.js.map @@ -0,0 +1 @@ +{"version":3,"file":"password.js","sourceRoot":"","sources":["../../src/client/password.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAyB,MAAM,aAAa,CAAA;AAWhE,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,IA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,CAAA;IAC7C,OAAO;QACL,IAAI;QACJ,OAAO;QACP,IAAI;QACJ,OAAO;QACP,SAAS;KACV,CAAA;AACH,CAAC,CAAA;AAMD,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAChC,IAAiB,EACjB,OAA6B,EACF,EAAE;IAC7B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAG,IAAI,CAAC,OAAO,QAAQ,IAAI,CAAC,IAAI,sBAAsB,EACtD;QACE,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;KAC9B,CACF,CAAA;IAED,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAC/C,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAqB,CAAA;IAC7C,OAAO;QACL,IAAI;QACJ,OAAO;QACP,IAAI;QACJ,OAAO;QACP,SAAS;KACV,CAAA;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/client/refresh.d.ts b/dist/client/refresh.d.ts new file mode 100644 index 0000000..406f08a --- /dev/null +++ b/dist/client/refresh.d.ts @@ -0,0 +1,8 @@ +import type { AuthPluginOutput } from "../types.js"; +interface BaseOptions { + name: string; + baseURL: string; +} +export declare const refresh: (options: BaseOptions) => Promise; +export {}; +//# sourceMappingURL=refresh.d.ts.map \ No newline at end of file diff --git a/dist/client/refresh.d.ts.map b/dist/client/refresh.d.ts.map new file mode 100644 index 0000000..47fdeea --- /dev/null +++ b/dist/client/refresh.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../src/client/refresh.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AACD,eAAO,MAAM,OAAO,GAClB,SAAS,WAAW,KACnB,OAAO,CAAC,gBAAgB,CAiB1B,CAAA"} \ No newline at end of file diff --git a/dist/client/refresh.js b/dist/client/refresh.js new file mode 100644 index 0000000..4209f7f --- /dev/null +++ b/dist/client/refresh.js @@ -0,0 +1,16 @@ +import { WrongClientUsage } from "../core/errors/consoleErrors.js"; +export const refresh = async (options) => { + if (typeof window === "undefined") { + throw new WrongClientUsage(); + } + const response = await fetch(`${options.baseURL}/api/${options.name}/session/refresh`); + const { message, kind, data, isError, isSuccess } = (await response.json()); + return { + message, + kind, + data, + isError, + isSuccess, + }; +}; +//# sourceMappingURL=refresh.js.map \ No newline at end of file diff --git a/dist/client/refresh.js.map b/dist/client/refresh.js.map new file mode 100644 index 0000000..fe3fed9 --- /dev/null +++ b/dist/client/refresh.js.map @@ -0,0 +1 @@ +{"version":3,"file":"refresh.js","sourceRoot":"","sources":["../../src/client/refresh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAOlE,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAC1B,OAAoB,EACO,EAAE;IAC7B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,MAAM,IAAI,gBAAgB,EAAE,CAAA;IAC9B,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAG,OAAO,CAAC,OAAO,QAAQ,OAAO,CAAC,IAAI,kBAAkB,CACzD,CAAA;IACD,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAC/C,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAqB,CAAA;IAC7C,OAAO;QACL,OAAO;QACP,IAAI;QACJ,IAAI;QACJ,OAAO;QACP,SAAS;KACV,CAAA;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/client/register.d.ts b/dist/client/register.d.ts new file mode 100644 index 0000000..0b48ba1 --- /dev/null +++ b/dist/client/register.d.ts @@ -0,0 +1,10 @@ +import { type PasswordSignupPayload } from "./password.js"; +interface BaseOptions { + name: string; + baseURL: string; +} +export declare const register: (options: BaseOptions) => { + password: (paylaod: PasswordSignupPayload) => Promise; +}; +export {}; +//# sourceMappingURL=register.d.ts.map \ No newline at end of file diff --git a/dist/client/register.d.ts.map b/dist/client/register.d.ts.map new file mode 100644 index 0000000..6baefad --- /dev/null +++ b/dist/client/register.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/client/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,qBAAqB,EAAkB,MAAM,eAAe,CAAA;AAE1E,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,eAAO,MAAM,QAAQ,GAAI,SAAS,WAAW;wBAEf,qBAAqB;CAGlD,CAAA"} \ No newline at end of file diff --git a/dist/client/register.js b/dist/client/register.js new file mode 100644 index 0000000..c15f83f --- /dev/null +++ b/dist/client/register.js @@ -0,0 +1,7 @@ +import { passwordSignup } from "./password.js"; +export const register = (options) => { + return { + password: async (paylaod) => await passwordSignup(options, paylaod), + }; +}; +//# sourceMappingURL=register.js.map \ No newline at end of file diff --git a/dist/client/register.js.map b/dist/client/register.js.map new file mode 100644 index 0000000..9d6c7c7 --- /dev/null +++ b/dist/client/register.js.map @@ -0,0 +1 @@ +{"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/client/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,cAAc,EAAE,MAAM,eAAe,CAAA;AAO1E,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,OAAoB,EAAE,EAAE;IAC/C,OAAO;QACL,QAAQ,EAAE,KAAK,EAAE,OAA8B,EAAE,EAAE,CACjD,MAAM,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC;KACzC,CAAA;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/client/session.d.ts b/dist/client/session.d.ts new file mode 100644 index 0000000..ce727c9 --- /dev/null +++ b/dist/client/session.d.ts @@ -0,0 +1,16 @@ +import type { AuthPluginOutput } from "../types.js"; +interface BaseOptions { + name: string; + headers: HeadersInit; + baseURL: string; +} +export declare const getSession: (opts: BaseOptions) => Promise; +export declare const getClientSession: (opts: Pick) => Promise<{ + data: unknown; + message: string; + kind: import("../types.js").ErrorKind | import("../types.js").SuccessKind; + isError: boolean; + isSuccess: boolean; +}>; +export {}; +//# sourceMappingURL=session.d.ts.map \ No newline at end of file diff --git a/dist/client/session.d.ts.map b/dist/client/session.d.ts.map new file mode 100644 index 0000000..d3a7eb7 --- /dev/null +++ b/dist/client/session.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/client/session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,WAAW,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,eAAO,MAAM,UAAU,GACrB,MAAM,WAAW,KAChB,OAAO,CAAC,gBAAgB,CAiB1B,CAAA;AAED,eAAO,MAAM,gBAAgB,GAC3B,MAAM,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;;;;;;EAgB5C,CAAA"} \ No newline at end of file diff --git a/dist/client/session.js b/dist/client/session.js new file mode 100644 index 0000000..5ad8be7 --- /dev/null +++ b/dist/client/session.js @@ -0,0 +1,30 @@ +import { WrongClientUsage } from "../core/errors/consoleErrors.js"; +export const getSession = async (opts) => { + const response = await fetch(`${opts.baseURL}/api/${opts.name}/session/user`, { + method: "GET", + headers: opts.headers, + }); + const { data, message, kind, isError, isSuccess } = (await response.json()); + return { + data, + message, + kind, + isError, + isSuccess, + }; +}; +export const getClientSession = async (opts) => { + if (typeof window === "undefined") { + throw new WrongClientUsage(); + } + const response = await fetch(`${opts.baseURL}/api/${opts.name}/session/user`); + const { data, message, kind, isError, isSuccess } = (await response.json()); + return { + data, + message, + kind, + isError, + isSuccess, + }; +}; +//# sourceMappingURL=session.js.map \ No newline at end of file diff --git a/dist/client/session.js.map b/dist/client/session.js.map new file mode 100644 index 0000000..b8c8760 --- /dev/null +++ b/dist/client/session.js.map @@ -0,0 +1 @@ +{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/client/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AASlE,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAC7B,IAAiB,EACU,EAAE;IAC7B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAG,IAAI,CAAC,OAAO,QAAQ,IAAI,CAAC,IAAI,eAAe,EAC/C;QACE,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CACF,CAAA;IACD,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAC/C,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAqB,CAAA;IAC7C,OAAO;QACL,IAAI;QACJ,OAAO;QACP,IAAI;QACJ,OAAO;QACP,SAAS;KACV,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EACnC,IAA2C,EAC3C,EAAE;IACF,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,MAAM,IAAI,gBAAgB,EAAE,CAAA;IAC9B,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,QAAQ,IAAI,CAAC,IAAI,eAAe,CAAC,CAAA;IAC7E,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAC/C,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAqB,CAAA;IAC7C,OAAO;QACL,IAAI;QACJ,OAAO;QACP,IAAI;QACJ,OAAO;QACP,SAAS;KACV,CAAA;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/client/signin.d.ts b/dist/client/signin.d.ts new file mode 100644 index 0000000..980bf3a --- /dev/null +++ b/dist/client/signin.d.ts @@ -0,0 +1,13 @@ +import { type PasswordSigninPayload } from "./password.js"; +import { type OauthProvider } from "./oauth.js"; +interface BaseOptions { + name: string; + baseURL: string; + redirectUrl?: string; +} +export declare const signin: (options: BaseOptions) => { + oauth: (provider: OauthProvider) => void; + password: (payload: PasswordSigninPayload) => Promise; +}; +export {}; +//# sourceMappingURL=signin.d.ts.map \ No newline at end of file diff --git a/dist/client/signin.d.ts.map b/dist/client/signin.d.ts.map new file mode 100644 index 0000000..674f738 --- /dev/null +++ b/dist/client/signin.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"signin.d.ts","sourceRoot":"","sources":["../../src/client/signin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC1E,OAAO,EAAS,KAAK,aAAa,EAAE,MAAM,YAAY,CAAA;AACtD,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,eAAO,MAAM,MAAM,GAAI,SAAS,WAAW;sBAErB,aAAa;wBAEL,qBAAqB;CAGlD,CAAA"} \ No newline at end of file diff --git a/dist/client/signin.js b/dist/client/signin.js new file mode 100644 index 0000000..58d8ea7 --- /dev/null +++ b/dist/client/signin.js @@ -0,0 +1,10 @@ +import { passwordSignin } from "./password.js"; +import { oauth } from "./oauth.js"; +export const signin = (options) => { + return { + oauth: (provider) => oauth(options, provider), + // passkey: () => passkeyInit(), NEEDS IMPROVEMENT + password: async (payload) => await passwordSignin(options, payload), + }; +}; +//# sourceMappingURL=signin.js.map \ No newline at end of file diff --git a/dist/client/signin.js.map b/dist/client/signin.js.map new file mode 100644 index 0000000..b3e7e13 --- /dev/null +++ b/dist/client/signin.js.map @@ -0,0 +1 @@ +{"version":3,"file":"signin.js","sourceRoot":"","sources":["../../src/client/signin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA8B,MAAM,eAAe,CAAA;AAC1E,OAAO,EAAE,KAAK,EAAsB,MAAM,YAAY,CAAA;AAOtD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAoB,EAAE,EAAE;IAC7C,OAAO;QACL,KAAK,EAAE,CAAC,QAAuB,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC5D,kDAAkD;QAClD,QAAQ,EAAE,KAAK,EAAE,OAA8B,EAAE,EAAE,CACjD,MAAM,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC;KACzC,CAAA;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/client/signout.d.ts b/dist/client/signout.d.ts new file mode 100644 index 0000000..50c5fe2 --- /dev/null +++ b/dist/client/signout.d.ts @@ -0,0 +1,15 @@ +import { SuccessKind } from "../types.js"; +interface BaseOptions { + name: string; + returnTo?: string | undefined; + baseURL: string; +} +export declare const signout: (opts: BaseOptions) => Promise<{ + data: unknown; + message: string; + kind: import("../types.js").ErrorKind | SuccessKind; + isError: boolean; + isSuccess: boolean; +}>; +export {}; +//# sourceMappingURL=signout.d.ts.map \ No newline at end of file diff --git a/dist/client/signout.d.ts.map b/dist/client/signout.d.ts.map new file mode 100644 index 0000000..3fcbf2b --- /dev/null +++ b/dist/client/signout.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"signout.d.ts","sourceRoot":"","sources":["../../src/client/signout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAyB,MAAM,aAAa,CAAA;AAGhE,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,eAAO,MAAM,OAAO,GAAU,MAAM,WAAW;;;;;;EA+B9C,CAAA"} \ No newline at end of file diff --git a/dist/client/signout.js b/dist/client/signout.js new file mode 100644 index 0000000..f395730 --- /dev/null +++ b/dist/client/signout.js @@ -0,0 +1,32 @@ +import { WrongClientUsage } from "../core/errors/consoleErrors.js"; +import { SuccessKind } from "../types.js"; +import * as qs from "qs-esm"; +export const signout = async (opts) => { + if (typeof window === "undefined") { + throw new WrongClientUsage(); + } + const query = {}; + if (opts.returnTo) { + query.returnTo = opts.returnTo; + } + const response = await fetch(`${opts.baseURL}/api/${opts.name}/session/signout?${qs.stringify(query)}`); + if (response.redirected) { + window.location.href = response.url; + return { + data: {}, + message: "Signing out...", + kind: SuccessKind.Deleted, + isError: false, + isSuccess: true, + }; + } + const { data, message, kind, isError, isSuccess } = (await response.json()); + return { + data, + message, + kind, + isError, + isSuccess, + }; +}; +//# sourceMappingURL=signout.js.map \ No newline at end of file diff --git a/dist/client/signout.js.map b/dist/client/signout.js.map new file mode 100644 index 0000000..8ae0c04 --- /dev/null +++ b/dist/client/signout.js.map @@ -0,0 +1 @@ +{"version":3,"file":"signout.js","sourceRoot":"","sources":["../../src/client/signout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAClE,OAAO,EAAE,WAAW,EAAyB,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,QAAQ,CAAA;AAQ5B,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,IAAiB,EAAE,EAAE;IACjD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,MAAM,IAAI,gBAAgB,EAAE,CAAA;IAC9B,CAAC;IACD,MAAM,KAAK,GAA2B,EAAE,CAAA;IACxC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;IAChC,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAG,IAAI,CAAC,OAAO,QAAQ,IAAI,CAAC,IAAI,oBAAoB,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAC1E,CAAA;IACD,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;QACxB,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAA;QACnC,OAAO;YACL,IAAI,EAAE,EAAE;YACR,OAAO,EAAE,gBAAgB;YACzB,IAAI,EAAE,WAAW,CAAC,OAAO;YACzB,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,IAAI;SAChB,CAAA;IACH,CAAC;IACD,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAC/C,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAqB,CAAA;IAC7C,OAAO;QACL,IAAI;QACJ,OAAO;QACP,IAAI;QACJ,OAAO;QACP,SAAS;KACV,CAAA;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/collection/hooks.d.ts b/dist/collection/hooks.d.ts new file mode 100644 index 0000000..f4a3d66 --- /dev/null +++ b/dist/collection/hooks.d.ts @@ -0,0 +1,3 @@ +import { CollectionAfterDeleteHook } from "payload"; +export declare const deleteLinkedAccounts: (accountsSlug: string) => CollectionAfterDeleteHook; +//# sourceMappingURL=hooks.d.ts.map \ No newline at end of file diff --git a/dist/collection/hooks.d.ts.map b/dist/collection/hooks.d.ts.map new file mode 100644 index 0000000..eb83868 --- /dev/null +++ b/dist/collection/hooks.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/collection/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAEnD,eAAO,MAAM,oBAAoB,GAC9B,cAAc,MAAM,KAAG,yBAUvB,CAAA"} \ No newline at end of file diff --git a/dist/collection/hooks.js b/dist/collection/hooks.js new file mode 100644 index 0000000..bf47b56 --- /dev/null +++ b/dist/collection/hooks.js @@ -0,0 +1,11 @@ +export const deleteLinkedAccounts = (accountsSlug) => async (args) => { + const { payload } = args.req; + const { doc: user } = args; + await payload.delete({ + collection: accountsSlug, + where: { + user: { equals: user["id"] }, + }, + }); +}; +//# sourceMappingURL=hooks.js.map \ No newline at end of file diff --git a/dist/collection/hooks.js.map b/dist/collection/hooks.js.map new file mode 100644 index 0000000..d3aa553 --- /dev/null +++ b/dist/collection/hooks.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/collection/hooks.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,oBAAoB,GAC/B,CAAC,YAAoB,EAA6B,EAAE,CACpD,KAAK,EAAE,IAAI,EAAE,EAAE;IACb,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,CAAA;IAC5B,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;IAC1B,MAAM,OAAO,CAAC,MAAM,CAAC;QACnB,UAAU,EAAE,YAAY;QACxB,KAAK,EAAE;YACL,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;SAC7B;KACF,CAAC,CAAA;AACJ,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/collection/index.d.ts b/dist/collection/index.d.ts new file mode 100644 index 0000000..7f2d0be --- /dev/null +++ b/dist/collection/index.d.ts @@ -0,0 +1,19 @@ +import type { CollectionConfig, Field } from "payload"; +/** + * A higher order function that takes the collection config for the argument + * @param incomingCollection + * @returns {CollectionConfig} + */ +export declare const withUsersCollection: (incomingCollection: Omit & { + fields?: Field[] | undefined; +}) => CollectionConfig; +/** + * A higher order function that takes the collection config and a Users collection slug for the arguments + * @param incomingCollection + * @param userCollectionSlug + * @returns {CollectionConfig} + */ +export declare const withAccountCollection: (incomingCollection: Omit & { + fields?: Field[] | undefined; +}, usersCollectionSlug: string) => CollectionConfig; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/collection/index.d.ts.map b/dist/collection/index.d.ts.map new file mode 100644 index 0000000..3586689 --- /dev/null +++ b/dist/collection/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collection/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAGtD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,oBAAoB,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,GAAG;IACrD,MAAM,CAAC,EAAE,KAAK,EAAE,GAAG,SAAS,CAAA;CAC7B,KACA,gBA+EF,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAChC,oBAAoB,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,GAAG;IACrD,MAAM,CAAC,EAAE,KAAK,EAAE,GAAG,SAAS,CAAA;CAC7B,EACD,qBAAqB,MAAM,KAC1B,gBAgHF,CAAA"} \ No newline at end of file diff --git a/dist/collection/index.js b/dist/collection/index.js new file mode 100644 index 0000000..f28abb6 --- /dev/null +++ b/dist/collection/index.js @@ -0,0 +1,197 @@ +import { MissingCollectionSlug } from "../core/errors/consoleErrors.js"; +/** + * A higher order function that takes the collection config for the argument + * @param incomingCollection + * @returns {CollectionConfig} + */ +export const withUsersCollection = (incomingCollection) => { + if (!incomingCollection.slug) { + throw new MissingCollectionSlug(); + } + if (incomingCollection.auth) { + } + const collectionConfig = { + ...incomingCollection, + fields: [], + }; + const baseFields = [ + { + name: "hashedPassword", + type: "text", + unique: true, + }, + { + name: "hashSalt", + type: "text", + unique: true, + }, + { + name: "hashIterations", + type: "number", + }, + { + name: "verificationCode", + label: "Verification Code", + type: "text", + unique: true, + }, + { + name: "verificationHash", + label: "Verification Hash", + type: "text", + }, + { + name: "verificationTokenExpire", + label: "Verification Token Expire", + type: "number", + }, + { + name: "verificationKind", + label: "Verification Kind", + type: "text", + }, + ]; + if (!incomingCollection.fields?.find((field) => field.type === "email")) { + baseFields.push({ + name: "email", + type: "email", + unique: true, + required: true, + }); + } + collectionConfig.fields = [ + ...(incomingCollection.fields ?? []), + ...baseFields, + ]; + collectionConfig.access = { + admin: ({ req: { user } }) => Boolean(user), + create: ({ req: { user } }) => Boolean(user), + delete: ({ req: { user } }) => Boolean(user), + read: ({ req: { user } }) => Boolean(user), + update: ({ req: { user } }) => Boolean(user), + ...(incomingCollection.access ?? {}), + }; + collectionConfig.admin = { + defaultColumns: ["name", "email"], + useAsTitle: "name", + ...incomingCollection.admin, + }; + collectionConfig.timestamps = true; + return collectionConfig; +}; +/** + * A higher order function that takes the collection config and a Users collection slug for the arguments + * @param incomingCollection + * @param userCollectionSlug + * @returns {CollectionConfig} + */ +export const withAccountCollection = (incomingCollection, usersCollectionSlug) => { + if (!incomingCollection.slug) { + throw new MissingCollectionSlug(); + } + const collectionConfig = { + ...incomingCollection, + fields: [], + }; + const baseFields = [ + { + name: "name", + type: "text", + }, + { + name: "picture", + type: "text", + }, + { + name: "user", + type: "relationship", + relationTo: usersCollectionSlug, + hasMany: false, + required: true, + label: "User", + }, + { + name: "issuerName", + type: "text", + required: true, + label: "Issuer Name", + }, + { + name: "scope", + type: "text", + }, + { + name: "sub", + type: "text", + required: true, + }, + { + name: "access_token", + type: "text", + }, + { + name: "passkey", + type: "group", + fields: [ + { + name: "credentialId", + type: "text", + required: true, + }, + { + name: "publicKey", + type: "json", + required: true, + }, + { + name: "counter", + type: "number", + required: true, + }, + { + name: "transports", + type: "json", + required: true, + }, + { + name: "deviceType", + type: "text", + required: true, + }, + { + name: "backedUp", + type: "checkbox", + required: true, + }, + ], + admin: { + condition: (_data, peerData) => { + if (peerData.issuerName === "Passkey") { + return true; + } + return false; + }, + }, + }, + ]; + collectionConfig.fields = [ + ...baseFields, + ...(incomingCollection.fields ?? []), + ]; + collectionConfig.access = { + admin: ({ req: { user } }) => Boolean(user), + read: ({ req: { user } }) => Boolean(user), + create: () => false, + update: () => false, + delete: () => true, + ...(incomingCollection.access ?? {}), + }; + collectionConfig.admin = { + defaultColumns: ["issuerName", "scope", "user"], + useAsTitle: "id", + ...incomingCollection.admin, + }; + collectionConfig.timestamps = true; + return collectionConfig; +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/collection/index.js.map b/dist/collection/index.js.map new file mode 100644 index 0000000..5c8e04f --- /dev/null +++ b/dist/collection/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/collection/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAEvE;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,kBAEC,EACiB,EAAE;IACpB,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC;QAC7B,MAAM,IAAI,qBAAqB,EAAE,CAAA;IACnC,CAAC;IAED,IAAI,kBAAkB,CAAC,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED,MAAM,gBAAgB,GAAqB;QACzC,GAAG,kBAAkB;QACrB,MAAM,EAAE,EAAE;KACX,CAAA;IAED,MAAM,UAAU,GAAY;QAC1B;YACE,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,IAAI;SACb;QACD;YACE,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,IAAI;SACb;QACD;YACE,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,QAAQ;SACf;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,KAAK,EAAE,mBAAmB;YAC1B,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,IAAI;SACb;QACD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nB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;QAClB,GAAG,CAAC,kBAAkB,CAAC,MAAM,IAAI,EAAE,CAAC;KACrC,CAAA;IACD,gBAAgB,CAAC,KAAK,GAAG;QACvB,cAAc,EAAE,CAAC,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC;QAC/C,UAAU,EAAE,IAAI;QAChB,GAAG,kBAAkB,CAAC,KAAK;KAC5B,CAAA;IACD,gBAAgB,CAAC,UAAU,GAAG,IAAI,CAAA;IAClC,OAAO,gBAAgB,CAAA;AACzB,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/constants.d.ts b/dist/constants.d.ts new file mode 100644 index 0000000..b0ef37b --- /dev/null +++ b/dist/constants.d.ts @@ -0,0 +1,3 @@ +export declare const APP_COOKIE_SUFFIX = "session-token"; +export declare const EPHEMERAL_CODE_COOKIE_NAME = "__session-ep-claim"; +//# sourceMappingURL=constants.d.ts.map \ No newline at end of file diff --git a/dist/constants.d.ts.map b/dist/constants.d.ts.map new file mode 100644 index 0000000..3fdf938 --- /dev/null +++ b/dist/constants.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,kBAAkB,CAAA;AAChD,eAAO,MAAM,0BAA0B,uBAAuB,CAAA"} \ No newline at end of file diff --git a/dist/constants.js b/dist/constants.js new file mode 100644 index 0000000..db672dc --- /dev/null +++ b/dist/constants.js @@ -0,0 +1,3 @@ +export const APP_COOKIE_SUFFIX = "session-token"; +export const EPHEMERAL_CODE_COOKIE_NAME = "__session-ep-claim"; +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/dist/constants.js.map b/dist/constants.js.map new file mode 100644 index 0000000..d06a99e --- /dev/null +++ b/dist/constants.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAA;AAChD,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAA"} \ No newline at end of file diff --git a/dist/core/endpoints.d.ts b/dist/core/endpoints.d.ts new file mode 100644 index 0000000..01f7bb2 --- /dev/null +++ b/dist/core/endpoints.d.ts @@ -0,0 +1,111 @@ +import type { BasePayload, Endpoint } from "payload"; +import type { AccountInfo, OAuthProviderConfig, PasswordProviderConfig } from "../types.js"; +/** + * Base interface for all endpoint strategies. Useful to keep extending for providers with + * different requirements to interact with + * + * @interface EndpointStrategy + * + * @typedef {EndpointStrategy} + * + */ +interface EndpointStrategy { + createEndpoints(config: unknown): Endpoint[]; +} +/** + * Oauth endpoint strategy to implement dynamic enpoints for all type of Oauth providers + * + * @export + * @class OAuthEndpointStrategy + * @typedef {OAuthEndpointStrategy} + * @internal + */ +export declare class OAuthEndpointStrategy implements EndpointStrategy { + private providers; + constructor(providers: Record); + createEndpoints({ pluginType, collections, allowOAuthAutoSignUp, useAdmin, successRedirectPath, errorRedirectPath, }: { + pluginType: string; + collections: { + usersCollection: string; + accountsCollection: string; + }; + allowOAuthAutoSignUp: boolean; + useAdmin: boolean; + successRedirectPath: string; + errorRedirectPath: string; + }): Endpoint[]; +} +/** + * Passkey endpoint strategy to implement enpoints for Passkey provider + * + * @export + * @class PasskeyEndpointStrategy + * @typedef {PasskeyEndpointStrategy} + * @implements {EndpointStrategy} + * @internal + */ +export declare class PasskeyEndpointStrategy implements EndpointStrategy { + createEndpoints({ pluginType, rpID, sessionCallback, }: { + pluginType: string; + collections: { + usersCollection: string; + accountsCollection: string; + }; + rpID: string; + sessionCallback: (accountInfo: AccountInfo, issuerName: string, payload: BasePayload) => Promise; + }): Endpoint[]; +} +/** + * Endpoint strategy for Password based authentication + */ +export declare class PasswordAuthEndpointStrategy implements EndpointStrategy { + private internals; + private providerConfig; + constructor(internals: { + usersCollectionSlug: string; + }, providerConfig: PasswordProviderConfig); + createEndpoints({ pluginType, useAdmin, successRedirectPath, errorRedirectPath, }: { + pluginType: string; + useAdmin: boolean; + successRedirectPath: string; + errorRedirectPath: string; + }): Endpoint[]; +} +/** + * Endpoint strategy for managing sessions + */ +export declare class SessionEndpointStrategy implements EndpointStrategy { + private internals; + constructor(internals: { + usersCollectionSlug: string; + }); + createEndpoints({ pluginType }: { + pluginType: string; + }): Endpoint[]; +} +/** + * The generic endpoint factory class + * + * @export + * @class EndpointsFactory + * @typedef {EndpointsFactory} + * @internal + */ +type Strategies = "oauth" | "passkey" | "password" | "session"; +export declare class EndpointsFactory { + private pluginType; + private collections; + private allowOAuthAutoSignUp; + private useAdmin; + private successRedirectPath; + private errorRedirectPath; + private strategies; + constructor(pluginType: string, collections: { + usersCollection: string; + accountsCollection: string; + }, allowOAuthAutoSignUp: boolean, useAdmin: boolean, successRedirectPath: string, errorRedirectPath: string); + registerStrategy(name: Strategies, strategy: EndpointStrategy): void; + createEndpoints(strategyName: Strategies, config?: Record | undefined): Endpoint[]; +} +export {}; +//# sourceMappingURL=endpoints.d.ts.map \ No newline at end of file diff --git a/dist/core/endpoints.d.ts.map b/dist/core/endpoints.d.ts.map new file mode 100644 index 0000000..0cb4a44 --- /dev/null +++ b/dist/core/endpoints.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../src/core/endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAkB,MAAM,SAAS,CAAA;AACpE,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,aAAa,CAAA;AAKpB;;;;;;;;GAQG;AACH,UAAU,gBAAgB;IACxB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,QAAQ,EAAE,CAAA;CAC7C;AAED;;;;;;;GAOG;AACH,qBAAa,qBAAsB,YAAW,gBAAgB;IAChD,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,mB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AG,QAAQ,EAAE;CAuBf;AAED;;GAEG;AACH,qBAAa,uBAAwB,YAAW,gBAAgB;IAE5D,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE;QACjB,mBAAmB,EAAE,MAAM,CAAA;KAC5B;IAEH,eAAe,CAAC,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,QAAQ,EAAE;CAWpE;AAED;;;;;;;GAOG;AAEH,KAAK,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAA;AAC9D,qBAAa,gBAAgB;IAGzB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,oBAAoB;IAC5B,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,mBAAmB;IAC3B,OAAO,CAAC,iBAAiB;IAV3B,OAAO,CAAC,UAAU,CAAuC;gBAE/C,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE;QACnB,eAAe,EAAE,MAAM,CAAA;QACvB,kBAAkB,EAAE,MAAM,CAAA;KAC3B,EACO,oBAAoB,EAAE,OAAO,EAC7B,QAAQ,EAAE,OAAO,EACjB,mBAAmB,EAAE,MAAM,EAC3B,iBAAiB,EAAE,MAAM;IAGnC,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAIpE,eAAe,CACb,YAAY,EAAE,UAAU,EACxB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC3C,QAAQ,EAAE;CAed"} \ No newline at end of file diff --git a/dist/core/endpoints.js b/dist/core/endpoints.js new file mode 100644 index 0000000..e0f7571 --- /dev/null +++ b/dist/core/endpoints.js @@ -0,0 +1,145 @@ +import { OAuthHandlers } from "./routeHandlers/oauth.js"; +import { PasskeyHandlers } from "./routeHandlers/passkey.js"; +import { PasswordAuthHandlers } from "./routeHandlers/password.js"; +import { SessionHandlers } from "./routeHandlers/session.js"; +/** + * Oauth endpoint strategy to implement dynamic enpoints for all type of Oauth providers + * + * @export + * @class OAuthEndpointStrategy + * @typedef {OAuthEndpointStrategy} + * @internal + */ +export class OAuthEndpointStrategy { + providers; + constructor(providers) { + this.providers = providers; + } + createEndpoints({ pluginType, collections, allowOAuthAutoSignUp, useAdmin, successRedirectPath, errorRedirectPath, }) { + return [ + { + path: `/${pluginType}/oauth/:resource/:provider`, + method: "get", + handler: (request) => { + const provider = this.providers[request.routeParams?.provider]; + const state = request.searchParams.get("state") ?? undefined; + return OAuthHandlers({ + pluginType, + collections, + allowOAuthAutoSignUp, + secret: request.payload.secret, + useAdmin, + request, + provider, + successRedirectPath, + errorRedirectPath, + state, + }); + }, + }, + ]; + } +} +/** + * Passkey endpoint strategy to implement enpoints for Passkey provider + * + * @export + * @class PasskeyEndpointStrategy + * @typedef {PasskeyEndpointStrategy} + * @implements {EndpointStrategy} + * @internal + */ +export class PasskeyEndpointStrategy { + createEndpoints({ pluginType, rpID, sessionCallback, }) { + return [ + { + path: `/${pluginType}/passkey/:resource`, + method: "post", + handler: (request) => { + return PasskeyHandlers(request, request.routeParams?.resource, rpID, (accountInfo) => { + return sessionCallback(accountInfo, "Passkey", request.payload); + }); + }, + }, + ]; + } +} +/** + * Endpoint strategy for Password based authentication + */ +export class PasswordAuthEndpointStrategy { + internals; + providerConfig; + constructor(internals, providerConfig) { + this.internals = internals; + this.providerConfig = providerConfig; + } + createEndpoints({ pluginType, useAdmin, successRedirectPath, errorRedirectPath, }) { + return [ + { + path: `/${pluginType}/auth/:kind`, + handler: (request) => { + const stage = request.searchParams.get("stage") ?? undefined; + return PasswordAuthHandlers(request, pluginType, request.routeParams?.kind, this.internals, request.payload.secret, useAdmin, successRedirectPath, errorRedirectPath, this.providerConfig, stage); + }, + method: "post", + }, + ]; + } +} +/** + * Endpoint strategy for managing sessions + */ +export class SessionEndpointStrategy { + internals; + constructor(internals) { + this.internals = internals; + } + createEndpoints({ pluginType }) { + return [ + { + path: `/${pluginType}/session/:kind`, + handler: (request) => { + return SessionHandlers(request, pluginType, this.internals); + }, + method: "get", + }, + ]; + } +} +export class EndpointsFactory { + pluginType; + collections; + allowOAuthAutoSignUp; + useAdmin; + successRedirectPath; + errorRedirectPath; + strategies = {}; + constructor(pluginType, collections, allowOAuthAutoSignUp, useAdmin, successRedirectPath, errorRedirectPath) { + this.pluginType = pluginType; + this.collections = collections; + this.allowOAuthAutoSignUp = allowOAuthAutoSignUp; + this.useAdmin = useAdmin; + this.successRedirectPath = successRedirectPath; + this.errorRedirectPath = errorRedirectPath; + } + registerStrategy(name, strategy) { + this.strategies[name] = strategy; + } + createEndpoints(strategyName, config) { + const strategy = this.strategies[strategyName]; + if (!strategy) { + throw new Error(`Strategy "${strategyName}" not found.`); + } + return strategy.createEndpoints({ + pluginType: this.pluginType, + allowOAuthAutoSignUp: this.allowOAuthAutoSignUp, + useAdmin: this.useAdmin, + collections: this.collections, + successRedirectPath: this.successRedirectPath, + errorRedirectPath: this.errorRedirectPath, + ...config, + }); + } +} +//# sourceMappingURL=endpoints.js.map \ No newline at end of file diff --git a/dist/core/endpoints.js.map b/dist/core/endpoints.js.map new file mode 100644 index 0000000..3712ee2 --- /dev/null +++ b/dist/core/endpoints.js.map @@ -0,0 +1 @@ +{"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../../src/core/endpoints.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAc5D;;;;;;;GAOG;AACH,MAAM,OAAO,qBAAqB;IACZ;IAApB,YAAoB,SAA8C;QAA9C,cAAS,GAAT,SAAS,CAAqC;IAAG,CAAC;IAEtE,eAAe,CAAC,EACd,UAAU,EACV,WA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ACO,yBAAoB,GAApB,oBAAoB,CAAS;QAC7B,aAAQ,GAAR,QAAQ,CAAS;QACjB,wBAAmB,GAAnB,mBAAmB,CAAQ;QAC3B,sBAAiB,GAAjB,iBAAiB,CAAQ;IAChC,CAAC;IAEJ,gBAAgB,CAAC,IAAgB,EAAE,QAA0B;QAC3D,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAA;IAClC,CAAC;IAED,eAAe,CACb,YAAwB,EACxB,MAA4C;QAE5C,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAA;QAC9C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,aAAa,YAAY,cAAc,CAAC,CAAA;QAC1D,CAAC;QACD,OAAO,QAAQ,CAAC,eAAe,CAAC;YAC9B,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,oBAAoB,EAAE,IAAI,CAAC,oBAAoB;YAC/C,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;YAC7C,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,GAAG,MAAM;SACV,CAAC,CAAA;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/dist/core/errors/apiErrors.d.ts b/dist/core/errors/apiErrors.d.ts new file mode 100644 index 0000000..ced8d4a --- /dev/null +++ b/dist/core/errors/apiErrors.d.ts @@ -0,0 +1,47 @@ +import { ErrorKind } from "../../types.js"; +export declare class AuthAPIError extends Response { + constructor(message: string, kind: ErrorKind); +} +export declare class MissingEmailAPIError extends AuthAPIError { + constructor(); +} +export declare class UnVerifiedAccountAPIError extends AuthAPIError { + constructor(); +} +export declare class UserNotFoundAPIError extends AuthAPIError { + constructor(); +} +export declare class EmailNotFoundAPIError extends AuthAPIError { + constructor(); +} +export declare class PasskeyVerificationAPIError extends AuthAPIError { + constructor(); +} +export declare class InvalidAPIRequest extends AuthAPIError { + constructor(); +} +export declare class UnauthorizedAPIRequest extends AuthAPIError { + constructor(); +} +export declare class AuthenticationFailed extends AuthAPIError { + constructor(); +} +export declare class InvalidCredentials extends AuthAPIError { + constructor(); +} +export declare class InvalidRequestBodyError extends AuthAPIError { + constructor(); +} +export declare class EmailAlreadyExistError extends AuthAPIError { + constructor(); +} +export declare class InternalServerError extends AuthAPIError { + constructor(); +} +export declare class MissingOrInvalidVerification extends AuthAPIError { + constructor(); +} +export declare class MissingCollection extends AuthAPIError { + constructor(); +} +//# sourceMappingURL=apiErrors.d.ts.map \ No newline at end of file diff --git a/dist/core/errors/apiErrors.d.ts.map b/dist/core/errors/apiErrors.d.ts.map new file mode 100644 index 0000000..a5080b2 --- /dev/null +++ b/dist/core/errors/apiErrors.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"apiErrors.d.ts","sourceRoot":"","sources":["../../../src/core/errors/apiErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAU1C,qBAAa,YAAa,SAAQ,QAAQ;gBAC5B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS;CAc7C;AAED,qBAAa,oBAAqB,SAAQ,YAAY;;CAIrD;AAED,qBAAa,yBAA0B,SAAQ,YAAY;;CAI1D;AAED,qBAAa,oBAAqB,SAAQ,YAAY;;CAIrD;AAED,qBAAa,qBAAsB,SAAQ,YAAY;;CAItD;AAED,qBAAa,2BAA4B,SAAQ,YAAY;;CAI5D;AAED,qBAAa,iBAAkB,SAAQ,YAAY;;CAIlD;AAED,qBAAa,sBAAuB,SAAQ,YAAY;;CAIvD;AAED,qBAAa,oBAAqB,SAAQ,YAAY;;CAIrD;AAED,qBAAa,kBAAmB,SAAQ,YAAY;;CAInD;AAED,qBAAa,uBAAwB,SAAQ,YAAY;;CAIxD;AAED,qBAAa,sBAAuB,SAAQ,YAAY;;CAIvD;AAED,qBAAa,mBAAoB,SAAQ,YAAY;;CAIpD;AAED,qBAAa,4BAA6B,SAAQ,YAAY;;CAO7D;AAED,qBAAa,iBAAkB,SAAQ,YAAY;;CAIlD"} \ No newline at end of file diff --git a/dist/core/errors/apiErrors.js b/dist/core/errors/apiErrors.js new file mode 100644 index 0000000..764aa6c --- /dev/null +++ b/dist/core/errors/apiErrors.js @@ -0,0 +1,93 @@ +import { ErrorKind } from "../../types.js"; +const statusByKind = { + [ErrorKind.NotFound]: 404, + [ErrorKind.BadRequest]: 400, + [ErrorKind.InternalServer]: 500, + [ErrorKind.NotAuthenticated]: 401, + [ErrorKind.NotAuthorized]: 403, + [ErrorKind.Conflict]: 409, +}; +export class AuthAPIError extends Response { + constructor(message, kind) { + super(JSON.stringify({ + message, + kind, + data: null, + isSuccess: false, + isError: true, + }), { + status: statusByKind[kind], + }); + } +} +export class MissingEmailAPIError extends AuthAPIError { + constructor() { + super("Missing email. Email is required", ErrorKind.BadRequest); + } +} +export class UnVerifiedAccountAPIError extends AuthAPIError { + constructor() { + super("Account is not verified", ErrorKind.BadRequest); + } +} +export class UserNotFoundAPIError extends AuthAPIError { + constructor() { + super("User not found", ErrorKind.NotFound); + } +} +export class EmailNotFoundAPIError extends AuthAPIError { + constructor() { + super("No user found with this email", ErrorKind.BadRequest); + } +} +export class PasskeyVerificationAPIError extends AuthAPIError { + constructor() { + super("Passkey verification failed", ErrorKind.BadRequest); + } +} +export class InvalidAPIRequest extends AuthAPIError { + constructor() { + super("Invalid API request", ErrorKind.BadRequest); + } +} +export class UnauthorizedAPIRequest extends AuthAPIError { + constructor() { + super("Unauthorized access", ErrorKind.NotAuthorized); + } +} +export class AuthenticationFailed extends AuthAPIError { + constructor() { + super("Authentication Failed", ErrorKind.NotAuthenticated); + } +} +export class InvalidCredentials extends AuthAPIError { + constructor() { + super("Invalid Credentials", ErrorKind.BadRequest); + } +} +export class InvalidRequestBodyError extends AuthAPIError { + constructor() { + super("Wrong request body. Missing parameters", ErrorKind.BadRequest); + } +} +export class EmailAlreadyExistError extends AuthAPIError { + constructor() { + super("Email is already taken", ErrorKind.Conflict); + } +} +export class InternalServerError extends AuthAPIError { + constructor() { + super("Something went wrong. Server failure", ErrorKind.BadRequest); + } +} +export class MissingOrInvalidVerification extends AuthAPIError { + constructor() { + super("Verification failed. Missing or invalid verification code.", ErrorKind.BadRequest); + } +} +export class MissingCollection extends AuthAPIError { + constructor() { + super("Missing collection", ErrorKind.NotFound); + } +} +//# sourceMappingURL=apiErrors.js.map \ No newline at end of file diff --git a/dist/core/errors/apiErrors.js.map b/dist/core/errors/apiErrors.js.map new file mode 100644 index 0000000..9fadbd9 --- /dev/null +++ b/dist/core/errors/apiErrors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"apiErrors.js","sourceRoot":"","sources":["../../../src/core/errors/apiErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,YAAY,GAAG;IACnB,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,GAAG;IACzB,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,GAAG;IAC3B,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,GAAG;IAC/B,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,GAAG;IACjC,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,GAAG;IAC9B,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,GAAG;CAC1B,CAAA;AACD,MAAM,OAAO,YAAa,SAAQ,QAAQ;IACxC,YAAY,OAAe,EAAE,IAAe;QAC1C,KAAK,CACH,IAAI,CAAC,SAAS,CAAC;YACb,OAAO;YACP,IAAI;YACJ,IAAI,EAAE,IAAI;YACV,SAAS,EAAE,KAAK;YAChB,OAAO,EAAE,IAAI;SACd,CAAC,EACF;YACE,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC;SAC3B,CACF,CAAA;IACH,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ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AAQ,YAAY;IACtD;QACE,KAAK,CAAC,wBAAwB,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAA;IACrD,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,YAAY;IACnD;QACE,KAAK,CAAC,sCAAsC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAA;IACrE,CAAC;CACF;AAED,MAAM,OAAO,4BAA6B,SAAQ,YAAY;IAC5D;QACE,KAAK,CACH,4DAA4D,EAC5D,SAAS,CAAC,UAAU,CACrB,CAAA;IACH,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IACjD;QACE,KAAK,CAAC,oBAAoB,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAA;IACjD,CAAC;CACF"} \ No newline at end of file diff --git a/dist/core/errors/consoleErrors.d.ts b/dist/core/errors/consoleErrors.d.ts new file mode 100644 index 0000000..5b09baa --- /dev/null +++ b/dist/core/errors/consoleErrors.d.ts @@ -0,0 +1,65 @@ +declare class PluginError extends Error { + constructor(message: string, cause?: string); +} +export declare class MissingPayloadAuthBaseURL extends PluginError { + constructor(); +} +export declare class InvalidServerURL extends PluginError { + constructor(); +} +export declare class InvalidProvider extends PluginError { + constructor(); +} +export declare class ProviderAlreadyExists extends PluginError { + constructor(); +} +export declare class InvalidOAuthAlgorithm extends PluginError { + constructor(); +} +export declare class InvalidOAuthResource extends PluginError { + constructor(); +} +export declare class MissingOrInvalidSession extends PluginError { + constructor(); +} +export declare class MissingOrInvalidParams extends PluginError { + constructor(); +} +export declare class MissingSecret extends PluginError { + constructor(); +} +export declare class AuthenticationFailed extends PluginError { + constructor(); +} +export declare class UserNotFound extends PluginError { + constructor(); +} +export declare class InvalidCredentials extends PluginError { + constructor(); +} +export declare class MissingUsersCollection extends PluginError { + constructor(); +} +export declare class InvalidPasskeyRequest extends PluginError { + constructor(); +} +export declare class InvalidCollectionSlug extends PluginError { + constructor(); +} +export declare class MissingCollections extends PluginError { + constructor(); +} +export declare class MissingEnv extends PluginError { + constructor(env: string); +} +export declare class MissingEmailAdapter extends PluginError { + constructor(); +} +export declare class MissingCollectionSlug extends PluginError { + constructor(); +} +export declare class WrongClientUsage extends PluginError { + constructor(); +} +export {}; +//# sourceMappingURL=consoleErrors.d.ts.map \ No newline at end of file diff --git a/dist/core/errors/consoleErrors.d.ts.map b/dist/core/errors/consoleErrors.d.ts.map new file mode 100644 index 0000000..b7937f1 --- /dev/null +++ b/dist/core/errors/consoleErrors.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"consoleErrors.d.ts","sourceRoot":"","sources":["../../../src/core/errors/consoleErrors.ts"],"names":[],"mappings":"AAAA,cAAM,WAAY,SAAQ,KAAK;gBACjB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;CAO5C;AACD,qBAAa,yBAA0B,SAAQ,WAAW;;CAIzD;AACD,qBAAa,gBAAiB,SAAQ,WAAW;;CAMhD;AACD,qBAAa,eAAgB,SAAQ,WAAW;;CAI/C;AAED,qBAAa,qBAAsB,SAAQ,WAAW;;CAIrD;AAED,qBAAa,qBAAsB,SAAQ,WAAW;;CAMrD;AAED,qBAAa,oBAAqB,SAAQ,WAAW;;CAIpD;AAED,qBAAa,uBAAwB,SAAQ,WAAW;;CAIvD;AAED,qBAAa,sBAAuB,SAAQ,WAAW;;CAItD;AAED,qBAAa,aAAc,SAAQ,WAAW;;CAI7C;AAED,qBAAa,oBAAqB,SAAQ,WAAW;;CAIpD;AAED,qBAAa,YAAa,SAAQ,WAAW;;CAI5C;AAED,qBAAa,kBAAmB,SAAQ,WAAW;;CAIlD;AAED,qBAAa,sBAAuB,SAAQ,WAAW;;CAItD;AAED,qBAAa,qBAAsB,SAAQ,WAAW;;CAIrD;AAED,qBAAa,qBAAsB,SAAQ,WAAW;;CAIrD;AAED,qBAAa,kBAAmB,SAAQ,WAAW;;CAIlD;AAED,qBAAa,UAAW,SAAQ,WAAW;gBAC7B,GAAG,EAAE,MAAM;CAGxB;AAED,qBAAa,mBAAoB,SAAQ,WAAW;;CAMnD;AAED,qBAAa,qBAAsB,SAAQ,WAAW;;CAIrD;AAED,qBAAa,gBAAiB,SAAQ,WAAW;;CAIhD"} \ No newline at end of file diff --git a/dist/core/errors/consoleErrors.js b/dist/core/errors/consoleErrors.js new file mode 100644 index 0000000..1d1b4ea --- /dev/null +++ b/dist/core/errors/consoleErrors.js @@ -0,0 +1,110 @@ +class PluginError extends Error { + constructor(message, cause) { + super(message); + this.name = "PAYLOAD_AUTH_PLUGIN_ERROR"; + this.message = message; + this.cause = cause; + this.stack = ""; + } +} +export class MissingPayloadAuthBaseURL extends PluginError { + constructor() { + super("Missing or invalid Payload Auth base URL"); + } +} +export class InvalidServerURL extends PluginError { + constructor() { + super("Missing or invalid server URL. Please set serverURL in your Payload config"); + } +} +export class InvalidProvider extends PluginError { + constructor() { + super("Invalid Provider"); + } +} +export class ProviderAlreadyExists extends PluginError { + constructor() { + super("Duplicate provider found"); + } +} +export class InvalidOAuthAlgorithm extends PluginError { + constructor() { + super("Invalid OAuth Algorithm. Plugin only support OIDC and OAuth2 algorithms"); + } +} +export class InvalidOAuthResource extends PluginError { + constructor() { + super("Invalid resource request. Check docs before initiating requests"); + } +} +export class MissingOrInvalidSession extends PluginError { + constructor() { + super("Missing or invalid session."); + } +} +export class MissingOrInvalidParams extends PluginError { + constructor() { + super("Missing or invalid params"); + } +} +export class MissingSecret extends PluginError { + constructor() { + super("Missing secret in the options"); + } +} +export class AuthenticationFailed extends PluginError { + constructor() { + super("Failed to authenticate"); + } +} +export class UserNotFound extends PluginError { + constructor() { + super("User not found"); + } +} +export class InvalidCredentials extends PluginError { + constructor() { + super("Invalid credentials"); + } +} +export class MissingUsersCollection extends PluginError { + constructor() { + super("Missing users collection"); + } +} +export class InvalidPasskeyRequest extends PluginError { + constructor() { + super("Invalid or missing request"); + } +} +export class InvalidCollectionSlug extends PluginError { + constructor() { + super("Missing or invalid collection slug"); + } +} +export class MissingCollections extends PluginError { + constructor() { + super("Missing collections"); + } +} +export class MissingEnv extends PluginError { + constructor(env) { + super("Missing ENV " + env); + } +} +export class MissingEmailAdapter extends PluginError { + constructor() { + super("Email adapter is required. Check the docs for the setup: https://payloadcms.com/docs/email/overview"); + } +} +export class MissingCollectionSlug extends PluginError { + constructor() { + super("Missing collection slug"); + } +} +export class WrongClientUsage extends PluginError { + constructor() { + super("Using client only code in server side"); + } +} +//# sourceMappingURL=consoleErrors.js.map \ No newline at end of file diff --git a/dist/core/errors/consoleErrors.js.map b/dist/core/errors/consoleErrors.js.map new file mode 100644 index 0000000..a153469 --- /dev/null +++ b/dist/core/errors/consoleErrors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"consoleErrors.js","sourceRoot":"","sources":["../../../src/core/errors/consoleErrors.ts"],"names":[],"mappings":"AAAA,MAAM,WAAY,SAAQ,KAAK;IAC7B,YAAY,OAAe,EAAE,KAAc;QACzC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAA;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAA;IACjB,CAAC;CACF;AACD,MAAM,OAAO,yBAA0B,SAAQ,WAAW;IACxD;QACE,KAAK,CAAC,0CAA0C,CAAC,CAAA;IACnD,CAAC;CACF;AACD,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IAC/C;QACE,KAAK,CACH,4EAA4E,CAC7E,CAAA;IACH,CAAC;CACF;AACD,MAAM,OAAO,eAAgB,SAAQ,WAAW;IAC9C;QACE,KAAK,CAAC,kBAAkB,CAAC,CAAA;IAC3B,CAAC;CACF;AAED,MAAM,OAAO,qBAAsB,SAAQ,WAAW;IACpD;QACE,KAAK,CAAC,0BAA0B,CAAC,CAAA;IACnC,CAAC;CACF;AAED,MAAM,OAAO,qBAAsB,SAAQ,WAAW;IACpD;QACE,KAAK,CACH,yE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CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,WAAW;IAClD;QACE,KAAK,CACH,qGAAqG,CACtG,CAAA;IACH,CAAC;CACF;AAED,MAAM,OAAO,qBAAsB,SAAQ,WAAW;IACpD;QACE,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAClC,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IAC/C;QACE,KAAK,CAAC,uCAAuC,CAAC,CAAA;IAChD,CAAC;CACF"} \ No newline at end of file diff --git a/dist/core/preflights/collections.d.ts b/dist/core/preflights/collections.d.ts new file mode 100644 index 0000000..b6ce710 --- /dev/null +++ b/dist/core/preflights/collections.d.ts @@ -0,0 +1,3 @@ +import { CollectionConfig } from "payload"; +export declare function preflightCollectionCheck(slugs: string[], collections: CollectionConfig[] | undefined): void; +//# sourceMappingURL=collections.d.ts.map \ No newline at end of file diff --git a/dist/core/preflights/collections.d.ts.map b/dist/core/preflights/collections.d.ts.map new file mode 100644 index 0000000..8464498 --- /dev/null +++ b/dist/core/preflights/collections.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../../src/core/preflights/collections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAM1C,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,EAAE,EACf,WAAW,EAAE,gBAAgB,EAAE,GAAG,SAAS,QAW5C"} \ No newline at end of file diff --git a/dist/core/preflights/collections.js b/dist/core/preflights/collections.js new file mode 100644 index 0000000..2b736fa --- /dev/null +++ b/dist/core/preflights/collections.js @@ -0,0 +1,13 @@ +import { InvalidCollectionSlug, MissingCollections, } from "../errors/consoleErrors.js"; +export function preflightCollectionCheck(slugs, collections) { + if (!collections?.length) { + throw new MissingCollections(); + } + slugs.forEach((slug) => { + if (!collections.some((c) => c.slug === slug)) { + throw new InvalidCollectionSlug(); + } + }); + return; +} +//# sourceMappingURL=collections.js.map \ No newline at end of file diff --git a/dist/core/preflights/collections.js.map b/dist/core/preflights/collections.js.map new file mode 100644 index 0000000..f3234fc --- /dev/null +++ b/dist/core/preflights/collections.js.map @@ -0,0 +1 @@ +{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../../src/core/preflights/collections.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,4BAA4B,CAAA;AAEnC,MAAM,UAAU,wBAAwB,CACtC,KAAe,EACf,WAA2C;IAE3C,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;QACzB,MAAM,IAAI,kBAAkB,EAAE,CAAA;IAChC,CAAC;IACD,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;YAC9C,MAAM,IAAI,qBAAqB,EAAE,CAAA;QACnC,CAAC;IACH,CAAC,CAAC,CAAA;IACF,OAAM;AACR,CAAC"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth2_authorization.d.ts b/dist/core/protocols/oauth/oauth2_authorization.d.ts new file mode 100644 index 0000000..be90a39 --- /dev/null +++ b/dist/core/protocols/oauth/oauth2_authorization.d.ts @@ -0,0 +1,4 @@ +import { OAuth2ProviderConfig, ParsedOAuthState } from "../../../types"; +import type { PayloadRequest } from "payload"; +export declare function OAuth2Authorization(pluginType: string, request: PayloadRequest, providerConfig: OAuth2ProviderConfig, clientOrigin?: string | undefined, parsedState?: ParsedOAuthState | null): Promise; +//# sourceMappingURL=oauth2_authorization.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth2_authorization.d.ts.map b/dist/core/protocols/oauth/oauth2_authorization.d.ts.map new file mode 100644 index 0000000..9f79b18 --- /dev/null +++ b/dist/core/protocols/oauth/oauth2_authorization.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"oauth2_authorization.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oauth2_authorization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAEhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,EACvB,cAAc,EAAE,oBAAoB,EACpC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,EACjC,WAAW,CAAC,EAAE,gBAAgB,GAAG,IAAI,GACpC,OAAO,CAAC,QAAQ,CAAC,CAsEnB"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth2_authorization.js b/dist/core/protocols/oauth/oauth2_authorization.js new file mode 100644 index 0000000..05d8764 --- /dev/null +++ b/dist/core/protocols/oauth/oauth2_authorization.js @@ -0,0 +1,51 @@ +import { createOAuthState } from "../../routeHandlers/oauth"; +import { getCallbackURL } from "../../utils/cb"; +import * as oauth from "oauth4webapi"; +export async function OAuth2Authorization(pluginType, request, providerConfig, clientOrigin, parsedState) { + const callback_url = getCallbackURL(request.payload.config.serverURL, pluginType, providerConfig.id); + const code_verifier = parsedState?.codeVerifier || oauth.generateRandomCodeVerifier(); + const code_challenge = await oauth.calculatePKCECodeChallenge(code_verifier); + const code_challenge_method = "S256"; + const { authorization_server, client_id, scope, params } = providerConfig; + const client = { + client_id, + }; + const as = authorization_server; + const cookies = []; + const cookieMaxage = new Date(Date.now() + 300 * 1000); + const authorizationURL = new URL(as.authorization_endpoint); + authorizationURL.searchParams.set("client_id", client.client_id); + authorizationURL.searchParams.set("redirect_uri", callback_url.toString()); + authorizationURL.searchParams.set("response_type", "code"); + authorizationURL.searchParams.set("scope", scope); + authorizationURL.searchParams.set("code_challenge", code_challenge); + authorizationURL.searchParams.set("code_challenge_method", code_challenge_method); + if (parsedState) { + authorizationURL.searchParams.set("state", createOAuthState(parsedState)); + } + if (params) { + Object.entries(params).map(([key, value]) => { + authorizationURL.searchParams.set(key, value); + }); + } + if (as.code_challenge_methods_supported?.includes("S256") !== true) { + const state = oauth.generateRandomState(); + authorizationURL.searchParams.set("state", state); + cookies.push(`__session-oauth-state=${state};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`); + } + cookies.push(`__session-code-verifier=${code_verifier};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`); + if (clientOrigin && clientOrigin !== undefined) { + cookies.push(`__session-client-origin=${clientOrigin};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`); + } + const res = new Response(null, { + status: 302, + headers: { + Location: authorizationURL.href, + }, + }); + for (const c of cookies) { + res.headers.append("Set-Cookie", c); + } + return res; +} +//# sourceMappingURL=oauth2_authorization.js.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth2_authorization.js.map b/dist/core/protocols/oauth/oauth2_authorization.js.map new file mode 100644 index 0000000..60b1219 --- /dev/null +++ b/dist/core/protocols/oauth/oauth2_authorization.js.map @@ -0,0 +1 @@ +{"version":3,"file":"oauth2_authorization.js","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oauth2_authorization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAGrC,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,UAAkB,EAClB,OAAuB,EACvB,cAAoC,EACpC,YAAiC,EACjC,WAAqC;IAErC,MAAM,YAAY,GAAG,cAAc,CACjC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAChC,UAAU,EACV,cAAc,CAAC,EAAE,CAClB,CAAA;IACD,MAAM,aAAa,GACjB,WAAW,EAAE,YAAY,IAAI,KAAK,C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CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAC1C,gBAAgB,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QAC/C,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,EAAE,CAAC,gCAAgC,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;QACnE,MAAM,KAAK,GAAG,KAAK,CAAC,mBAAmB,EAAE,CAAA;QACzC,gBAAgB,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;QACjD,OAAO,CAAC,IAAI,CACV,yBAAyB,KAAK,yCAAyC,YAAY,CAAC,WAAW,EAAE,EAAE,CACpG,CAAA;IACH,CAAC;IACD,OAAO,CAAC,IAAI,CACV,2BAA2B,aAAa,yCAAyC,YAAY,CAAC,WAAW,EAAE,EAAE,CAC9G,CAAA;IACD,IAAI,YAAY,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/C,OAAO,CAAC,IAAI,CACV,2BAA2B,YAAY,yCAAyC,YAAY,CAAC,WAAW,EAAE,EAAE,CAC7G,CAAA;IACH,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE;QAC7B,MAAM,EAAE,GAAG;QACX,OAAO,EAAE;YACP,QAAQ,EAAE,gBAAgB,CAAC,IAAI;SAChC;KACF,CAAC,CAAA;IAEF,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAA;IACrC,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth2_callback.d.ts b/dist/core/protocols/oauth/oauth2_callback.d.ts new file mode 100644 index 0000000..3a4d2ba --- /dev/null +++ b/dist/core/protocols/oauth/oauth2_callback.d.ts @@ -0,0 +1,3 @@ +import { OAuthCallbackParams, ParsedOAuthState } from "../../../types"; +export declare function OAuth2Callback(params: OAuthCallbackParams, parsedState: ParsedOAuthState | null): Promise; +//# sourceMappingURL=oauth2_callback.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth2_callback.d.ts.map b/dist/core/protocols/oauth/oauth2_callback.d.ts.map new file mode 100644 index 0000000..691a092 --- /dev/null +++ b/dist/core/protocols/oauth/oauth2_callback.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"oauth2_callback.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oauth2_callback.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAIjB,MAAM,SAAS,CAAA;AAEhB,wBAAsB,cAAc,CAClC,MAAM,EAAE,mBAAmB,EAC3B,WAAW,EAAE,gBAAgB,GAAG,IAAI,GACnC,OAAO,CAAC,QAAQ,CAAC,CAuHnB"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth2_callback.js b/dist/core/protocols/oauth/oauth2_callback.js new file mode 100644 index 0000000..82ffb31 --- /dev/null +++ b/dist/core/protocols/oauth/oauth2_callback.js @@ -0,0 +1,60 @@ +import * as oauth from "oauth4webapi"; +import { parseCookies } from "payload"; +import { OAuthAuthentication } from "./oauth_authentication"; +import { MissingOrInvalidSession } from "../../errors/consoleErrors"; +import { createOAuthState } from "../../routeHandlers/oauth"; +import { getCallbackURL } from "../../utils/cb"; +export async function OAuth2Callback(params, parsedState) { + const { pluginType, request, provider, collections, allowOAuthAutoSignUp, useAdmin, secret, successRedirectPath, errorRedirectPath, } = params; + const providerConfig = provider; + const parsedCookies = parseCookies(request.headers); + const code_verifier = parsedState?.codeVerifier || parsedCookies.get("__session-code-verifier"); + const state = parsedState + ? createOAuthState(parsedState) + : parsedCookies.get("__session-oauth-state"); + if (!code_verifier) { + throw new MissingOrInvalidSession(); + } + const { client_id, client_secret, authorization_server, client_auth_type, profile, } = providerConfig; + const client = { + client_id, + }; + const clientAuth = client_auth_type === "client_secret_basic" + ? oauth.ClientSecretBasic(client_secret ?? "") + : oauth.ClientSecretPost(client_secret ?? ""); + const current_url = new URL(request.url); + const callback_url = getCallbackURL(request.payload.config.serverURL, pluginType, providerConfig.id); + const as = authorization_server; + const params_oauth = oauth.validateAuthResponse(as, client, current_url, state); + const grantResponse = await oauth.authorizationCodeGrantRequest(as, client, clientAuth, params_oauth, callback_url.toString(), code_verifier); + const body = (await grantResponse.json()); + let response = new Response(JSON.stringify(body), grantResponse); + if (Array.isArray(body.scope)) { + body.scope = body.scope.join(" "); + response = new Response(JSON.stringify(body), grantResponse); + } + const token_result = await oauth.processAuthorizationCodeResponse(as, client, response); + const userInfoResponse = await oauth.userInfoRequest(as, client, token_result.access_token); + const userInfo = (await userInfoResponse.json()); + // Use the provider's profile callback if available + let accountInfo; + if (profile) { + accountInfo = profile(userInfo); + } + else { + accountInfo = { + sub: userInfo.sub ?? "", + name: userInfo.name ?? "", + email: userInfo.email ?? "", + picture: userInfo.picture ?? "", + }; + } + const userData = { + ...accountInfo, + scope: providerConfig.scope, + issuer: providerConfig.authorization_server.issuer, + access_token: token_result.access_token, + }; + return await OAuthAuthentication(pluginType, collections, allowOAuthAutoSignUp, useAdmin, secret, request, successRedirectPath, errorRedirectPath, userData); +} +//# sourceMappingURL=oauth2_callback.js.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth2_callback.js.map b/dist/core/protocols/oauth/oauth2_callback.js.map new file mode 100644 index 0000000..086773f --- /dev/null +++ b/dist/core/protocols/oauth/oauth2_callback.js.map @@ -0,0 +1 @@ +{"version":3,"file":"oauth2_callback.js","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oauth2_callback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAA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,CAAC,CAAA;IACjC,CAAC;SAAM,CAAC;QACN,WAAW,GAAG;YACZ,GAAG,EAAE,QAAQ,CAAC,GAAG,IAAI,EAAE;YACvB,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,EAAE;YACzB,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI,EAAE;YAC3B,OAAO,EAAE,QAAQ,CAAC,OAAO,IAAI,EAAE;SAChC,CAAA;IACH,CAAC;IAED,MAAM,QAAQ,GAAqB;QACjC,GAAG,WAAW;QACd,KAAK,EAAE,cAAc,CAAC,KAAK;QAC3B,MAAM,EAAE,cAAc,CAAC,oBAAoB,CAAC,MAAM;QAClD,YAAY,EAAE,YAAY,CAAC,YAAY;KACxC,CAAA;IAED,OAAO,MAAM,mBAAmB,CAC9B,UAAU,EACV,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACR,MAAM,EACN,OAAO,EACP,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,CACT,CAAA;AACH,CAAC"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth_authentication.d.ts b/dist/core/protocols/oauth/oauth_authentication.d.ts new file mode 100644 index 0000000..d43b8c7 --- /dev/null +++ b/dist/core/protocols/oauth/oauth_authentication.d.ts @@ -0,0 +1,4 @@ +import type { PayloadRequest } from "payload"; +import { OAuthAccountData, OAuthCollections } from "../../../types"; +export declare function OAuthAuthentication(pluginType: string, collections: OAuthCollections, allowOAuthAutoSignUp: boolean, useAdmin: boolean, secret: string, request: PayloadRequest, successRedirectPath: string, errorRedirectPath: string, userData: OAuthAccountData): Promise; +//# sourceMappingURL=oauth_authentication.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth_authentication.d.ts.map b/dist/core/protocols/oauth/oauth_authentication.d.ts.map new file mode 100644 index 0000000..6868c9f --- /dev/null +++ b/dist/core/protocols/oauth/oauth_authentication.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"oauth_authentication.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oauth_authentication.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,cAAc,EAGf,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAY5D,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,gBAAgB,EAC7B,oBAAoB,EAAE,OAAO,EAC7B,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,cAAc,EACvB,mBAAmB,EAAE,MAAM,EAC3B,iBAAiB,EAAE,MAAM,EACzB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,QAAQ,CAAC,CAmLnB"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth_authentication.js b/dist/core/protocols/oauth/oauth_authentication.js new file mode 100644 index 0000000..cff1e15 --- /dev/null +++ b/dist/core/protocols/oauth/oauth_authentication.js @@ -0,0 +1,142 @@ +import * as jose from "jose"; +import { v4 as uuid } from "uuid"; +import { parseCookies } from "payload"; +import { APP_COOKIE_SUFFIX } from "../../../constants"; +import { UserNotFoundAPIError, MissingCollection, } from "../../errors/apiErrors"; +import { createSessionCookies, invalidateOAuthCookies, } from "../../utils/cookies"; +import { removeExpiredSessions } from "../../utils/session"; +export async function OAuthAuthentication(pluginType, collections, allowOAuthAutoSignUp, useAdmin, secret, request, successRedirectPath, errorRedirectPath, userData) { + const { email: _email, sub, name, scope, issuer, picture, access_token, } = userData; + const { payload } = request; + const email = _email.toLowerCase(); + const userRecords = await payload.find({ + collection: collections.usersCollection, + where: { + email: { + equals: email, + }, + }, + }); + let userRecord; + if (userRecords.docs.length === 1 && userRecords.docs[0]) { + userRecord = userRecords.docs[0]; + } + else if (allowOAuthAutoSignUp) { + const data = { + email, + name, + }; + const hasAuthEnabled = Boolean(payload.collections[collections.usersCollection]?.config.auth); + if (hasAuthEnabled) { + data.password = jose.base64url.encode(crypto.getRandomValues(new Uint8Array(16))); + } + const userRecords = await payload.create({ + collection: collections.usersCollection, + data, + }); + userRecord = userRecords; + } + else { + return new UserNotFoundAPIError(); + } + const accountData = { + scope, + name: name, + picture: picture, + issuerName: issuer, + access_token, + }; + const accountRecords = await payload.find({ + collection: collections.accountsCollection, + where: { + sub: { equals: sub }, + }, + }); + if (accountRecords.docs && + accountRecords.docs.length === 1 && + accountRecords.docs[0]) { + await payload.update({ + collection: collections.accountsCollection, + id: accountRecords.docs[0].id, + data: accountData, + }); + } + else { + accountData.sub = sub; + accountData.user = userRecord.id; + await payload.create({ + collection: collections.accountsCollection, + data: accountData, + }); + } + let cookies = []; + const collectionConfig = payload.config.collections.find((collection) => collection.slug === collections.usersCollection); + if (!collectionConfig) { + return new MissingCollection(); + } + const sessionID = collectionConfig?.auth.useSessions ? uuid() : null; + if (collectionConfig?.auth.useSessions) { + const now = new Date(); + const tokenExpInMs = collectionConfig.auth.tokenExpiration * 1000; + const expiresAt = new Date(now.getTime() + tokenExpInMs); + const session = { + id: sessionID, + createdAt: now, + expiresAt, + }; + if (!userRecord["sessions"]?.length) { + userRecord["sessions"] = [session]; + } + else { + userRecord.sessions = removeExpiredSessions(userRecord.sessions); + userRecord.sessions.push(session); + } + await payload.db.updateOne({ + id: userRecord.id, + collection: collections.usersCollection, + data: userRecord, + req: request, + returning: false, + }); + } + const cookieName = useAdmin + ? `${payload.config.cookiePrefix}-token` + : `__${pluginType}-${APP_COOKIE_SUFFIX}`; + cookies = [ + ...(await createSessionCookies(cookieName, secret, { + id: userRecord.id, + email: email, + sid: sessionID, + collection: collections.usersCollection, + }, useAdmin ? collectionConfig?.auth.tokenExpiration : undefined)), + ]; + cookies = invalidateOAuthCookies(cookies); + // Get the state data from cookies and pass it as a query parameter + const parsedCookies = parseCookies(request.headers); + const cookieState = parsedCookies.get("__session-oauth-state"); + const successRedirectionURL = new URL(`${payload.config.serverURL}${successRedirectPath}`); + // Add the state as a query parameter if it exists + if (cookieState) { + try { + // Validate that it's proper JSON + JSON.parse(cookieState); + // Add the state as a query parameter (URL encode it) + successRedirectionURL.searchParams.set("state", encodeURIComponent(cookieState)); + console.log("Added state to redirect URL:", cookieState); + } + catch (error) { + console.error("Failed to parse state data, continuing without state:", error); + } + } + const res = new Response(null, { + status: 302, + headers: { + Location: successRedirectionURL.href, + }, + }); + for (const c of cookies) { + res.headers.append("Set-Cookie", c); + } + return res; +} +//# sourceMappingURL=oauth_authentication.js.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth_authentication.js.map b/dist/core/protocols/oauth/oauth_authentication.js.map new file mode 100644 index 0000000..7002db2 --- /dev/null +++ b/dist/core/protocols/oauth/oauth_authentication.js.map @@ -0,0 +1 @@ +{"version":3,"file":"oauth_authentication.js","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oauth_authentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAQtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EACL,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,UAAkB,EAClB,WAA6B,EAC7B,oBAA6B,EAC7B,QAAiB,EACjB,MAAc,EACd,OAAuB,EACvB,mBAA2B,EAC3B,iBAAyB,EACzB,QAA0B;IAE1B,MAAM,EACJ,KAAK,EAAE,MAAM,EACb,GAAG,EACH,IAAI,EACJ,KAAK,EACL,MAAM,EACN,OAAO,EACP,YAAY,GACb,GAAG,QAAQ,CAAA;IACZ,MAAM,EAAE,OAAO,EAAE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OAAO,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAA;IAEzC,mEAAmE;IACnE,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACnD,MAAM,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;IAE9D,MAAM,qBAAqB,GAAG,IAAI,GAAG,CACnC,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,GAAG,mBAAmB,EAAE,CACpD,CAAA;IAED,kDAAkD;IAClD,IAAI,WAAW,EAAE,CAAC;QAChB,IAAI,CAAC;YACH,iCAAiC;YACjC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;YACvB,qDAAqD;YACrD,qBAAqB,CAAC,YAAY,CAAC,GAAG,CACpC,OAAO,EACP,kBAAkB,CAAC,WAAW,CAAC,CAChC,CAAA;YACD,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,WAAW,CAAC,CAAA;QAC1D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CACX,uDAAuD,EACvD,KAAK,CACN,CAAA;QACH,CAAC;IACH,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE;QAC7B,MAAM,EAAE,GAAG;QACX,OAAO,EAAE;YACP,QAAQ,EAAE,qBAAqB,CAAC,IAAI;SACrC;KACF,CAAC,CAAA;IAEF,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAA;IACrC,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oidc_authorization.d.ts b/dist/core/protocols/oauth/oidc_authorization.d.ts new file mode 100644 index 0000000..a3fe23b --- /dev/null +++ b/dist/core/protocols/oauth/oidc_authorization.d.ts @@ -0,0 +1,4 @@ +import type { PayloadRequest } from "payload"; +import { OIDCProviderConfig, ParsedOAuthState } from "../../../types"; +export declare function OIDCAuthorization(pluginType: string, request: PayloadRequest, providerConfig: OIDCProviderConfig, parsedState?: ParsedOAuthState | null): Promise; +//# sourceMappingURL=oidc_authorization.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oidc_authorization.d.ts.map b/dist/core/protocols/oauth/oidc_authorization.d.ts.map new file mode 100644 index 0000000..8769001 --- /dev/null +++ b/dist/core/protocols/oauth/oidc_authorization.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"oidc_authorization.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oidc_authorization.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAG7C,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE9D,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,EACvB,cAAc,EAAE,kBAAkB,EAClC,WAAW,CAAC,EAAE,gBAAgB,GAAG,IAAI,GACpC,OAAO,CAAC,QAAQ,CAAC,CAsFnB"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oidc_authorization.js b/dist/core/protocols/oauth/oidc_authorization.js new file mode 100644 index 0000000..14bbc60 --- /dev/null +++ b/dist/core/protocols/oauth/oidc_authorization.js @@ -0,0 +1,63 @@ +import * as oauth from "oauth4webapi"; +import { createOAuthState } from "../../routeHandlers/oauth"; +import { getCallbackURL } from "../../utils/cb"; +export async function OIDCAuthorization(pluginType, request, providerConfig, parsedState) { + const callback_url = getCallbackURL(request.payload.config.serverURL, pluginType, providerConfig.id); + const code_verifier = parsedState?.codeVerifier || oauth.generateRandomCodeVerifier(); + const code_challenge = await oauth.calculatePKCECodeChallenge(code_verifier); + const code_challenge_method = "S256"; + const { client_id, issuer, algorithm, scope, params } = providerConfig; + const client = { + client_id, + }; + const issuer_url = new URL(issuer); + const as = await oauth + .discoveryRequest(issuer_url, { algorithm }) + .then((response) => oauth.processDiscoveryResponse(issuer_url, response)); + const cookies = []; + const cookieMaxage = new Date(Date.now() + 300 * 1000); + const authorizationURL = new URL(as.authorization_endpoint); + authorizationURL.searchParams.set("client_id", client.client_id); + authorizationURL.searchParams.set("redirect_uri", callback_url.toString()); + authorizationURL.searchParams.set("response_type", "code"); + authorizationURL.searchParams.set("scope", scope); + authorizationURL.searchParams.set("code_challenge", code_challenge); + authorizationURL.searchParams.set("code_challenge_method", code_challenge_method); + // Create and store state parameter + let stateValue; + if (parsedState) { + stateValue = createOAuthState(parsedState); + authorizationURL.searchParams.set("state", stateValue); + // Store the state in a cookie for callback validation + cookies.push(`__session-oauth-state=${stateValue};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`); + } + if (params) { + Object.entries(params).map(([key, value]) => { + // Don't override the state if we already set it + if (key !== "state" || !stateValue) { + authorizationURL.searchParams.set(key, value); + // If state comes from params and we haven't set it yet, store it in cookie + if (key === "state" && !stateValue) { + cookies.push(`__session-oauth-state=${value};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`); + } + } + }); + } + if (as.code_challenge_methods_supported?.includes("S256") !== true) { + const nonce = parsedState?.nonce || oauth.generateRandomNonce(); + authorizationURL.searchParams.set("nonce", nonce); + cookies.push(`__session-oauth-nonce=${nonce};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`); + } + cookies.push(`__session-code-verifier=${code_verifier};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`); + const res = new Response(null, { + status: 302, + headers: { + Location: authorizationURL.href, + }, + }); + for (const c of cookies) { + res.headers.append("Set-Cookie", c); + } + return res; +} +//# sourceMappingURL=oidc_authorization.js.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oidc_authorization.js.map b/dist/core/protocols/oauth/oidc_authorization.js.map new file mode 100644 index 0000000..a4ddedd --- /dev/null +++ b/dist/core/protocols/oauth/oidc_authorization.js.map @@ -0,0 +1 @@ +{"version":3,"file":"oidc_authorization.js","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oidc_authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAGhD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,UAAkB,EAClB,OAAuB,EACvB,cAAkC,EAClC,WAAqC;IAErC,MAAM,YAAY,GAAG,cAAc,CACjC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAChC,UAAU,EACV,cAAc,CAAC,EAAE,CAClB,CAAA;IAED,MAAM,aAAa,GACjB,WAAW,EAAE,YAAY,IAAI,KAAK,CAAC,0BAA0B,EAAE,CAAA;IACjE,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,0BAA0B,CAAC,aAAa,CAAC,CAAA;IAC5E,MAAM,qBAAqB,GAAG,MAAM,CAAA;IACpC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,cAAc,CAAA;IAEtE,MAAM,MAAM,GAAiB;QAC3B,SAAS;KACV,CAAA;IACD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,MAAM,CAAQ,CAAA;IACzC,MAAM,EAAE,GAAG,MAAM,KAAK;SACnB,gBAAgB,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,CAAC;SAC3C,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAA;IAE3E,MAAM,OAAO,GAAa,EAAE,CAAA;IAC5B,MAAM,YAAY,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IA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AAO,IAAI,CAAC,UAAU,EAAE,CAAC;oBACnC,OAAO,CAAC,IAAI,CACV,yBAAyB,KAAK,yCAAyC,YAAY,CAAC,WAAW,EAAE,EAAE,CACpG,CAAA;gBACH,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,EAAE,CAAC,gCAAgC,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;QACnE,MAAM,KAAK,GAAG,WAAW,EAAE,KAAK,IAAI,KAAK,CAAC,mBAAmB,EAAE,CAAA;QAC/D,gBAAgB,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;QACjD,OAAO,CAAC,IAAI,CACV,yBAAyB,KAAK,yCAAyC,YAAY,CAAC,WAAW,EAAE,EAAE,CACpG,CAAA;IACH,CAAC;IAED,OAAO,CAAC,IAAI,CACV,2BAA2B,aAAa,yCAAyC,YAAY,CAAC,WAAW,EAAE,EAAE,CAC9G,CAAA;IAED,MAAM,GAAG,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE;QAC7B,MAAM,EAAE,GAAG;QACX,OAAO,EAAE;YACP,QAAQ,EAAE,gBAAgB,CAAC,IAAI;SAChC;KACF,CAAC,CAAA;IAEF,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAA;IACrC,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oidc_callback.d.ts b/dist/core/protocols/oauth/oidc_callback.d.ts new file mode 100644 index 0000000..f159f96 --- /dev/null +++ b/dist/core/protocols/oauth/oidc_callback.d.ts @@ -0,0 +1,3 @@ +import type { OAuthCallbackParams, ParsedOAuthState } from "../../../types"; +export declare function OIDCCallback(params: OAuthCallbackParams, parsedState: ParsedOAuthState | null): Promise; +//# sourceMappingURL=oidc_callback.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oidc_callback.d.ts.map b/dist/core/protocols/oauth/oidc_callback.d.ts.map new file mode 100644 index 0000000..a092e80 --- /dev/null +++ b/dist/core/protocols/oauth/oidc_callback.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"oidc_callback.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oidc_callback.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,mBAAmB,EACnB,gBAAgB,EAEjB,MAAM,SAAS,CAAA;AAWhB,wBAAsB,YAAY,CAChC,MAAM,EAAE,mBAAmB,EAC3B,WAAW,EAAE,gBAAgB,GAAG,IAAI,GACnC,OAAO,CAAC,QAAQ,CAAC,CAiKnB"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oidc_callback.js b/dist/core/protocols/oauth/oidc_callback.js new file mode 100644 index 0000000..06cee2b --- /dev/null +++ b/dist/core/protocols/oauth/oidc_callback.js @@ -0,0 +1,92 @@ +import * as oauth from "oauth4webapi"; +import { parseCookies } from "payload"; +import { InternalServerError, MissingEmailAPIError, UnVerifiedAccountAPIError, } from "../../errors/apiErrors"; +import { MissingOrInvalidSession } from "../../errors/consoleErrors"; +import { getCallbackURL } from "../../utils/cb"; +import { OAuthAuthentication } from "./oauth_authentication"; +export async function OIDCCallback(params, parsedState) { + const { pluginType, request, provider, collections, allowOAuthAutoSignUp, useAdmin, secret, successRedirectPath, errorRedirectPath, } = params; + const providerConfig = provider; + const parsedCookies = parseCookies(request.headers); + const code_verifier = parsedState?.codeVerifier || parsedCookies.get("__session-code-verifier"); + const nonce = parsedState?.nonce || parsedCookies.get("__session-oauth-nonce"); + if (!code_verifier) { + throw new MissingOrInvalidSession(); + } + const { client_id, client_secret, issuer, algorithm, profile } = providerConfig; + const client = { + client_id, + }; + const clientAuth = oauth.ClientSecretPost(client_secret ?? ""); + const current_url = new URL(request.url); + const callback_url = getCallbackURL(request.payload.config.serverURL, pluginType, providerConfig.id); + const issuer_url = new URL(issuer); + const as = await oauth + .discoveryRequest(issuer_url, { algorithm }) + .then((response) => oauth.processDiscoveryResponse(issuer_url, response)); + // Handle state validation manually since we're using it for redirect logic + const cookieState = parsedCookies.get("__session-oauth-state"); + const urlState = current_url.searchParams.get("state"); + const urlStateDecoded = urlState ? decodeURIComponent(urlState) : null; + console.error("Cookie state:", cookieState); + console.error("URL state (from callback):", urlState); + console.error("URL state decoded:", urlStateDecoded); + // Validate state manually for security + if (cookieState && urlStateDecoded && cookieState !== urlStateDecoded) { + throw new Error("State parameter mismatch - possible CSRF attack"); + } + // Remove state from URL for OAuth validation since we handle it separately + const urlWithoutState = new URL(current_url.toString()); + urlWithoutState.searchParams.delete("state"); + // Pass undefined for state since we're handling it manually + const params_oauth = oauth.validateAuthResponse(as, client, urlWithoutState, // URL without state parameter + undefined); + console.error("OIDC Callback params_oauth:", params_oauth); + const grantResponse = await oauth.authorizationCodeGrantRequest(as, client, clientAuth, params_oauth, callback_url.toString(), code_verifier); + const body = (await grantResponse.json()); + let response = new Response(JSON.stringify(body), grantResponse); + if (Array.isArray(body.scope)) { + body.scope = body.scope.join(" "); + response = new Response(JSON.stringify(body), grantResponse); + } + const token_result = await oauth.processAuthorizationCodeResponse(as, client, response, { + expectedNonce: nonce, + requireIdToken: true, + }); + const claims = oauth.getValidatedIdTokenClaims(token_result); + if (!claims?.sub) { + return new InternalServerError(); + } + const userInfoResponse = await oauth.userInfoRequest(as, client, token_result.access_token); + const result = await oauth.processUserInfoResponse(as, client, claims?.sub, userInfoResponse); + if (!result.email) { + return new MissingEmailAPIError(); + } + // Remove skip_email_verification check since it's not in your types + // Only check email_verified if it exists in the result + if (result.email_verified === false) { + return new UnVerifiedAccountAPIError(); + } + // Use the provider's profile callback if available, otherwise use direct mapping + let accountInfo; + if (profile) { + const filteredResult = Object.fromEntries(Object.entries(result).filter(([_, v]) => v !== undefined)); + accountInfo = profile(filteredResult); + } + else { + accountInfo = { + sub: result.sub, + name: result.name ?? "", + email: result.email, + picture: result.picture ?? "", + }; + } + const userData = { + ...accountInfo, + scope: providerConfig.scope, + issuer: providerConfig.issuer, + access_token: token_result.access_token, + }; + return await OAuthAuthentication(pluginType, collections, allowOAuthAutoSignUp, useAdmin, secret, request, successRedirectPath, errorRedirectPath, userData); +} +//# sourceMappingURL=oidc_callback.js.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oidc_callback.js.map b/dist/core/protocols/oauth/oidc_callback.js.map new file mode 100644 index 0000000..8bf5d31 --- /dev/null +++ b/dist/core/protocols/oauth/oidc_callback.js.map @@ -0,0 +1 @@ +{"version":3,"file":"oidc_callback.js","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oidc_callback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAQtC,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAG5D,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAA2B,EAC3B,WAAoC;IAEpC,MAAM,EACJ,UAAU,EACV,OAAO,EACP,QAAQ,EACR,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACR,MAAM,EACN,mBAAmB,EACnB,iBAAiB,GAClB,GAAG,MAAM,CAAA;IAEV,MAAM,cAAc,GAAG,QAA8B,CAAA;IACrD,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAEnD,MAAM,aAAa,GACjB,WAAW,EAAE,YAAY,IAAI,aAAa,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA;IAC3E,MAAM,KAAK,GAAG,WAAW,EA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SAC9B,CAAA;IACH,CAAC;IAED,MAAM,QAAQ,GAAqB;QACjC,GAAG,WAAW;QACd,KAAK,EAAE,cAAc,CAAC,KAAK;QAC3B,MAAM,EAAE,cAAc,CAAC,MAAM;QAC7B,YAAY,EAAE,YAAY,CAAC,YAAY;KACxC,CAAA;IAED,OAAO,MAAM,mBAAmB,CAC9B,UAAU,EACV,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACR,MAAM,EACN,OAAO,EACP,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,CACT,CAAA;AACH,CAAC"} \ No newline at end of file diff --git a/dist/core/protocols/passkey/authentication.d.ts b/dist/core/protocols/passkey/authentication.d.ts new file mode 100644 index 0000000..769d8e6 --- /dev/null +++ b/dist/core/protocols/passkey/authentication.d.ts @@ -0,0 +1,5 @@ +import { PayloadRequest } from "payload"; +import { AccountInfo } from "../../../types.js"; +export declare function GeneratePasskeyAuthentication(request: PayloadRequest, rpID: string): Promise; +export declare function VerifyPasskeyAuthentication(request: PayloadRequest, rpID: string, session_callback: (accountInfo: AccountInfo) => Promise): Promise; +//# sourceMappingURL=authentication.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/passkey/authentication.d.ts.map b/dist/core/protocols/passkey/authentication.d.ts.map new file mode 100644 index 0000000..794eb62 --- /dev/null +++ b/dist/core/protocols/passkey/authentication.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols/passkey/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,MAAM,SAAS,CAAA;AAUtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAG/C,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,QAAQ,CAAC,CAqCnB;AAED,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,GAChE,OAAO,CAAC,QAAQ,CAAC,CA6DnB"} \ No newline at end of file diff --git a/dist/core/protocols/passkey/authentication.js b/dist/core/protocols/passkey/authentication.js new file mode 100644 index 0000000..3ac19dd --- /dev/null +++ b/dist/core/protocols/passkey/authentication.js @@ -0,0 +1,73 @@ +import { parseCookies } from "payload"; +import { generateAuthenticationOptions, verifyAuthenticationResponse, } from "@simplewebauthn/server"; +import { PasskeyVerificationAPIError } from "../../errors/apiErrors.js"; +import { MissingOrInvalidSession } from "../../errors/consoleErrors.js"; +import { hashCode } from "../../utils/hash.js"; +export async function GeneratePasskeyAuthentication(request, rpID) { + // @ts-expect-error TODO: Fix undefined object method + const { data } = (await request.json()); + const registrationOptions = { + rpID, + timeout: 60000, + allowCredentials: [ + { + id: data.passkey.credentialId, + transports: data.passkey.transports, + }, + ], + userVerification: "required", + }; + const options = await generateAuthenticationOptions(registrationOptions); + const cookieMaxage = new Date(Date.now() + 300 * 1000); + const cookies = []; + cookies.push(`__session-webpk-challenge=${options.challenge};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`); + const res = new Response(JSON.stringify({ options }), { status: 201 }); + cookies.forEach((cookie) => { + res.headers.append("Set-Cookie", cookie); + }); + return res; +} +export async function VerifyPasskeyAuthentication(request, rpID, session_callback) { + try { + const parsedCookies = parseCookies(request.headers); + const challenge = parsedCookies.get("__session-webpk-challenge"); + if (!challenge) { + throw new MissingOrInvalidSession(); + } + // @ts-expect-error TODO: Fix undefined object method + const { data } = (await request.json()); + const verification = await verifyAuthenticationResponse({ + response: data.authentication, + expectedChallenge: challenge, + expectedOrigin: request.payload.config.serverURL, + expectedRPID: rpID, + credential: { + id: data.passkey.credentialId, + publicKey: new Uint8Array(Object.values(data.passkey.publicKey)), + counter: data.passkey.counter, + transports: data.passkey.transports, + }, + }); + if (!verification.verified) { + throw new PasskeyVerificationAPIError(); + } + const { credentialID, credentialDeviceType, credentialBackedUp, newCounter, } = verification.authenticationInfo; + return await session_callback({ + sub: hashCode(data.email + request.payload.secret).toString(), + name: "", + picture: "", + email: data.email, + passKey: { + credentialId: credentialID, + counter: newCounter, + deviceType: credentialDeviceType, + backedUp: credentialBackedUp, + }, + }); + } + catch (error) { + console.error(error); + return Response.json({}); + } +} +//# sourceMappingURL=authentication.js.map \ No newline at end of file diff --git a/dist/core/protocols/passkey/authentication.js.map b/dist/core/protocols/passkey/authentication.js.map new file mode 100644 index 0000000..d375b97 --- /dev/null +++ b/dist/core/protocols/passkey/authentication.js.map @@ -0,0 +1 @@ +{"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../../../src/core/protocols/passkey/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,SAAS,CAAA;AACtD,OAAO,EAGL,6BAA6B,EAE7B,4BAA4B,GAC7B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAA;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,OAAuB,EACvB,IAAY;IAEZ,qDAAqD;IACrD,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,EAAE,CAWrC,CAAA;IAED,MAAM,mBAAmB,GAAsC;QAC7D,IAAI;QACJ,OAAO,EAAE,KAAK;QACd,gBAAgB,EAAE;YAChB;gBACE,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY;gBAC7B,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU;aACpC;SACF;QACD,gBAAgB,EAAE,UAAU;KAC7B,CAAA;IACD,MAAM,OAAO,GAAG,MAAM,6BAA6B,CAAC,mBAAmB,CAAC,CAAA;IACxE,MAA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AY;gBAC7B,SAAS,EAAE,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;gBAChE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;gBAC7B,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU;aACpC;SACF,CAAC,CAAA;QACF,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;YAC3B,MAAM,IAAI,2BAA2B,EAAE,CAAA;QACzC,CAAC;QACD,MAAM,EACJ,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,GACX,GAAG,YAAY,CAAC,kBAAmB,CAAA;QACpC,OAAO,MAAM,gBAAgB,CAAC;YAC5B,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;YAC7D,IAAI,EAAE,EAAE;YACR,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE;gBACP,YAAY,EAAE,YAAY;gBAC1B,OAAO,EAAE,UAAU;gBACnB,UAAU,EAAE,oBAAoB;gBAChC,QAAQ,EAAE,kBAAkB;aAC7B;SACF,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACpB,OAAO,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC1B,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/dist/core/protocols/passkey/index.d.ts b/dist/core/protocols/passkey/index.d.ts new file mode 100644 index 0000000..2a007dc --- /dev/null +++ b/dist/core/protocols/passkey/index.d.ts @@ -0,0 +1,3 @@ +import { PayloadRequest } from "payload"; +export declare function InitPasskey(request: PayloadRequest): Promise; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/passkey/index.d.ts.map b/dist/core/protocols/passkey/index.d.ts.map new file mode 100644 index 0000000..aeca202 --- /dev/null +++ b/dist/core/protocols/passkey/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols/passkey/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAIxC,wBAAsB,WAAW,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,CAsB5E"} \ No newline at end of file diff --git a/dist/core/protocols/passkey/index.js b/dist/core/protocols/passkey/index.js new file mode 100644 index 0000000..fb593d3 --- /dev/null +++ b/dist/core/protocols/passkey/index.js @@ -0,0 +1,24 @@ +import { MissingEmailAPIError } from "../../errors/apiErrors.js"; +import { hashCode } from "../../utils/hash.js"; +export async function InitPasskey(request) { + // @ts-expect-error TODO: Fix undefined object method + const { data } = (await request.json()); + if (!data.email) { + throw new MissingEmailAPIError(); + } + const existingRecord = await request.payload.find({ + collection: "accounts", + where: { + sub: { + equals: hashCode(data.email + request.payload.secret).toString(), + }, + }, + }); + if (existingRecord.totalDocs !== 1) { + return new Response(JSON.stringify({ data: {} }), { status: 200 }); + } + return new Response(JSON.stringify({ data: existingRecord.docs[0] }), { + status: 200, + }); +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/core/protocols/passkey/index.js.map b/dist/core/protocols/passkey/index.js.map new file mode 100644 index 0000000..09a59cf --- /dev/null +++ b/dist/core/protocols/passkey/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/protocols/passkey/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAuB;IACvD,qDAAqD;IACrD,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,EAAE,CAAgC,CAAA;IAEtE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,oBAAoB,EAAE,CAAA;IAClC,CAAC;IAED,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;QAChD,UAAU,EAAE,UAAU;QACtB,KAAK,EAAE;YACL,GAAG,EAAE;gBACH,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;aACjE;SACF;KACF,CAAC,CAAA;IACF,IAAI,cAAc,CAAC,SAAS,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;IACpE,CAAC;IACD,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;QACpE,MAAM,EAAE,GAAG;KACZ,CAAC,CAAA;AACJ,CAAC"} \ No newline at end of file diff --git a/dist/core/protocols/passkey/registration.d.ts b/dist/core/protocols/passkey/registration.d.ts new file mode 100644 index 0000000..0735bda --- /dev/null +++ b/dist/core/protocols/passkey/registration.d.ts @@ -0,0 +1,5 @@ +import { PayloadRequest } from "payload"; +import { AccountInfo } from "../../../types.js"; +export declare function GeneratePasskeyRegistration(request: PayloadRequest, rpID: string): Promise; +export declare function VerifyPasskeyRegistration(request: PayloadRequest, rpID: string, session_callback: (accountInfo: AccountInfo) => Promise): Promise; +//# sourceMappingURL=registration.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/passkey/registration.d.ts.map b/dist/core/protocols/passkey/registration.d.ts.map new file mode 100644 index 0000000..a3cb467 --- /dev/null +++ b/dist/core/protocols/passkey/registration.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols/passkey/registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,MAAM,SAAS,CAAA;AAStD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAG/C,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,QAAQ,CAAC,CA2BnB;AAED,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,GAChE,OAAO,CAAC,QAAQ,CAAC,CA0CnB"} \ No newline at end of file diff --git a/dist/core/protocols/passkey/registration.js b/dist/core/protocols/passkey/registration.js new file mode 100644 index 0000000..a408a5e --- /dev/null +++ b/dist/core/protocols/passkey/registration.js @@ -0,0 +1,70 @@ +import { parseCookies } from "payload"; +import { generateRegistrationOptions, verifyRegistrationResponse, } from "@simplewebauthn/server"; +import { PasskeyVerificationAPIError } from "../../errors/apiErrors.js"; +import { MissingOrInvalidSession } from "../../errors/consoleErrors.js"; +import { hashCode } from "../../utils/hash.js"; +export async function GeneratePasskeyRegistration(request, rpID) { + // @ts-expect-error TODO: Fix undefined object method + const { data } = (await request.json()); + const registrationOptions = { + rpName: "Payload Passkey Webauth", + rpID, + userName: data.email, + timeout: 60000, + attestationType: "none", + authenticatorSelection: { + residentKey: "required", + userVerification: "required", + }, + supportedAlgorithmIDs: [-7, -257], + }; + const options = await generateRegistrationOptions(registrationOptions); + const cookieMaxage = new Date(Date.now() + 300 * 1000); + const cookies = []; + cookies.push(`__session-webpk-challenge=${options.challenge};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`); + const res = new Response(JSON.stringify({ options }), { status: 201 }); + cookies.forEach((cookie) => { + res.headers.append("Set-Cookie", cookie); + }); + return res; +} +export async function VerifyPasskeyRegistration(request, rpID, session_callback) { + try { + const parsedCookies = parseCookies(request.headers); + const challenge = parsedCookies.get("__session-webpk-challenge"); + if (!challenge) { + throw new MissingOrInvalidSession(); + } + // @ts-expect-error TODO: Fix undefined object method + const body = (await request.json()); + const verification = await verifyRegistrationResponse({ + response: body.data.registration, + expectedChallenge: challenge, + expectedOrigin: request.payload.config.serverURL, + expectedRPID: rpID, + }); + if (!verification.verified) { + throw new PasskeyVerificationAPIError(); + } + const { credential, credentialDeviceType, credentialBackedUp } = verification.registrationInfo; + return await session_callback({ + sub: hashCode(body.data.email + request.payload.secret).toString(), + name: "", + picture: "", + email: body.data.email, + passKey: { + credentialId: credential.id, + publicKey: credential.publicKey, + counter: credential.counter, + transports: credential.transports, + deviceType: credentialDeviceType, + backedUp: credentialBackedUp, + }, + }); + } + catch (error) { + console.error(error); + return Response.json({}); + } +} +//# sourceMappingURL=registration.js.map \ No newline at end of file diff --git a/dist/core/protocols/passkey/registration.js.map b/dist/core/protocols/passkey/registration.js.map new file mode 100644 index 0000000..8ccd72c --- /dev/null +++ b/dist/core/protocols/passkey/registration.js.map @@ -0,0 +1 @@ +{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../../src/core/protocols/passkey/registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,SAAS,CAAA;AACtD,OAAO,EACL,2BAA2B,EAG3B,0BAA0B,GAC3B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAA;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,OAAuB,EACvB,IAAY;IAEZ,q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,IAAI,CAAC,EAAE,CAAC,CAAA;IAC1B,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/dist/core/protocols/password.d.ts b/dist/core/protocols/password.d.ts new file mode 100644 index 0000000..b4da05d --- /dev/null +++ b/dist/core/protocols/password.d.ts @@ -0,0 +1,17 @@ +import { type PayloadRequest } from "payload"; +export declare const PasswordSignin: (pluginType: string, request: PayloadRequest, internal: { + usersCollectionSlug: string; +}, useAdmin: boolean, secret: string, successRedirectPath: string, errorRedirectPath: string) => Promise; +export declare const PasswordSignup: (pluginType: string, request: PayloadRequest, internal: { + usersCollectionSlug: string; +}, useAdmin: boolean, secret: string, successRedirectPath: string, errorRedirectPath: string) => Promise; +export declare const ForgotPasswordInit: (request: PayloadRequest, internal: { + usersCollectionSlug: string; +}, emailTemplate: any) => Promise; +export declare const ForgotPasswordVerify: (request: PayloadRequest, internal: { + usersCollectionSlug: string; +}) => Promise; +export declare const ResetPassword: (cookieName: string, secret: string, internal: { + usersCollectionSlug: string; +}, request: PayloadRequest) => Promise; +//# sourceMappingURL=password.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/password.d.ts.map b/dist/core/protocols/password.d.ts.map new file mode 100644 index 0000000..3eb752e --- /dev/null +++ b/dist/core/protocols/password.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../../src/core/protocols/password.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;AAwD3D,eAAO,MAAM,cAAc,GACzB,YAAY,MAAM,EAClB,SAAS,cAAc,EACvB,UAAU;IACR,mBAAmB,EAAE,MAAM,CAAA;CAC5B,EACD,UAAU,OAAO,EACjB,QAAQ,MAAM,EACd,qBAAqB,MAAM,EAC3B,mBAAmB,MAAM,sBAyF1B,CAAA;AAED,eAAO,MAAM,cAAc,GACzB,YAAY,MAAM,EAClB,SAAS,cAAc,EACvB,UAAU;IACR,mBAAmB,EAAE,MAAM,CAAA;CAC5B,EACD,UAAU,OAAO,EACjB,QAAQ,MAAM,EACd,qBAAqB,MAAM,EAC3B,mBAAmB,MAAM,sBAwG1B,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC7B,SAAS,cAAc,EACvB,UAAU;IACR,mBAAmB,EAAE,MAAM,CAAA;CAC5B,EACD,eAAe,GAAG,sBA8DnB,CAAA;AAED,eAAO,MAAM,oBAAoB,GAC/B,SAAS,cAAc,EACvB,UAAU;IACR,mBAAmB,EAAE,MAAM,CAAA;CAC5B,sBAyEF,CAAA;AAED,eAAO,MAAM,aAAa,GACxB,YAAY,MAAM,EAClB,QAAQ,MAAM,EACd,UAAU;IACR,mBAAmB,EAAE,MAAM,CAAA;CAC5B,EACD,SAAS,cAAc,sBAyFxB,CAAA"} \ No newline at end of file diff --git a/dist/core/protocols/password.js b/dist/core/protocols/password.js new file mode 100644 index 0000000..fd68f0d --- /dev/null +++ b/dist/core/protocols/password.js @@ -0,0 +1,326 @@ +import { parseCookies } from "payload"; +import { EmailAlreadyExistError, InvalidCredentials, InvalidRequestBodyError, MissingCollection, MissingOrInvalidVerification, UnauthorizedAPIRequest, UserNotFoundAPIError, } from "../errors/apiErrors.js"; +import { hashPassword, verifyPassword } from "../utils/password.js"; +import { SuccessKind } from "../../types.js"; +import { ephemeralCode, verifyEphemeralCode } from "../utils/hash.js"; +import { APP_COOKIE_SUFFIX } from "../../constants.js"; +import { createSessionCookies, invalidateOAuthCookies, verifySessionCookie, } from "../utils/cookies.js"; +import { v4 as uuid } from "uuid"; +import { removeExpiredSessions } from "../utils/session.js"; +const redirectWithSession = async (cookieName, path, secret, fields, request, tokenExpiration) => { + let cookies = []; + cookies = [ + ...(await createSessionCookies(cookieName, secret, fields, tokenExpiration)), + ]; + cookies = invalidateOAuthCookies(cookies); + const successRedirectionURL = new URL(`${request.origin}${path}`); + const res = new Response(null, { + status: 302, + headers: { + Location: successRedirectionURL.href, + }, + }); + for (const c of cookies) { + res.headers.append("Set-Cookie", c); + } + return res; +}; +export const PasswordSignin = async (pluginType, request, internal, useAdmin, secret, successRedirectPath, errorRedirectPath) => { + const body = request.json && + (await request.json()); + if (!body?.email || !body.password) { + return new InvalidRequestBodyError(); + } + const email = body.email.toLowerCase(); + const { payload } = request; + const { docs } = await payload.find({ + collection: internal.usersCollectionSlug, + where: { + email: { equals: email }, + }, + limit: 1, + }); + if (docs.length !== 1) { + return new UserNotFoundAPIError(); + } + const userRecord = docs[0]; + if (!userRecord) { + return new UserNotFoundAPIError(); + } + if (!userRecord.hashedPassword) { + return new InvalidCredentials(); + } + const isVerifed = await verifyPassword(body.password, userRecord.hashedPassword, userRecord.hashSalt, userRecord.hashIterations); + if (!isVerifed) { + return new InvalidCredentials(); + } + const collectionConfig = payload.config.collections.find((collection) => collection.slug === internal.usersCollectionSlug); + if (!collectionConfig) { + return new MissingCollection(); + } + const sessionID = collectionConfig?.auth.useSessions ? uuid() : null; + if (collectionConfig?.auth.useSessions) { + const now = new Date(); + const tokenExpInMs = collectionConfig.auth.tokenExpiration * 1000; + const expiresAt = new Date(now.getTime() + tokenExpInMs); + const session = { id: sessionID, createdAt: now, expiresAt }; + if (!userRecord["sessions"]?.length) { + userRecord["sessions"] = [session]; + } + else { + userRecord.sessions = removeExpiredSessions(userRecord.sessions); + userRecord.sessions.push(session); + } + await payload.db.updateOne({ + id: userRecord.id, + collection: internal.usersCollectionSlug, + data: userRecord, + req: request, + returning: false, + }); + } + const cookieName = useAdmin + ? `${payload.config.cookiePrefix}-token` + : `__${pluginType}-${APP_COOKIE_SUFFIX}`; + const signinFields = { + id: userRecord.id, + email, + sid: sessionID, + collection: internal.usersCollectionSlug, + }; + return await redirectWithSession(cookieName, successRedirectPath, secret, signinFields, request, useAdmin ? collectionConfig.auth.tokenExpiration : undefined); +}; +export const PasswordSignup = async (pluginType, request, internal, useAdmin, secret, successRedirectPath, errorRedirectPath) => { + const body = request.json && + (await request.json()); + if (!body?.email || !body.password) { + return new InvalidRequestBodyError(); + } + const email = body.email.toLowerCase(); + const { payload } = request; + const { docs } = await payload.find({ + collection: internal.usersCollectionSlug, + where: { + email: { equals: email }, + }, + limit: 1, + }); + if (docs.length > 0) { + return new EmailAlreadyExistError(); + } + const { hash: hashedPassword, salt: hashSalt, iterations, } = await hashPassword(body.password); + const userRecord = await payload.create({ + collection: internal.usersCollectionSlug, + data: { + email, + hashedPassword: hashedPassword, + hashIterations: iterations, + hashSalt, + ...body.userInfo, + }, + }); + if (body.allowAutoSignin) { + const collectionConfig = payload.config.collections.find((collection) => collection.slug === internal.usersCollectionSlug); + if (!collectionConfig) { + return new MissingCollection(); + } + const sessionID = collectionConfig?.auth.useSessions ? uuid() : null; + if (collectionConfig?.auth.useSessions) { + const now = new Date(); + const tokenExpInMs = collectionConfig.auth.tokenExpiration * 1000; + const expiresAt = new Date(now.getTime() + tokenExpInMs); + const session = { id: sessionID, createdAt: now, expiresAt }; + if (!userRecord["sessions"]?.length) { + userRecord["sessions"] = [session]; + } + else { + userRecord.sessions = removeExpiredSessions(userRecord.sessions); + userRecord.sessions.push(session); + } + await payload.db.updateOne({ + id: userRecord.id, + collection: internal.usersCollectionSlug, + data: userRecord, + req: request, + returning: false, + }); + } + const cookieName = useAdmin + ? `${payload.config.cookiePrefix}-token` + : `__${pluginType}-${APP_COOKIE_SUFFIX}`; + const signinFields = { + id: userRecord.id, + email, + sid: sessionID, + collection: internal.usersCollectionSlug, + }; + return await redirectWithSession(cookieName, successRedirectPath, secret, signinFields, request, useAdmin ? collectionConfig.auth.tokenExpiration : undefined); + } + return Response.json({ + message: "Signed up successfully", + kind: SuccessKind.Created, + isSuccess: true, + isError: false, + }, { status: 201 }); +}; +export const ForgotPasswordInit = async (request, internal, emailTemplate) => { + const { payload } = request; + const body = request.json && + (await request.json()); + if (!body?.email) { + return new InvalidRequestBodyError(); + } + const email = body.email.toLowerCase(); + const { docs } = await payload.find({ + collection: internal.usersCollectionSlug, + where: { + email: { equals: email }, + }, + limit: 1, + }); + if (docs.length !== 1) { + return new UserNotFoundAPIError(); + } + const { code, hash } = await ephemeralCode(6, payload.secret); + await payload.sendEmail({ + to: email, + subject: "Password recovery", + html: await emailTemplate({ + verificationCode: code, + }), + }); + const res = new Response(JSON.stringify({ + message: "Verification email sent", + kind: SuccessKind.Created, + isSuccess: true, + isError: false, + }), { status: 201 }); + const verification_token_expires = new Date(); + verification_token_expires.setDate(verification_token_expires.getDate() + 7); + if (!docs[0]) { + return new MissingOrInvalidVerification(); + } + await payload.update({ + collection: internal.usersCollectionSlug, + id: docs[0].id, + data: { + verificationHash: hash, + verificationCode: code, + verificationTokenExpire: Math.floor(verification_token_expires.getTime() / 1000), + verificationKind: "PASSWORD_RESTORE", + }, + }); + return res; +}; +export const ForgotPasswordVerify = async (request, internal) => { + const { payload } = request; + const body = request.json && + (await request.json()); + if (!body?.password || !body.code) { + return new InvalidRequestBodyError(); + } + const { docs } = await payload.find({ + collection: internal.usersCollectionSlug, + where: { + verificationCode: { equals: body.code }, + }, + }); + if (docs.length === 0 || !docs[0]) { + return new MissingOrInvalidVerification(); + } + const currentDate = Date.now(); + if (docs.length === 0 || + docs[0].verificationCode !== body.code || + !docs[0].verificationHash || + Math.floor(currentDate / 1000) > docs[0].verificationTokenExpire || + docs[0].verificationKind !== "PASSWORD_RESTORE") { + return new MissingOrInvalidVerification(); + } + const { verificationHash: hash, id: userId } = docs[0]; + const isVerified = await verifyEphemeralCode(body.code, hash, payload.secret); + if (!isVerified) { + return new MissingOrInvalidVerification(); + } + const { hash: hashedPassword, salt: hashSalt, iterations, } = await hashPassword(body.password); + await payload.update({ + collection: internal.usersCollectionSlug, + id: userId, + data: { + hashedPassword, + hashSalt, + hashIterations: iterations, + verificationHash: null, + verificationCode: null, + verificationTokenExpire: null, + verificationKind: null, + }, + }); + const res = new Response(JSON.stringify({ + message: "Password recovered successfully", + kind: SuccessKind.Updated, + isSuccess: true, + isError: false, + }), { status: 201 }); + return res; +}; +export const ResetPassword = async (cookieName, secret, internal, request) => { + const { payload } = request; + const cookies = parseCookies(request.headers); + const token = cookies.get(cookieName); + if (!token) { + return new UnauthorizedAPIRequest(); + } + const jwtResponse = await verifySessionCookie(token, secret); + if (!jwtResponse.payload) { + return new UnauthorizedAPIRequest(); + } + const body = request.json && + (await request.json()); + if (!body?.email || !body?.currentPassword || !body?.newPassword) { + return new InvalidRequestBodyError(); + } + const email = body.email.toLowerCase(); + const { docs } = await payload.find({ + collection: internal.usersCollectionSlug, + where: { + email: { equals: email }, + }, + limit: 1, + }); + if (docs.length !== 1) { + return new UserNotFoundAPIError(); + } + const user = docs[0]; + if (!user) { + return new UserNotFoundAPIError(); + } + const isVerifed = await verifyPassword(body.currentPassword, user?.hashedPassword, user?.hashSalt, user?.hashIterations); + if (!isVerifed) { + return new InvalidCredentials(); + } + const { hash: hashedPassword, salt: hashSalt, iterations, } = await hashPassword(body.newPassword); + await payload.update({ + collection: internal.usersCollectionSlug, + id: user.id, + data: { + hashedPassword, + hashSalt, + hashIterations: iterations, + }, + }); + // if (body.signoutOnUpdate) { + // let cookies: string[] = [] + // cookies = [...invalidateSessionCookies(cookieName, cookies)] + // return + // } + const res = new Response(JSON.stringify({ + message: "Password reset complete", + kind: SuccessKind.Updated, + isSuccess: true, + isError: false, + }), { + status: 201, + }); + return res; +}; +//# sourceMappingURL=password.js.map \ No newline at end of file diff --git a/dist/core/protocols/password.js.map b/dist/core/protocols/password.js.map new file mode 100644 index 0000000..39b14cc --- /dev/null +++ b/dist/core/protocols/password.js.map @@ -0,0 +1 @@ +{"version":3,"file":"password.js","sourceRoot":"","sources":["../../../src/core/protocols/password.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,SAAS,CAAA;AAC3D,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,4BAA4B,EAC5B,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,s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GAAG,CAAA;AACZ,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/core/protocols/session.d.ts b/dist/core/protocols/session.d.ts new file mode 100644 index 0000000..1c79c61 --- /dev/null +++ b/dist/core/protocols/session.d.ts @@ -0,0 +1,7 @@ +import { type PayloadRequest } from "payload"; +export declare const SessionRefresh: (cookieName: string, request: PayloadRequest) => Promise; +export declare const SessionUser: (cookieName: string, request: PayloadRequest, internal: { + usersCollectionSlug: string; +}, fields: string[]) => Promise; +export declare const SessionSignout: (cookieName: string, request: PayloadRequest) => Promise; +//# sourceMappingURL=session.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/session.d.ts.map b/dist/core/protocols/session.d.ts.map new file mode 100644 index 0000000..6ef719c --- /dev/null +++ b/dist/core/protocols/session.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/core/protocols/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;AAQ3D,eAAO,MAAM,cAAc,GACzB,YAAY,MAAM,EAClB,SAAS,cAAc,sBAsCxB,CAAA;AAED,eAAO,MAAM,WAAW,GACtB,YAAY,MAAM,EAClB,SAAS,cAAc,EACvB,UAAU;IACR,mBAAmB,EAAE,MAAM,CAAA;CAC5B,EACD,QAAQ,MAAM,EAAE,sBAgEjB,CAAA;AAED,eAAO,MAAM,cAAc,GACzB,YAAY,MAAM,EAClB,SAAS,cAAc,sBAqCxB,CAAA"} \ No newline at end of file diff --git a/dist/core/protocols/session.js b/dist/core/protocols/session.js new file mode 100644 index 0000000..3f30b88 --- /dev/null +++ b/dist/core/protocols/session.js @@ -0,0 +1,110 @@ +import { parseCookies } from "payload"; +import { UnauthorizedAPIRequest, UserNotFoundAPIError, } from "../errors/apiErrors.js"; +import { createSessionCookies, verifySessionCookie } from "../utils/cookies.js"; +import { ErrorKind, SuccessKind } from "../../types.js"; +export const SessionRefresh = async (cookieName, request) => { + const { payload } = request; + const cookies = parseCookies(request.headers); + const token = cookies.get(cookieName); + if (!token) { + return new UnauthorizedAPIRequest(); + } + const jwtResponse = await verifySessionCookie(token, payload.secret); + if (!jwtResponse.payload) { + return new UnauthorizedAPIRequest(); + } + let refreshCookies = []; + refreshCookies = [ + ...(await createSessionCookies(cookieName, payload.secret, jwtResponse.payload)), + ]; + const res = new Response(JSON.stringify({ + message: "Session refreshed", + kind: SuccessKind.Updated, + isSuccess: true, + isError: false, + }), { + status: 201, + }); + for (const cookie of refreshCookies) { + res.headers.append("Set-Cookie", cookie); + } + return res; +}; +export const SessionUser = async (cookieName, request, internal, fields) => { + const { payload } = request; + const cookies = parseCookies(request.headers); + const token = cookies.get(cookieName); + if (!token) { + return new Response(JSON.stringify({ + message: "Missing user session", + kind: ErrorKind.NotAuthenticated, + data: {}, + isSuccess: false, + isError: true, + }), { + status: 403, + }); + } + const jwtResponse = await verifySessionCookie(token, payload.secret); + if (!jwtResponse.payload) { + return new Response(JSON.stringify({ + message: "Invalid user session", + kind: ErrorKind.NotAuthenticated, + data: {}, + isSuccess: false, + isError: true, + }), { + status: 401, + }); + } + const doc = await request.payload.findByID({ + collection: internal.usersCollectionSlug, + id: jwtResponse.payload.id, + }); + if (!doc?.id) { + return new UserNotFoundAPIError(); + } + return new Response(JSON.stringify({ + message: "Fetched user session", + kind: SuccessKind.Retrieved, + data: { + isAuthenticated: true, + user: { + id: doc.id, + email: doc.email, + }, + }, + isSuccess: true, + isError: false, + }), { + status: 200, + }); +}; +export const SessionSignout = async (cookieName, request) => { + const searchParams = request.query; + const expired = "Thu, 01 Jan 1970 00:00:00 GMT"; + const cookies = []; + cookies.push(`${cookieName}=; Path=/; HttpOnly; SameSite=Lax; Expires=${expired}`); + let res = new Response(JSON.stringify({ + message: "Signed Out", + kind: SuccessKind.Deleted, + isSuccess: true, + isError: false, + }), { + status: 200, + }); + if (searchParams.returnTo) { + const returnToURL = new URL(`${request.origin}/${searchParams.returnTo}`); + res = new Response(null, { + status: 302, + headers: { + Location: returnToURL.href, + }, + }); + } + for (const cookie of cookies) { + res.headers.append("Set-Cookie", cookie); + } + return res; +}; +//# sourceMappingURL=session.js.map \ No newline at end of file diff --git a/dist/core/protocols/session.js.map b/dist/core/protocols/session.js.map new file mode 100644 index 0000000..8f547fd --- /dev/null +++ b/dist/core/protocols/session.js.map @@ -0,0 +1 @@ +{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/core/protocols/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,SAAS,CAAA;AAC3D,OAAO,EACL,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC/E,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEvD,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,UAAkB,EAClB,OAAuB,EACvB,EAAE;IACF,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;IAC3B,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAC7C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACrC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,sBAAsB,EAAE,CAAA;IACrC,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IACpE,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QACzB,OAAO,IAAI,sBAAsB,EAAE,CAAA;IACrC,CAAC;IACD,IAAI,cAAc,GAAa,EAAE,CAAA;IACjC,cAAc,GAAG;QACf,GAAG,CAAC,MAAM,oBAAoB,CAC5B,UAAU,EACV,OAAO,CAAC,MAAM,EACd,WAAW,CAAC,OAAO,CACpB,CAAC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f,OAAO,EAAE,KAAK;KACf,CAAC,EACF;QACE,MAAM,EAAE,GAAG;KACZ,CACF,CAAA;IAED,IAAI,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC1B,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,IAAI,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAA;QACzE,GAAG,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE;YACvB,MAAM,EAAE,GAAG;YACX,OAAO,EAAE;gBACP,QAAQ,EAAE,WAAW,CAAC,IAAI;aAC3B;SACF,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;IAC1C,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/core/routeHandlers/oauth.d.ts b/dist/core/routeHandlers/oauth.d.ts new file mode 100644 index 0000000..f86c1c3 --- /dev/null +++ b/dist/core/routeHandlers/oauth.d.ts @@ -0,0 +1,10 @@ +import type { OAuthHandlersParams, ParsedOAuthState } from "../../types"; +/** + * Create OAuth state parameter + */ +export declare function createOAuthState(data: ParsedOAuthState): string; +/** + * Main OAuth handler that routes to appropriate authorization or callback handlers + */ +export declare function OAuthHandlers(params: OAuthHandlersParams): Promise; +//# sourceMappingURL=oauth.d.ts.map \ No newline at end of file diff --git a/dist/core/routeHandlers/oauth.d.ts.map b/dist/core/routeHandlers/oauth.d.ts.map new file mode 100644 index 0000000..7fde8e2 --- /dev/null +++ b/dist/core/routeHandlers/oauth.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../src/core/routeHandlers/oauth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EAEnB,gBAAgB,EACjB,MAAM,SAAS,CAAA;AAyBhB;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAO/D;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,QAAQ,CAAC,CAgEnB"} \ No newline at end of file diff --git a/dist/core/routeHandlers/oauth.js b/dist/core/routeHandlers/oauth.js new file mode 100644 index 0000000..267f8da --- /dev/null +++ b/dist/core/routeHandlers/oauth.js @@ -0,0 +1,76 @@ +import { InvalidOAuthAlgorithm, InvalidOAuthResource, InvalidProvider, } from "../errors/consoleErrors"; +import { OIDCAuthorization } from "../protocols/oauth/oidc_authorization"; +import { OAuth2Authorization } from "../protocols/oauth/oauth2_authorization"; +import { OIDCCallback } from "../protocols/oauth/oidc_callback"; +import { OAuth2Callback } from "../protocols/oauth/oauth2_callback"; +/** + * Safely parse OAuth state parameter + */ +function parseOAuthState(state) { + if (!state) + return null; + try { + return JSON.parse(decodeURIComponent(state)); + } + catch (error) { + console.warn("Failed to parse OAuth state:", error); + return null; + } +} +/** + * Create OAuth state parameter + */ +export function createOAuthState(data) { + return encodeURIComponent(JSON.stringify({ + ...data, + timestamp: Date.now(), + })); +} +/** + * Main OAuth handler that routes to appropriate authorization or callback handlers + */ +export async function OAuthHandlers(params) { + const { pluginType, collections, allowOAuthAutoSignUp, secret, useAdmin, request, provider, successRedirectPath, errorRedirectPath, state, } = params; + if (!provider) { + throw new InvalidProvider(); + } + const resource = request.routeParams?.resource; + const parsedState = parseOAuthState(state); + // Create callback params with parsed state + const callbackParams = { + pluginType, + collections, + allowOAuthAutoSignUp, + secret, + useAdmin, + request, + provider, + successRedirectPath: parsedState?.redirectPath || successRedirectPath, + errorRedirectPath, + }; + switch (resource) { + case "authorization": + switch (provider.algorithm) { + case "oidc": + return OIDCAuthorization(pluginType, request, provider, parsedState); + case "oauth2": + return OAuth2Authorization(pluginType, request, provider, undefined, parsedState); + default: + throw new InvalidOAuthAlgorithm(); + } + case "callback": + switch (provider.algorithm) { + case "oidc": { + return OIDCCallback(callbackParams, parsedState); + } + case "oauth2": { + return OAuth2Callback(callbackParams, parsedState); + } + default: + throw new InvalidOAuthAlgorithm(); + } + default: + throw new InvalidOAuthResource(); + } +} +//# sourceMappingURL=oauth.js.map \ No newline at end of file diff --git a/dist/core/routeHandlers/oauth.js.map b/dist/core/routeHandlers/oauth.js.map new file mode 100644 index 0000000..b190a4d --- /dev/null +++ b/dist/core/routeHandlers/oauth.js.map @@ -0,0 +1 @@ +{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../../src/core/routeHandlers/oauth.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,GAChB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAElE;;GAEG;AACH,SAAS,eAAe,CAAC,KAAyB;IAChD,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IAEvB,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAqB,CAAA;IAClE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAA;QACnD,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAsB;IACrD,OAAO,kBAAkB,CACvB,IAAI,CAAC,SAAS,CAAC;QACb,GAAG,IAAI;QACP,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACtB,CAAC,CACH,CAAA;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC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BACD;oBACE,MAAM,IAAI,qBAAqB,EAAE,CAAA;YACrC,CAAC;QACH;YACE,MAAM,IAAI,oBAAoB,EAAE,CAAA;IACpC,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/dist/core/routeHandlers/passkey.d.ts b/dist/core/routeHandlers/passkey.d.ts new file mode 100644 index 0000000..7c56de4 --- /dev/null +++ b/dist/core/routeHandlers/passkey.d.ts @@ -0,0 +1,4 @@ +import type { PayloadRequest } from "payload"; +import type { AccountInfo } from "../../types.js"; +export declare function PasskeyHandlers(request: PayloadRequest, resource: string, rpID: string, sessionCallBack: (accountInfo: AccountInfo) => Promise): Promise; +//# sourceMappingURL=passkey.d.ts.map \ No newline at end of file diff --git a/dist/core/routeHandlers/passkey.d.ts.map b/dist/core/routeHandlers/passkey.d.ts.map new file mode 100644 index 0000000..1207927 --- /dev/null +++ b/dist/core/routeHandlers/passkey.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"passkey.d.ts","sourceRoot":"","sources":["../../../src/core/routeHandlers/passkey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAG7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAUjD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,GAC/D,OAAO,CAAC,QAAQ,CAAC,CAenB"} \ No newline at end of file diff --git a/dist/core/routeHandlers/passkey.js b/dist/core/routeHandlers/passkey.js new file mode 100644 index 0000000..9700a58 --- /dev/null +++ b/dist/core/routeHandlers/passkey.js @@ -0,0 +1,21 @@ +import { InvalidAPIRequest } from "../errors/apiErrors.js"; +import { InitPasskey } from "../protocols/passkey/index.js"; +import { GeneratePasskeyRegistration, VerifyPasskeyRegistration, } from "../protocols/passkey/registration.js"; +import { GeneratePasskeyAuthentication, VerifyPasskeyAuthentication, } from "../protocols/passkey/authentication.js"; +export function PasskeyHandlers(request, resource, rpID, sessionCallBack) { + switch (resource) { + case "init": + return InitPasskey(request); + case "generate-registration-options": + return GeneratePasskeyRegistration(request, rpID); + case "verify-registration": + return VerifyPasskeyRegistration(request, rpID, sessionCallBack); + case "generate-authentication-options": + return GeneratePasskeyAuthentication(request, rpID); + case "verify-authentication": + return VerifyPasskeyAuthentication(request, rpID, sessionCallBack); + default: + throw new InvalidAPIRequest(); + } +} +//# sourceMappingURL=passkey.js.map \ No newline at end of file diff --git a/dist/core/routeHandlers/passkey.js.map b/dist/core/routeHandlers/passkey.js.map new file mode 100644 index 0000000..5db4e23 --- /dev/null +++ b/dist/core/routeHandlers/passkey.js.map @@ -0,0 +1 @@ +{"version":3,"file":"passkey.js","sourceRoot":"","sources":["../../../src/core/routeHandlers/passkey.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAE3D,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,GAC1B,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,wCAAwC,CAAA;AAE/C,MAAM,UAAU,eAAe,CAC7B,OAAuB,EACvB,QAAgB,EAChB,IAAY,EACZ,eAAgE;IAEhE,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,MAAM;YACT,OAAO,WAAW,CAAC,OAAO,CAAC,CAAA;QAC7B,KAAK,+BAA+B;YAClC,OAAO,2BAA2B,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QACnD,KAAK,qBAAqB;YACxB,OAAO,yBAAyB,CAAC,OAAO,EAAE,IAAI,EAAE,eAAe,CAAC,CAAA;QAClE,KAAK,iCAAiC;YACpC,OAAO,6BAA6B,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QACrD,KAAK,uBAAuB;YAC1B,OAAO,2BAA2B,CAAC,OAAO,EAAE,IAAI,EAAE,eAAe,CAAC,CAAA;QACpE;YACE,MAAM,IAAI,iBAAiB,EAAE,CAAA;IACjC,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/dist/core/routeHandlers/password.d.ts b/dist/core/routeHandlers/password.d.ts new file mode 100644 index 0000000..c21c9a3 --- /dev/null +++ b/dist/core/routeHandlers/password.d.ts @@ -0,0 +1,6 @@ +import type { PayloadRequest } from "payload"; +import type { PasswordProviderConfig } from "../../types.js"; +export declare function PasswordAuthHandlers(request: PayloadRequest, pluginType: string, kind: string, internal: { + usersCollectionSlug: string; +}, secret: string, useAdmin: boolean, successRedirectPath: string, errorRedirectPath: string, providerConfig: PasswordProviderConfig, stage?: string | undefined): Promise; +//# sourceMappingURL=password.d.ts.map \ No newline at end of file diff --git a/dist/core/routeHandlers/password.d.ts.map b/dist/core/routeHandlers/password.d.ts.map new file mode 100644 index 0000000..bf14710 --- /dev/null +++ b/dist/core/routeHandlers/password.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../../src/core/routeHandlers/password.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAU7C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAE5D,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE;IACR,mBAAmB,EAAE,MAAM,CAAA;CAC5B,EACD,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,OAAO,EACjB,mBAAmB,EAAE,MAAM,EAC3B,iBAAiB,EAAE,MAAM,EACzB,cAAc,EAAE,sBAAsB,EACtC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GACzB,OAAO,CAAC,QAAQ,CAAC,CA6CnB"} \ No newline at end of file diff --git a/dist/core/routeHandlers/password.js b/dist/core/routeHandlers/password.js new file mode 100644 index 0000000..c4ba03a --- /dev/null +++ b/dist/core/routeHandlers/password.js @@ -0,0 +1,25 @@ +import { ForgotPasswordInit, ForgotPasswordVerify, PasswordSignin, PasswordSignup, ResetPassword, } from "../protocols/password.js"; +import { InvalidAPIRequest } from "../errors/apiErrors.js"; +import { APP_COOKIE_SUFFIX } from "../../constants.js"; +export function PasswordAuthHandlers(request, pluginType, kind, internal, secret, useAdmin, successRedirectPath, errorRedirectPath, providerConfig, stage) { + switch (kind) { + case "signin": + return PasswordSignin(pluginType, request, internal, useAdmin, secret, successRedirectPath, errorRedirectPath); + case "signup": + return PasswordSignup(pluginType, request, internal, useAdmin, secret, successRedirectPath, errorRedirectPath); + case "forgot-password": + switch (stage) { + case "init": + return ForgotPasswordInit(request, internal, providerConfig.emailTemplates.forgotPassword); + case "verify": + return ForgotPasswordVerify(request, internal); + default: + throw new InvalidAPIRequest(); + } + case "reset-password": + return ResetPassword(`__${pluginType}-${APP_COOKIE_SUFFIX}`, secret, internal, request); + default: + throw new InvalidAPIRequest(); + } +} +//# sourceMappingURL=password.js.map \ No newline at end of file diff --git a/dist/core/routeHandlers/password.js.map b/dist/core/routeHandlers/password.js.map new file mode 100644 index 0000000..996f09a --- /dev/null +++ b/dist/core/routeHandlers/password.js.map @@ -0,0 +1 @@ +{"version":3,"file":"password.js","sourceRoot":"","sources":["../../../src/core/routeHandlers/password.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,aAAa,GACd,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAGtD,MAAM,UAAU,oBAAoB,CAClC,OAAuB,EACvB,UAAkB,EAClB,IAAY,EACZ,QAEC,EACD,MAAc,EACd,QAAiB,EACjB,mBAA2B,EAC3B,iBAAyB,EACzB,cAAsC,EACtC,KAA0B;IAE1B,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,QAAQ;YACX,OAAO,cAAc,CACnB,UAAU,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,mBAAmB,EACnB,iBAAiB,CAClB,CAAA;QACH,KAAK,QAAQ;YACX,OAAO,cAAc,CACnB,UAAU,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,mBAAmB,EACnB,iBAAiB,CAClB,CAAA;QACH,KAAK,iBAAiB;YACpB,QAAQ,KAAK,EAAE,CAAC;gBACd,KAAK,MAAM;oBACT,OAAO,kBAAkB,CACvB,OAAO,EACP,QAAQ,EACR,cAAc,CAAC,cAAc,CAAC,cAAc,CAC7C,CAAA;gBACH,KAAK,QAAQ;oBACX,OAAO,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;gBAChD;oBACE,MAAM,IAAI,iBAAiB,EAAE,CAAA;YACjC,CAAC;QACH,KAAK,gBAAgB;YACnB,OAAO,aAAa,CAClB,KAAK,UAAU,IAAI,iBAAiB,EAAE,EACtC,MAAM,EACN,QAAQ,EACR,OAAO,CACR,CAAA;QACH;YACE,MAAM,IAAI,iBAAiB,EAAE,CAAA;IACjC,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/dist/core/routeHandlers/session.d.ts b/dist/core/routeHandlers/session.d.ts new file mode 100644 index 0000000..2585a26 --- /dev/null +++ b/dist/core/routeHandlers/session.d.ts @@ -0,0 +1,5 @@ +import type { PayloadRequest } from "payload"; +export declare function SessionHandlers(request: PayloadRequest, pluginType: string, internals: { + usersCollectionSlug: string; +}): Promise; +//# sourceMappingURL=session.d.ts.map \ No newline at end of file diff --git a/dist/core/routeHandlers/session.d.ts.map b/dist/core/routeHandlers/session.d.ts.map new file mode 100644 index 0000000..d250a69 --- /dev/null +++ b/dist/core/routeHandlers/session.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/core/routeHandlers/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAS7C,wBAAgB,eAAe,CAC7B,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE;IACT,mBAAmB,EAAE,MAAM,CAAA;CAC5B,qBAwBF"} \ No newline at end of file diff --git a/dist/core/routeHandlers/session.js b/dist/core/routeHandlers/session.js new file mode 100644 index 0000000..832ef9d --- /dev/null +++ b/dist/core/routeHandlers/session.js @@ -0,0 +1,21 @@ +import { InvalidAPIRequest } from "../errors/apiErrors.js"; +import { SessionRefresh, SessionSignout, SessionUser, } from "../protocols/session.js"; +import { APP_COOKIE_SUFFIX } from "../../constants.js"; +export function SessionHandlers(request, pluginType, internals) { + if (pluginType === "admin") { + // TODO: Implementation is not necessary as it is already handled by Payload. But can be customised. + throw new InvalidAPIRequest(); + } + const kind = request.routeParams?.kind; + switch (kind) { + case "refresh": + return SessionRefresh(`__${pluginType}-${APP_COOKIE_SUFFIX}`, request); + case "user": + return SessionUser(`__${pluginType}-${APP_COOKIE_SUFFIX}`, request, internals, []); + case "signout": + return SessionSignout(`__${pluginType}-${APP_COOKIE_SUFFIX}`, request); + default: + throw new InvalidAPIRequest(); + } +} +//# sourceMappingURL=session.js.map \ No newline at end of file diff --git a/dist/core/routeHandlers/session.js.map b/dist/core/routeHandlers/session.js.map new file mode 100644 index 0000000..78b8802 --- /dev/null +++ b/dist/core/routeHandlers/session.js.map @@ -0,0 +1 @@ +{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/core/routeHandlers/session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EACL,cAAc,EACd,cAAc,EACd,WAAW,GACZ,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAEtD,MAAM,UAAU,eAAe,CAC7B,OAAuB,EACvB,UAAkB,EAClB,SAEC;IAED,IAAI,UAAU,KAAK,OAAO,EAAE,CAAC;QAC3B,oGAAoG;QACpG,MAAM,IAAI,iBAAiB,EAAE,CAAA;IAC/B,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,IAAc,CAAA;IAEhD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,SAAS;YACZ,OAAO,cAAc,CAAC,KAAK,UAAU,IAAI,iBAAiB,EAAE,EAAE,OAAO,CAAC,CAAA;QACxE,KAAK,MAAM;YACT,OAAO,WAAW,CAChB,KAAK,UAAU,IAAI,iBAAiB,EAAE,EACtC,OAAO,EACP,SAAS,EACT,EAAE,CACH,CAAA;QACH,KAAK,SAAS;YACZ,OAAO,cAAc,CAAC,KAAK,UAAU,IAAI,iBAAiB,EAAE,EAAE,OAAO,CAAC,CAAA;QACxE;YACE,MAAM,IAAI,iBAAiB,EAAE,CAAA;IACjC,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/dist/core/utils/cb.d.ts b/dist/core/utils/cb.d.ts new file mode 100644 index 0000000..703c194 --- /dev/null +++ b/dist/core/utils/cb.d.ts @@ -0,0 +1,2 @@ +export declare function getCallbackURL(baseURL: string, pluginType: string, provider: string): URL; +//# sourceMappingURL=cb.d.ts.map \ No newline at end of file diff --git a/dist/core/utils/cb.d.ts.map b/dist/core/utils/cb.d.ts.map new file mode 100644 index 0000000..7bcc43d --- /dev/null +++ b/dist/core/utils/cb.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"cb.d.ts","sourceRoot":"","sources":["../../../src/core/utils/cb.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,GAAG,CAKL"} \ No newline at end of file diff --git a/dist/core/utils/cb.js b/dist/core/utils/cb.js new file mode 100644 index 0000000..94b01a1 --- /dev/null +++ b/dist/core/utils/cb.js @@ -0,0 +1,7 @@ +export function getCallbackURL(baseURL, pluginType, provider) { + const callback_url = new URL(baseURL); + callback_url.pathname = `/api/${pluginType}/oauth/callback/${provider}`; + callback_url.search = ""; + return callback_url; +} +//# sourceMappingURL=cb.js.map \ No newline at end of file diff --git a/dist/core/utils/cb.js.map b/dist/core/utils/cb.js.map new file mode 100644 index 0000000..9b49687 --- /dev/null +++ b/dist/core/utils/cb.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cb.js","sourceRoot":"","sources":["../../../src/core/utils/cb.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc,CAC5B,OAAe,EACf,UAAkB,EAClB,QAAgB;IAEhB,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,OAAO,CAAQ,CAAA;IAC5C,YAAY,CAAC,QAAQ,GAAG,QAAQ,UAAU,mBAAmB,QAAQ,EAAE,CAAA;IACvE,YAAY,CAAC,MAAM,GAAG,EAAE,CAAA;IACxB,OAAO,YAAY,CAAA;AACrB,CAAC"} \ No newline at end of file diff --git a/dist/core/utils/cookies.d.ts b/dist/core/utils/cookies.d.ts new file mode 100644 index 0000000..95f0dde --- /dev/null +++ b/dist/core/utils/cookies.d.ts @@ -0,0 +1,12 @@ +import * as jwt from "jose"; +export declare function createSessionCookies(name: string, secret: string, fieldsToSign: Record, expiration?: number): Promise; +export declare function verifySessionCookie(token: string, secret: string): Promise>; +export declare function invalidateOAuthCookies(cookies: string[]): string[]; +export declare const invalidateSessionCookies: (name: string, cookies: string[]) => string[]; +//# sourceMappingURL=cookies.d.ts.map \ No newline at end of file diff --git a/dist/core/utils/cookies.d.ts.map b/dist/core/utils/cookies.d.ts.map new file mode 100644 index 0000000..0d55b36 --- /dev/null +++ b/dist/core/utils/cookies.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../../src/core/utils/cookies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,MAAM,CAAA;AAG3B,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,UAAU,CAAC,EAAE,MAAM,qBAsBpB;AAED,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;QAG/D,MAAM;WACH,MAAM;gBACD,MAAM;SACb,MAAM;SACN,MAAM;IAEd;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,YAevD;AAED,eAAO,MAAM,wBAAwB,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,EAAE,aAIvE,CAAA"} \ No newline at end of file diff --git a/dist/core/utils/cookies.js b/dist/core/utils/cookies.js new file mode 100644 index 0000000..ec13912 --- /dev/null +++ b/dist/core/utils/cookies.js @@ -0,0 +1,37 @@ +import * as jwt from "jose"; +import { getCookieExpiration } from "payload"; +export async function createSessionCookies(name, secret, fieldsToSign, expiration) { + const tokenExpiration = expiration ?? + getCookieExpiration({ + seconds: 7200, + }).getTime(); + const secretKey = new TextEncoder().encode(secret); + const issuedAt = Math.floor(Date.now() / 1000); + const exp = issuedAt + tokenExpiration; + const token = await new jwt.SignJWT(fieldsToSign) + .setProtectedHeader({ alg: "HS256", typ: "JWT" }) + .setIssuedAt(issuedAt) + .setExpirationTime(exp) + .sign(secretKey); + const cookies = []; + cookies.push(`${name}=${token};Path=/;HttpOnly;SameSite=lax;Expires=${getCookieExpiration({ seconds: expiration }).toUTCString()}`); + return cookies; +} +export async function verifySessionCookie(token, secret) { + const secretKey = new TextEncoder().encode(secret); + return await jwt.jwtVerify(token, secretKey); +} +export function invalidateOAuthCookies(cookies) { + const expired = "Thu, 01 Jan 1970 00:00:00 GMT"; + cookies.push(`__session-oauth-state=; Path=/; HttpOnly; SameSite=Lax; Expires=${expired}`); + cookies.push(`__session-oauth-nonce=; Path=/; HttpOnly; SameSite=Lax; Expires=${expired}`); + cookies.push(`__session-code-verifier=; Path=/; HttpOnly; SameSite=Lax; Expires=${expired}`); + cookies.push(`__session-webpk-challenge=; Path=/; HttpOnly; SameSite=Lax; Expires=${expired}`); + return cookies; +} +export const invalidateSessionCookies = (name, cookies) => { + const expired = "Thu, 01 Jan 1970 00:00:00 GMT"; + cookies.push(`${name}=; Path=/; HttpOnly; SameSite=Lax; Expires=${expired}`); + return cookies; +}; +//# sourceMappingURL=cookies.js.map \ No newline at end of file diff --git a/dist/core/utils/cookies.js.map b/dist/core/utils/cookies.js.map new file mode 100644 index 0000000..26647ab --- /dev/null +++ b/dist/core/utils/cookies.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cookies.js","sourceRoot":"","sources":["../../../src/core/utils/cookies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAE7C,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,IAAY,EACZ,MAAc,EACd,YAAqC,EACrC,UAAmB;IAEnB,MAAM,eAAe,GACnB,UAAU;QACV,mBAAmB,CAAC;YAClB,OAAO,EAAE,IAAI;SACd,CAAC,CAAC,OAAO,EAAE,CAAA;IAEd,MAAM,SAAS,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;IAC9C,MAAM,GAAG,GAAG,QAAQ,GAAG,eAAe,CAAA;IACtC,MAAM,KAAK,GAAG,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC;SAC9C,kBAAkB,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;SAChD,WAAW,CAAC,QAAQ,CAAC;SACrB,iBAAiB,CAAC,GAAG,CAAC;SACtB,IAAI,CAAC,SAAS,CAAC,CAAA;IAElB,MAAM,OAAO,GAAa,EAAE,CAAA;IAC5B,OAAO,CAAC,IAAI,CACV,GAAG,IAAI,IAAI,KAAK,yCAAyC,mBAAmB,CAAC,EAAE,OAAO,EAAE,UAAW,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CACvH,CAAA;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,KAAa,EAAE,MAAc;IACrE,MAAM,SAAS,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAClD,OAAO,MAAM,GAAG,CAAC,SAAS,CAMvB,KAAK,EAAE,SAAS,CAAC,CAAA;AACtB,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,OAAiB;IACtD,MAAM,OAAO,GAAG,+BAA+B,CAAA;IAC/C,OAAO,CAAC,IAAI,CACV,mEAAmE,OAAO,EAAE,CAC7E,CAAA;IACD,OAAO,CAAC,IAAI,CACV,mEAAmE,OAAO,EAAE,CAC7E,CAAA;IACD,OAAO,CAAC,IAAI,CACV,qEAAqE,OAAO,EAAE,CAC/E,CAAA;IACD,OAAO,CAAC,IAAI,CACV,uEAAuE,OAAO,EAAE,CACjF,CAAA;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,IAAY,EAAE,OAAiB,EAAE,EAAE;IAC1E,MAAM,OAAO,GAAG,+BAA+B,CAAA;IAC/C,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,8CAA8C,OAAO,EAAE,CAAC,CAAA;IAC5E,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/core/utils/hash.d.ts b/dist/core/utils/hash.d.ts new file mode 100644 index 0000000..1e84f6a --- /dev/null +++ b/dist/core/utils/hash.d.ts @@ -0,0 +1,7 @@ +export declare function hashCode(s: string): number; +export declare const ephemeralCode: (length: number, secret: string) => Promise<{ + hash: string; + code: string; +}>; +export declare const verifyEphemeralCode: (code: string, hashB64: string, secret: string) => Promise; +//# sourceMappingURL=hash.d.ts.map \ No newline at end of file diff --git a/dist/core/utils/hash.d.ts.map b/dist/core/utils/hash.d.ts.map new file mode 100644 index 0000000..8b0d52f --- /dev/null +++ b/dist/core/utils/hash.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../../src/core/utils/hash.ts"],"names":[],"mappings":"AAEA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,UAMjC;AAED,eAAO,MAAM,aAAa,GAAU,QAAQ,MAAM,EAAE,QAAQ,MAAM;;;EAqCjE,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC9B,MAAM,MAAM,EACZ,SAAS,MAAM,EACf,QAAQ,MAAM,qBAqBf,CAAA"} \ No newline at end of file diff --git a/dist/core/utils/hash.js b/dist/core/utils/hash.js new file mode 100644 index 0000000..f09b101 --- /dev/null +++ b/dist/core/utils/hash.js @@ -0,0 +1,54 @@ +import * as jose from "jose"; +export function hashCode(s) { + let h = 0; + const l = s.length; + let i = 0; + if (l > 0) + while (i < l) + h = ((h << 5) + h + s.charCodeAt(i++)) | 0; + return h; +} +export const ephemeralCode = async (length, secret) => { + const code = []; + while (code.length < length) { + const buffer = crypto.getRandomValues(new Uint8Array(length * 2)); + for (const byte of buffer) { + if (byte < 250 && code.length < length) { + code.push(byte % 10); + } + } + } + const codeStr = code.join(""); + const iterations = 600000; + const encoder = new TextEncoder(); + const bytes = encoder.encode(codeStr); + const salt = encoder.encode(secret); + const keyMaterial = await crypto.subtle.importKey("raw", bytes, "PBKDF2", false, ["deriveBits"]); + const hash = await crypto.subtle.deriveBits({ + name: "PBKDF2", + hash: "SHA-256", + salt: salt, + iterations, + }, keyMaterial, 256); + const hashB64 = jose.base64url.encode(new Uint8Array(hash)); + return { + hash: hashB64, + code: codeStr, + }; +}; +export const verifyEphemeralCode = async (code, hashB64, secret) => { + const encoder = new TextEncoder(); + const codeBytes = encoder.encode(code); + const salt = encoder.encode(secret); + const params = { + name: "PBKDF2", + hash: "SHA-256", + salt, + iterations: 600000, + }; + const keyMaterial = await crypto.subtle.importKey("raw", codeBytes, "PBKDF2", false, ["deriveBits"]); + const hash = await crypto.subtle.deriveBits(params, keyMaterial, 256); + const hashBase64 = jose.base64url.encode(new Uint8Array(hash)); + return hashBase64 === hashB64; +}; +//# sourceMappingURL=hash.js.map \ No newline at end of file diff --git a/dist/core/utils/hash.js.map b/dist/core/utils/hash.js.map new file mode 100644 index 0000000..9d9d60f --- /dev/null +++ b/dist/core/utils/hash.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../../src/core/utils/hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,MAAM,UAAU,QAAQ,CAAC,CAAS;IAChC,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAA;IAClB,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,GAAG,CAAC;YAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAA;IACnE,OAAO,CAAC,CAAA;AACV,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,MAAc,EAAE,MAAc,EAAE,EAAE;IACpE,MAAM,IAAI,GAAa,EAAE,CAAA;IACzB,OAAO,IAAI,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,MAAM,GAAG,CA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AC,CAAA;IACtC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACnC,MAAM,MAAM,GAAG;QACb,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,SAAS;QACf,IAAI;QACJ,UAAU,EAAE,MAAM;KACnB,CAAA;IACD,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAC/C,KAAK,EACL,SAAS,EACT,QAAQ,EACR,KAAK,EACL,CAAC,YAAY,CAAC,CACf,CAAA;IACD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,CAAA;IACrE,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA;IAC9D,OAAO,UAAU,KAAK,OAAO,CAAA;AAC/B,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/core/utils/password.d.ts b/dist/core/utils/password.d.ts new file mode 100644 index 0000000..e789731 --- /dev/null +++ b/dist/core/utils/password.d.ts @@ -0,0 +1,7 @@ +export declare const hashPassword: (password: string) => Promise<{ + hash: string; + salt: string; + iterations: number; +}>; +export declare const verifyPassword: (password: string, hashB64: string, saltB64: string, iterations: number) => Promise; +//# sourceMappingURL=password.d.ts.map \ No newline at end of file diff --git a/dist/core/utils/password.d.ts.map b/dist/core/utils/password.d.ts.map new file mode 100644 index 0000000..068e09b --- /dev/null +++ b/dist/core/utils/password.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../../src/core/utils/password.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,GAAU,UAAU,MAAM;;;;EA6BlD,CAAA;AAED,eAAO,MAAM,cAAc,GACzB,UAAU,MAAM,EAChB,SAAS,MAAM,EACf,SAAS,MAAM,EACf,YAAY,MAAM,qBAqBnB,CAAA"} \ No newline at end of file diff --git a/dist/core/utils/password.js b/dist/core/utils/password.js new file mode 100644 index 0000000..2a3834d --- /dev/null +++ b/dist/core/utils/password.js @@ -0,0 +1,37 @@ +import * as jose from "jose"; +export const hashPassword = async (password) => { + const iterations = 600000; + const encoder = new TextEncoder(); + const bytes = encoder.encode(password); + const salt = crypto.getRandomValues(new Uint8Array(16)); + const keyMaterial = await crypto.subtle.importKey("raw", bytes, "PBKDF2", false, ["deriveBits"]); + const hash = await crypto.subtle.deriveBits({ + name: "PBKDF2", + hash: "SHA-256", + salt: salt, + iterations, + }, keyMaterial, 256); + const hashB64 = jose.base64url.encode(new Uint8Array(hash)); + const saltB64 = jose.base64url.encode(salt); + return { + hash: hashB64, + salt: saltB64, + iterations, + }; +}; +export const verifyPassword = async (password, hashB64, saltB64, iterations) => { + const encoder = new TextEncoder(); + const passwordBytes = encoder.encode(password); + const salt = jose.base64url.decode(saltB64); + const params = { + name: "PBKDF2", + hash: "SHA-256", + salt, + iterations, + }; + const keyMaterial = await crypto.subtle.importKey("raw", passwordBytes, "PBKDF2", false, ["deriveBits"]); + const hash = await crypto.subtle.deriveBits(params, keyMaterial, 256); + const hashBase64 = jose.base64url.encode(new Uint8Array(hash)); + return hashBase64 === hashB64; +}; +//# sourceMappingURL=password.js.map \ No newline at end of file diff --git a/dist/core/utils/password.js.map b/dist/core/utils/password.js.map new file mode 100644 index 0000000..de90461 --- /dev/null +++ b/dist/core/utils/password.js.map @@ -0,0 +1 @@ +{"version":3,"file":"password.js","sourceRoot":"","sources":["../../../src/core/utils/password.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,QAAgB,EAAE,EAAE;IACrD,MAAM,UAAU,GAAG,MAAM,CAAA;IACzB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;IACjC,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA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ACf,CAAA;IACD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,CAAA;IACrE,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA;IAC9D,OAAO,UAAU,KAAK,OAAO,CAAA;AAC/B,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/core/utils/session.d.ts b/dist/core/utils/session.d.ts new file mode 100644 index 0000000..162a50a --- /dev/null +++ b/dist/core/utils/session.d.ts @@ -0,0 +1,3 @@ +import { UserSession } from "../../types.js"; +export declare const removeExpiredSessions: (sessions: UserSession[]) => UserSession[]; +//# sourceMappingURL=session.d.ts.map \ No newline at end of file diff --git a/dist/core/utils/session.d.ts.map b/dist/core/utils/session.d.ts.map new file mode 100644 index 0000000..54f89e0 --- /dev/null +++ b/dist/core/utils/session.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/core/utils/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,eAAO,MAAM,qBAAqB,GAAI,UAAU,WAAW,EAAE,kBAO5D,CAAA"} \ No newline at end of file diff --git a/dist/core/utils/session.js b/dist/core/utils/session.js new file mode 100644 index 0000000..c43293d --- /dev/null +++ b/dist/core/utils/session.js @@ -0,0 +1,8 @@ +export const removeExpiredSessions = (sessions) => { + const now = new Date(); + return sessions.filter(({ expiresAt }) => { + const expiry = expiresAt instanceof Date ? expiresAt : new Date(expiresAt); + return expiry > now; + }); +}; +//# sourceMappingURL=session.js.map \ No newline at end of file diff --git a/dist/core/utils/session.js.map b/dist/core/utils/session.js.map new file mode 100644 index 0000000..0b904e4 --- /dev/null +++ b/dist/core/utils/session.js.map @@ -0,0 +1 @@ +{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/core/utils/session.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAAuB,EAAE,EAAE;IAC/D,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAA;IAEtB,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;QACvC,MAAM,MAAM,GAAG,SAAS,YAAY,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,CAAA;QAC1E,OAAO,MAAM,GAAG,GAAG,CAAA;IACrB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/core/utils/slug.d.ts b/dist/core/utils/slug.d.ts new file mode 100644 index 0000000..32b5dc2 --- /dev/null +++ b/dist/core/utils/slug.d.ts @@ -0,0 +1,2 @@ +export declare const formatSlug: (val: string) => string; +//# sourceMappingURL=slug.d.ts.map \ No newline at end of file diff --git a/dist/core/utils/slug.d.ts.map b/dist/core/utils/slug.d.ts.map new file mode 100644 index 0000000..748c035 --- /dev/null +++ b/dist/core/utils/slug.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"slug.d.ts","sourceRoot":"","sources":["../../../src/core/utils/slug.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,KAAG,MAIvB,CAAA"} \ No newline at end of file diff --git a/dist/core/utils/slug.js b/dist/core/utils/slug.js new file mode 100644 index 0000000..2a385b4 --- /dev/null +++ b/dist/core/utils/slug.js @@ -0,0 +1,5 @@ +export const formatSlug = (val) => val + .replace(/ /g, "-") + .replace(/[^\w-]+/g, "") + .toLowerCase(); +//# sourceMappingURL=slug.js.map \ No newline at end of file diff --git a/dist/core/utils/slug.js.map b/dist/core/utils/slug.js.map new file mode 100644 index 0000000..228391a --- /dev/null +++ b/dist/core/utils/slug.js.map @@ -0,0 +1 @@ +{"version":3,"file":"slug.js","sourceRoot":"","sources":["../../../src/core/utils/slug.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAW,EAAU,EAAE,CAChD,GAAG;KACA,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;KAClB,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;KACvB,WAAW,EAAE,CAAA"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..1bbade4 --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,2 @@ +export { authPlugin } from "./plugin.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map new file mode 100644 index 0000000..a09ab36 --- /dev/null +++ b/dist/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..662800e --- /dev/null +++ b/dist/index.js @@ -0,0 +1,2 @@ +export { authPlugin } from "./plugin.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map new file mode 100644 index 0000000..4a9a15f --- /dev/null +++ b/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA"} \ No newline at end of file diff --git a/dist/plugin.d.ts b/dist/plugin.d.ts new file mode 100644 index 0000000..9d9a64b --- /dev/null +++ b/dist/plugin.d.ts @@ -0,0 +1,90 @@ +/** + * The App plugin is used for authenticating users in the frontent app of the Payload CMS application. + * It support magic link, password, OAuth, and Passkey based authentications. + * + * On top of it, to add additional security it also support 2FA using OTP, and TOTP. + * + * The set up is very lean and flexible to tailor the auth process in a specific way. + * + * ```ts + * import {authPlugin} from "payload-auth-plugin"; + * + * export const plugins = [ + * authPlugin({ + * name: "a-unique-name", + * usersCollectionSlug: "users-collection-slug", + * accountsCollectionSlug: "accounts-collection-slug", + * providers:[] + * }) + * ] + * + * ``` + * @packageDocumentation + */ +import type { Plugin } from "payload"; +import type { PasswordProviderConfig, OAuthProviderConfig, PasskeyProviderConfig } from "./types.js"; +/** + * Adds authentication to the Payload app. + */ +interface PluginOptions { + /** + * Enable or disable plugin + * + * @default true + * + */ + enabled?: boolean | undefined; + /** + * This name will be used to created endpoints, tokens, and etc. + * For example, if you want to pass + */ + name: string; + /** + * + * Enable authuentication only-for Admin + * + */ + useAdmin?: boolean | undefined; + /** + * Auth providers supported by the plugin + * + */ + providers: (OAuthProviderConfig | PasskeyProviderConfig | PasswordProviderConfig)[]; + /** + * Users collection slug. + * + * The collection to store all the user records. + * + */ + usersCollectionSlug: string; + /** + * User accounts collection slug. + * + * The collection to store all the account records thant belongs to a user. + * Multiple accounts can belong to one user + * + */ + accountsCollectionSlug: string; + /** + * Allow auto signup if user doesn't have an account. + * + * @default false + * + */ + allowOAuthAutoSignUp?: boolean | undefined; + /** + * Path to redirect upon successful signin, signups and etc + * + * Example: /dashboard or /admin or /profile + */ + successRedirectPath: string; + /** + * Path to redirect upon failed signin, signups and etc. + * + * Example: /dashboard or /admin or /profile + */ + errorRedirectPath: string; +} +export declare const authPlugin: (pluginOptions: PluginOptions) => Plugin; +export {}; +//# sourceMappingURL=plugin.d.ts.map \ No newline at end of file diff --git a/dist/plugin.d.ts.map b/dist/plugin.d.ts.map new file mode 100644 index 0000000..f4c3ee9 --- /dev/null +++ b/dist/plugin.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAoB,MAAM,EAAE,MAAM,SAAS,CAAA;AACvD,OAAO,KAAK,EACV,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,YAAY,CAAA;AAoBnB;;GAEG;AACH,UAAU,aAAa;IACrB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;;;OAIG;IAEH,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAE9B;;;OAGG;IACH,SAAS,EAAE,CACP,mBAAmB,GACnB,qBAAqB,GACrB,sBAAsB,CACzB,EAAE,CAAA;IAEH;;;;;OAKG;IACH,mBAAmB,EAAE,MAAM,CAAA;IAE3B;;;;;;OAMG;IACH,sBAAsB,EAAE,MAAM,CAAA;IAE9B;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAE1C;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,CAAA;IAE3B;;;;OAIG;IACH,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AAED,eAAO,MAAM,UAAU,GACpB,eAAe,aAAa,KAAG,MA+F/B,CAAA"} \ No newline at end of file diff --git a/dist/plugin.js b/dist/plugin.js new file mode 100644 index 0000000..42d863f --- /dev/null +++ b/dist/plugin.js @@ -0,0 +1,78 @@ +/** + * The App plugin is used for authenticating users in the frontent app of the Payload CMS application. + * It support magic link, password, OAuth, and Passkey based authentications. + * + * On top of it, to add additional security it also support 2FA using OTP, and TOTP. + * + * The set up is very lean and flexible to tailor the auth process in a specific way. + * + * ```ts + * import {authPlugin} from "payload-auth-plugin"; + * + * export const plugins = [ + * authPlugin({ + * name: "a-unique-name", + * usersCollectionSlug: "users-collection-slug", + * accountsCollectionSlug: "accounts-collection-slug", + * providers:[] + * }) + * ] + * + * ``` + * @packageDocumentation + */ +import { InvalidServerURL, MissingEmailAdapter, } from "./core/errors/consoleErrors.js"; +import { getPasswordProvider, getOAuthProviders, getPasskeyProvider, } from "./providers/utils.js"; +import { PasswordAuthEndpointStrategy, EndpointsFactory, OAuthEndpointStrategy, PasskeyEndpointStrategy, SessionEndpointStrategy, } from "./core/endpoints.js"; +import { formatSlug } from "./core/utils/slug.js"; +import { preflightCollectionCheck } from "./core/preflights/collections.js"; +export const authPlugin = (pluginOptions) => (incomingConfig) => { + const config = { ...incomingConfig }; + if (pluginOptions.enabled === false) { + return config; + } + if (!config.serverURL) { + throw new InvalidServerURL(); + } + const { usersCollectionSlug, accountsCollectionSlug, providers, allowOAuthAutoSignUp, useAdmin, successRedirectPath, errorRedirectPath, } = pluginOptions; + preflightCollectionCheck([usersCollectionSlug, accountsCollectionSlug], config.collections); + const name = formatSlug(pluginOptions.name); + const oauthProviders = getOAuthProviders(providers); + const passkeyProvider = getPasskeyProvider(providers); + const passwordProvider = getPasswordProvider(providers); + const endpointsFactory = new EndpointsFactory(name, { + usersCollection: usersCollectionSlug, + accountsCollection: accountsCollectionSlug, + }, allowOAuthAutoSignUp ?? false, !!useAdmin, successRedirectPath, errorRedirectPath); + let oauthEndpoints = []; + let passkeyEndpoints = []; + let passwordEndpoints = []; + if (Object.keys(oauthProviders).length > 0) { + endpointsFactory.registerStrategy("oauth", new OAuthEndpointStrategy(oauthProviders)); + oauthEndpoints = endpointsFactory.createEndpoints("oauth"); + } + if (passkeyProvider) { + endpointsFactory.registerStrategy("passkey", new PasskeyEndpointStrategy()); + passkeyEndpoints = endpointsFactory.createEndpoints("passkey"); + } + if (passwordProvider) { + if (!config.email) { + throw new MissingEmailAdapter(); + } + endpointsFactory.registerStrategy("password", new PasswordAuthEndpointStrategy({ + usersCollectionSlug, + }, passwordProvider)); + passwordEndpoints = endpointsFactory.createEndpoints("password"); + } + endpointsFactory.registerStrategy("session", new SessionEndpointStrategy({ usersCollectionSlug })); + const sessionEndpoints = endpointsFactory.createEndpoints("session"); + config.endpoints = [ + ...(config.endpoints ?? []), + ...oauthEndpoints, + ...passkeyEndpoints, + ...passwordEndpoints, + ...sessionEndpoints, + ]; + return config; +}; +//# sourceMappingURL=plugin.js.map \ No newline at end of file diff --git a/dist/plugin.js.map b/dist/plugin.js.map new file mode 100644 index 0000000..b378a8e --- /dev/null +++ b/dist/plugin.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAQH,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,4BAA4B,EAC5B,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAA;AA6E3E,MAAM,CAAC,MAAM,UAAU,GACrB,CAAC,aAA4B,EAAU,EAAE,CACzC,CAAC,cAAsB,EAAU,EAAE;IACjC,MAAM,MAAM,GAAG,EAAE,GAAG,cAAc,EAAE,CAAA;IAEpC,IAAI,aAAa,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;QACpC,OAAO,MAAM,CAAA;IACf,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QACtB,MAAM,IAAI,gBAAgB,EAAE,CAAA;IAC9B,CAAC;IAED,MAAM,EACJ,mBAAmB,EACnB,sBAAsB,EACtB,SAAS,EACT,oBAAoB,EACpB,QAAQ,EACR,mBAAmB,EACnB,iBAAiB,GAClB,GAAG,aAAa,CAAA;IAEjB,wBAAwB,CACtB,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,EAC7C,MAAM,CAAC,WAAW,CACnB,CAAA;IAED,MAAM,IAAI,GAAG,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;IAE3C,MAAM,cAAc,GAAG,iBAAiB,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gBAAgB,CAAC,gBAAgB,CAC/B,SAAS,EACT,IAAI,uBAAuB,CAAC,EAAE,mBAAmB,EAAE,CAAC,CACrD,CAAA;IACD,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,eAAe,CAAC,SAAS,CAAC,CAAA;IAEpE,MAAM,CAAC,SAAS,GAAG;QACjB,GAAG,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;QAC3B,GAAG,cAAc;QACjB,GAAG,gBAAgB;QACnB,GAAG,iBAAiB;QACpB,GAAG,gBAAgB;KACpB,CAAA;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/providers/index.d.ts b/dist/providers/index.d.ts new file mode 100644 index 0000000..edef66e --- /dev/null +++ b/dist/providers/index.d.ts @@ -0,0 +1,20 @@ +import GoogleAuthProvider from "./oidc/google.js"; +import GitHubAuthProvider from "./oauth2/github.js"; +import GitLabAuthProvider from "./oidc/gitlab.js"; +import AtlassianAuthProvider from "./oauth2/atlassian.js"; +import DiscordAuthProvider from "./oauth2/discord.js"; +import FacebookAuthProvider from "./oauth2/facebook.js"; +import SlackAuthProvider from "./oidc/slack.js"; +import Auth0AuthProvider from "./oauth2/auth0.js"; +import OktaAuthProvider from "./oidc/okta.js"; +import CognitoAuthProvider from "./oidc/cognito.js"; +import KeyCloakAuthProvider from "./oidc/keycloak.js"; +import PasskeyAuthProvider from "./passkey.js"; +import MicrosoftEntraAuthProvider from "./oidc/microsoft-entra.js"; +import AppleOIDCAuthProvider from "./oidc/apple.js"; +import AppleOAuth2Provider from "./oauth2/apple.js"; +import JumpCloudAuthProvider from "./oauth2/jumpcloud.js"; +import TwitchAuthProvider from "./oauth2/twitch.js"; +import PasswordProvider from "./password.js"; +export { GoogleAuthProvider, GitHubAuthProvider, GitLabAuthProvider, AtlassianAuthProvider, DiscordAuthProvider, FacebookAuthProvider, SlackAuthProvider, Auth0AuthProvider, CognitoAuthProvider, KeyCloakAuthProvider, PasskeyAuthProvider, MicrosoftEntraAuthProvider, AppleOIDCAuthProvider, AppleOAuth2Provider, JumpCloudAuthProvider, TwitchAuthProvider, PasswordProvider, OktaAuthProvider, }; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/providers/index.d.ts.map b/dist/providers/index.d.ts.map new file mode 100644 index 0000000..0a72904 --- /dev/null +++ b/dist/providers/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,kBAAkB,CAAA;AACjD,OAAO,kBAAkB,MAAM,oBAAoB,CAAA;AACnD,OAAO,kBAAkB,MAAM,kBAAkB,CAAA;AACjD,OAAO,qBAAqB,MAAM,uBAAuB,CAAA;AACzD,OAAO,mBAAmB,MAAM,qBAAqB,CAAA;AACrD,OAAO,oBAAoB,MAAM,sBAAsB,CAAA;AACvD,OAAO,iBAAiB,MAAM,iBAAiB,CAAA;AAC/C,OAAO,iBAAiB,MAAM,mBAAmB,CAAA;AACjD,OAAO,gBAAgB,MAAM,gBAAgB,CAAA;AAC7C,OAAO,mBAAmB,MAAM,mBAAmB,CAAA;AACnD,OAAO,oBAAoB,MAAM,oBAAoB,CAAA;AACrD,OAAO,mBAAmB,MAAM,cAAc,CAAA;AAC9C,OAAO,0BAA0B,MAAM,2BAA2B,CAAA;AAClE,OAAO,qBAAqB,MAAM,iBAAiB,CAAA;AACnD,OAAO,mBAAmB,MAAM,mBAAmB,CAAA;AACnD,OAAO,qBAAqB,MAAM,uBAAuB,CAAA;AACzD,OAAO,kBAAkB,MAAM,oBAAoB,CAAA;AACnD,OAAO,gBAAgB,MAAM,eAAe,CAAA;AAE5C,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,GACjB,CAAA"} \ No newline at end of file diff --git a/dist/providers/index.js b/dist/providers/index.js new file mode 100644 index 0000000..2d321ff --- /dev/null +++ b/dist/providers/index.js @@ -0,0 +1,20 @@ +import GoogleAuthProvider from "./oidc/google.js"; +import GitHubAuthProvider from "./oauth2/github.js"; +import GitLabAuthProvider from "./oidc/gitlab.js"; +import AtlassianAuthProvider from "./oauth2/atlassian.js"; +import DiscordAuthProvider from "./oauth2/discord.js"; +import FacebookAuthProvider from "./oauth2/facebook.js"; +import SlackAuthProvider from "./oidc/slack.js"; +import Auth0AuthProvider from "./oauth2/auth0.js"; +import OktaAuthProvider from "./oidc/okta.js"; +import CognitoAuthProvider from "./oidc/cognito.js"; +import KeyCloakAuthProvider from "./oidc/keycloak.js"; +import PasskeyAuthProvider from "./passkey.js"; +import MicrosoftEntraAuthProvider from "./oidc/microsoft-entra.js"; +import AppleOIDCAuthProvider from "./oidc/apple.js"; +import AppleOAuth2Provider from "./oauth2/apple.js"; +import JumpCloudAuthProvider from "./oauth2/jumpcloud.js"; +import TwitchAuthProvider from "./oauth2/twitch.js"; +import PasswordProvider from "./password.js"; +export { GoogleAuthProvider, GitHubAuthProvider, GitLabAuthProvider, AtlassianAuthProvider, DiscordAuthProvider, FacebookAuthProvider, SlackAuthProvider, Auth0AuthProvider, CognitoAuthProvider, KeyCloakAuthProvider, PasskeyAuthProvider, MicrosoftEntraAuthProvider, AppleOIDCAuthProvider, AppleOAuth2Provider, JumpCloudAuthProvider, TwitchAuthProvider, PasswordProvider, OktaAuthProvider, }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/providers/index.js.map b/dist/providers/index.js.map new file mode 100644 index 0000000..4c8f659 --- /dev/null +++ b/dist/providers/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,kBAAkB,CAAA;AACjD,OAAO,kBAAkB,MAAM,oBAAoB,CAAA;AACnD,OAAO,kBAAkB,MAAM,kBAAkB,CAAA;AACjD,OAAO,qBAAqB,MAAM,uBAAuB,CAAA;AACzD,OAAO,mBAAmB,MAAM,qBAAqB,CAAA;AACrD,OAAO,oBAAoB,MAAM,sBAAsB,CAAA;AACvD,OAAO,iBAAiB,MAAM,iBAAiB,CAAA;AAC/C,OAAO,iBAAiB,MAAM,mBAAmB,CAAA;AACjD,OAAO,gBAAgB,MAAM,gBAAgB,CAAA;AAC7C,OAAO,mBAAmB,MAAM,mBAAmB,CAAA;AACnD,OAAO,oBAAoB,MAAM,oBAAoB,CAAA;AACrD,OAAO,mBAAmB,MAAM,cAAc,CAAA;AAC9C,OAAO,0BAA0B,MAAM,2BAA2B,CAAA;AAClE,OAAO,qBAAqB,MAAM,iBAAiB,CAAA;AACnD,OAAO,mBAAmB,MAAM,mBAAmB,CAAA;AACnD,OAAO,qBAAqB,MAAM,uBAAuB,CAAA;AACzD,OAAO,kBAAkB,MAAM,oBAAoB,CAAA;AACnD,OAAO,gBAAgB,MAAM,eAAe,CAAA;AAE5C,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,GACjB,CAAA"} \ No newline at end of file diff --git a/dist/providers/magiclink.d.ts b/dist/providers/magiclink.d.ts new file mode 100644 index 0000000..8fab843 --- /dev/null +++ b/dist/providers/magiclink.d.ts @@ -0,0 +1 @@ +//# sourceMappingURL=magiclink.d.ts.map \ No newline at end of file diff --git a/dist/providers/magiclink.d.ts.map b/dist/providers/magiclink.d.ts.map new file mode 100644 index 0000000..222d950 --- /dev/null +++ b/dist/providers/magiclink.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"magiclink.d.ts","sourceRoot":"","sources":["../../src/providers/magiclink.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/providers/magiclink.js b/dist/providers/magiclink.js new file mode 100644 index 0000000..4523629 --- /dev/null +++ b/dist/providers/magiclink.js @@ -0,0 +1,3 @@ +"use strict"; +// NOT IMPLEMENTED YET +//# sourceMappingURL=magiclink.js.map \ No newline at end of file diff --git a/dist/providers/magiclink.js.map b/dist/providers/magiclink.js.map new file mode 100644 index 0000000..001cb64 --- /dev/null +++ b/dist/providers/magiclink.js.map @@ -0,0 +1 @@ +{"version":3,"file":"magiclink.js","sourceRoot":"","sources":["../../src/providers/magiclink.ts"],"names":[],"mappings":";AAAA,sBAAsB"} \ No newline at end of file diff --git a/dist/providers/oauth2/apple.d.ts b/dist/providers/oauth2/apple.d.ts new file mode 100644 index 0000000..14b555b --- /dev/null +++ b/dist/providers/oauth2/apple.d.ts @@ -0,0 +1,35 @@ +import type { OAuth2ProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; +type AppleAuthConfig = OAuthBaseProviderConfig; +/** + * Add Apple OAuth2 Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/apple + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {AppleOAuth2Provider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * AppleOAuth2Provider({ + * client_id: process.env.APPLE_CLIENT_ID as string, + * client_secret: process.env.APPLE_CLIENT_SECRET as string, + * }) + * ] + * }) + * + * ] + * ``` + * + */ +declare function AppleOAuth2Provider(config: AppleAuthConfig): OAuth2ProviderConfig; +export default AppleOAuth2Provider; +//# sourceMappingURL=apple.d.ts.map \ No newline at end of file diff --git a/dist/providers/oauth2/apple.d.ts.map b/dist/providers/oauth2/apple.d.ts.map new file mode 100644 index 0000000..7f7d915 --- /dev/null +++ b/dist/providers/oauth2/apple.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"apple.d.ts","sourceRoot":"","sources":["../../../src/providers/oauth2/apple.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,KAAK,eAAe,GAAG,uBAAuB,CAAA;AAQ9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,iBAAS,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,oBAAoB,CAwB1E;AAED,eAAe,mBAAmB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/apple.js b/dist/providers/oauth2/apple.js new file mode 100644 index 0000000..84eb1cc --- /dev/null +++ b/dist/providers/oauth2/apple.js @@ -0,0 +1,61 @@ +const authorization_server = { + issuer: "https://appleid.apple.com", + authorization_endpoint: "https://appleid.apple.com/auth/authorize", + token_endpoint: "https://appleid.apple.com/auth/token", +}; +/** + * Add Apple OAuth2 Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/apple + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {AppleOAuth2Provider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * AppleOAuth2Provider({ + * client_id: process.env.APPLE_CLIENT_ID as string, + * client_secret: process.env.APPLE_CLIENT_SECRET as string, + * }) + * ] + * }) + * + * ] + * ``` + * + */ +function AppleOAuth2Provider(config) { + const { overrideScope, ...restConfig } = config; + return { + ...restConfig, + id: "apple", + scope: overrideScope ?? "name email", + authorization_server, + name: "Apple", + algorithm: "oauth2", + params: { + ...config.params, + response_mode: "form_post", + }, + kind: "oauth", + profile: (profile) => { + return { + sub: profile.sub, + name: profile.name, + email: profile.email, + picture: profile.picture, + }; + }, + }; +} +export default AppleOAuth2Provider; +//# sourceMappingURL=apple.js.map \ No newline at end of file diff --git a/dist/providers/oauth2/apple.js.map b/dist/providers/oauth2/apple.js.map new file mode 100644 index 0000000..bab769a --- /dev/null +++ b/dist/providers/oauth2/apple.js.map @@ -0,0 +1 @@ +{"version":3,"file":"apple.js","sourceRoot":"","sources":["../../../src/providers/oauth2/apple.ts"],"names":[],"mappings":"AASA,MAAM,oBAAoB,GAAwB;IAChD,MAAM,EAAE,2BAA2B;IACnC,sBAAsB,EAAE,0CAA0C;IAClE,cAAc,EAAE,sCAAsC;CACvD,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,SAAS,mBAAmB,CAAC,MAAuB;IAClD,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,aAAa,IAAI,YAAY;QACpC,oBAAoB;QACpB,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,QAAQ;QACnB,MAAM,EAAE;YACN,GAAG,MAAM,CAAC,MAAM;YAChB,aAAa,EAAE,WAAW;SAC3B;QACD,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,mBAAmB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/atlassian.d.ts b/dist/providers/oauth2/atlassian.d.ts new file mode 100644 index 0000000..5b2ea85 --- /dev/null +++ b/dist/providers/oauth2/atlassian.d.ts @@ -0,0 +1,35 @@ +import type { OAuth2ProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; +type AtlassianAuthConfig = OAuthBaseProviderConfig; +/** + * Add Atlassian OAuth2 Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/atlassian + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {AtlassianAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugins[] = [ + * authPlugin({ + * providers:[ + * AtlassianAuthProvider({ + * client_id: process.env.ATLASSIAN_CLIENT_ID as string, + * client_secret: process.env.ATLASSIAN_CLIENT_SECRET as string, + * }) + * ] + * }) + * + * ] + * ``` + * + */ +declare function AtlassianAuthProvider(config: AtlassianAuthConfig): OAuth2ProviderConfig; +export default AtlassianAuthProvider; +//# sourceMappingURL=atlassian.d.ts.map \ No newline at end of file diff --git a/dist/providers/oauth2/atlassian.d.ts.map b/dist/providers/oauth2/atlassian.d.ts.map new file mode 100644 index 0000000..705ab22 --- /dev/null +++ b/dist/providers/oauth2/atlassian.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"atlassian.d.ts","sourceRoot":"","sources":["../../../src/providers/oauth2/atlassian.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EAEpB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAWvB,KAAK,mBAAmB,GAAG,uBAAuB,CAAA;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,iBAAS,qBAAqB,CAC5B,MAAM,EAAE,mBAAmB,GAC1B,oBAAoB,CAmBtB;AAED,eAAe,qBAAqB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/atlassian.js b/dist/providers/oauth2/atlassian.js new file mode 100644 index 0000000..d13e203 --- /dev/null +++ b/dist/providers/oauth2/atlassian.js @@ -0,0 +1,59 @@ +const algorithm = "oauth2"; +const authorization_server = { + issuer: "https://auth.atlassian.com", + authorization_endpoint: "https://auth.atlassian.com/authorize", + token_endpoint: "https://auth.atlassian.com/oauth/token", + userinfo_endpoint: "https://api.atlassian.com/me", +}; +/** + * Add Atlassian OAuth2 Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/atlassian + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {AtlassianAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugins[] = [ + * authPlugin({ + * providers:[ + * AtlassianAuthProvider({ + * client_id: process.env.ATLASSIAN_CLIENT_ID as string, + * client_secret: process.env.ATLASSIAN_CLIENT_SECRET as string, + * }) + * ] + * }) + * + * ] + * ``` + * + */ +function AtlassianAuthProvider(config) { + const { overrideScope, ...restConfig } = config; + return { + ...restConfig, + id: "atlassian", + authorization_server, + name: "Atlassian", + algorithm, + scope: overrideScope ?? "read:me read:account", + kind: "oauth", + profile: (profile) => { + return { + sub: profile.account_id, + name: profile.name, + email: profile.email, + picture: profile.picture, + }; + }, + }; +} +export default AtlassianAuthProvider; +//# sourceMappingURL=atlassian.js.map \ No newline at end of file diff --git a/dist/providers/oauth2/atlassian.js.map b/dist/providers/oauth2/atlassian.js.map new file mode 100644 index 0000000..10d4822 --- /dev/null +++ b/dist/providers/oauth2/atlassian.js.map @@ -0,0 +1 @@ +{"version":3,"file":"atlassian.js","sourceRoot":"","sources":["../../../src/providers/oauth2/atlassian.ts"],"names":[],"mappings":"AAOA,MAAM,SAAS,GAAG,QAAQ,CAAA;AAE1B,MAAM,oBAAoB,GAA8B;IACtD,MAAM,EAAE,4BAA4B;IACpC,sBAAsB,EAAE,sCAAsC;IAC9D,cAAc,EAAE,wCAAwC;IACxD,iBAAiB,EAAE,8BAA8B;CAClD,CAAA;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,SAAS,qBAAqB,CAC5B,MAA2B;IAE3B,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAC/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,WAAW;QACf,oBAAoB;QACpB,IAAI,EAAE,WAAW;QACjB,SAAS;QACT,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,UAAoB;gBACjC,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,qBAAqB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/auth0.d.ts b/dist/providers/oauth2/auth0.d.ts new file mode 100644 index 0000000..71e93c0 --- /dev/null +++ b/dist/providers/oauth2/auth0.d.ts @@ -0,0 +1,37 @@ +import type { OAuth2ProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; +interface Auth0AuthConfig extends OAuthBaseProviderConfig { + domain: string; +} +/** + * Add Auth0 OAuth2 Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/auth0 + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {Auth0AuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * Auth0AuthProvider({ + * client_id: process.env.AUTH0_CLIENT_ID as string, + * client_secret: process.env.AUTH0_CLIENT_SECRET as string, + * domain: process.env.AUTH0_DOMAIN as string, + * }) + * ] + * }) + * ] + * ``` + * + */ +declare function Auth0AuthProvider(config: Auth0AuthConfig): OAuth2ProviderConfig; +export default Auth0AuthProvider; +//# sourceMappingURL=auth0.d.ts.map \ No newline at end of file diff --git a/dist/providers/oauth2/auth0.d.ts.map b/dist/providers/oauth2/auth0.d.ts.map new file mode 100644 index 0000000..500dc43 --- /dev/null +++ b/dist/providers/oauth2/auth0.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"auth0.d.ts","sourceRoot":"","sources":["../../../src/providers/oauth2/auth0.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EAEpB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,UAAU,eAAgB,SAAQ,uBAAuB;IACvD,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,iBAAS,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,oBAAoB,CA0BxE;AAED,eAAe,iBAAiB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/auth0.js b/dist/providers/oauth2/auth0.js new file mode 100644 index 0000000..c2d0352 --- /dev/null +++ b/dist/providers/oauth2/auth0.js @@ -0,0 +1,58 @@ +/** + * Add Auth0 OAuth2 Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/auth0 + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {Auth0AuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * Auth0AuthProvider({ + * client_id: process.env.AUTH0_CLIENT_ID as string, + * client_secret: process.env.AUTH0_CLIENT_SECRET as string, + * domain: process.env.AUTH0_DOMAIN as string, + * }) + * ] + * }) + * ] + * ``` + * + */ +function Auth0AuthProvider(config) { + const { domain, overrideScope, ...restConfig } = config; + const authorization_server = { + issuer: `https://${domain}/`, + authorization_endpoint: `https://${domain}/authorize`, + token_endpoint: `https://${domain}/oauth/token`, + userinfo_endpoint: `https://${domain}/userinfo`, + }; + return { + ...restConfig, + id: "auth0", + scope: overrideScope ?? "openid email profile", + authorization_server, + name: "Auth0", + algorithm: "oauth2", + kind: "oauth", + profile: (profile) => { + return { + sub: profile.sub, + name: profile.name, + email: profile.email, + picture: profile.picture, + }; + }, + }; +} +export default Auth0AuthProvider; +//# sourceMappingURL=auth0.js.map \ No newline at end of file diff --git a/dist/providers/oauth2/auth0.js.map b/dist/providers/oauth2/auth0.js.map new file mode 100644 index 0000000..b408042 --- /dev/null +++ b/dist/providers/oauth2/auth0.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth0.js","sourceRoot":"","sources":["../../../src/providers/oauth2/auth0.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,SAAS,iBAAiB,CAAC,MAAuB;IAChD,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IACvD,MAAM,oBAAoB,GAA8B;QACtD,MAAM,EAAE,WAAW,MAAM,GAAG;QAC5B,sBAAsB,EAAE,WAAW,MAAM,YAAY;QACrD,cAAc,EAAE,WAAW,MAAM,cAAc;QAC/C,iBAAiB,EAAE,WAAW,MAAM,WAAW;KAChD,CAAA;IAED,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,oBAAoB;QACpB,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,QAAQ;QACnB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,iBAAiB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/discord.d.ts b/dist/providers/oauth2/discord.d.ts new file mode 100644 index 0000000..4a02ca8 --- /dev/null +++ b/dist/providers/oauth2/discord.d.ts @@ -0,0 +1,32 @@ +import type { OAuth2ProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; +type DiscordAuthConfig = OAuthBaseProviderConfig; +/** + * Add Discord OAuth2 Provider + * + * ``` + * https://example.com/api/{name}/oauth/callback/discord + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {DiscordAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * DiscordAuthProvider({ + * client_id: process.env.DISCORD_CLIENT_ID as string, + * client_secret: process.env.DISCORD_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + * + */ +declare function DiscordAuthProvider(config: DiscordAuthConfig): OAuth2ProviderConfig; +export default DiscordAuthProvider; +//# sourceMappingURL=discord.d.ts.map \ No newline at end of file diff --git a/dist/providers/oauth2/discord.d.ts.map b/dist/providers/oauth2/discord.d.ts.map new file mode 100644 index 0000000..2a1020a --- /dev/null +++ b/dist/providers/oauth2/discord.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"discord.d.ts","sourceRoot":"","sources":["../../../src/providers/oauth2/discord.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EAEpB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAQvB,KAAK,iBAAiB,GAAG,uBAAuB,CAAA;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,iBAAS,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,GAAG,oBAAoB,CAsB5E;AAED,eAAe,mBAAmB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/discord.js b/dist/providers/oauth2/discord.js new file mode 100644 index 0000000..e5ebb61 --- /dev/null +++ b/dist/providers/oauth2/discord.js @@ -0,0 +1,56 @@ +const authorization_server = { + issuer: "https://discord.com", + authorization_endpoint: "https://discord.com/api/oauth2/authorize", + token_endpoint: "https://discord.com/api/oauth2/token", + userinfo_endpoint: "https://discord.com/api/users/@me", +}; +/** + * Add Discord OAuth2 Provider + * + * ``` + * https://example.com/api/{name}/oauth/callback/discord + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {DiscordAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * DiscordAuthProvider({ + * client_id: process.env.DISCORD_CLIENT_ID as string, + * client_secret: process.env.DISCORD_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + * + */ +function DiscordAuthProvider(config) { + const { overrideScope, ...restConfig } = config; + return { + ...restConfig, + id: "discord", + scope: overrideScope ?? "identify email", + authorization_server, + name: "Discord", + algorithm: "oauth2", + kind: "oauth", + profile: (profile) => { + const format = profile.avatar?.toString().startsWith("a_") ? "gif" : "png"; + return { + sub: profile.id, + name: profile.username ?? profile.global_name, + email: profile.email, + picture: `https://cdn.discordapp.com/avatars/${profile.id}/${profile.avatar}.${format}`, + }; + }, + }; +} +export default DiscordAuthProvider; +//# sourceMappingURL=discord.js.map \ No newline at end of file diff --git a/dist/providers/oauth2/discord.js.map b/dist/providers/oauth2/discord.js.map new file mode 100644 index 0000000..ebe9b0a --- /dev/null +++ b/dist/providers/oauth2/discord.js.map @@ -0,0 +1 @@ +{"version":3,"file":"discord.js","sourceRoot":"","sources":["../../../src/providers/oauth2/discord.ts"],"names":[],"mappings":"AAOA,MAAM,oBAAoB,GAA8B;IACtD,MAAM,EAAE,qBAAqB;IAC7B,sBAAsB,EAAE,0CAA0C;IAClE,cAAc,EAAE,sCAAsC;IACtD,iBAAiB,EAAE,mCAAmC;CACvD,CAAA;AAGD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,SAAS,mBAAmB,CAAC,MAAyB;IACpD,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,aAAa,IAAI,gBAAgB;QACxC,oBAAoB;QACpB,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,QAAQ;QACnB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;YAE1E,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,EAAY;gBACzB,IAAI,EAAG,OAAO,CAAC,QAAmB,IAAK,OAAO,CAAC,WAAsB;gBACrE,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,sCAAsC,OAAO,CAAC,EAAE,IAAI,OAAO,CAAC,MAAM,IAAI,MAAM,EAAE;aACxF,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,mBAAmB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/facebook.d.ts b/dist/providers/oauth2/facebook.d.ts new file mode 100644 index 0000000..0ffff67 --- /dev/null +++ b/dist/providers/oauth2/facebook.d.ts @@ -0,0 +1,33 @@ +import type { OAuth2ProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; +type FacebookAuthConfig = OAuthBaseProviderConfig; +/** + * Add Facebook OAuth2 Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/facebook + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {FacebookAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * FacebookAuthProvider({ + * client_id: process.env.FACEBOOK_CLIENT_ID as string, + * client_secret: process.env.FACEBOOK_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + */ +declare function FacebookAuthProvider(config: FacebookAuthConfig): OAuth2ProviderConfig; +export default FacebookAuthProvider; +//# sourceMappingURL=facebook.d.ts.map \ No newline at end of file diff --git a/dist/providers/oauth2/facebook.d.ts.map b/dist/providers/oauth2/facebook.d.ts.map new file mode 100644 index 0000000..aebda92 --- /dev/null +++ b/dist/providers/oauth2/facebook.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"facebook.d.ts","sourceRoot":"","sources":["../../../src/providers/oauth2/facebook.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EAEpB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAUvB,KAAK,kBAAkB,GAAG,uBAAuB,CAAA;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,iBAAS,oBAAoB,CAC3B,MAAM,EAAE,kBAAkB,GACzB,oBAAoB,CA6BtB;AAED,eAAe,oBAAoB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/facebook.js b/dist/providers/oauth2/facebook.js new file mode 100644 index 0000000..3c36b75 --- /dev/null +++ b/dist/providers/oauth2/facebook.js @@ -0,0 +1,64 @@ +const authorization_server = { + issuer: "https://www.facebook.com", + authorization_endpoint: "https://www.facebook.com/v19.0/dialog/oauth", + token_endpoint: "https://graph.facebook.com/oauth/access_token", + userinfo_endpoint: "https://graph.facebook.com/me?fields=id,name,email,picture", +}; +/** + * Add Facebook OAuth2 Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/facebook + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {FacebookAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * FacebookAuthProvider({ + * client_id: process.env.FACEBOOK_CLIENT_ID as string, + * client_secret: process.env.FACEBOOK_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + */ +function FacebookAuthProvider(config) { + const { overrideScope, ...restConfig } = config; + return { + ...restConfig, + id: "facebook", + scope: overrideScope ?? "email", + authorization_server, + name: "Facebook", + algorithm: "oauth2", + kind: "oauth", + profile: (profile) => { + let picture; + if (typeof profile.picture === "object" && profile.picture !== null) { + // Type assertion + const dataContainer = profile.picture; + if ("data" in dataContainer) { + picture = dataContainer.data.url; + } + } + return { + sub: profile.id, + name: profile.name, + email: profile.email, + picture: picture, + }; + }, + }; +} +export default FacebookAuthProvider; +//# sourceMappingURL=facebook.js.map \ No newline at end of file diff --git a/dist/providers/oauth2/facebook.js.map b/dist/providers/oauth2/facebook.js.map new file mode 100644 index 0000000..42af266 --- /dev/null +++ b/dist/providers/oauth2/facebook.js.map @@ -0,0 +1 @@ +{"version":3,"file":"facebook.js","sourceRoot":"","sources":["../../../src/providers/oauth2/facebook.ts"],"names":[],"mappings":"AAOA,MAAM,oBAAoB,GAA8B;IACtD,MAAM,EAAE,0BAA0B;IAClC,sBAAsB,EAAE,6CAA6C;IACrE,cAAc,EAAE,+CAA+C;IAC/D,iBAAiB,EACf,4DAA4D;CAC/D,CAAA;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,SAAS,oBAAoB,CAC3B,MAA0B;IAE1B,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,aAAa,IAAI,OAAO;QAC/B,oBAAoB;QACpB,IAAI,EAAE,UAAU;QAChB,SAAS,EAAE,QAAQ;QACnB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,IAAI,OAAO,CAAA;YAEX,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;gBACpE,iBAAiB;gBACjB,MAAM,aAAa,GAAG,OAAO,CAAC,OAAoC,CAAA;gBAClE,IAAI,MAAM,IAAI,aAAa,EAAE,CAAC;oBAC5B,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,GAAG,CAAA;gBAClC,CAAC;YACH,CAAC;YACD,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,EAAY;gBACzB,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAiB;aAC3B,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,oBAAoB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/github.d.ts b/dist/providers/oauth2/github.d.ts new file mode 100644 index 0000000..e9e7444 --- /dev/null +++ b/dist/providers/oauth2/github.d.ts @@ -0,0 +1,34 @@ +import type { OAuth2ProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; +type GitHubAuthConfig = OAuthBaseProviderConfig; +/** + * Add Github OAuth2 Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/github + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {GithubAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * GithubAuthProvider({ + * client_id: process.env.GITHUB_CLIENT_ID as string, + * client_secret: process.env.GITHUB_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + * + */ +declare function GitHubAuthProvider(config: GitHubAuthConfig): OAuth2ProviderConfig; +export default GitHubAuthProvider; +//# sourceMappingURL=github.d.ts.map \ No newline at end of file diff --git a/dist/providers/oauth2/github.d.ts.map b/dist/providers/oauth2/github.d.ts.map new file mode 100644 index 0000000..39f5cfd --- /dev/null +++ b/dist/providers/oauth2/github.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../src/providers/oauth2/github.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EAEpB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AASvB,KAAK,gBAAgB,GAAG,uBAAuB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,iBAAS,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,oBAAoB,CAoB1E;AAED,eAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/github.js b/dist/providers/oauth2/github.js new file mode 100644 index 0000000..e5b4507 --- /dev/null +++ b/dist/providers/oauth2/github.js @@ -0,0 +1,57 @@ +const authorization_server = { + issuer: "https://github.com", + authorization_endpoint: "https://github.com/login/oauth/authorize", + token_endpoint: "https://github.com/login/oauth/access_token", + userinfo_endpoint: "https://api.github.com/user", +}; +/** + * Add Github OAuth2 Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/github + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {GithubAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * GithubAuthProvider({ + * client_id: process.env.GITHUB_CLIENT_ID as string, + * client_secret: process.env.GITHUB_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + * + */ +function GitHubAuthProvider(config) { + const { overrideScope, ...restConfig } = config; + return { + ...restConfig, + id: "github", + scope: overrideScope ?? "openid email profile", + authorization_server, + name: "GitHub", + algorithm: "oauth2", + kind: "oauth", + profile: (profile) => { + return { + sub: profile.id, + name: profile.name, + email: profile.email, + picture: profile.picture, + }; + }, + }; +} +export default GitHubAuthProvider; +//# sourceMappingURL=github.js.map \ No newline at end of file diff --git a/dist/providers/oauth2/github.js.map b/dist/providers/oauth2/github.js.map new file mode 100644 index 0000000..9bc8053 --- /dev/null +++ b/dist/providers/oauth2/github.js.map @@ -0,0 +1 @@ +{"version":3,"file":"github.js","sourceRoot":"","sources":["../../../src/providers/oauth2/github.ts"],"names":[],"mappings":"AAOA,MAAM,oBAAoB,GAA8B;IACtD,MAAM,EAAE,oBAAoB;IAC5B,sBAAsB,EAAE,0CAA0C;IAClE,cAAc,EAAE,6CAA6C;IAC7D,iBAAiB,EAAE,6BAA6B;CACjD,CAAA;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,SAAS,kBAAkB,CAAC,MAAwB;IAClD,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,oBAAoB;QACpB,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,QAAQ;QACnB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,EAAY;gBACzB,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/jumpcloud.d.ts b/dist/providers/oauth2/jumpcloud.d.ts new file mode 100644 index 0000000..3d1f65d --- /dev/null +++ b/dist/providers/oauth2/jumpcloud.d.ts @@ -0,0 +1,32 @@ +import type { OAuthBaseProviderConfig, OAuth2ProviderConfig } from "../../types.js"; +type JumpCloudAuthConfig = OAuthBaseProviderConfig; +/** + * Add Jump Cloud OAuth2 Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/jumpcloud + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {JumpCloudAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * JumpCloudAuthProvider({ + * client_id: process.env.JUMP_CLOUD_CLIENT_ID as string, + * client_secret: process.env.JUMP_CLOUD_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + */ +declare function JumpCloudAuthProvider(config: JumpCloudAuthConfig): OAuth2ProviderConfig; +export default JumpCloudAuthProvider; +//# sourceMappingURL=jumpcloud.d.ts.map \ No newline at end of file diff --git a/dist/providers/oauth2/jumpcloud.d.ts.map b/dist/providers/oauth2/jumpcloud.d.ts.map new file mode 100644 index 0000000..4b58c85 --- /dev/null +++ b/dist/providers/oauth2/jumpcloud.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"jumpcloud.d.ts","sourceRoot":"","sources":["../../../src/providers/oauth2/jumpcloud.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,gBAAgB,CAAA;AASvB,KAAK,mBAAmB,GAAG,uBAAuB,CAAA;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,iBAAS,qBAAqB,CAC5B,MAAM,EAAE,mBAAmB,GAC1B,oBAAoB,CAoBtB;AAED,eAAe,qBAAqB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/jumpcloud.js b/dist/providers/oauth2/jumpcloud.js new file mode 100644 index 0000000..b828d28 --- /dev/null +++ b/dist/providers/oauth2/jumpcloud.js @@ -0,0 +1,55 @@ +const authorization_server = { + issuer: "https://oauth.id.jumpcloud.com/", + authorization_endpoint: "https://oauth.id.jumpcloud.com/oauth2/auth", + token_endpoint: "https://oauth.id.jumpcloud.com/oauth2/token", + userinfo_endpoint: "https://oauth.id.jumpcloud.com/userinfo", +}; +/** + * Add Jump Cloud OAuth2 Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/jumpcloud + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {JumpCloudAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * JumpCloudAuthProvider({ + * client_id: process.env.JUMP_CLOUD_CLIENT_ID as string, + * client_secret: process.env.JUMP_CLOUD_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + */ +function JumpCloudAuthProvider(config) { + const { overrideScope, ...restConfig } = config; + return { + ...restConfig, + id: "jumpcloud", + scope: overrideScope ?? "openid email profile", + authorization_server, + name: "Jump Cloud", + algorithm: "oauth2", + kind: "oauth", + profile: (profile) => { + return { + sub: profile.email, + name: profile.name, + email: profile.email, + picture: profile.picture, + }; + }, + }; +} +export default JumpCloudAuthProvider; +//# sourceMappingURL=jumpcloud.js.map \ No newline at end of file diff --git a/dist/providers/oauth2/jumpcloud.js.map b/dist/providers/oauth2/jumpcloud.js.map new file mode 100644 index 0000000..ec628ef --- /dev/null +++ b/dist/providers/oauth2/jumpcloud.js.map @@ -0,0 +1 @@ +{"version":3,"file":"jumpcloud.js","sourceRoot":"","sources":["../../../src/providers/oauth2/jumpcloud.ts"],"names":[],"mappings":"AAOA,MAAM,oBAAoB,GAA8B;IACtD,MAAM,EAAE,iCAAiC;IACzC,sBAAsB,EAAE,4CAA4C;IACpE,cAAc,EAAE,6CAA6C;IAC7D,iBAAiB,EAAE,yCAAyC;CAC7D,CAAA;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,SAAS,qBAAqB,CAC5B,MAA2B;IAE3B,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,oBAAoB;QACpB,IAAI,EAAE,YAAY;QAClB,SAAS,EAAE,QAAQ;QACnB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,KAAe;gBAC5B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,qBAAqB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/twitch.d.ts b/dist/providers/oauth2/twitch.d.ts new file mode 100644 index 0000000..b0f00bc --- /dev/null +++ b/dist/providers/oauth2/twitch.d.ts @@ -0,0 +1,33 @@ +import type { OAuth2ProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; +type TwitchAuthConfig = OAuthBaseProviderConfig; +/** + * Add Twitch OAuth2 Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/twitch + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {TwitchAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * TwitchAuthProvider({ + * client_id: process.env.TWITCH_CLIENT_ID as string, + * client_secret: process.env.TWITCH_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + */ +declare function TwitchAuthProvider(config: TwitchAuthConfig): OAuth2ProviderConfig; +export default TwitchAuthProvider; +//# sourceMappingURL=twitch.d.ts.map \ No newline at end of file diff --git a/dist/providers/oauth2/twitch.d.ts.map b/dist/providers/oauth2/twitch.d.ts.map new file mode 100644 index 0000000..66f2a1b --- /dev/null +++ b/dist/providers/oauth2/twitch.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"twitch.d.ts","sourceRoot":"","sources":["../../../src/providers/oauth2/twitch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EAEpB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AASvB,KAAK,gBAAgB,GAAG,uBAAuB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,iBAAS,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,oBAAoB,CA2B1E;AAED,eAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/twitch.js b/dist/providers/oauth2/twitch.js new file mode 100644 index 0000000..9691d24 --- /dev/null +++ b/dist/providers/oauth2/twitch.js @@ -0,0 +1,63 @@ +const authorization_server = { + issuer: "https://id.twitch.tv/oauth2", + authorization_endpoint: "https://id.twitch.tv/oauth2/authorize", + token_endpoint: "https://id.twitch.tv/oauth2/token", + userinfo_endpoint: "https://id.twitch.tv/oauth2/userinfo", +}; +/** + * Add Twitch OAuth2 Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/twitch + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {TwitchAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * TwitchAuthProvider({ + * client_id: process.env.TWITCH_CLIENT_ID as string, + * client_secret: process.env.TWITCH_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + */ +function TwitchAuthProvider(config) { + const { overrideScope, ...restConfig } = config; + return { + ...restConfig, + id: "twitch", + scope: overrideScope ?? "openid user:read:email", + authorization_server, + name: "Twitch", + algorithm: "oauth2", + kind: "oauth", + params: { + scope: overrideScope ?? "openid user:read:email", + claims: JSON.stringify({ + id_token: { email: null, picture: null, preferred_username: null }, + userinfo: { email: null, picture: null, preferred_username: null }, + }), + }, + profile: (profile) => { + return { + sub: profile.sub, + name: profile.name, + email: profile.email, + picture: profile.picture, + }; + }, + }; +} +export default TwitchAuthProvider; +//# sourceMappingURL=twitch.js.map \ No newline at end of file diff --git a/dist/providers/oauth2/twitch.js.map b/dist/providers/oauth2/twitch.js.map new file mode 100644 index 0000000..6071420 --- /dev/null +++ b/dist/providers/oauth2/twitch.js.map @@ -0,0 +1 @@ +{"version":3,"file":"twitch.js","sourceRoot":"","sources":["../../../src/providers/oauth2/twitch.ts"],"names":[],"mappings":"AAOA,MAAM,oBAAoB,GAA8B;IACtD,MAAM,EAAE,6BAA6B;IACrC,sBAAsB,EAAE,uCAAuC;IAC/D,cAAc,EAAE,mCAAmC;IACnD,iBAAiB,EAAE,sCAAsC;CAC1D,CAAA;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,SAAS,kBAAkB,CAAC,MAAwB;IAClD,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,aAAa,IAAI,wBAAwB;QAChD,oBAAoB;QACpB,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,QAAQ;QACnB,IAAI,EAAE,OAAO;QACb,MAAM,EAAE;YACN,KAAK,EAAE,aAAa,IAAI,wBAAwB;YAChD,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC;gBACrB,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE;gBAClE,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE;aACnE,CAAC;SACH;QACD,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/apple.d.ts b/dist/providers/oidc/apple.d.ts new file mode 100644 index 0000000..e25aefc --- /dev/null +++ b/dist/providers/oidc/apple.d.ts @@ -0,0 +1,35 @@ +import type { OAuthBaseProviderConfig, OIDCProviderConfig } from "../../types.js"; +interface AppleAuthConfig extends OAuthBaseProviderConfig { + client_id: string; + params?: Record; +} +/** + * Add Apple OIDC Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/apple + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import { authPlugin } from "payload-auth-plugin" + * import { AppleOIDCAuthProvider } from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * AppleOIDCAuthProvider({ + * client_id: process.env.APPLE_CLIENT_ID as string, + * }) + * ] + * }) + * ``` + * + */ +declare function AppleOIDCAuthProvider(config: AppleAuthConfig): OIDCProviderConfig; +export default AppleOIDCAuthProvider; +//# sourceMappingURL=apple.d.ts.map \ No newline at end of file diff --git a/dist/providers/oidc/apple.d.ts.map b/dist/providers/oidc/apple.d.ts.map new file mode 100644 index 0000000..c8c2af1 --- /dev/null +++ b/dist/providers/oidc/apple.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"apple.d.ts","sourceRoot":"","sources":["../../../src/providers/oidc/apple.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,gBAAgB,CAAA;AAEvB,UAAU,eAAgB,SAAQ,uBAAuB;IACvD,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,iBAAS,qBAAqB,CAAC,MAAM,EAAE,eAAe,GAAG,kBAAkB,CAmB1E;AAED,eAAe,qBAAqB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/apple.js b/dist/providers/oidc/apple.js new file mode 100644 index 0000000..9d9b345 --- /dev/null +++ b/dist/providers/oidc/apple.js @@ -0,0 +1,49 @@ +/** + * Add Apple OIDC Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/apple + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import { authPlugin } from "payload-auth-plugin" + * import { AppleOIDCAuthProvider } from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * AppleOIDCAuthProvider({ + * client_id: process.env.APPLE_CLIENT_ID as string, + * }) + * ] + * }) + * ``` + * + */ +function AppleOIDCAuthProvider(config) { + const { overrideScope, ...restConfig } = config; + return { + ...restConfig, + id: "apple", + scope: overrideScope ?? "openid name email", + issuer: "https://appleid.apple.com", + name: "Apple", + algorithm: "oidc", + kind: "oauth", + profile: (profile) => { + return { + sub: profile.sub, + name: profile.name, + email: profile.email, + picture: profile.picture, + }; + }, + }; +} +export default AppleOIDCAuthProvider; +//# sourceMappingURL=apple.js.map \ No newline at end of file diff --git a/dist/providers/oidc/apple.js.map b/dist/providers/oidc/apple.js.map new file mode 100644 index 0000000..96c1294 --- /dev/null +++ b/dist/providers/oidc/apple.js.map @@ -0,0 +1 @@ +{"version":3,"file":"apple.js","sourceRoot":"","sources":["../../../src/providers/oidc/apple.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,SAAS,qBAAqB,CAAC,MAAuB;IACpD,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAC/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,aAAa,IAAI,mBAAmB;QAC3C,MAAM,EAAE,2BAA2B;QACnC,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,qBAAqB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/cognito.d.ts b/dist/providers/oidc/cognito.d.ts new file mode 100644 index 0000000..a4e5aaa --- /dev/null +++ b/dist/providers/oidc/cognito.d.ts @@ -0,0 +1,35 @@ +import type { OIDCProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; +interface CognitoAuthConfig extends OAuthBaseProviderConfig { + domain: string; +} +/** + * Add Cognito OIDC Provider + * + * #### Callback or Redirect URL pattern + * ``` + * https://example.com/api/{name}/oauth/callback/cognito + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import { authPlugin } from "payload-auth-plugin" + * import { CognitoAuthProvider } from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * CognitoAuthProvider({ + * client_id: process.env.COGNITO_CLIENT_ID as string, + * client_secret: process.env.COGNITO_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + * + */ +declare function CognitoAuthProvider(config: CognitoAuthConfig): OIDCProviderConfig; +export default CognitoAuthProvider; +//# sourceMappingURL=cognito.d.ts.map \ No newline at end of file diff --git a/dist/providers/oidc/cognito.d.ts.map b/dist/providers/oidc/cognito.d.ts.map new file mode 100644 index 0000000..8b635e5 --- /dev/null +++ b/dist/providers/oidc/cognito.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"cognito.d.ts","sourceRoot":"","sources":["../../../src/providers/oidc/cognito.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,UAAU,iBAAkB,SAAQ,uBAAuB;IACzD,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,iBAAS,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,GAAG,kBAAkB,CAmB1E;AAED,eAAe,mBAAmB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/cognito.js b/dist/providers/oidc/cognito.js new file mode 100644 index 0000000..72ce563 --- /dev/null +++ b/dist/providers/oidc/cognito.js @@ -0,0 +1,50 @@ +/** + * Add Cognito OIDC Provider + * + * #### Callback or Redirect URL pattern + * ``` + * https://example.com/api/{name}/oauth/callback/cognito + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import { authPlugin } from "payload-auth-plugin" + * import { CognitoAuthProvider } from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * CognitoAuthProvider({ + * client_id: process.env.COGNITO_CLIENT_ID as string, + * client_secret: process.env.COGNITO_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + * + */ +function CognitoAuthProvider(config) { + const { domain, overrideScope, ...restConfig } = config; + return { + ...restConfig, + id: "cognito", + scope: overrideScope ?? "email openid profile", + issuer: domain, + name: "Congnito", + algorithm: "oidc", + kind: "oauth", + profile: (profile) => { + return { + sub: profile.sub, + name: profile.name, + email: profile.email, + picture: profile.picture, + }; + }, + }; +} +export default CognitoAuthProvider; +//# sourceMappingURL=cognito.js.map \ No newline at end of file diff --git a/dist/providers/oidc/cognito.js.map b/dist/providers/oidc/cognito.js.map new file mode 100644 index 0000000..49f9b00 --- /dev/null +++ b/dist/providers/oidc/cognito.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cognito.js","sourceRoot":"","sources":["../../../src/providers/oidc/cognito.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,SAAS,mBAAmB,CAAC,MAAyB;IACpD,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IACvD,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,UAAU;QAChB,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,mBAAmB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/gitlab.d.ts b/dist/providers/oidc/gitlab.d.ts new file mode 100644 index 0000000..2a676e1 --- /dev/null +++ b/dist/providers/oidc/gitlab.d.ts @@ -0,0 +1,34 @@ +import type { OIDCProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; +type GitLabAuthConfig = OAuthBaseProviderConfig; +/** + * Add GitLab OIDC Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/gitlab + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import { authPlugin } from "payload-auth-plugin" + * import { GitLabAuthProvider } from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * GitLabAuthProvider({ + * client_id: process.env.GITLAB_CLIENT_ID as string, + * client_secret: process.env.GITLAB_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + * + */ +declare function GitLabAuthProvider(config: GitLabAuthConfig): OIDCProviderConfig; +export default GitLabAuthProvider; +//# sourceMappingURL=gitlab.d.ts.map \ No newline at end of file diff --git a/dist/providers/oidc/gitlab.d.ts.map b/dist/providers/oidc/gitlab.d.ts.map new file mode 100644 index 0000000..c38a115 --- /dev/null +++ b/dist/providers/oidc/gitlab.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"gitlab.d.ts","sourceRoot":"","sources":["../../../src/providers/oidc/gitlab.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,KAAK,gBAAgB,GAAG,uBAAuB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,iBAAS,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,kBAAkB,CAoBxE;AAED,eAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/gitlab.js b/dist/providers/oidc/gitlab.js new file mode 100644 index 0000000..2fe077b --- /dev/null +++ b/dist/providers/oidc/gitlab.js @@ -0,0 +1,51 @@ +/** + * Add GitLab OIDC Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/gitlab + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import { authPlugin } from "payload-auth-plugin" + * import { GitLabAuthProvider } from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * GitLabAuthProvider({ + * client_id: process.env.GITLAB_CLIENT_ID as string, + * client_secret: process.env.GITLAB_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + * + */ +function GitLabAuthProvider(config) { + const { overrideScope, ...restConfig } = config; + return { + ...restConfig, + id: "gitlab", + scope: overrideScope ?? "openid email profile", + issuer: "https://gitlab.com", + name: "GitLab", + algorithm: "oidc", + kind: "oauth", + profile: (profile) => { + return { + sub: profile.sub, + name: profile.name, + email: profile.email, + picture: profile.picture, + }; + }, + }; +} +export default GitLabAuthProvider; +//# sourceMappingURL=gitlab.js.map \ No newline at end of file diff --git a/dist/providers/oidc/gitlab.js.map b/dist/providers/oidc/gitlab.js.map new file mode 100644 index 0000000..2ac70b7 --- /dev/null +++ b/dist/providers/oidc/gitlab.js.map @@ -0,0 +1 @@ +{"version":3,"file":"gitlab.js","sourceRoot":"","sources":["../../../src/providers/oidc/gitlab.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,SAAS,kBAAkB,CAAC,MAAwB;IAClD,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,MAAM,EAAE,oBAAoB;QAC5B,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/google.d.ts b/dist/providers/oidc/google.d.ts new file mode 100644 index 0000000..876cdbb --- /dev/null +++ b/dist/providers/oidc/google.d.ts @@ -0,0 +1,31 @@ +import type { OIDCProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; +type GoogleAuthConfig = OAuthBaseProviderConfig; +/** + * Add Google OIDC Provider + * + * ``` + * https://example.com/api/{name}/oauth/callback/google + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {GoogleAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * GoogleAuthProvider({ + * client_id: process.env.GOOGLE_CLIENT_ID as string, + * client_secret: process.env.GOOGLE_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + */ +declare function GoogleAuthProvider(config: GoogleAuthConfig): OIDCProviderConfig; +export default GoogleAuthProvider; +//# sourceMappingURL=google.d.ts.map \ No newline at end of file diff --git a/dist/providers/oidc/google.d.ts.map b/dist/providers/oidc/google.d.ts.map new file mode 100644 index 0000000..08349e7 --- /dev/null +++ b/dist/providers/oidc/google.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/providers/oidc/google.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,KAAK,gBAAgB,GAAG,uBAAuB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,iBAAS,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,kBAAkB,CAoBxE;AAED,eAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/google.js b/dist/providers/oidc/google.js new file mode 100644 index 0000000..02a9be9 --- /dev/null +++ b/dist/providers/oidc/google.js @@ -0,0 +1,48 @@ +/** + * Add Google OIDC Provider + * + * ``` + * https://example.com/api/{name}/oauth/callback/google + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {GoogleAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * GoogleAuthProvider({ + * client_id: process.env.GOOGLE_CLIENT_ID as string, + * client_secret: process.env.GOOGLE_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + */ +function GoogleAuthProvider(config) { + const { overrideScope, ...restConfig } = config; + return { + ...config, + id: "google", + scope: overrideScope ?? "openid email profile", + issuer: "https://accounts.google.com", + name: "Google", + algorithm: "oidc", + kind: "oauth", + profile: (profile) => { + return { + sub: profile.sub, + name: profile.name, + email: profile.email, + picture: profile.picture, + }; + }, + }; +} +export default GoogleAuthProvider; +//# sourceMappingURL=google.js.map \ No newline at end of file diff --git a/dist/providers/oidc/google.js.map b/dist/providers/oidc/google.js.map new file mode 100644 index 0000000..6eabe3b --- /dev/null +++ b/dist/providers/oidc/google.js.map @@ -0,0 +1 @@ +{"version":3,"file":"google.js","sourceRoot":"","sources":["../../../src/providers/oidc/google.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,SAAS,kBAAkB,CAAC,MAAwB;IAClD,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,MAAM;QACT,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,MAAM,EAAE,6BAA6B;QACrC,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/keycloak.d.ts b/dist/providers/oidc/keycloak.d.ts new file mode 100644 index 0000000..93bc4b7 --- /dev/null +++ b/dist/providers/oidc/keycloak.d.ts @@ -0,0 +1,43 @@ +import type { OIDCProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; +interface KeyCloakAuthConfig extends OAuthBaseProviderConfig { + realm: string; + domain: string; + identifier: string; + name: string; +} +/** + * Add KeyCloak OIDC Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{app_name}/oauth/callback/{name} + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {KeyCloakAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * KeyCloakAuthProvider({ + * realm: process.env.KEYCLOAK_REALM as string, + * domain: process.env.KEYCLOAK_DOMAIN as string, + * identifier: process.env.KEYCLOAK_IDENTIFIER as string, + * name: process.env.KEYCLOAK_NAME as string, + * client_id: process.env.KEYCLOAK_CLIENT_ID as string, + * client_secret: process.env.KEYCLOAK_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + * + */ +declare function KeyCloakAuthProvider(config: KeyCloakAuthConfig): OIDCProviderConfig; +export default KeyCloakAuthProvider; +//# sourceMappingURL=keycloak.d.ts.map \ No newline at end of file diff --git a/dist/providers/oidc/keycloak.d.ts.map b/dist/providers/oidc/keycloak.d.ts.map new file mode 100644 index 0000000..22833f0 --- /dev/null +++ b/dist/providers/oidc/keycloak.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"keycloak.d.ts","sourceRoot":"","sources":["../../../src/providers/oidc/keycloak.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,UAAU,kBAAmB,SAAQ,uBAAuB;IAC1D,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,iBAAS,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAoB5E;AAED,eAAe,oBAAoB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/keycloak.js b/dist/providers/oidc/keycloak.js new file mode 100644 index 0000000..3c19b0a --- /dev/null +++ b/dist/providers/oidc/keycloak.js @@ -0,0 +1,55 @@ +/** + * Add KeyCloak OIDC Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{app_name}/oauth/callback/{name} + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {KeyCloakAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * KeyCloakAuthProvider({ + * realm: process.env.KEYCLOAK_REALM as string, + * domain: process.env.KEYCLOAK_DOMAIN as string, + * identifier: process.env.KEYCLOAK_IDENTIFIER as string, + * name: process.env.KEYCLOAK_NAME as string, + * client_id: process.env.KEYCLOAK_CLIENT_ID as string, + * client_secret: process.env.KEYCLOAK_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + * + */ +function KeyCloakAuthProvider(config) { + const { realm, domain, identifier, name, overrideScope, ...restConfig } = config; + return { + ...restConfig, + id: identifier, + scope: overrideScope ?? "email openid profile", + issuer: `https://${domain}/realms/${realm}`, + name, + algorithm: "oidc", + kind: "oauth", + profile: (profile) => { + return { + sub: profile.sub, + name: profile.name, + email: profile.email, + picture: profile.picture, + }; + }, + }; +} +export default KeyCloakAuthProvider; +//# sourceMappingURL=keycloak.js.map \ No newline at end of file diff --git a/dist/providers/oidc/keycloak.js.map b/dist/providers/oidc/keycloak.js.map new file mode 100644 index 0000000..96040e9 --- /dev/null +++ b/dist/providers/oidc/keycloak.js.map @@ -0,0 +1 @@ +{"version":3,"file":"keycloak.js","sourceRoot":"","sources":["../../../src/providers/oidc/keycloak.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,SAAS,oBAAoB,CAAC,MAA0B;IACtD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GACrE,MAAM,CAAA;IACR,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,MAAM,EAAE,WAAW,MAAM,WAAW,KAAK,EAAE;QAC3C,IAAI;QACJ,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,oBAAoB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/microsoft-entra.d.ts b/dist/providers/oidc/microsoft-entra.d.ts new file mode 100644 index 0000000..e155e0d --- /dev/null +++ b/dist/providers/oidc/microsoft-entra.d.ts @@ -0,0 +1,38 @@ +import type { OIDCProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; +type MicrosoftEntraAuthConfig = OAuthBaseProviderConfig & { + tenant_id: string; + skip_email_verification?: boolean | undefined; +}; +/** + * Add Microsoft Entra OIDC Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/msft-entra + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import { authPlugin } from "payload-auth-plugin" + * import { MicrosoftEntraAuthProvider } from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * MicrosoftEntraAuthProvider({ + * tenant_id: process.env.MICROSOFTENTRA_TENANT_ID as string, + * client_id: process.env.MICROSOFTENTRA_CLIENT_ID as string, + * client_secret: process.env.MICROSOFTENTRA_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + * + */ +declare function MicrosoftEntraAuthProvider(config: MicrosoftEntraAuthConfig): OIDCProviderConfig; +export default MicrosoftEntraAuthProvider; +//# sourceMappingURL=microsoft-entra.d.ts.map \ No newline at end of file diff --git a/dist/providers/oidc/microsoft-entra.d.ts.map b/dist/providers/oidc/microsoft-entra.d.ts.map new file mode 100644 index 0000000..aa12c53 --- /dev/null +++ b/dist/providers/oidc/microsoft-entra.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"microsoft-entra.d.ts","sourceRoot":"","sources":["../../../src/providers/oidc/microsoft-entra.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,KAAK,wBAAwB,GAAG,uBAAuB,GAAG;IACxD,SAAS,EAAE,MAAM,CAAA;IAIjB,uBAAuB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9C,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,iBAAS,0BAA0B,CACjC,MAAM,EAAE,wBAAwB,GAC/B,kBAAkB,CAqBpB;AAED,eAAe,0BAA0B,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/microsoft-entra.js b/dist/providers/oidc/microsoft-entra.js new file mode 100644 index 0000000..8fa6e7e --- /dev/null +++ b/dist/providers/oidc/microsoft-entra.js @@ -0,0 +1,53 @@ +/** + * Add Microsoft Entra OIDC Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/msft-entra + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import { authPlugin } from "payload-auth-plugin" + * import { MicrosoftEntraAuthProvider } from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * MicrosoftEntraAuthProvider({ + * tenant_id: process.env.MICROSOFTENTRA_TENANT_ID as string, + * client_id: process.env.MICROSOFTENTRA_CLIENT_ID as string, + * client_secret: process.env.MICROSOFTENTRA_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + * + */ +function MicrosoftEntraAuthProvider(config) { + const { overrideScope, ...restConfig } = config; + return { + ...restConfig, + id: "msft-entra", + scope: overrideScope ?? "openid profile email offline_access", + issuer: `https://login.microsoftonline.com/${config.tenant_id}/v2.0`, + name: "Microsoft Entra", + algorithm: "oidc", + kind: "oauth", + profile: (profile) => { + const email = profile.email; + return { + sub: profile.sub, + name: profile.name, + email: email.toLowerCase(), + picture: profile.picture, + }; + }, + }; +} +export default MicrosoftEntraAuthProvider; +//# sourceMappingURL=microsoft-entra.js.map \ No newline at end of file diff --git a/dist/providers/oidc/microsoft-entra.js.map b/dist/providers/oidc/microsoft-entra.js.map new file mode 100644 index 0000000..3dad1bd --- /dev/null +++ b/dist/providers/oidc/microsoft-entra.js.map @@ -0,0 +1 @@ +{"version":3,"file":"microsoft-entra.js","sourceRoot":"","sources":["../../../src/providers/oidc/microsoft-entra.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,SAAS,0BAA0B,CACjC,MAAgC;IAEhC,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,aAAa,IAAI,qCAAqC;QAC7D,MAAM,EAAE,qCAAqC,MAAM,CAAC,SAAS,OAAO;QACpE,IAAI,EAAE,iBAAiB;QACvB,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAe,CAAA;YACrC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE;gBAC1B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,0BAA0B,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/okta.d.ts b/dist/providers/oidc/okta.d.ts new file mode 100644 index 0000000..b89df09 --- /dev/null +++ b/dist/providers/oidc/okta.d.ts @@ -0,0 +1,7 @@ +import type { OIDCProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; +interface OktaAuthConfig extends OAuthBaseProviderConfig { + domain: string; +} +declare function OktaAuthProvider(config: OktaAuthConfig): OIDCProviderConfig; +export default OktaAuthProvider; +//# sourceMappingURL=okta.d.ts.map \ No newline at end of file diff --git a/dist/providers/oidc/okta.d.ts.map b/dist/providers/oidc/okta.d.ts.map new file mode 100644 index 0000000..7f0d1c7 --- /dev/null +++ b/dist/providers/oidc/okta.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"okta.d.ts","sourceRoot":"","sources":["../../../src/providers/oidc/okta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,UAAU,cAAe,SAAQ,uBAAuB;IACtD,MAAM,EAAE,MAAM,CAAA;CACf;AA6CD,iBAAS,gBAAgB,CAAC,MAAM,EAAE,cAAc,GAAG,kBAAkB,CAyBpE;AAED,eAAe,gBAAgB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/okta.js b/dist/providers/oidc/okta.js new file mode 100644 index 0000000..9752ee3 --- /dev/null +++ b/dist/providers/oidc/okta.js @@ -0,0 +1,67 @@ +/** + * Add Okta OIDC Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/{name} + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {OktaAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * OktaAuthProvider({g, + * domain: process.env.KEYCLOAK_DOMAIN as string, + * client_id: process.env.KEYCLOAK_CLIENT_ID as string, + * client_secret: process.env.KEYCLOAK_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + * + */ +function encodeString(s) { + let h = 0; + const l = s.length; + let i = 0; + if (l > 0) { + while (i < l) { + h = ((h << 5) - h + s.charCodeAt(i++)) | 0; // Bitwise operations to create a hash + } + } + return h; +} +function OktaAuthProvider(config) { + const { domain, overrideScope, ...restConfig } = config; + const stateCode = encodeString(config.client_id).toString(); + return { + ...restConfig, + id: "okta", + scope: overrideScope ?? "email openid profile", + issuer: `https://${domain}`, + name: "Okta", + algorithm: "oidc", + kind: "oauth", + params: { + state: `state-${stateCode}`, + }, + profile: (profile) => { + return { + sub: profile.sub, + name: profile.name, + email: profile.email, + picture: profile.picture, + }; + }, + }; +} +export default OktaAuthProvider; +//# sourceMappingURL=okta.js.map \ No newline at end of file diff --git a/dist/providers/oidc/okta.js.map b/dist/providers/oidc/okta.js.map new file mode 100644 index 0000000..0887968 --- /dev/null +++ b/dist/providers/oidc/okta.js.map @@ -0,0 +1 @@ +{"version":3,"file":"okta.js","sourceRoot":"","sources":["../../../src/providers/oidc/okta.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,SAAS,YAAY,CAAC,CAAS;IAC7B,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAA;IAClB,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACV,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACb,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAA,CAAC,sCAAsC;QACnF,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAsB;IAC9C,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAEvD,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAA;IAE3D,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,MAAM;QACV,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,MAAM,EAAE,WAAW,MAAM,EAAE;QAC3B,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,OAAO;QACb,MAAM,EAAE;YACN,KAAK,EAAE,SAAS,SAAS,EAAE;SAC5B;QACD,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,gBAAgB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/slack.d.ts b/dist/providers/oidc/slack.d.ts new file mode 100644 index 0000000..8fe7dca --- /dev/null +++ b/dist/providers/oidc/slack.d.ts @@ -0,0 +1,34 @@ +import type { OIDCProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; +type SlackAuthConfig = OAuthBaseProviderConfig; +/** + * Add Slack OIDC Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/slack + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {SlackAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * SlackAuthProvider({ + * client_id: process.env.SLACK_CLIENT_ID as string, + * client_secret: process.env.SLACK_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + * + */ +declare function SlackAuthProvider(config: SlackAuthConfig): OIDCProviderConfig; +export default SlackAuthProvider; +//# sourceMappingURL=slack.d.ts.map \ No newline at end of file diff --git a/dist/providers/oidc/slack.d.ts.map b/dist/providers/oidc/slack.d.ts.map new file mode 100644 index 0000000..9aa3567 --- /dev/null +++ b/dist/providers/oidc/slack.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"slack.d.ts","sourceRoot":"","sources":["../../../src/providers/oidc/slack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,KAAK,eAAe,GAAG,uBAAuB,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,iBAAS,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,kBAAkB,CAoBtE;AAED,eAAe,iBAAiB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/slack.js b/dist/providers/oidc/slack.js new file mode 100644 index 0000000..20bbbf7 --- /dev/null +++ b/dist/providers/oidc/slack.js @@ -0,0 +1,51 @@ +/** + * Add Slack OIDC Provider + * + * #### Callback or Redirect URL pattern + * + * ``` + * https://example.com/api/{name}/oauth/callback/slack + * ``` + * + * #### Plugin Setup + * + * ```ts + * import { Plugin } from 'payload' + * import {authPlugin} from "payload-auth-plugin" + * import {SlackAuthProvider} from "payload-auth-plugin/providers" + * + * export const plugins: Plugin[] = [ + * authPlugin({ + * providers:[ + * SlackAuthProvider({ + * client_id: process.env.SLACK_CLIENT_ID as string, + * client_secret: process.env.SLACK_CLIENT_SECRET as string, + * }) + * ] + * }) + * ] + * ``` + * + */ +function SlackAuthProvider(config) { + const { overrideScope, ...restConfig } = config; + return { + ...restConfig, + id: "slack", + scope: overrideScope ?? "openid email profile", + issuer: "https://slack.com", + name: "Slack", + algorithm: "oidc", + kind: "oauth", + profile: (profile) => { + return { + sub: profile.sub, + name: profile.name, + email: profile.email, + picture: profile.picture, + }; + }, + }; +} +export default SlackAuthProvider; +//# sourceMappingURL=slack.js.map \ No newline at end of file diff --git a/dist/providers/oidc/slack.js.map b/dist/providers/oidc/slack.js.map new file mode 100644 index 0000000..9bcc001 --- /dev/null +++ b/dist/providers/oidc/slack.js.map @@ -0,0 +1 @@ +{"version":3,"file":"slack.js","sourceRoot":"","sources":["../../../src/providers/oidc/slack.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,SAAS,iBAAiB,CAAC,MAAuB;IAChD,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,MAAM,EAAE,mBAAmB;QAC3B,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,iBAAiB,CAAA"} \ No newline at end of file diff --git a/dist/providers/passkey.d.ts b/dist/providers/passkey.d.ts new file mode 100644 index 0000000..a36b75b --- /dev/null +++ b/dist/providers/passkey.d.ts @@ -0,0 +1,4 @@ +import { PasskeyProviderConfig } from "../types.js"; +declare function PasskeyAuthProvider(): PasskeyProviderConfig; +export default PasskeyAuthProvider; +//# sourceMappingURL=passkey.d.ts.map \ No newline at end of file diff --git a/dist/providers/passkey.d.ts.map b/dist/providers/passkey.d.ts.map new file mode 100644 index 0000000..e218b98 --- /dev/null +++ b/dist/providers/passkey.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"passkey.d.ts","sourceRoot":"","sources":["../../src/providers/passkey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAEnD,iBAAS,mBAAmB,IAAI,qBAAqB,CAKpD;AAED,eAAe,mBAAmB,CAAA"} \ No newline at end of file diff --git a/dist/providers/passkey.js b/dist/providers/passkey.js new file mode 100644 index 0000000..32f2197 --- /dev/null +++ b/dist/providers/passkey.js @@ -0,0 +1,8 @@ +function PasskeyAuthProvider() { + return { + id: "passkey", + kind: "passkey", + }; +} +export default PasskeyAuthProvider; +//# sourceMappingURL=passkey.js.map \ No newline at end of file diff --git a/dist/providers/passkey.js.map b/dist/providers/passkey.js.map new file mode 100644 index 0000000..e03dda1 --- /dev/null +++ b/dist/providers/passkey.js.map @@ -0,0 +1 @@ +{"version":3,"file":"passkey.js","sourceRoot":"","sources":["../../src/providers/passkey.ts"],"names":[],"mappings":"AAEA,SAAS,mBAAmB;IAC1B,OAAO;QACL,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,SAAS;KAChB,CAAA;AACH,CAAC;AAED,eAAe,mBAAmB,CAAA"} \ No newline at end of file diff --git a/dist/providers/password.d.ts b/dist/providers/password.d.ts new file mode 100644 index 0000000..fc069a3 --- /dev/null +++ b/dist/providers/password.d.ts @@ -0,0 +1,12 @@ +import type { PasswordProviderConfig } from "../types.js"; +type PasswordProviderOptions = { + /** + * Email templates + */ + emailTemplates: { + forgotPassword: any; + }; +}; +declare function PasswordProvider(options: PasswordProviderOptions): PasswordProviderConfig; +export default PasswordProvider; +//# sourceMappingURL=password.d.ts.map \ No newline at end of file diff --git a/dist/providers/password.d.ts.map b/dist/providers/password.d.ts.map new file mode 100644 index 0000000..c8b3e89 --- /dev/null +++ b/dist/providers/password.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../src/providers/password.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD,KAAK,uBAAuB,GAAG;IAC7B;;OAEG;IACH,cAAc,EAAE;QACd,cAAc,EAAE,GAAG,CAAA;KACpB,CAAA;CACF,CAAA;AAED,iBAAS,gBAAgB,CACvB,OAAO,EAAE,uBAAuB,GAC/B,sBAAsB,CAMxB;AACD,eAAe,gBAAgB,CAAA"} \ No newline at end of file diff --git a/dist/providers/password.js b/dist/providers/password.js new file mode 100644 index 0000000..d72f4a7 --- /dev/null +++ b/dist/providers/password.js @@ -0,0 +1,9 @@ +function PasswordProvider(options) { + return { + id: "password", + kind: "password", + ...options, + }; +} +export default PasswordProvider; +//# sourceMappingURL=password.js.map \ No newline at end of file diff --git a/dist/providers/password.js.map b/dist/providers/password.js.map new file mode 100644 index 0000000..16bc060 --- /dev/null +++ b/dist/providers/password.js.map @@ -0,0 +1 @@ +{"version":3,"file":"password.js","sourceRoot":"","sources":["../../src/providers/password.ts"],"names":[],"mappings":"AAWA,SAAS,gBAAgB,CACvB,OAAgC;IAEhC,OAAO;QACL,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,UAAU;QAChB,GAAG,OAAO;KACX,CAAA;AACH,CAAC;AACD,eAAe,gBAAgB,CAAA"} \ No newline at end of file diff --git a/dist/providers/utils.d.ts b/dist/providers/utils.d.ts new file mode 100644 index 0000000..7667a49 --- /dev/null +++ b/dist/providers/utils.d.ts @@ -0,0 +1,24 @@ +import { ProvidersConfig, OAuthProviderConfig, PasskeyProviderConfig, PasswordProviderConfig } from "../types.js"; +/** + * Reducer function to extract the OAuth providers + * + * @internal + * @param {ProvidersConfig[]} providers + * @returns {Record} + */ +export declare function getOAuthProviders(providers: ProvidersConfig[]): Record; +/** + * Function to get the Passkey provider + * + * @export + * @param {ProvidersConfig[]} providers + * @returns {(PasskeyProviderConfig | null)} + */ +export declare function getPasskeyProvider(providers: ProvidersConfig[]): PasskeyProviderConfig | null; +/** + * Function to get the Password provider + * + * @internal + */ +export declare function getPasswordProvider(providers: ProvidersConfig[]): PasswordProviderConfig | null; +//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/dist/providers/utils.d.ts.map b/dist/providers/utils.d.ts.map new file mode 100644 index 0000000..9762eb9 --- /dev/null +++ b/dist/providers/utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/providers/utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,aAAa,CAAA;AAEpB;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,eAAe,EAAE,GAC3B,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAWrC;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,eAAe,EAAE,GAC3B,qBAAqB,GAAG,IAAI,CAQ9B;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,eAAe,EAAE,GAC3B,sBAAsB,GAAG,IAAI,CAM/B"} \ No newline at end of file diff --git a/dist/providers/utils.js b/dist/providers/utils.js new file mode 100644 index 0000000..1bca23f --- /dev/null +++ b/dist/providers/utils.js @@ -0,0 +1,47 @@ +import { ProviderAlreadyExists } from "../core/errors/consoleErrors.js"; +/** + * Reducer function to extract the OAuth providers + * + * @internal + * @param {ProvidersConfig[]} providers + * @returns {Record} + */ +export function getOAuthProviders(providers) { + const records = {}; + providers.map((provider) => { + if (records[provider.id]) { + throw new ProviderAlreadyExists(); + } + if (provider.kind === "oauth") { + records[provider.id] = provider; + } + }); + return records; +} +/** + * Function to get the Passkey provider + * + * @export + * @param {ProvidersConfig[]} providers + * @returns {(PasskeyProviderConfig | null)} + */ +export function getPasskeyProvider(providers) { + const passkeyProvider = providers.find((provider) => provider.kind === "passkey"); + if (passkeyProvider) { + return passkeyProvider; + } + return null; +} +/** + * Function to get the Password provider + * + * @internal + */ +export function getPasswordProvider(providers) { + const provider = providers.find((provider) => provider.kind === "password"); + if (provider) { + return provider; + } + return null; +} +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/dist/providers/utils.js.map b/dist/providers/utils.js.map new file mode 100644 index 0000000..67d55dc --- /dev/null +++ b/dist/providers/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/providers/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAQvE;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAC/B,SAA4B;IAE5B,MAAM,OAAO,GAAwC,EAAE,CAAA;IACvD,SAAS,CAAC,GAAG,CAAC,CAAC,QAAyB,EAAE,EAAE;QAC1C,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,qBAAqB,EAAE,CAAA;QACnC,CAAC;QACD,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC9B,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAA;QACjC,CAAC;IACH,CAAC,CAAC,CAAA;IACF,OAAO,OAAO,CAAA;AAChB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,SAA4B;IAE5B,MAAM,eAAe,GAAG,SAAS,CAAC,IAAI,CACpC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,CAC1C,CAAA;IACD,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,eAAe,CAAA;IACxB,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,SAA4B;IAE5B,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,UAAU,CAAC,CAAA;IAC3E,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,QAAQ,CAAA;IACjB,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"} \ No newline at end of file diff --git a/dist/types.d.ts b/dist/types.d.ts new file mode 100644 index 0000000..10006d1 --- /dev/null +++ b/dist/types.d.ts @@ -0,0 +1,151 @@ +import type { AuthorizationServer } from "oauth4webapi"; +import { PayloadRequest } from "payload"; +export declare enum ErrorKind { + NotFound = "NotFound", + InternalServer = "InternalServer", + BadRequest = "BadRequest", + NotAuthorized = "NotAuthorized", + NotAuthenticated = "NotAuthenticated", + Conflict = "Conflict" +} +export declare enum SuccessKind { + Created = "Created", + Updated = "Updated", + Retrieved = "Retrieved", + Deleted = "Deleted" +} +export interface AuthPluginOutput { + message: string; + kind: ErrorKind | SuccessKind; + data: unknown; + isSuccess: boolean; + isError: boolean; +} +/** + * Generic OAuth provider callback output + * + * @interface OAuthProviderOutput + * @internal + */ +interface OAuthProviderOutput { + /** + * OAuth Provider ID. Usually the slugified provider name + * + * @type {string} + */ + id: string; + /** + * OAuth provider name. For example Google, Apple + * + * @type {string} + */ + name: string; + /** + * Scope of account attributes to request from the provider + * + * @type {string} + */ + scope: string; + /** + * Profile callback that returns account information requried to link with users + * + * @type {( + * profile: Record, + * ) => AccountInfo} + */ + profile: (profile: Record) => AccountInfo; +} +export interface OAuthBaseProviderConfig { + client_id: string; + client_secret?: string; + client_auth_type?: "client_secret_basic" | "client_secret_post"; + params?: Record; + /** + * Override default scope of the provider + */ + overrideScope?: string | undefined; +} +export interface OIDCProviderConfig extends OAuthProviderOutput, OAuthBaseProviderConfig { + issuer: string; + algorithm: "oidc"; + kind: "oauth"; + skip_email_verification?: boolean | undefined; +} +export interface OAuth2ProviderConfig extends OAuthProviderOutput, OAuthBaseProviderConfig { + authorization_server: AuthorizationServer; + algorithm: "oauth2"; + kind: "oauth"; +} +export type OAuthProviderConfig = OIDCProviderConfig | OAuth2ProviderConfig; +export interface AccountInfo { + sub: string; + name: string; + picture: string; + email: string; + passKey?: { + credentialId: string; + publicKey?: Uint8Array; + counter: number; + transports?: string[]; + deviceType: string; + backedUp: boolean; + }; + access_token?: string; +} +export type PasswordProviderConfig = { + id: string; + kind: "password"; + emailTemplates: { + forgotPassword: any; + }; +}; +export interface CredentialsAccountInfo { + name: string; + email: string; +} +export type PasskeyProviderConfig = { + id: string; + kind: "passkey"; +}; +export type ProvidersConfig = OAuthProviderConfig | PasskeyProviderConfig | PasswordProviderConfig; +export type AuthenticationStrategy = "Cookie"; +export type UserSession = { + createdAt: Date | string; + expiresAt: Date | string; + id: string; +}; +export interface OAuthCollections { + usersCollection: string; + accountsCollection: string; +} +export interface OAuthBaseParams { + pluginType: string; + collections: OAuthCollections; + allowOAuthAutoSignUp: boolean; + secret: string; + useAdmin: boolean; + request: PayloadRequest; + provider: OAuthProviderConfig; + successRedirectPath: string; + errorRedirectPath: string; +} +export interface OAuthHandlersParams extends OAuthBaseParams { + state?: string; +} +export interface OAuthCallbackParams extends OAuthBaseParams { +} +export interface OAuthAccountData extends Omit { + scope: string; + issuer: string; + access_token: string; +} +export interface ParsedOAuthState { + redirectPath?: string; + provider?: string; + timestamp?: number; + nonce?: string; + codeVerifier?: string; + [key: string]: unknown; +} +export {}; +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/dist/types.d.ts.map b/dist/types.d.ts.map new file mode 100644 index 0000000..753b49d --- /dev/null +++ b/dist/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAExC,oBAAY,SAAS;IACnB,Q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AA;AACD,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,MAAM,CAAA;IACvB,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,gBAAgB,CAAA;IAC7B,oBAAoB,EAAE,OAAO,CAAA;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,cAAc,CAAA;IACvB,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AACD,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,mBAAoB,SAAQ,eAAe;CAAG;AAE/D,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC;IACpE,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB"} \ No newline at end of file diff --git a/dist/types.js b/dist/types.js new file mode 100644 index 0000000..cb54075 --- /dev/null +++ b/dist/types.js @@ -0,0 +1,17 @@ +export var ErrorKind; +(function (ErrorKind) { + ErrorKind["NotFound"] = "NotFound"; + ErrorKind["InternalServer"] = "InternalServer"; + ErrorKind["BadRequest"] = "BadRequest"; + ErrorKind["NotAuthorized"] = "NotAuthorized"; + ErrorKind["NotAuthenticated"] = "NotAuthenticated"; + ErrorKind["Conflict"] = "Conflict"; +})(ErrorKind || (ErrorKind = {})); +export var SuccessKind; +(function (SuccessKind) { + SuccessKind["Created"] = "Created"; + SuccessKind["Updated"] = "Updated"; + SuccessKind["Retrieved"] = "Retrieved"; + SuccessKind["Deleted"] = "Deleted"; +})(SuccessKind || (SuccessKind = {})); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/dist/types.js.map b/dist/types.js.map new file mode 100644 index 0000000..48ae2b0 --- /dev/null +++ b/dist/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,MAAM,CAAN,IAAY,SAOX;AAPD,WAAY,SAAS;IACnB,kCAAqB,CAAA;IACrB,8CAAiC,CAAA;IACjC,sCAAyB,CAAA;IACzB,4CAA+B,CAAA;IAC/B,kDAAqC,CAAA;IACrC,kCAAqB,CAAA;AACvB,CAAC,EAPW,SAAS,KAAT,SAAS,QAOpB;AAED,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,sCAAuB,CAAA;IACvB,kCAAmB,CAAA;AACrB,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB"} \ No newline at end of file diff --git a/src/core/protocols/oauth/oauth_authentication.ts b/src/core/protocols/oauth/oauth_authentication.ts index 92042cf..48f8527 100644 --- a/src/core/protocols/oauth/oauth_authentication.ts +++ b/src/core/protocols/oauth/oauth_authentication.ts @@ -169,39 +169,33 @@ export async function OAuthAuthentication( cookies = invalidateOAuthCookies(cookies) - // Get the intended redirect URL from the state or cookies + // Get the state data from cookies and pass it as a query parameter const parsedCookies = parseCookies(request.headers) - let redirectUrl = successRedirectPath - - // Option 1: If you're using the manual state validation approach const cookieState = parsedCookies.get("__session-oauth-state") + + const successRedirectionURL = new URL( + `${payload.config.serverURL}${successRedirectPath}`, + ) + + // Add the state as a query parameter if it exists if (cookieState) { try { - const stateData = JSON.parse(cookieState) - if (stateData.redirectUrl) { - redirectUrl = stateData.redirectUrl - } + // Validate that it's proper JSON + JSON.parse(cookieState) + // Add the state as a query parameter (URL encode it) + successRedirectionURL.searchParams.set( + "state", + encodeURIComponent(cookieState), + ) + console.log("Added state to redirect URL:", cookieState) } catch (error) { - console.error("Failed to parse state data:", error) - // Fall back to default redirect path + console.error( + "Failed to parse state data, continuing without state:", + error, + ) } } - console.log("Redirecting user to:", redirectUrl) - - // Ensure the redirect URL is safe (starts with / or is a relative path) - if ( - !redirectUrl.startsWith("/") && - !redirectUrl.startsWith(payload.config.serverURL) - ) { - console.warn("Unsafe redirect URL detected, using default:", redirectUrl) - redirectUrl = successRedirectPath - } - - const successRedirectionURL = new URL( - `${payload.config.serverURL}${redirectUrl}`, - ) - const res = new Response(null, { status: 302, headers: { From f6df91341181a5b22a1d39d571906606c417b0ac Mon Sep 17 00:00:00 2001 From: = Date: Tue, 5 Aug 2025 17:04:47 +0100 Subject: [PATCH 5/7] add verified --- dist/core/protocols/oauth/oauth_authentication.d.ts.map | 2 +- dist/core/protocols/oauth/oauth_authentication.js | 5 +++-- dist/core/protocols/oauth/oauth_authentication.js.map | 2 +- package.json | 4 ++-- src/core/protocols/oauth/oauth_authentication.ts | 5 +++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dist/core/protocols/oauth/oauth_authentication.d.ts.map b/dist/core/protocols/oauth/oauth_authentication.d.ts.map index 6868c9f..7ce3695 100644 --- a/dist/core/protocols/oauth/oauth_authentication.d.ts.map +++ b/dist/core/protocols/oauth/oauth_authentication.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"oauth_authentication.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oauth_authentication.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,cAAc,EAGf,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAY5D,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,gBAAgB,EAC7B,oBAAoB,EAAE,OAAO,EAC7B,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,cAAc,EACvB,mBAAmB,EAAE,MAAM,EAC3B,iBAAiB,EAAE,MAAM,EACzB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,QAAQ,CAAC,CAmLnB"} \ No newline at end of file +{"version":3,"file":"oauth_authentication.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oauth_authentication.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,cAAc,EAGf,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAY5D,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,gBAAgB,EAC7B,oBAAoB,EAAE,OAAO,EAC7B,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,cAAc,EACvB,mBAAmB,EAAE,MAAM,EAC3B,iBAAiB,EAAE,MAAM,EACzB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,QAAQ,CAAC,CAoLnB"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth_authentication.js b/dist/core/protocols/oauth/oauth_authentication.js index cff1e15..f1c27cc 100644 --- a/dist/core/protocols/oauth/oauth_authentication.js +++ b/dist/core/protocols/oauth/oauth_authentication.js @@ -25,6 +25,7 @@ export async function OAuthAuthentication(pluginType, collections, allowOAuthAut const data = { email, name, + _verified: true, }; const hasAuthEnabled = Boolean(payload.collections[collections.usersCollection]?.config.auth); if (hasAuthEnabled) { @@ -41,8 +42,8 @@ export async function OAuthAuthentication(pluginType, collections, allowOAuthAut } const accountData = { scope, - name: name, - picture: picture, + name, + picture, issuerName: issuer, access_token, }; diff --git a/dist/core/protocols/oauth/oauth_authentication.js.map b/dist/core/protocols/oauth/oauth_authentication.js.map index 7002db2..e206126 100644 --- a/dist/core/protocols/oauth/oauth_authentication.js.map +++ b/dist/core/protocols/oauth/oauth_authentication.js.map @@ -1 +1 @@ -{"version":3,"file":"oauth_authentication.js","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oauth_authentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAQtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EACL,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,UAAkB,EAClB,WAA6B,EAC7B,oBAA6B,EAC7B,QAAiB,EACjB,MAAc,EACd,OAAuB,EACvB,mBAA2B,EAC3B,iBAAyB,EACzB,QAA0B;IAE1B,MAAM,EACJ,KAAK,EAAE,MAAM,EACb,GAAG,EACH,IAAI,EACJ,KAAK,EACL,MAAM,EACN,OAAO,EACP,YAAY,GACb,GAAG,QAAQ,CAAA;IACZ,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;IAE3B,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAA;IAElC,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC;QACrC,UAAU,EAAE,WAAW,CAAC,eAAe;QACvC,KAAK,EAAE;YACL,KAAK,EAAE;gBACL,MAAM,EAAE,KAAK;aACd;SACF;KACF,CAAC,CAAA;IAEF,IAAI,UAAmC,CAAA;IACvC,IAAI,WA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,EAAE,CACpD,CAAA;IAED,kDAAkD;IAClD,IAAI,WAAW,EAAE,CAAC;QAChB,IAAI,CAAC;YACH,iCAAiC;YACjC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;YACvB,qDAAqD;YACrD,qBAAqB,CAAC,YAAY,CAAC,GAAG,CACpC,OAAO,EACP,kBAAkB,CAAC,WAAW,CAAC,CAChC,CAAA;YACD,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,WAAW,CAAC,CAAA;QAC1D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CACX,uDAAuD,EACvD,KAAK,CACN,CAAA;QACH,CAAC;IACH,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE;QAC7B,MAAM,EAAE,GAAG;QACX,OAAO,EAAE;YACP,QAAQ,EAAE,qBAAqB,CAAC,IAAI;SACrC;KACF,CAAC,CAAA;IAEF,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAA;IACrC,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"} \ No newline at end of file +{"version":3,"file":"oauth_authentication.js","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oauth_authentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAQtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EACL,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,qBAAqB,EAAE,M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AK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAA;IACrC,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"} \ No newline at end of file diff --git a/package.json b/package.json index ad17da5..f5ed65a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "payload-auth-plugin", - "version": "0.7.4", + "version": "0.7.5", "type": "module", "sideEffects": false, "author": "Sourab Pramanik", @@ -95,4 +95,4 @@ "peerDependencies": { "payload": "^3.48.0" } -} +} \ No newline at end of file diff --git a/src/core/protocols/oauth/oauth_authentication.ts b/src/core/protocols/oauth/oauth_authentication.ts index 48f8527..2be3aaf 100644 --- a/src/core/protocols/oauth/oauth_authentication.ts +++ b/src/core/protocols/oauth/oauth_authentication.ts @@ -59,6 +59,7 @@ export async function OAuthAuthentication( const data: Record = { email, name, + _verified: true, } const hasAuthEnabled = Boolean( payload.collections[collections.usersCollection]?.config.auth, @@ -79,8 +80,8 @@ export async function OAuthAuthentication( const accountData: Record = { scope, - name: name, - picture: picture, + name, + picture, issuerName: issuer, access_token, } From 2df5719794c9129dddf2cd943492ca4fce916057 Mon Sep 17 00:00:00 2001 From: WillODR Date: Wed, 24 Sep 2025 13:34:10 +0100 Subject: [PATCH 6/7] feat(collection): hide sensitive fields in users collection configuration --- dist/collection/index.d.ts.map | 2 +- dist/collection/index.js | 21 +++++++++++++++++++++ dist/collection/index.js.map | 2 +- package.json | 4 ++-- src/collection/index.ts | 21 +++++++++++++++++++++ 5 files changed, 46 insertions(+), 4 deletions(-) diff --git a/dist/collection/index.d.ts.map b/dist/collection/index.d.ts.map index 3586689..13ea03b 100644 --- a/dist/collection/index.d.ts.map +++ b/dist/collection/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collection/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAGtD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,oBAAoB,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,GAAG;IACrD,MAAM,CAAC,EAAE,KAAK,EAAE,GAAG,SAAS,CAAA;CAC7B,KACA,gBA+EF,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAChC,oBAAoB,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,GAAG;IACrD,MAAM,CAAC,EAAE,KAAK,EAAE,GAAG,SAAS,CAAA;CAC7B,EACD,qBAAqB,MAAM,KAC1B,gBAgHF,CAAA"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collection/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAGtD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,oBAAoB,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,GAAG;IACrD,MAAM,CAAC,EAAE,KAAK,EAAE,GAAG,SAAS,CAAA;CAC7B,KACA,gBAoGF,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAChC,oBAAoB,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,GAAG;IACrD,MAAM,CAAC,EAAE,KAAK,EAAE,GAAG,SAAS,CAAA;CAC7B,EACD,qBAAqB,MAAM,KAC1B,gBAgHF,CAAA"} \ No newline at end of file diff --git a/dist/collection/index.js b/dist/collection/index.js index f28abb6..2bbf5a1 100644 --- a/dist/collection/index.js +++ b/dist/collection/index.js @@ -19,36 +19,57 @@ export const withUsersCollection = (incomingCollection) => { name: "hashedPassword", type: "text", unique: true, + admin: { + hidden: true, + }, }, { name: "hashSalt", type: "text", unique: true, + admin: { + hidden: true, + }, }, { name: "hashIterations", type: "number", + admin: { + hidden: true, + }, }, { name: "verificationCode", label: "Verification Code", type: "text", unique: true, + admin: { + hidden: true, + }, }, { name: "verificationHash", label: "Verification Hash", type: "text", + admin: { + hidden: true, + }, }, { name: "verificationTokenExpire", label: "Verification Token Expire", type: "number", + admin: { + hidden: true, + }, }, { name: "verificationKind", label: "Verification Kind", type: "text", + admin: { + hidden: true, + }, }, ]; if (!incomingCollection.fields?.find((field) => field.type === "email")) { diff --git a/dist/collection/index.js.map b/dist/collection/index.js.map index 5c8e04f..5e8c8c3 100644 --- a/dist/collection/index.js.map +++ b/dist/collection/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/collection/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAEvE;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,kBAEC,EACiB,EAAE;IACpB,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC;QAC7B,MAAM,IAAI,qBAAqB,EAAE,CAAA;IACnC,CAAC;IAED,IAAI,kBAAkB,CAAC,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED,MAAM,gBAAgB,GAAqB;QACzC,GAAG,kBAAkB;QACrB,MAAM,EAAE,EAAE;KACX,CAAA;IAED,MAAM,UAAU,GAAY;QAC1B;YACE,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,IAAI;SACb;QACD;YACE,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,IAAI;SACb;QACD;YACE,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,QAAQ;SACf;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,KAAK,EAAE,mBAAmB;YAC1B,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,IAAI;SACb;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,KAAK,EAAE,mBAAmB;YAC1B,IAAI,EAAE,MAAM;S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AAI,EAAE,CAAC;KACrC,CAAA;IACD,gBAAgB,CAAC,KAAK,GAAG;QACvB,cAAc,EAAE,CAAC,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC;QAC/C,UAAU,EAAE,IAAI;QAChB,GAAG,kBAAkB,CAAC,KAAK;KAC5B,CAAA;IACD,gBAAgB,CAAC,UAAU,GAAG,IAAI,CAAA;IAClC,OAAO,gBAAgB,CAAA;AACzB,CAAC,CAAA"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/collection/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAEvE;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,kBAEC,EACiB,EAAE;IACpB,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC;QAC7B,MAAM,IAAI,qBAAqB,EAAE,CAAA;IACnC,CAAC;IAED,IAAI,kBAAkB,CAAC,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED,MAAM,gBAAgB,GAAqB;QACzC,GAAG,kBAAkB;QACrB,MAAM,EAAE,EAAE;KACX,CAAA;IAED,MAAM,UAAU,GAAY;QAC1B;YACE,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE;gBACL,MAAM,EAAE,IAAI;aACb;SACF;QACD;YACE,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE;gBACL,MAAM,EAAE,IAAI;aACb;SACF;QACD;YACE,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE;gBACL,MAAM,EAAE,IAAI;aACb;SACF;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,KAAK,EAAE,mBAAmB;YAC1B,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,IAAI;YACZ,KAAK,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AAE,CAAC,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;QAC1C,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK;QACnB,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK;QACnB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;QAClB,GAAG,CAAC,kBAAkB,CAAC,MAAM,IAAI,EAAE,CAAC;KACrC,CAAA;IACD,gBAAgB,CAAC,KAAK,GAAG;QACvB,cAAc,EAAE,CAAC,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC;QAC/C,UAAU,EAAE,IAAI;QAChB,GAAG,kBAAkB,CAAC,KAAK;KAC5B,CAAA;IACD,gBAAgB,CAAC,UAAU,GAAG,IAAI,CAAA;IAClC,OAAO,gBAAgB,CAAA;AACzB,CAAC,CAAA"} \ No newline at end of file diff --git a/package.json b/package.json index f5ed65a..a260d31 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "payload-auth-plugin", - "version": "0.7.5", + "version": "0.7.6", "type": "module", "sideEffects": false, "author": "Sourab Pramanik", @@ -95,4 +95,4 @@ "peerDependencies": { "payload": "^3.48.0" } -} \ No newline at end of file +} diff --git a/src/collection/index.ts b/src/collection/index.ts index d9f42e4..1b26aba 100644 --- a/src/collection/index.ts +++ b/src/collection/index.ts @@ -28,36 +28,57 @@ export const withUsersCollection = ( name: "hashedPassword", type: "text", unique: true, + admin: { + hidden: true, + }, }, { name: "hashSalt", type: "text", unique: true, + admin: { + hidden: true, + }, }, { name: "hashIterations", type: "number", + admin: { + hidden: true, + }, }, { name: "verificationCode", label: "Verification Code", type: "text", unique: true, + admin: { + hidden: true, + }, }, { name: "verificationHash", label: "Verification Hash", type: "text", + admin: { + hidden: true, + }, }, { name: "verificationTokenExpire", label: "Verification Token Expire", type: "number", + admin: { + hidden: true, + }, }, { name: "verificationKind", label: "Verification Kind", type: "text", + admin: { + hidden: true, + }, }, ] if (!incomingCollection.fields?.find((field) => field.type === "email")) { From 8802130e1805620584acc2f61e584f5da0eb8175 Mon Sep 17 00:00:00 2001 From: WillODR Date: Wed, 24 Sep 2025 13:37:39 +0100 Subject: [PATCH 7/7] delete dist --- .gitignore | 2 +- dist/client/index.d.ts | 40 --- dist/client/index.d.ts.map | 1 - dist/client/index.js | 80 ----- dist/client/index.js.map | 1 - dist/client/oauth.d.ts | 9 - dist/client/oauth.d.ts.map | 1 - dist/client/oauth.js | 7 - dist/client/oauth.js.map | 1 - dist/client/passkey/authentication.d.ts | 10 - dist/client/passkey/authentication.d.ts.map | 1 - dist/client/passkey/authentication.js | 30 -- dist/client/passkey/authentication.js.map | 1 - dist/client/passkey/index.d.ts | 2 - dist/client/passkey/index.d.ts.map | 1 - dist/client/passkey/index.js | 36 -- dist/client/passkey/index.js.map | 1 - dist/client/passkey/registration.d.ts | 2 - dist/client/passkey/registration.d.ts.map | 1 - dist/client/passkey/registration.js | 28 -- dist/client/passkey/registration.js.map | 1 - dist/client/password.d.ts | 33 -- dist/client/password.d.ts.map | 1 - dist/client/password.js | 92 ----- dist/client/password.js.map | 1 - dist/client/refresh.d.ts | 8 - dist/client/refresh.d.ts.map | 1 - dist/client/refresh.js | 16 - dist/client/refresh.js.map | 1 - dist/client/register.d.ts | 10 - dist/client/register.d.ts.map | 1 - dist/client/register.js | 7 - dist/client/register.js.map | 1 - dist/client/session.d.ts | 16 - dist/client/session.d.ts.map | 1 - dist/client/session.js | 30 -- dist/client/session.js.map | 1 - dist/client/signin.d.ts | 13 - dist/client/signin.d.ts.map | 1 - dist/client/signin.js | 10 - dist/client/signin.js.map | 1 - dist/client/signout.d.ts | 15 - dist/client/signout.d.ts.map | 1 - dist/client/signout.js | 32 -- dist/client/signout.js.map | 1 - dist/collection/hooks.d.ts | 3 - dist/collection/hooks.d.ts.map | 1 - dist/collection/hooks.js | 11 - dist/collection/hooks.js.map | 1 - dist/collection/index.d.ts | 19 - dist/collection/index.d.ts.map | 1 - dist/collection/index.js | 218 ------------ dist/collection/index.js.map | 1 - dist/constants.d.ts | 3 - dist/constants.d.ts.map | 1 - dist/constants.js | 3 - dist/constants.js.map | 1 - dist/core/endpoints.d.ts | 111 ------ dist/core/endpoints.d.ts.map | 1 - dist/core/endpoints.js | 145 -------- dist/core/endpoints.js.map | 1 - dist/core/errors/apiErrors.d.ts | 47 --- dist/core/errors/apiErrors.d.ts.map | 1 - dist/core/errors/apiErrors.js | 93 ----- dist/core/errors/apiErrors.js.map | 1 - dist/core/errors/consoleErrors.d.ts | 65 ---- dist/core/errors/consoleErrors.d.ts.map | 1 - dist/core/errors/consoleErrors.js | 110 ------ dist/core/errors/consoleErrors.js.map | 1 - dist/core/preflights/collections.d.ts | 3 - dist/core/preflights/collections.d.ts.map | 1 - dist/core/preflights/collections.js | 13 - dist/core/preflights/collections.js.map | 1 - .../protocols/oauth/oauth2_authorization.d.ts | 4 - .../oauth/oauth2_authorization.d.ts.map | 1 - .../protocols/oauth/oauth2_authorization.js | 51 --- .../oauth/oauth2_authorization.js.map | 1 - .../core/protocols/oauth/oauth2_callback.d.ts | 3 - .../protocols/oauth/oauth2_callback.d.ts.map | 1 - dist/core/protocols/oauth/oauth2_callback.js | 60 ---- .../protocols/oauth/oauth2_callback.js.map | 1 - .../protocols/oauth/oauth_authentication.d.ts | 4 - .../oauth/oauth_authentication.d.ts.map | 1 - .../protocols/oauth/oauth_authentication.js | 143 -------- .../oauth/oauth_authentication.js.map | 1 - .../protocols/oauth/oidc_authorization.d.ts | 4 - .../oauth/oidc_authorization.d.ts.map | 1 - .../protocols/oauth/oidc_authorization.js | 63 ---- .../protocols/oauth/oidc_authorization.js.map | 1 - dist/core/protocols/oauth/oidc_callback.d.ts | 3 - .../protocols/oauth/oidc_callback.d.ts.map | 1 - dist/core/protocols/oauth/oidc_callback.js | 92 ----- .../core/protocols/oauth/oidc_callback.js.map | 1 - .../protocols/passkey/authentication.d.ts | 5 - .../protocols/passkey/authentication.d.ts.map | 1 - dist/core/protocols/passkey/authentication.js | 73 ---- .../protocols/passkey/authentication.js.map | 1 - dist/core/protocols/passkey/index.d.ts | 3 - dist/core/protocols/passkey/index.d.ts.map | 1 - dist/core/protocols/passkey/index.js | 24 -- dist/core/protocols/passkey/index.js.map | 1 - dist/core/protocols/passkey/registration.d.ts | 5 - .../protocols/passkey/registration.d.ts.map | 1 - dist/core/protocols/passkey/registration.js | 70 ---- .../protocols/passkey/registration.js.map | 1 - dist/core/protocols/password.d.ts | 17 - dist/core/protocols/password.d.ts.map | 1 - dist/core/protocols/password.js | 326 ------------------ dist/core/protocols/password.js.map | 1 - dist/core/protocols/session.d.ts | 7 - dist/core/protocols/session.d.ts.map | 1 - dist/core/protocols/session.js | 110 ------ dist/core/protocols/session.js.map | 1 - dist/core/routeHandlers/oauth.d.ts | 10 - dist/core/routeHandlers/oauth.d.ts.map | 1 - dist/core/routeHandlers/oauth.js | 76 ---- dist/core/routeHandlers/oauth.js.map | 1 - dist/core/routeHandlers/passkey.d.ts | 4 - dist/core/routeHandlers/passkey.d.ts.map | 1 - dist/core/routeHandlers/passkey.js | 21 -- dist/core/routeHandlers/passkey.js.map | 1 - dist/core/routeHandlers/password.d.ts | 6 - dist/core/routeHandlers/password.d.ts.map | 1 - dist/core/routeHandlers/password.js | 25 -- dist/core/routeHandlers/password.js.map | 1 - dist/core/routeHandlers/session.d.ts | 5 - dist/core/routeHandlers/session.d.ts.map | 1 - dist/core/routeHandlers/session.js | 21 -- dist/core/routeHandlers/session.js.map | 1 - dist/core/utils/cb.d.ts | 2 - dist/core/utils/cb.d.ts.map | 1 - dist/core/utils/cb.js | 7 - dist/core/utils/cb.js.map | 1 - dist/core/utils/cookies.d.ts | 12 - dist/core/utils/cookies.d.ts.map | 1 - dist/core/utils/cookies.js | 37 -- dist/core/utils/cookies.js.map | 1 - dist/core/utils/hash.d.ts | 7 - dist/core/utils/hash.d.ts.map | 1 - dist/core/utils/hash.js | 54 --- dist/core/utils/hash.js.map | 1 - dist/core/utils/password.d.ts | 7 - dist/core/utils/password.d.ts.map | 1 - dist/core/utils/password.js | 37 -- dist/core/utils/password.js.map | 1 - dist/core/utils/session.d.ts | 3 - dist/core/utils/session.d.ts.map | 1 - dist/core/utils/session.js | 8 - dist/core/utils/session.js.map | 1 - dist/core/utils/slug.d.ts | 2 - dist/core/utils/slug.d.ts.map | 1 - dist/core/utils/slug.js | 5 - dist/core/utils/slug.js.map | 1 - dist/index.d.ts | 2 - dist/index.d.ts.map | 1 - dist/index.js | 2 - dist/index.js.map | 1 - dist/plugin.d.ts | 90 ----- dist/plugin.d.ts.map | 1 - dist/plugin.js | 78 ----- dist/plugin.js.map | 1 - dist/providers/index.d.ts | 20 -- dist/providers/index.d.ts.map | 1 - dist/providers/index.js | 20 -- dist/providers/index.js.map | 1 - dist/providers/magiclink.d.ts | 1 - dist/providers/magiclink.d.ts.map | 1 - dist/providers/magiclink.js | 3 - dist/providers/magiclink.js.map | 1 - dist/providers/oauth2/apple.d.ts | 35 -- dist/providers/oauth2/apple.d.ts.map | 1 - dist/providers/oauth2/apple.js | 61 ---- dist/providers/oauth2/apple.js.map | 1 - dist/providers/oauth2/atlassian.d.ts | 35 -- dist/providers/oauth2/atlassian.d.ts.map | 1 - dist/providers/oauth2/atlassian.js | 59 ---- dist/providers/oauth2/atlassian.js.map | 1 - dist/providers/oauth2/auth0.d.ts | 37 -- dist/providers/oauth2/auth0.d.ts.map | 1 - dist/providers/oauth2/auth0.js | 58 ---- dist/providers/oauth2/auth0.js.map | 1 - dist/providers/oauth2/discord.d.ts | 32 -- dist/providers/oauth2/discord.d.ts.map | 1 - dist/providers/oauth2/discord.js | 56 --- dist/providers/oauth2/discord.js.map | 1 - dist/providers/oauth2/facebook.d.ts | 33 -- dist/providers/oauth2/facebook.d.ts.map | 1 - dist/providers/oauth2/facebook.js | 64 ---- dist/providers/oauth2/facebook.js.map | 1 - dist/providers/oauth2/github.d.ts | 34 -- dist/providers/oauth2/github.d.ts.map | 1 - dist/providers/oauth2/github.js | 57 --- dist/providers/oauth2/github.js.map | 1 - dist/providers/oauth2/jumpcloud.d.ts | 32 -- dist/providers/oauth2/jumpcloud.d.ts.map | 1 - dist/providers/oauth2/jumpcloud.js | 55 --- dist/providers/oauth2/jumpcloud.js.map | 1 - dist/providers/oauth2/twitch.d.ts | 33 -- dist/providers/oauth2/twitch.d.ts.map | 1 - dist/providers/oauth2/twitch.js | 63 ---- dist/providers/oauth2/twitch.js.map | 1 - dist/providers/oidc/apple.d.ts | 35 -- dist/providers/oidc/apple.d.ts.map | 1 - dist/providers/oidc/apple.js | 49 --- dist/providers/oidc/apple.js.map | 1 - dist/providers/oidc/cognito.d.ts | 35 -- dist/providers/oidc/cognito.d.ts.map | 1 - dist/providers/oidc/cognito.js | 50 --- dist/providers/oidc/cognito.js.map | 1 - dist/providers/oidc/gitlab.d.ts | 34 -- dist/providers/oidc/gitlab.d.ts.map | 1 - dist/providers/oidc/gitlab.js | 51 --- dist/providers/oidc/gitlab.js.map | 1 - dist/providers/oidc/google.d.ts | 31 -- dist/providers/oidc/google.d.ts.map | 1 - dist/providers/oidc/google.js | 48 --- dist/providers/oidc/google.js.map | 1 - dist/providers/oidc/keycloak.d.ts | 43 --- dist/providers/oidc/keycloak.d.ts.map | 1 - dist/providers/oidc/keycloak.js | 55 --- dist/providers/oidc/keycloak.js.map | 1 - dist/providers/oidc/microsoft-entra.d.ts | 38 -- dist/providers/oidc/microsoft-entra.d.ts.map | 1 - dist/providers/oidc/microsoft-entra.js | 53 --- dist/providers/oidc/microsoft-entra.js.map | 1 - dist/providers/oidc/okta.d.ts | 7 - dist/providers/oidc/okta.d.ts.map | 1 - dist/providers/oidc/okta.js | 67 ---- dist/providers/oidc/okta.js.map | 1 - dist/providers/oidc/slack.d.ts | 34 -- dist/providers/oidc/slack.d.ts.map | 1 - dist/providers/oidc/slack.js | 51 --- dist/providers/oidc/slack.js.map | 1 - dist/providers/passkey.d.ts | 4 - dist/providers/passkey.d.ts.map | 1 - dist/providers/passkey.js | 8 - dist/providers/passkey.js.map | 1 - dist/providers/password.d.ts | 12 - dist/providers/password.d.ts.map | 1 - dist/providers/password.js | 9 - dist/providers/password.js.map | 1 - dist/providers/utils.d.ts | 24 -- dist/providers/utils.d.ts.map | 1 - dist/providers/utils.js | 47 --- dist/providers/utils.js.map | 1 - dist/types.d.ts | 151 -------- dist/types.d.ts.map | 1 - dist/types.js | 17 - dist/types.js.map | 1 - 249 files changed, 1 insertion(+), 4824 deletions(-) delete mode 100644 dist/client/index.d.ts delete mode 100644 dist/client/index.d.ts.map delete mode 100644 dist/client/index.js delete mode 100644 dist/client/index.js.map delete mode 100644 dist/client/oauth.d.ts delete mode 100644 dist/client/oauth.d.ts.map delete mode 100644 dist/client/oauth.js delete mode 100644 dist/client/oauth.js.map delete mode 100644 dist/client/passkey/authentication.d.ts delete mode 100644 dist/client/passkey/authentication.d.ts.map delete mode 100644 dist/client/passkey/authentication.js delete mode 100644 dist/client/passkey/authentication.js.map delete mode 100644 dist/client/passkey/index.d.ts delete mode 100644 dist/client/passkey/index.d.ts.map delete mode 100644 dist/client/passkey/index.js delete mode 100644 dist/client/passkey/index.js.map delete mode 100644 dist/client/passkey/registration.d.ts delete mode 100644 dist/client/passkey/registration.d.ts.map delete mode 100644 dist/client/passkey/registration.js delete mode 100644 dist/client/passkey/registration.js.map delete mode 100644 dist/client/password.d.ts delete mode 100644 dist/client/password.d.ts.map delete mode 100644 dist/client/password.js delete mode 100644 dist/client/password.js.map delete mode 100644 dist/client/refresh.d.ts delete mode 100644 dist/client/refresh.d.ts.map delete mode 100644 dist/client/refresh.js delete mode 100644 dist/client/refresh.js.map delete mode 100644 dist/client/register.d.ts delete mode 100644 dist/client/register.d.ts.map delete mode 100644 dist/client/register.js delete mode 100644 dist/client/register.js.map delete mode 100644 dist/client/session.d.ts delete mode 100644 dist/client/session.d.ts.map delete mode 100644 dist/client/session.js delete mode 100644 dist/client/session.js.map delete mode 100644 dist/client/signin.d.ts delete mode 100644 dist/client/signin.d.ts.map delete mode 100644 dist/client/signin.js delete mode 100644 dist/client/signin.js.map delete mode 100644 dist/client/signout.d.ts delete mode 100644 dist/client/signout.d.ts.map delete mode 100644 dist/client/signout.js delete mode 100644 dist/client/signout.js.map delete mode 100644 dist/collection/hooks.d.ts delete mode 100644 dist/collection/hooks.d.ts.map delete mode 100644 dist/collection/hooks.js delete mode 100644 dist/collection/hooks.js.map delete mode 100644 dist/collection/index.d.ts delete mode 100644 dist/collection/index.d.ts.map delete mode 100644 dist/collection/index.js delete mode 100644 dist/collection/index.js.map delete mode 100644 dist/constants.d.ts delete mode 100644 dist/constants.d.ts.map delete mode 100644 dist/constants.js delete mode 100644 dist/constants.js.map delete mode 100644 dist/core/endpoints.d.ts delete mode 100644 dist/core/endpoints.d.ts.map delete mode 100644 dist/core/endpoints.js delete mode 100644 dist/core/endpoints.js.map delete mode 100644 dist/core/errors/apiErrors.d.ts delete mode 100644 dist/core/errors/apiErrors.d.ts.map delete mode 100644 dist/core/errors/apiErrors.js delete mode 100644 dist/core/errors/apiErrors.js.map delete mode 100644 dist/core/errors/consoleErrors.d.ts delete mode 100644 dist/core/errors/consoleErrors.d.ts.map delete mode 100644 dist/core/errors/consoleErrors.js delete mode 100644 dist/core/errors/consoleErrors.js.map delete mode 100644 dist/core/preflights/collections.d.ts delete mode 100644 dist/core/preflights/collections.d.ts.map delete mode 100644 dist/core/preflights/collections.js delete mode 100644 dist/core/preflights/collections.js.map delete mode 100644 dist/core/protocols/oauth/oauth2_authorization.d.ts delete mode 100644 dist/core/protocols/oauth/oauth2_authorization.d.ts.map delete mode 100644 dist/core/protocols/oauth/oauth2_authorization.js delete mode 100644 dist/core/protocols/oauth/oauth2_authorization.js.map delete mode 100644 dist/core/protocols/oauth/oauth2_callback.d.ts delete mode 100644 dist/core/protocols/oauth/oauth2_callback.d.ts.map delete mode 100644 dist/core/protocols/oauth/oauth2_callback.js delete mode 100644 dist/core/protocols/oauth/oauth2_callback.js.map delete mode 100644 dist/core/protocols/oauth/oauth_authentication.d.ts delete mode 100644 dist/core/protocols/oauth/oauth_authentication.d.ts.map delete mode 100644 dist/core/protocols/oauth/oauth_authentication.js delete mode 100644 dist/core/protocols/oauth/oauth_authentication.js.map delete mode 100644 dist/core/protocols/oauth/oidc_authorization.d.ts delete mode 100644 dist/core/protocols/oauth/oidc_authorization.d.ts.map delete mode 100644 dist/core/protocols/oauth/oidc_authorization.js delete mode 100644 dist/core/protocols/oauth/oidc_authorization.js.map delete mode 100644 dist/core/protocols/oauth/oidc_callback.d.ts delete mode 100644 dist/core/protocols/oauth/oidc_callback.d.ts.map delete mode 100644 dist/core/protocols/oauth/oidc_callback.js delete mode 100644 dist/core/protocols/oauth/oidc_callback.js.map delete mode 100644 dist/core/protocols/passkey/authentication.d.ts delete mode 100644 dist/core/protocols/passkey/authentication.d.ts.map delete mode 100644 dist/core/protocols/passkey/authentication.js delete mode 100644 dist/core/protocols/passkey/authentication.js.map delete mode 100644 dist/core/protocols/passkey/index.d.ts delete mode 100644 dist/core/protocols/passkey/index.d.ts.map delete mode 100644 dist/core/protocols/passkey/index.js delete mode 100644 dist/core/protocols/passkey/index.js.map delete mode 100644 dist/core/protocols/passkey/registration.d.ts delete mode 100644 dist/core/protocols/passkey/registration.d.ts.map delete mode 100644 dist/core/protocols/passkey/registration.js delete mode 100644 dist/core/protocols/passkey/registration.js.map delete mode 100644 dist/core/protocols/password.d.ts delete mode 100644 dist/core/protocols/password.d.ts.map delete mode 100644 dist/core/protocols/password.js delete mode 100644 dist/core/protocols/password.js.map delete mode 100644 dist/core/protocols/session.d.ts delete mode 100644 dist/core/protocols/session.d.ts.map delete mode 100644 dist/core/protocols/session.js delete mode 100644 dist/core/protocols/session.js.map delete mode 100644 dist/core/routeHandlers/oauth.d.ts delete mode 100644 dist/core/routeHandlers/oauth.d.ts.map delete mode 100644 dist/core/routeHandlers/oauth.js delete mode 100644 dist/core/routeHandlers/oauth.js.map delete mode 100644 dist/core/routeHandlers/passkey.d.ts delete mode 100644 dist/core/routeHandlers/passkey.d.ts.map delete mode 100644 dist/core/routeHandlers/passkey.js delete mode 100644 dist/core/routeHandlers/passkey.js.map delete mode 100644 dist/core/routeHandlers/password.d.ts delete mode 100644 dist/core/routeHandlers/password.d.ts.map delete mode 100644 dist/core/routeHandlers/password.js delete mode 100644 dist/core/routeHandlers/password.js.map delete mode 100644 dist/core/routeHandlers/session.d.ts delete mode 100644 dist/core/routeHandlers/session.d.ts.map delete mode 100644 dist/core/routeHandlers/session.js delete mode 100644 dist/core/routeHandlers/session.js.map delete mode 100644 dist/core/utils/cb.d.ts delete mode 100644 dist/core/utils/cb.d.ts.map delete mode 100644 dist/core/utils/cb.js delete mode 100644 dist/core/utils/cb.js.map delete mode 100644 dist/core/utils/cookies.d.ts delete mode 100644 dist/core/utils/cookies.d.ts.map delete mode 100644 dist/core/utils/cookies.js delete mode 100644 dist/core/utils/cookies.js.map delete mode 100644 dist/core/utils/hash.d.ts delete mode 100644 dist/core/utils/hash.d.ts.map delete mode 100644 dist/core/utils/hash.js delete mode 100644 dist/core/utils/hash.js.map delete mode 100644 dist/core/utils/password.d.ts delete mode 100644 dist/core/utils/password.d.ts.map delete mode 100644 dist/core/utils/password.js delete mode 100644 dist/core/utils/password.js.map delete mode 100644 dist/core/utils/session.d.ts delete mode 100644 dist/core/utils/session.d.ts.map delete mode 100644 dist/core/utils/session.js delete mode 100644 dist/core/utils/session.js.map delete mode 100644 dist/core/utils/slug.d.ts delete mode 100644 dist/core/utils/slug.d.ts.map delete mode 100644 dist/core/utils/slug.js delete mode 100644 dist/core/utils/slug.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.d.ts.map delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 dist/plugin.d.ts delete mode 100644 dist/plugin.d.ts.map delete mode 100644 dist/plugin.js delete mode 100644 dist/plugin.js.map delete mode 100644 dist/providers/index.d.ts delete mode 100644 dist/providers/index.d.ts.map delete mode 100644 dist/providers/index.js delete mode 100644 dist/providers/index.js.map delete mode 100644 dist/providers/magiclink.d.ts delete mode 100644 dist/providers/magiclink.d.ts.map delete mode 100644 dist/providers/magiclink.js delete mode 100644 dist/providers/magiclink.js.map delete mode 100644 dist/providers/oauth2/apple.d.ts delete mode 100644 dist/providers/oauth2/apple.d.ts.map delete mode 100644 dist/providers/oauth2/apple.js delete mode 100644 dist/providers/oauth2/apple.js.map delete mode 100644 dist/providers/oauth2/atlassian.d.ts delete mode 100644 dist/providers/oauth2/atlassian.d.ts.map delete mode 100644 dist/providers/oauth2/atlassian.js delete mode 100644 dist/providers/oauth2/atlassian.js.map delete mode 100644 dist/providers/oauth2/auth0.d.ts delete mode 100644 dist/providers/oauth2/auth0.d.ts.map delete mode 100644 dist/providers/oauth2/auth0.js delete mode 100644 dist/providers/oauth2/auth0.js.map delete mode 100644 dist/providers/oauth2/discord.d.ts delete mode 100644 dist/providers/oauth2/discord.d.ts.map delete mode 100644 dist/providers/oauth2/discord.js delete mode 100644 dist/providers/oauth2/discord.js.map delete mode 100644 dist/providers/oauth2/facebook.d.ts delete mode 100644 dist/providers/oauth2/facebook.d.ts.map delete mode 100644 dist/providers/oauth2/facebook.js delete mode 100644 dist/providers/oauth2/facebook.js.map delete mode 100644 dist/providers/oauth2/github.d.ts delete mode 100644 dist/providers/oauth2/github.d.ts.map delete mode 100644 dist/providers/oauth2/github.js delete mode 100644 dist/providers/oauth2/github.js.map delete mode 100644 dist/providers/oauth2/jumpcloud.d.ts delete mode 100644 dist/providers/oauth2/jumpcloud.d.ts.map delete mode 100644 dist/providers/oauth2/jumpcloud.js delete mode 100644 dist/providers/oauth2/jumpcloud.js.map delete mode 100644 dist/providers/oauth2/twitch.d.ts delete mode 100644 dist/providers/oauth2/twitch.d.ts.map delete mode 100644 dist/providers/oauth2/twitch.js delete mode 100644 dist/providers/oauth2/twitch.js.map delete mode 100644 dist/providers/oidc/apple.d.ts delete mode 100644 dist/providers/oidc/apple.d.ts.map delete mode 100644 dist/providers/oidc/apple.js delete mode 100644 dist/providers/oidc/apple.js.map delete mode 100644 dist/providers/oidc/cognito.d.ts delete mode 100644 dist/providers/oidc/cognito.d.ts.map delete mode 100644 dist/providers/oidc/cognito.js delete mode 100644 dist/providers/oidc/cognito.js.map delete mode 100644 dist/providers/oidc/gitlab.d.ts delete mode 100644 dist/providers/oidc/gitlab.d.ts.map delete mode 100644 dist/providers/oidc/gitlab.js delete mode 100644 dist/providers/oidc/gitlab.js.map delete mode 100644 dist/providers/oidc/google.d.ts delete mode 100644 dist/providers/oidc/google.d.ts.map delete mode 100644 dist/providers/oidc/google.js delete mode 100644 dist/providers/oidc/google.js.map delete mode 100644 dist/providers/oidc/keycloak.d.ts delete mode 100644 dist/providers/oidc/keycloak.d.ts.map delete mode 100644 dist/providers/oidc/keycloak.js delete mode 100644 dist/providers/oidc/keycloak.js.map delete mode 100644 dist/providers/oidc/microsoft-entra.d.ts delete mode 100644 dist/providers/oidc/microsoft-entra.d.ts.map delete mode 100644 dist/providers/oidc/microsoft-entra.js delete mode 100644 dist/providers/oidc/microsoft-entra.js.map delete mode 100644 dist/providers/oidc/okta.d.ts delete mode 100644 dist/providers/oidc/okta.d.ts.map delete mode 100644 dist/providers/oidc/okta.js delete mode 100644 dist/providers/oidc/okta.js.map delete mode 100644 dist/providers/oidc/slack.d.ts delete mode 100644 dist/providers/oidc/slack.d.ts.map delete mode 100644 dist/providers/oidc/slack.js delete mode 100644 dist/providers/oidc/slack.js.map delete mode 100644 dist/providers/passkey.d.ts delete mode 100644 dist/providers/passkey.d.ts.map delete mode 100644 dist/providers/passkey.js delete mode 100644 dist/providers/passkey.js.map delete mode 100644 dist/providers/password.d.ts delete mode 100644 dist/providers/password.d.ts.map delete mode 100644 dist/providers/password.js delete mode 100644 dist/providers/password.js.map delete mode 100644 dist/providers/utils.d.ts delete mode 100644 dist/providers/utils.d.ts.map delete mode 100644 dist/providers/utils.js delete mode 100644 dist/providers/utils.js.map delete mode 100644 dist/types.d.ts delete mode 100644 dist/types.d.ts.map delete mode 100644 dist/types.js delete mode 100644 dist/types.js.map diff --git a/.gitignore b/.gitignore index 7bac2b1..6c055b2 100644 --- a/.gitignore +++ b/.gitignore @@ -244,7 +244,7 @@ dev/generated-types.ts dev/generated-schema.graphql # Ignore dist, no need for git -# dist +dist .trunl dev/src/uploads diff --git a/dist/client/index.d.ts b/dist/client/index.d.ts deleted file mode 100644 index 5100716..0000000 --- a/dist/client/index.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { type PasswordResetPayload, type ForgotPasswordPayload, type PasswordRecoverPayload } from "./password.js"; -declare class AuthClient { - private name; - private baseURL; - constructor(name: string, options?: { - payloadBaseURL?: string | undefined; - } | undefined); - signin(redirectUrl?: string): { - oauth: (provider: import("./oauth.js").OauthProvider) => void; - password: (payload: import("./password.js").PasswordSigninPayload) => Promise; - }; - register(): { - password: (paylaod: import("./password.js").PasswordSignupPayload) => Promise; - }; - resetPassword(payload: PasswordResetPayload): Promise; - forgotPassword(payload: ForgotPasswordPayload): Promise; - recoverPassword(payload: PasswordRecoverPayload): Promise; - getSession({ headers }: { - headers: HeadersInit; - }): Promise; - getClientSession(): Promise<{ - data: unknown; - message: string; - kind: import("../types.js").ErrorKind | import("../types.js").SuccessKind; - isError: boolean; - isSuccess: boolean; - }>; - signout({ returnTo }: { - returnTo?: string | undefined; - }): Promise<{ - data: unknown; - message: string; - kind: import("../types.js").ErrorKind | import("../types.js").SuccessKind; - isError: boolean; - isSuccess: boolean; - }>; - refreshSession(): Promise; -} -export { AuthClient }; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/client/index.d.ts.map b/dist/client/index.d.ts.map deleted file mode 100644 index 8fb841c..0000000 --- a/dist/client/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC5B,MAAM,eAAe,CAAA;AAQtB,cAAM,UAAU;IAGZ,OAAO,CAAC,IAAI;IAFd,OAAO,CAAC,OAAO,CAAQ;gBAEb,IAAI,EAAE,MAAM,EACpB,OAAO,CAAC,EACJ;QACE,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KACpC,GACD,SAAS;IAWf,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM;;;;IAQ3B,QAAQ;;;IAMF,aAAa,CAAC,OAAO,EAAE,oBAAoB;IAS3C,cAAc,CAAC,OAAO,EAAE,qBAAqB;IAS7C,eAAe,CAAC,OAAO,EAAE,sBAAsB;IAS/C,UAAU,CAAC,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE;IAOhD,gBAAgB;;;;;;;IAMhB,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE;;;;;;;IAOvD,cAAc;CAMrB;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"} \ No newline at end of file diff --git a/dist/client/index.js b/dist/client/index.js deleted file mode 100644 index 5cb2cdb..0000000 --- a/dist/client/index.js +++ /dev/null @@ -1,80 +0,0 @@ -import { resetPassword, forgotPassword, recoverPassword, } from "./password.js"; -import { refresh } from "./refresh.js"; -import { signin } from "./signin.js"; -import { register } from "./register.js"; -import { getSession, getClientSession } from "./session.js"; -import { signout } from "./signout.js"; -import { MissingPayloadAuthBaseURL } from "../core/errors/consoleErrors.js"; -class AuthClient { - name; - baseURL; - constructor(name, options) { - this.name = name; - if (!options?.payloadBaseURL && !process.env.NEXT_PUBLIC_PAYLOAD_AUTH_URL) { - throw new MissingPayloadAuthBaseURL(); - } - this.baseURL = - options?.payloadBaseURL ?? - process.env.NEXT_PUBLIC_PAYLOAD_AUTH_URL; - } - signin(redirectUrl) { - console.error("the redirectUrl is: " + redirectUrl); - return signin({ - name: this.name, - baseURL: this.baseURL, - redirectUrl, - }); - } - register() { - return register({ - name: this.name, - baseURL: this.baseURL, - }); - } - async resetPassword(payload) { - return await resetPassword({ - name: this.name, - baseURL: this.baseURL, - }, payload); - } - async forgotPassword(payload) { - return await forgotPassword({ - name: this.name, - baseURL: this.baseURL, - }, payload); - } - async recoverPassword(payload) { - return await recoverPassword({ - name: this.name, - baseURL: this.baseURL, - }, payload); - } - async getSession({ headers }) { - return await getSession({ - name: this.name, - baseURL: this.baseURL, - headers, - }); - } - async getClientSession() { - return await getClientSession({ - name: this.name, - baseURL: this.baseURL, - }); - } - async signout({ returnTo }) { - return await signout({ - name: this.name, - baseURL: this.baseURL, - returnTo, - }); - } - async refreshSession() { - return await refresh({ - name: this.name, - baseURL: this.baseURL, - }); - } -} -export { AuthClient }; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/client/index.js.map b/dist/client/index.js.map deleted file mode 100644 index 44118fa..0000000 --- a/dist/client/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,cAAc,EACd,eAAe,GAIhB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAE3E,MAAM,UAAU;IAGJ;IAFF,OAAO,CAAQ;IACvB,YACU,IAAY,EACpB,OAIa;QALL,SAAI,GAAJ,IAAI,CAAQ;QAOpB,IAAI,CAAC,OAAO,EAAE,cAAc,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,C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AC;IACD,KAAK,CAAC,gBAAgB;QACpB,OAAO,MAAM,gBAAgB,CAAC;YAC5B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAA;IACJ,CAAC;IACD,KAAK,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAqC;QAC3D,OAAO,MAAM,OAAO,CAAC;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ;SACT,CAAC,CAAA;IACJ,CAAC;IACD,KAAK,CAAC,cAAc;QAClB,OAAO,MAAM,OAAO,CAAC;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAA;IACJ,CAAC;CACF;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"} \ No newline at end of file diff --git a/dist/client/oauth.d.ts b/dist/client/oauth.d.ts deleted file mode 100644 index 02e55ba..0000000 --- a/dist/client/oauth.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -type BaseOptions = { - name: string; - baseURL: string; - redirectUrl?: string; -}; -export type OauthProvider = "google" | "github" | "apple" | "cognito" | "gitlab" | "msft-entra" | "slack" | "atlassian" | "auth0" | "discord" | "facebook" | "jumpcloud" | "twitch" | "okta"; -export declare const oauth: (options: BaseOptions, provider: OauthProvider) => void; -export {}; -//# sourceMappingURL=oauth.d.ts.map \ No newline at end of file diff --git a/dist/client/oauth.d.ts.map b/dist/client/oauth.d.ts.map deleted file mode 100644 index a1c80cc..0000000 --- a/dist/client/oauth.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/client/oauth.ts"],"names":[],"mappings":"AAEA,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,SAAS,GACT,QAAQ,GACR,YAAY,GACZ,OAAO,GACP,WAAW,GACX,OAAO,GACP,SAAS,GACT,UAAU,GACV,WAAW,GACX,QAAQ,GACR,MAAM,CAAA;AAEV,eAAO,MAAM,KAAK,GAAI,SAAS,WAAW,EAAE,UAAU,aAAa,KAAG,IAGrE,CAAA"} \ No newline at end of file diff --git a/dist/client/oauth.js b/dist/client/oauth.js deleted file mode 100644 index d8734a1..0000000 --- a/dist/client/oauth.js +++ /dev/null @@ -1,7 +0,0 @@ -/// -/// -export const oauth = (options, provider) => { - const oauthURL = `${options.baseURL}/api/${options.name}/oauth/authorization/${provider}${options.redirectUrl ? `?state=${encodeURIComponent(JSON.stringify({ redirectUrl: options.redirectUrl }))}` : ""}`; - window.location.href = oauthURL; -}; -//# sourceMappingURL=oauth.js.map \ No newline at end of file diff --git a/dist/client/oauth.js.map b/dist/client/oauth.js.map deleted file mode 100644 index 95657bb..0000000 --- a/dist/client/oauth.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../src/client/oauth.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,oCAAoC;AAuBpC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAoB,EAAE,QAAuB,EAAQ,EAAE;IAC3E,MAAM,QAAQ,GAAG,GAAG,OAAO,CAAC,OAAO,QAAQ,OAAO,CAAC,IAAI,wBAAwB,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;IAC3M,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAA;AACjC,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/client/passkey/authentication.d.ts b/dist/client/passkey/authentication.d.ts deleted file mode 100644 index 022a9ea..0000000 --- a/dist/client/passkey/authentication.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { AuthenticatorTransportFuture } from "@simplewebauthn/server"; -export declare const authentication: (passkey: { - backedUp: boolean; - counter: 0; - credentialId: string; - deviceType: string; - publicKey: Uint8Array; - transports: AuthenticatorTransportFuture[]; -}, email: string) => Promise; -//# sourceMappingURL=authentication.d.ts.map \ No newline at end of file diff --git a/dist/client/passkey/authentication.d.ts.map b/dist/client/passkey/authentication.d.ts.map deleted file mode 100644 index 4e35757..0000000 --- a/dist/client/passkey/authentication.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../../src/client/passkey/authentication.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAA;AAErE,eAAO,MAAM,cAAc,GACzB,SAAS;IACP,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,CAAC,CAAA;IACV,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,UAAU,CAAA;IACrB,UAAU,EAAE,4BAA4B,EAAE,CAAA;CAC3C,EACD,OAAO,MAAM,kBA+Bd,CAAA"} \ No newline at end of file diff --git a/dist/client/passkey/authentication.js b/dist/client/passkey/authentication.js deleted file mode 100644 index 71e7b87..0000000 --- a/dist/client/passkey/authentication.js +++ /dev/null @@ -1,30 +0,0 @@ -import { startAuthentication } from "@simplewebauthn/browser"; -export const authentication = async (passkey, email) => { - const resp = await fetch("/api/admin/passkey/generate-authentication-options", { - method: "POST", - body: JSON.stringify({ data: { passkey } }), - }); - const optionsJSON = await resp.json(); - try { - const authenticationResp = await startAuthentication({ - optionsJSON: optionsJSON.options, - }); - const response = await fetch("/api/admin/passkey/verify-authentication", { - method: "POST", - credentials: "include", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - data: { email, authentication: authenticationResp, passkey }, - }), - }); - if (response.redirected) { - window.location.href = response.url; // Redirect the user explicitly - } - } - catch (error) { - console.log(error); - } -}; -//# sourceMappingURL=authentication.js.map \ No newline at end of file diff --git a/dist/client/passkey/authentication.js.map b/dist/client/passkey/authentication.js.map deleted file mode 100644 index 32e94aa..0000000 --- a/dist/client/passkey/authentication.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../../src/client/passkey/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAG7D,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,OAOC,EACD,KAAa,EACb,EAAE;IACF,MAAM,IAAI,GAAG,MAAM,KAAK,CACtB,oDAAoD,EACpD;QACE,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC;KAC5C,CACF,CAAA;IACD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;IACrC,IAAI,CAAC;QACH,MAAM,kBAAkB,GAAG,MAAM,mBAAmB,CAAC;YACnD,WAAW,EAAE,WAAW,CAAC,OAAO;SACjC,CAAC,CAAA;QACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,0CAA0C,EAAE;YACvE,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,SAAS;YACtB,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,IAAI,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,OAAO,EAAE;aAC7D,CAAC;SACH,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;YACxB,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAA,CAAC,+BAA+B;QACrE,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/client/passkey/index.d.ts b/dist/client/passkey/index.d.ts deleted file mode 100644 index f40ef21..0000000 --- a/dist/client/passkey/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const init: () => Promise; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/client/passkey/index.d.ts.map b/dist/client/passkey/index.d.ts.map deleted file mode 100644 index 582a1ae..0000000 --- a/dist/client/passkey/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/passkey/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,IAAI,qBAmChB,CAAA"} \ No newline at end of file diff --git a/dist/client/passkey/index.js b/dist/client/passkey/index.js deleted file mode 100644 index ccbce74..0000000 --- a/dist/client/passkey/index.js +++ /dev/null @@ -1,36 +0,0 @@ -import { browserSupportsWebAuthn } from "@simplewebauthn/browser"; -import { registration } from "./registration.js"; -import { authentication } from "./authentication.js"; -//NOTE: EXPERIMENTAL -export const init = async () => { - if (!browserSupportsWebAuthn()) { - console.log("It seems this browser does not support WebAuthn/Passkey. Reach out to the plugin author"); - return; - } - //TODO: Need a better way to implement email vaildation - const emailInput = document.getElementById("field-email"); - const emailValue = emailInput.value; - if (!emailValue) { - alert("Enter your email"); - return; - } - const response = await fetch("/api/admin/passkey/init", { - method: "POST", - body: JSON.stringify({ data: { email: emailInput.value } }), - }); - if (response.ok) { - const { data } = await response.json(); - if (Object.entries(data).length === 0) { - return await registration(emailInput.value); - } - return await authentication({ - backedUp: data["passkey"]["backedUp"], - counter: data["passkey"]["counter"], - credentialId: data["passkey"]["credentialId"], - deviceType: data["passkey"]["deviceType"], - publicKey: data["passkey"]["publicKey"], - transports: data["passkey"]["transports"], - }, emailInput.value); - } -}; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/client/passkey/index.js.map b/dist/client/passkey/index.js.map deleted file mode 100644 index a0de6df..0000000 --- a/dist/client/passkey/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/passkey/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,oBAAoB;AAEpB,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;IAC7B,IAAI,CAAC,uBAAuB,EAAE,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,CACT,yFAAyF,CAC1F,CAAA;QACD,OAAM;IACR,CAAC;IACD,uDAAuD;IACvD,MAAM,UAAU,GAAG,QAAQ,CAAC,cAAc,CAAC,aAAa,CAAqB,CAAA;IAC7E,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAA;IACnC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,KAAK,CAAC,kBAAkB,CAAC,CAAA;QACzB,OAAM;IACR,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,yBAAyB,EAAE;QACtD,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC;KAC5D,CAAC,CAAA;IACF,IAAI,QAAQ,CAAC,EAAE,EAAE,CAAC;QAChB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QACtC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtC,OAAO,MAAM,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;QAC7C,CAAC;QACD,OAAO,MAAM,cAAc,CACzB;YACE,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC;YACrC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC;YACnC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC;YAC7C,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC;YACzC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC;YACvC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC;SAC1C,EACD,UAAU,CAAC,KAAK,CACjB,CAAA;IACH,CAAC;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/client/passkey/registration.d.ts b/dist/client/passkey/registration.d.ts deleted file mode 100644 index 61af640..0000000 --- a/dist/client/passkey/registration.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const registration: (email: string) => Promise; -//# sourceMappingURL=registration.d.ts.map \ No newline at end of file diff --git a/dist/client/passkey/registration.d.ts.map b/dist/client/passkey/registration.d.ts.map deleted file mode 100644 index dbc74e4..0000000 --- a/dist/client/passkey/registration.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../../src/client/passkey/registration.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,YAAY,GAAU,OAAO,MAAM,kBA4B/C,CAAA"} \ No newline at end of file diff --git a/dist/client/passkey/registration.js b/dist/client/passkey/registration.js deleted file mode 100644 index be87975..0000000 --- a/dist/client/passkey/registration.js +++ /dev/null @@ -1,28 +0,0 @@ -import { startRegistration } from "@simplewebauthn/browser"; -export const registration = async (email) => { - try { - const resp = await fetch("/api/admin/passkey/generate-registration-options", { - method: "POST", - body: JSON.stringify({ data: { email } }), - }); - const optionsJSON = await resp.json(); - const registrationResp = await startRegistration({ - optionsJSON: optionsJSON.options, - }); - const response = await fetch("/api/admin/passkey/verify-registration", { - method: "POST", - credentials: "include", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ data: { email, registration: registrationResp } }), - }); - if (response.redirected) { - window.location.href = response.url; - } - } - catch (error) { - console.log(error); - } -}; -//# sourceMappingURL=registration.js.map \ No newline at end of file diff --git a/dist/client/passkey/registration.js.map b/dist/client/passkey/registration.js.map deleted file mode 100644 index e6ada38..0000000 --- a/dist/client/passkey/registration.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../src/client/passkey/registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,KAAa,EAAE,EAAE;IAClD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,KAAK,CACtB,kDAAkD,EAClD;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC;SAC1C,CACF,CAAA;QACD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;QAErC,MAAM,gBAAgB,GAAG,MAAM,iBAAiB,CAAC;YAC/C,WAAW,EAAE,WAAW,CAAC,OAAO;SACjC,CAAC,CAAA;QACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,wCAAwC,EAAE;YACrE,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,SAAS;YACtB,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,EAAE,CAAC;SAC1E,CAAC,CAAA;QACF,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;YACxB,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAA;QACrC,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/client/password.d.ts b/dist/client/password.d.ts deleted file mode 100644 index de4da65..0000000 --- a/dist/client/password.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { type AuthPluginOutput } from "../types.js"; -interface BaseOptions { - name: string; - baseURL: string; -} -export interface PasswordSigninPayload { - email: string; - password: string; -} -export declare const passwordSignin: (opts: BaseOptions, payload: PasswordSigninPayload) => Promise; -export interface PasswordSignupPayload { - email: string; - password: string; - allowAutoSignin?: boolean; - userInfo?: Record; -} -export declare const passwordSignup: (opts: BaseOptions, payload: PasswordSignupPayload) => Promise; -export interface ForgotPasswordPayload { - email: string; -} -export declare const forgotPassword: (opts: BaseOptions, payload: ForgotPasswordPayload) => Promise; -export interface PasswordRecoverPayload { - password: string; - code: string; -} -export declare const recoverPassword: (opts: BaseOptions, payload: PasswordRecoverPayload) => Promise; -export interface PasswordResetPayload { - email: string; - password: string; -} -export declare const resetPassword: (opts: BaseOptions, payload: PasswordResetPayload) => Promise; -export {}; -//# sourceMappingURL=password.d.ts.map \ No newline at end of file diff --git a/dist/client/password.d.ts.map b/dist/client/password.d.ts.map deleted file mode 100644 index 0253c61..0000000 --- a/dist/client/password.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../src/client/password.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEhE,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB;AACD,eAAO,MAAM,cAAc,GACzB,MAAM,WAAW,EACjB,SAAS,qBAAqB,KAC7B,OAAO,CAAC,gBAAgB,CAyB1B,CAAA;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAED,eAAO,MAAM,cAAc,GACzB,MAAM,WAAW,EACjB,SAAS,qBAAqB,KAC7B,OAAO,CAAC,gBAAgB,CAwB1B,CAAA;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAA;CACd;AACD,eAAO,MAAM,cAAc,GACzB,MAAM,WAAW,EACjB,SAAS,qBAAqB,KAC7B,OAAO,CAAC,gBAAgB,CAkB1B,CAAA;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;CACb;AACD,eAAO,MAAM,eAAe,GAC1B,MAAM,WAAW,EACjB,SAAS,sBAAsB,KAC9B,OAAO,CAAC,gBAAgB,CAkB1B,CAAA;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB;AACD,eAAO,MAAM,aAAa,GACxB,MAAM,WAAW,EACjB,SAAS,oBAAoB,KAC5B,OAAO,CAAC,gBAAgB,CAkB1B,CAAA"} \ No newline at end of file diff --git a/dist/client/password.js b/dist/client/password.js deleted file mode 100644 index 6a170c3..0000000 --- a/dist/client/password.js +++ /dev/null @@ -1,92 +0,0 @@ -import { SuccessKind } from "../types.js"; -export const passwordSignin = async (opts, payload) => { - const response = await fetch(`${opts.baseURL}/api/${opts.name}/auth/signin`, { - method: "POST", - body: JSON.stringify(payload), - }); - if (response.redirected) { - window.location.href = response.url; - return { - data: {}, - message: "Redirecting user...", - kind: SuccessKind.Retrieved, - isError: false, - isSuccess: true, - }; - } - const { data, message, kind, isError, isSuccess } = (await response.json()); - return { - data, - message, - kind, - isError, - isSuccess, - }; -}; -export const passwordSignup = async (opts, payload) => { - const response = await fetch(`${opts.baseURL}/api/${opts.name}/auth/signup`, { - method: "POST", - body: JSON.stringify(payload), - }); - if (response.redirected) { - window.location.href = response.url; - return { - data: {}, - message: "Redirecting user...", - kind: SuccessKind.Retrieved, - isError: false, - isSuccess: true, - }; - } - const { data, message, kind, isError, isSuccess } = (await response.json()); - return { - data, - message, - kind, - isError, - isSuccess, - }; -}; -export const forgotPassword = async (opts, payload) => { - const response = await fetch(`${opts.baseURL}/api/${opts.name}/auth/forgot-password?stage=init`, { - method: "POST", - body: JSON.stringify(payload), - }); - const { data, message, kind, isError, isSuccess } = (await response.json()); - return { - data, - message, - kind, - isError, - isSuccess, - }; -}; -export const recoverPassword = async (opts, payload) => { - const response = await fetch(`${opts.baseURL}/api/${opts.name}/auth/forgot-password?stage=verify`, { - method: "POST", - body: JSON.stringify(payload), - }); - const { data, message, kind, isError, isSuccess } = (await response.json()); - return { - data, - message, - kind, - isError, - isSuccess, - }; -}; -export const resetPassword = async (opts, payload) => { - const response = await fetch(`${opts.baseURL}/api/${opts.name}/auth/reset-password`, { - method: "POST", - body: JSON.stringify(payload), - }); - const { data, message, kind, isError, isSuccess } = (await response.json()); - return { - data, - message, - kind, - isError, - isSuccess, - }; -}; -//# sourceMappingURL=password.js.map \ No newline at end of file diff --git a/dist/client/password.js.map b/dist/client/password.js.map deleted file mode 100644 index e6d5625..0000000 --- a/dist/client/password.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"password.js","sourceRoot":"","sources":["../../src/client/password.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAyB,MAAM,aA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AAS,EAAE,GAC/C,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAqB,CAAA;IAC7C,OAAO;QACL,IAAI;QACJ,OAAO;QACP,IAAI;QACJ,OAAO;QACP,SAAS;KACV,CAAA;AACH,CAAC,CAAA;AAMD,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAChC,IAAiB,EACjB,OAA6B,EACF,EAAE;IAC7B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAG,IAAI,CAAC,OAAO,QAAQ,IAAI,CAAC,IAAI,sBAAsB,EACtD;QACE,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;KAC9B,CACF,CAAA;IAED,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAC/C,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAqB,CAAA;IAC7C,OAAO;QACL,IAAI;QACJ,OAAO;QACP,IAAI;QACJ,OAAO;QACP,SAAS;KACV,CAAA;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/client/refresh.d.ts b/dist/client/refresh.d.ts deleted file mode 100644 index 406f08a..0000000 --- a/dist/client/refresh.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { AuthPluginOutput } from "../types.js"; -interface BaseOptions { - name: string; - baseURL: string; -} -export declare const refresh: (options: BaseOptions) => Promise; -export {}; -//# sourceMappingURL=refresh.d.ts.map \ No newline at end of file diff --git a/dist/client/refresh.d.ts.map b/dist/client/refresh.d.ts.map deleted file mode 100644 index 47fdeea..0000000 --- a/dist/client/refresh.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../src/client/refresh.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AACD,eAAO,MAAM,OAAO,GAClB,SAAS,WAAW,KACnB,OAAO,CAAC,gBAAgB,CAiB1B,CAAA"} \ No newline at end of file diff --git a/dist/client/refresh.js b/dist/client/refresh.js deleted file mode 100644 index 4209f7f..0000000 --- a/dist/client/refresh.js +++ /dev/null @@ -1,16 +0,0 @@ -import { WrongClientUsage } from "../core/errors/consoleErrors.js"; -export const refresh = async (options) => { - if (typeof window === "undefined") { - throw new WrongClientUsage(); - } - const response = await fetch(`${options.baseURL}/api/${options.name}/session/refresh`); - const { message, kind, data, isError, isSuccess } = (await response.json()); - return { - message, - kind, - data, - isError, - isSuccess, - }; -}; -//# sourceMappingURL=refresh.js.map \ No newline at end of file diff --git a/dist/client/refresh.js.map b/dist/client/refresh.js.map deleted file mode 100644 index fe3fed9..0000000 --- a/dist/client/refresh.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"refresh.js","sourceRoot":"","sources":["../../src/client/refresh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAOlE,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAC1B,OAAoB,EACO,EAAE;IAC7B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,MAAM,IAAI,gBAAgB,EAAE,CAAA;IAC9B,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAG,OAAO,CAAC,OAAO,QAAQ,OAAO,CAAC,IAAI,kBAAkB,CACzD,CAAA;IACD,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAC/C,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAqB,CAAA;IAC7C,OAAO;QACL,OAAO;QACP,IAAI;QACJ,IAAI;QACJ,OAAO;QACP,SAAS;KACV,CAAA;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/client/register.d.ts b/dist/client/register.d.ts deleted file mode 100644 index 0b48ba1..0000000 --- a/dist/client/register.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { type PasswordSignupPayload } from "./password.js"; -interface BaseOptions { - name: string; - baseURL: string; -} -export declare const register: (options: BaseOptions) => { - password: (paylaod: PasswordSignupPayload) => Promise; -}; -export {}; -//# sourceMappingURL=register.d.ts.map \ No newline at end of file diff --git a/dist/client/register.d.ts.map b/dist/client/register.d.ts.map deleted file mode 100644 index 6baefad..0000000 --- a/dist/client/register.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/client/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,qBAAqB,EAAkB,MAAM,eAAe,CAAA;AAE1E,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,eAAO,MAAM,QAAQ,GAAI,SAAS,WAAW;wBAEf,qBAAqB;CAGlD,CAAA"} \ No newline at end of file diff --git a/dist/client/register.js b/dist/client/register.js deleted file mode 100644 index c15f83f..0000000 --- a/dist/client/register.js +++ /dev/null @@ -1,7 +0,0 @@ -import { passwordSignup } from "./password.js"; -export const register = (options) => { - return { - password: async (paylaod) => await passwordSignup(options, paylaod), - }; -}; -//# sourceMappingURL=register.js.map \ No newline at end of file diff --git a/dist/client/register.js.map b/dist/client/register.js.map deleted file mode 100644 index 9d6c7c7..0000000 --- a/dist/client/register.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/client/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,cAAc,EAAE,MAAM,eAAe,CAAA;AAO1E,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,OAAoB,EAAE,EAAE;IAC/C,OAAO;QACL,QAAQ,EAAE,KAAK,EAAE,OAA8B,EAAE,EAAE,CACjD,MAAM,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC;KACzC,CAAA;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/client/session.d.ts b/dist/client/session.d.ts deleted file mode 100644 index ce727c9..0000000 --- a/dist/client/session.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { AuthPluginOutput } from "../types.js"; -interface BaseOptions { - name: string; - headers: HeadersInit; - baseURL: string; -} -export declare const getSession: (opts: BaseOptions) => Promise; -export declare const getClientSession: (opts: Pick) => Promise<{ - data: unknown; - message: string; - kind: import("../types.js").ErrorKind | import("../types.js").SuccessKind; - isError: boolean; - isSuccess: boolean; -}>; -export {}; -//# sourceMappingURL=session.d.ts.map \ No newline at end of file diff --git a/dist/client/session.d.ts.map b/dist/client/session.d.ts.map deleted file mode 100644 index d3a7eb7..0000000 --- a/dist/client/session.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/client/session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,WAAW,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,eAAO,MAAM,UAAU,GACrB,MAAM,WAAW,KAChB,OAAO,CAAC,gBAAgB,CAiB1B,CAAA;AAED,eAAO,MAAM,gBAAgB,GAC3B,MAAM,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;;;;;;EAgB5C,CAAA"} \ No newline at end of file diff --git a/dist/client/session.js b/dist/client/session.js deleted file mode 100644 index 5ad8be7..0000000 --- a/dist/client/session.js +++ /dev/null @@ -1,30 +0,0 @@ -import { WrongClientUsage } from "../core/errors/consoleErrors.js"; -export const getSession = async (opts) => { - const response = await fetch(`${opts.baseURL}/api/${opts.name}/session/user`, { - method: "GET", - headers: opts.headers, - }); - const { data, message, kind, isError, isSuccess } = (await response.json()); - return { - data, - message, - kind, - isError, - isSuccess, - }; -}; -export const getClientSession = async (opts) => { - if (typeof window === "undefined") { - throw new WrongClientUsage(); - } - const response = await fetch(`${opts.baseURL}/api/${opts.name}/session/user`); - const { data, message, kind, isError, isSuccess } = (await response.json()); - return { - data, - message, - kind, - isError, - isSuccess, - }; -}; -//# sourceMappingURL=session.js.map \ No newline at end of file diff --git a/dist/client/session.js.map b/dist/client/session.js.map deleted file mode 100644 index b8c8760..0000000 --- a/dist/client/session.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/client/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AASlE,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAC7B,IAAiB,EACU,EAAE;IAC7B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAG,IAAI,CAAC,OAAO,QAAQ,IAAI,CAAC,IAAI,eAAe,EAC/C;QACE,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CACF,CAAA;IACD,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAC/C,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAqB,CAAA;IAC7C,OAAO;QACL,IAAI;QACJ,OAAO;QACP,IAAI;QACJ,OAAO;QACP,SAAS;KACV,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EACnC,IAA2C,EAC3C,EAAE;IACF,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,MAAM,IAAI,gBAAgB,EAAE,CAAA;IAC9B,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,QAAQ,IAAI,CAAC,IAAI,eAAe,CAAC,CAAA;IAC7E,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAC/C,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAqB,CAAA;IAC7C,OAAO;QACL,IAAI;QACJ,OAAO;QACP,IAAI;QACJ,OAAO;QACP,SAAS;KACV,CAAA;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/client/signin.d.ts b/dist/client/signin.d.ts deleted file mode 100644 index 980bf3a..0000000 --- a/dist/client/signin.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { type PasswordSigninPayload } from "./password.js"; -import { type OauthProvider } from "./oauth.js"; -interface BaseOptions { - name: string; - baseURL: string; - redirectUrl?: string; -} -export declare const signin: (options: BaseOptions) => { - oauth: (provider: OauthProvider) => void; - password: (payload: PasswordSigninPayload) => Promise; -}; -export {}; -//# sourceMappingURL=signin.d.ts.map \ No newline at end of file diff --git a/dist/client/signin.d.ts.map b/dist/client/signin.d.ts.map deleted file mode 100644 index 674f738..0000000 --- a/dist/client/signin.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signin.d.ts","sourceRoot":"","sources":["../../src/client/signin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC1E,OAAO,EAAS,KAAK,aAAa,EAAE,MAAM,YAAY,CAAA;AACtD,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,eAAO,MAAM,MAAM,GAAI,SAAS,WAAW;sBAErB,aAAa;wBAEL,qBAAqB;CAGlD,CAAA"} \ No newline at end of file diff --git a/dist/client/signin.js b/dist/client/signin.js deleted file mode 100644 index 58d8ea7..0000000 --- a/dist/client/signin.js +++ /dev/null @@ -1,10 +0,0 @@ -import { passwordSignin } from "./password.js"; -import { oauth } from "./oauth.js"; -export const signin = (options) => { - return { - oauth: (provider) => oauth(options, provider), - // passkey: () => passkeyInit(), NEEDS IMPROVEMENT - password: async (payload) => await passwordSignin(options, payload), - }; -}; -//# sourceMappingURL=signin.js.map \ No newline at end of file diff --git a/dist/client/signin.js.map b/dist/client/signin.js.map deleted file mode 100644 index b3e7e13..0000000 --- a/dist/client/signin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signin.js","sourceRoot":"","sources":["../../src/client/signin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA8B,MAAM,eAAe,CAAA;AAC1E,OAAO,EAAE,KAAK,EAAsB,MAAM,YAAY,CAAA;AAOtD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAoB,EAAE,EAAE;IAC7C,OAAO;QACL,KAAK,EAAE,CAAC,QAAuB,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC5D,kDAAkD;QAClD,QAAQ,EAAE,KAAK,EAAE,OAA8B,EAAE,EAAE,CACjD,MAAM,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC;KACzC,CAAA;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/client/signout.d.ts b/dist/client/signout.d.ts deleted file mode 100644 index 50c5fe2..0000000 --- a/dist/client/signout.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { SuccessKind } from "../types.js"; -interface BaseOptions { - name: string; - returnTo?: string | undefined; - baseURL: string; -} -export declare const signout: (opts: BaseOptions) => Promise<{ - data: unknown; - message: string; - kind: import("../types.js").ErrorKind | SuccessKind; - isError: boolean; - isSuccess: boolean; -}>; -export {}; -//# sourceMappingURL=signout.d.ts.map \ No newline at end of file diff --git a/dist/client/signout.d.ts.map b/dist/client/signout.d.ts.map deleted file mode 100644 index 3fcbf2b..0000000 --- a/dist/client/signout.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signout.d.ts","sourceRoot":"","sources":["../../src/client/signout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAyB,MAAM,aAAa,CAAA;AAGhE,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,eAAO,MAAM,OAAO,GAAU,MAAM,WAAW;;;;;;EA+B9C,CAAA"} \ No newline at end of file diff --git a/dist/client/signout.js b/dist/client/signout.js deleted file mode 100644 index f395730..0000000 --- a/dist/client/signout.js +++ /dev/null @@ -1,32 +0,0 @@ -import { WrongClientUsage } from "../core/errors/consoleErrors.js"; -import { SuccessKind } from "../types.js"; -import * as qs from "qs-esm"; -export const signout = async (opts) => { - if (typeof window === "undefined") { - throw new WrongClientUsage(); - } - const query = {}; - if (opts.returnTo) { - query.returnTo = opts.returnTo; - } - const response = await fetch(`${opts.baseURL}/api/${opts.name}/session/signout?${qs.stringify(query)}`); - if (response.redirected) { - window.location.href = response.url; - return { - data: {}, - message: "Signing out...", - kind: SuccessKind.Deleted, - isError: false, - isSuccess: true, - }; - } - const { data, message, kind, isError, isSuccess } = (await response.json()); - return { - data, - message, - kind, - isError, - isSuccess, - }; -}; -//# sourceMappingURL=signout.js.map \ No newline at end of file diff --git a/dist/client/signout.js.map b/dist/client/signout.js.map deleted file mode 100644 index 8ae0c04..0000000 --- a/dist/client/signout.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signout.js","sourceRoot":"","sources":["../../src/client/signout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAClE,OAAO,EAAE,WAAW,EAAyB,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,QAAQ,CAAA;AAQ5B,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,IAAiB,EAAE,EAAE;IACjD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,MAAM,IAAI,gBAAgB,EAAE,CAAA;IAC9B,CAAC;IACD,MAAM,KAAK,GAA2B,EAAE,CAAA;IACxC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;IAChC,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAG,IAAI,CAAC,OAAO,QAAQ,IAAI,CAAC,IAAI,oBAAoB,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAC1E,CAAA;IACD,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;QACxB,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAA;QACnC,OAAO;YACL,IAAI,EAAE,EAAE;YACR,OAAO,EAAE,gBAAgB;YACzB,IAAI,EAAE,WAAW,CAAC,OAAO;YACzB,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,IAAI;SAChB,CAAA;IACH,CAAC;IACD,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAC/C,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAqB,CAAA;IAC7C,OAAO;QACL,IAAI;QACJ,OAAO;QACP,IAAI;QACJ,OAAO;QACP,SAAS;KACV,CAAA;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/collection/hooks.d.ts b/dist/collection/hooks.d.ts deleted file mode 100644 index f4a3d66..0000000 --- a/dist/collection/hooks.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { CollectionAfterDeleteHook } from "payload"; -export declare const deleteLinkedAccounts: (accountsSlug: string) => CollectionAfterDeleteHook; -//# sourceMappingURL=hooks.d.ts.map \ No newline at end of file diff --git a/dist/collection/hooks.d.ts.map b/dist/collection/hooks.d.ts.map deleted file mode 100644 index eb83868..0000000 --- a/dist/collection/hooks.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/collection/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAEnD,eAAO,MAAM,oBAAoB,GAC9B,cAAc,MAAM,KAAG,yBAUvB,CAAA"} \ No newline at end of file diff --git a/dist/collection/hooks.js b/dist/collection/hooks.js deleted file mode 100644 index bf47b56..0000000 --- a/dist/collection/hooks.js +++ /dev/null @@ -1,11 +0,0 @@ -export const deleteLinkedAccounts = (accountsSlug) => async (args) => { - const { payload } = args.req; - const { doc: user } = args; - await payload.delete({ - collection: accountsSlug, - where: { - user: { equals: user["id"] }, - }, - }); -}; -//# sourceMappingURL=hooks.js.map \ No newline at end of file diff --git a/dist/collection/hooks.js.map b/dist/collection/hooks.js.map deleted file mode 100644 index d3aa553..0000000 --- a/dist/collection/hooks.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/collection/hooks.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,oBAAoB,GAC/B,CAAC,YAAoB,EAA6B,EAAE,CACpD,KAAK,EAAE,IAAI,EAAE,EAAE;IACb,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,CAAA;IAC5B,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;IAC1B,MAAM,OAAO,CAAC,MAAM,CAAC;QACnB,UAAU,EAAE,YAAY;QACxB,KAAK,EAAE;YACL,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;SAC7B;KACF,CAAC,CAAA;AACJ,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/collection/index.d.ts b/dist/collection/index.d.ts deleted file mode 100644 index 7f2d0be..0000000 --- a/dist/collection/index.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { CollectionConfig, Field } from "payload"; -/** - * A higher order function that takes the collection config for the argument - * @param incomingCollection - * @returns {CollectionConfig} - */ -export declare const withUsersCollection: (incomingCollection: Omit & { - fields?: Field[] | undefined; -}) => CollectionConfig; -/** - * A higher order function that takes the collection config and a Users collection slug for the arguments - * @param incomingCollection - * @param userCollectionSlug - * @returns {CollectionConfig} - */ -export declare const withAccountCollection: (incomingCollection: Omit & { - fields?: Field[] | undefined; -}, usersCollectionSlug: string) => CollectionConfig; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/collection/index.d.ts.map b/dist/collection/index.d.ts.map deleted file mode 100644 index 13ea03b..0000000 --- a/dist/collection/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collection/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAGtD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,oBAAoB,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,GAAG;IACrD,MAAM,CAAC,EAAE,KAAK,EAAE,GAAG,SAAS,CAAA;CAC7B,KACA,gBAoGF,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAChC,oBAAoB,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,GAAG;IACrD,MAAM,CAAC,EAAE,KAAK,EAAE,GAAG,SAAS,CAAA;CAC7B,EACD,qBAAqB,MAAM,KAC1B,gBAgHF,CAAA"} \ No newline at end of file diff --git a/dist/collection/index.js b/dist/collection/index.js deleted file mode 100644 index 2bbf5a1..0000000 --- a/dist/collection/index.js +++ /dev/null @@ -1,218 +0,0 @@ -import { MissingCollectionSlug } from "../core/errors/consoleErrors.js"; -/** - * A higher order function that takes the collection config for the argument - * @param incomingCollection - * @returns {CollectionConfig} - */ -export const withUsersCollection = (incomingCollection) => { - if (!incomingCollection.slug) { - throw new MissingCollectionSlug(); - } - if (incomingCollection.auth) { - } - const collectionConfig = { - ...incomingCollection, - fields: [], - }; - const baseFields = [ - { - name: "hashedPassword", - type: "text", - unique: true, - admin: { - hidden: true, - }, - }, - { - name: "hashSalt", - type: "text", - unique: true, - admin: { - hidden: true, - }, - }, - { - name: "hashIterations", - type: "number", - admin: { - hidden: true, - }, - }, - { - name: "verificationCode", - label: "Verification Code", - type: "text", - unique: true, - admin: { - hidden: true, - }, - }, - { - name: "verificationHash", - label: "Verification Hash", - type: "text", - admin: { - hidden: true, - }, - }, - { - name: "verificationTokenExpire", - label: "Verification Token Expire", - type: "number", - admin: { - hidden: true, - }, - }, - { - name: "verificationKind", - label: "Verification Kind", - type: "text", - admin: { - hidden: true, - }, - }, - ]; - if (!incomingCollection.fields?.find((field) => field.type === "email")) { - baseFields.push({ - name: "email", - type: "email", - unique: true, - required: true, - }); - } - collectionConfig.fields = [ - ...(incomingCollection.fields ?? []), - ...baseFields, - ]; - collectionConfig.access = { - admin: ({ req: { user } }) => Boolean(user), - create: ({ req: { user } }) => Boolean(user), - delete: ({ req: { user } }) => Boolean(user), - read: ({ req: { user } }) => Boolean(user), - update: ({ req: { user } }) => Boolean(user), - ...(incomingCollection.access ?? {}), - }; - collectionConfig.admin = { - defaultColumns: ["name", "email"], - useAsTitle: "name", - ...incomingCollection.admin, - }; - collectionConfig.timestamps = true; - return collectionConfig; -}; -/** - * A higher order function that takes the collection config and a Users collection slug for the arguments - * @param incomingCollection - * @param userCollectionSlug - * @returns {CollectionConfig} - */ -export const withAccountCollection = (incomingCollection, usersCollectionSlug) => { - if (!incomingCollection.slug) { - throw new MissingCollectionSlug(); - } - const collectionConfig = { - ...incomingCollection, - fields: [], - }; - const baseFields = [ - { - name: "name", - type: "text", - }, - { - name: "picture", - type: "text", - }, - { - name: "user", - type: "relationship", - relationTo: usersCollectionSlug, - hasMany: false, - required: true, - label: "User", - }, - { - name: "issuerName", - type: "text", - required: true, - label: "Issuer Name", - }, - { - name: "scope", - type: "text", - }, - { - name: "sub", - type: "text", - required: true, - }, - { - name: "access_token", - type: "text", - }, - { - name: "passkey", - type: "group", - fields: [ - { - name: "credentialId", - type: "text", - required: true, - }, - { - name: "publicKey", - type: "json", - required: true, - }, - { - name: "counter", - type: "number", - required: true, - }, - { - name: "transports", - type: "json", - required: true, - }, - { - name: "deviceType", - type: "text", - required: true, - }, - { - name: "backedUp", - type: "checkbox", - required: true, - }, - ], - admin: { - condition: (_data, peerData) => { - if (peerData.issuerName === "Passkey") { - return true; - } - return false; - }, - }, - }, - ]; - collectionConfig.fields = [ - ...baseFields, - ...(incomingCollection.fields ?? []), - ]; - collectionConfig.access = { - admin: ({ req: { user } }) => Boolean(user), - read: ({ req: { user } }) => Boolean(user), - create: () => false, - update: () => false, - delete: () => true, - ...(incomingCollection.access ?? {}), - }; - collectionConfig.admin = { - defaultColumns: ["issuerName", "scope", "user"], - useAsTitle: "id", - ...incomingCollection.admin, - }; - collectionConfig.timestamps = true; - return collectionConfig; -}; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/collection/index.js.map b/dist/collection/index.js.map deleted file mode 100644 index 5e8c8c3..0000000 --- a/dist/collection/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/collection/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAEvE;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,kBAEC,EACiB,EAAE;IACpB,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC;QAC7B,MAAM,IAAI,qBAAqB,EAAE,CAAA;IACnC,CAAC;IAED,IAAI,kBAAkB,CAAC,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED,MAAM,gBAAgB,GAAqB;QACzC,GAAG,kBAAkB;QACrB,MAAM,EAAE,EAAE;KACX,CAAA;IAED,MAAM,UAAU,GAAY;QAC1B;YACE,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,IAAI;Y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,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;wBACtC,OAAO,IAAI,CAAA;oBACb,CAAC;oBACD,OAAO,KAAK,CAAA;gBACd,CAAC;aACF;SACF;KACF,CAAA;IAED,gBAAgB,CAAC,MAAM,GAAG;QACxB,GAAG,UAAU;QACb,GAAG,CAAC,kBAAkB,CAAC,MAAM,IAAI,EAAE,CAAC;KACrC,CAAA;IAED,gBAAgB,CAAC,MAAM,GAAG;QACxB,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;QAC3C,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;QAC1C,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK;QACnB,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK;QACnB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;QAClB,GAAG,CAAC,kBAAkB,CAAC,MAAM,IAAI,EAAE,CAAC;KACrC,CAAA;IACD,gBAAgB,CAAC,KAAK,GAAG;QACvB,cAAc,EAAE,CAAC,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC;QAC/C,UAAU,EAAE,IAAI;QAChB,GAAG,kBAAkB,CAAC,KAAK;KAC5B,CAAA;IACD,gBAAgB,CAAC,UAAU,GAAG,IAAI,CAAA;IAClC,OAAO,gBAAgB,CAAA;AACzB,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/constants.d.ts b/dist/constants.d.ts deleted file mode 100644 index b0ef37b..0000000 --- a/dist/constants.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare const APP_COOKIE_SUFFIX = "session-token"; -export declare const EPHEMERAL_CODE_COOKIE_NAME = "__session-ep-claim"; -//# sourceMappingURL=constants.d.ts.map \ No newline at end of file diff --git a/dist/constants.d.ts.map b/dist/constants.d.ts.map deleted file mode 100644 index 3fdf938..0000000 --- a/dist/constants.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,kBAAkB,CAAA;AAChD,eAAO,MAAM,0BAA0B,uBAAuB,CAAA"} \ No newline at end of file diff --git a/dist/constants.js b/dist/constants.js deleted file mode 100644 index db672dc..0000000 --- a/dist/constants.js +++ /dev/null @@ -1,3 +0,0 @@ -export const APP_COOKIE_SUFFIX = "session-token"; -export const EPHEMERAL_CODE_COOKIE_NAME = "__session-ep-claim"; -//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/dist/constants.js.map b/dist/constants.js.map deleted file mode 100644 index d06a99e..0000000 --- a/dist/constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAA;AAChD,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAA"} \ No newline at end of file diff --git a/dist/core/endpoints.d.ts b/dist/core/endpoints.d.ts deleted file mode 100644 index 01f7bb2..0000000 --- a/dist/core/endpoints.d.ts +++ /dev/null @@ -1,111 +0,0 @@ -import type { BasePayload, Endpoint } from "payload"; -import type { AccountInfo, OAuthProviderConfig, PasswordProviderConfig } from "../types.js"; -/** - * Base interface for all endpoint strategies. Useful to keep extending for providers with - * different requirements to interact with - * - * @interface EndpointStrategy - * - * @typedef {EndpointStrategy} - * - */ -interface EndpointStrategy { - createEndpoints(config: unknown): Endpoint[]; -} -/** - * Oauth endpoint strategy to implement dynamic enpoints for all type of Oauth providers - * - * @export - * @class OAuthEndpointStrategy - * @typedef {OAuthEndpointStrategy} - * @internal - */ -export declare class OAuthEndpointStrategy implements EndpointStrategy { - private providers; - constructor(providers: Record); - createEndpoints({ pluginType, collections, allowOAuthAutoSignUp, useAdmin, successRedirectPath, errorRedirectPath, }: { - pluginType: string; - collections: { - usersCollection: string; - accountsCollection: string; - }; - allowOAuthAutoSignUp: boolean; - useAdmin: boolean; - successRedirectPath: string; - errorRedirectPath: string; - }): Endpoint[]; -} -/** - * Passkey endpoint strategy to implement enpoints for Passkey provider - * - * @export - * @class PasskeyEndpointStrategy - * @typedef {PasskeyEndpointStrategy} - * @implements {EndpointStrategy} - * @internal - */ -export declare class PasskeyEndpointStrategy implements EndpointStrategy { - createEndpoints({ pluginType, rpID, sessionCallback, }: { - pluginType: string; - collections: { - usersCollection: string; - accountsCollection: string; - }; - rpID: string; - sessionCallback: (accountInfo: AccountInfo, issuerName: string, payload: BasePayload) => Promise; - }): Endpoint[]; -} -/** - * Endpoint strategy for Password based authentication - */ -export declare class PasswordAuthEndpointStrategy implements EndpointStrategy { - private internals; - private providerConfig; - constructor(internals: { - usersCollectionSlug: string; - }, providerConfig: PasswordProviderConfig); - createEndpoints({ pluginType, useAdmin, successRedirectPath, errorRedirectPath, }: { - pluginType: string; - useAdmin: boolean; - successRedirectPath: string; - errorRedirectPath: string; - }): Endpoint[]; -} -/** - * Endpoint strategy for managing sessions - */ -export declare class SessionEndpointStrategy implements EndpointStrategy { - private internals; - constructor(internals: { - usersCollectionSlug: string; - }); - createEndpoints({ pluginType }: { - pluginType: string; - }): Endpoint[]; -} -/** - * The generic endpoint factory class - * - * @export - * @class EndpointsFactory - * @typedef {EndpointsFactory} - * @internal - */ -type Strategies = "oauth" | "passkey" | "password" | "session"; -export declare class EndpointsFactory { - private pluginType; - private collections; - private allowOAuthAutoSignUp; - private useAdmin; - private successRedirectPath; - private errorRedirectPath; - private strategies; - constructor(pluginType: string, collections: { - usersCollection: string; - accountsCollection: string; - }, allowOAuthAutoSignUp: boolean, useAdmin: boolean, successRedirectPath: string, errorRedirectPath: string); - registerStrategy(name: Strategies, strategy: EndpointStrategy): void; - createEndpoints(strategyName: Strategies, config?: Record | undefined): Endpoint[]; -} -export {}; -//# sourceMappingURL=endpoints.d.ts.map \ No newline at end of file diff --git a/dist/core/endpoints.d.ts.map b/dist/core/endpoints.d.ts.map deleted file mode 100644 index 0cb4a44..0000000 --- a/dist/core/endpoints.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../src/core/endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAkB,MAAM,SAAS,CAAA;AACpE,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,aAAa,CAAA;AAKpB;;;;;;;;GAQG;AACH,UAAU,gBAAgB;IACxB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,QAAQ,EAAE,CAAA;CAC7C;AAED;;;;;;;GAOG;AACH,qBAAa,qBAAsB,YAAW,gBAAgB;IAChD,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC;IAElE,eAAe,CAAC,EACd,UAAU,EACV,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACR,mBAAmB,EACnB,iBAAiB,GAClB,EAAE;QACD,UAAU,EAAE,MAAM,CAAA;QAClB,WAAW,EAAE;YACX,eAAe,EAAE,MAAM,CAAA;YACvB,kBAAkB,EAAE,MAAM,CAAA;SAC3B,CAAA;QACD,oBAAoB,EAAE,OAAO,CAAA;QAC7B,QAAQ,EAAE,OAAO,CAAA;QACjB,mBAAmB,EAAE,MAAM,CAAA;QAC3B,iBAAiB,EAAE,MAAM,CAAA;KAC1B,GAAG,QAAQ,EAAE;CA4Bf;AAED;;;;;;;;GAQG;AACH,qBAAa,uBAAwB,YAAW,gBAAgB;IAC9D,eAAe,CAAC,EACd,UAAU,EACV,IAAI,EACJ,eAAe,GAChB,EAAE;QACD,UAAU,EAAE,MAAM,CAAA;QAClB,WAAW,EAAE;YACX,eAAe,EAAE,MAAM,CAAA;YACvB,kBAAkB,EAAE,MAAM,CAAA;S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AA;QACvB,kBAAkB,EAAE,MAAM,CAAA;KAC3B,EACO,oBAAoB,EAAE,OAAO,EAC7B,QAAQ,EAAE,OAAO,EACjB,mBAAmB,EAAE,MAAM,EAC3B,iBAAiB,EAAE,MAAM;IAGnC,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAIpE,eAAe,CACb,YAAY,EAAE,UAAU,EACxB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC3C,QAAQ,EAAE;CAed"} \ No newline at end of file diff --git a/dist/core/endpoints.js b/dist/core/endpoints.js deleted file mode 100644 index e0f7571..0000000 --- a/dist/core/endpoints.js +++ /dev/null @@ -1,145 +0,0 @@ -import { OAuthHandlers } from "./routeHandlers/oauth.js"; -import { PasskeyHandlers } from "./routeHandlers/passkey.js"; -import { PasswordAuthHandlers } from "./routeHandlers/password.js"; -import { SessionHandlers } from "./routeHandlers/session.js"; -/** - * Oauth endpoint strategy to implement dynamic enpoints for all type of Oauth providers - * - * @export - * @class OAuthEndpointStrategy - * @typedef {OAuthEndpointStrategy} - * @internal - */ -export class OAuthEndpointStrategy { - providers; - constructor(providers) { - this.providers = providers; - } - createEndpoints({ pluginType, collections, allowOAuthAutoSignUp, useAdmin, successRedirectPath, errorRedirectPath, }) { - return [ - { - path: `/${pluginType}/oauth/:resource/:provider`, - method: "get", - handler: (request) => { - const provider = this.providers[request.routeParams?.provider]; - const state = request.searchParams.get("state") ?? undefined; - return OAuthHandlers({ - pluginType, - collections, - allowOAuthAutoSignUp, - secret: request.payload.secret, - useAdmin, - request, - provider, - successRedirectPath, - errorRedirectPath, - state, - }); - }, - }, - ]; - } -} -/** - * Passkey endpoint strategy to implement enpoints for Passkey provider - * - * @export - * @class PasskeyEndpointStrategy - * @typedef {PasskeyEndpointStrategy} - * @implements {EndpointStrategy} - * @internal - */ -export class PasskeyEndpointStrategy { - createEndpoints({ pluginType, rpID, sessionCallback, }) { - return [ - { - path: `/${pluginType}/passkey/:resource`, - method: "post", - handler: (request) => { - return PasskeyHandlers(request, request.routeParams?.resource, rpID, (accountInfo) => { - return sessionCallback(accountInfo, "Passkey", request.payload); - }); - }, - }, - ]; - } -} -/** - * Endpoint strategy for Password based authentication - */ -export class PasswordAuthEndpointStrategy { - internals; - providerConfig; - constructor(internals, providerConfig) { - this.internals = internals; - this.providerConfig = providerConfig; - } - createEndpoints({ pluginType, useAdmin, successRedirectPath, errorRedirectPath, }) { - return [ - { - path: `/${pluginType}/auth/:kind`, - handler: (request) => { - const stage = request.searchParams.get("stage") ?? undefined; - return PasswordAuthHandlers(request, pluginType, request.routeParams?.kind, this.internals, request.payload.secret, useAdmin, successRedirectPath, errorRedirectPath, this.providerConfig, stage); - }, - method: "post", - }, - ]; - } -} -/** - * Endpoint strategy for managing sessions - */ -export class SessionEndpointStrategy { - internals; - constructor(internals) { - this.internals = internals; - } - createEndpoints({ pluginType }) { - return [ - { - path: `/${pluginType}/session/:kind`, - handler: (request) => { - return SessionHandlers(request, pluginType, this.internals); - }, - method: "get", - }, - ]; - } -} -export class EndpointsFactory { - pluginType; - collections; - allowOAuthAutoSignUp; - useAdmin; - successRedirectPath; - errorRedirectPath; - strategies = {}; - constructor(pluginType, collections, allowOAuthAutoSignUp, useAdmin, successRedirectPath, errorRedirectPath) { - this.pluginType = pluginType; - this.collections = collections; - this.allowOAuthAutoSignUp = allowOAuthAutoSignUp; - this.useAdmin = useAdmin; - this.successRedirectPath = successRedirectPath; - this.errorRedirectPath = errorRedirectPath; - } - registerStrategy(name, strategy) { - this.strategies[name] = strategy; - } - createEndpoints(strategyName, config) { - const strategy = this.strategies[strategyName]; - if (!strategy) { - throw new Error(`Strategy "${strategyName}" not found.`); - } - return strategy.createEndpoints({ - pluginType: this.pluginType, - allowOAuthAutoSignUp: this.allowOAuthAutoSignUp, - useAdmin: this.useAdmin, - collections: this.collections, - successRedirectPath: this.successRedirectPath, - errorRedirectPath: this.errorRedirectPath, - ...config, - }); - } -} -//# sourceMappingURL=endpoints.js.map \ No newline at end of file diff --git a/dist/core/endpoints.js.map b/dist/core/endpoints.js.map deleted file mode 100644 index 3712ee2..0000000 --- a/dist/core/endpoints.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../../src/core/endpoints.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAc5D;;;;;;;GAOG;AACH,MAAM,OAAO,qBAAqB;IACZ;IAApB,YAAoB,SAA8C;QAA9C,cAAS,GAAT,SAAS,CAAqC;IAAG,CAAC;IAEtE,eAAe,CAAC,EACd,UAAU,EACV,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACR,mBAAmB,EACnB,iBAAiB,GAWlB;QACC,OAAO;YACL;gBACE,IAAI,EAAE,IAAI,UAAU,4BAA4B;gBAChD,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE,CAAC,OAAuB,EAAE,EAAE;oBACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAC7B,OAAO,CAAC,WAAW,EAAE,QAAkB,CACjB,CAAA;oBAExB,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,SAAS,CAAA;oBAE5D,OAAO,aAAa,CAAC;wBACnB,UAAU;wBACV,WAAW;wBACX,oBAAoB;wBACpB,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM;wBAC9B,QAAQ;wBACR,OAAO;wBACP,QAAQ;wBACR,mBAAmB;wBACnB,iBAAiB;wBACjB,KAAK;qBACN,CAAC,CAAA;gBACJ,CAAC;aACF;SACF,CAAA;IACH,CAA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AAC,QAAQ;YACvB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;YAC7C,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,GAAG,MAAM;SACV,CAAC,CAAA;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/dist/core/errors/apiErrors.d.ts b/dist/core/errors/apiErrors.d.ts deleted file mode 100644 index ced8d4a..0000000 --- a/dist/core/errors/apiErrors.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { ErrorKind } from "../../types.js"; -export declare class AuthAPIError extends Response { - constructor(message: string, kind: ErrorKind); -} -export declare class MissingEmailAPIError extends AuthAPIError { - constructor(); -} -export declare class UnVerifiedAccountAPIError extends AuthAPIError { - constructor(); -} -export declare class UserNotFoundAPIError extends AuthAPIError { - constructor(); -} -export declare class EmailNotFoundAPIError extends AuthAPIError { - constructor(); -} -export declare class PasskeyVerificationAPIError extends AuthAPIError { - constructor(); -} -export declare class InvalidAPIRequest extends AuthAPIError { - constructor(); -} -export declare class UnauthorizedAPIRequest extends AuthAPIError { - constructor(); -} -export declare class AuthenticationFailed extends AuthAPIError { - constructor(); -} -export declare class InvalidCredentials extends AuthAPIError { - constructor(); -} -export declare class InvalidRequestBodyError extends AuthAPIError { - constructor(); -} -export declare class EmailAlreadyExistError extends AuthAPIError { - constructor(); -} -export declare class InternalServerError extends AuthAPIError { - constructor(); -} -export declare class MissingOrInvalidVerification extends AuthAPIError { - constructor(); -} -export declare class MissingCollection extends AuthAPIError { - constructor(); -} -//# sourceMappingURL=apiErrors.d.ts.map \ No newline at end of file diff --git a/dist/core/errors/apiErrors.d.ts.map b/dist/core/errors/apiErrors.d.ts.map deleted file mode 100644 index a5080b2..0000000 --- a/dist/core/errors/apiErrors.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"apiErrors.d.ts","sourceRoot":"","sources":["../../../src/core/errors/apiErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAU1C,qBAAa,YAAa,SAAQ,QAAQ;gBAC5B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS;CAc7C;AAED,qBAAa,oBAAqB,SAAQ,YAAY;;CAIrD;AAED,qBAAa,yBAA0B,SAAQ,YAAY;;CAI1D;AAED,qBAAa,oBAAqB,SAAQ,YAAY;;CAIrD;AAED,qBAAa,qBAAsB,SAAQ,YAAY;;CAItD;AAED,qBAAa,2BAA4B,SAAQ,YAAY;;CAI5D;AAED,qBAAa,iBAAkB,SAAQ,YAAY;;CAIlD;AAED,qBAAa,sBAAuB,SAAQ,YAAY;;CAIvD;AAED,qBAAa,oBAAqB,SAAQ,YAAY;;CAIrD;AAED,qBAAa,kBAAmB,SAAQ,YAAY;;CAInD;AAED,qBAAa,uBAAwB,SAAQ,YAAY;;CAIxD;AAED,qBAAa,sBAAuB,SAAQ,YAAY;;CAIvD;AAED,qBAAa,mBAAoB,SAAQ,YAAY;;CAIpD;AAED,qBAAa,4BAA6B,SAAQ,YAAY;;CAO7D;AAED,qBAAa,iBAAkB,SAAQ,YAAY;;CAIlD"} \ No newline at end of file diff --git a/dist/core/errors/apiErrors.js b/dist/core/errors/apiErrors.js deleted file mode 100644 index 764aa6c..0000000 --- a/dist/core/errors/apiErrors.js +++ /dev/null @@ -1,93 +0,0 @@ -import { ErrorKind } from "../../types.js"; -const statusByKind = { - [ErrorKind.NotFound]: 404, - [ErrorKind.BadRequest]: 400, - [ErrorKind.InternalServer]: 500, - [ErrorKind.NotAuthenticated]: 401, - [ErrorKind.NotAuthorized]: 403, - [ErrorKind.Conflict]: 409, -}; -export class AuthAPIError extends Response { - constructor(message, kind) { - super(JSON.stringify({ - message, - kind, - data: null, - isSuccess: false, - isError: true, - }), { - status: statusByKind[kind], - }); - } -} -export class MissingEmailAPIError extends AuthAPIError { - constructor() { - super("Missing email. Email is required", ErrorKind.BadRequest); - } -} -export class UnVerifiedAccountAPIError extends AuthAPIError { - constructor() { - super("Account is not verified", ErrorKind.BadRequest); - } -} -export class UserNotFoundAPIError extends AuthAPIError { - constructor() { - super("User not found", ErrorKind.NotFound); - } -} -export class EmailNotFoundAPIError extends AuthAPIError { - constructor() { - super("No user found with this email", ErrorKind.BadRequest); - } -} -export class PasskeyVerificationAPIError extends AuthAPIError { - constructor() { - super("Passkey verification failed", ErrorKind.BadRequest); - } -} -export class InvalidAPIRequest extends AuthAPIError { - constructor() { - super("Invalid API request", ErrorKind.BadRequest); - } -} -export class UnauthorizedAPIRequest extends AuthAPIError { - constructor() { - super("Unauthorized access", ErrorKind.NotAuthorized); - } -} -export class AuthenticationFailed extends AuthAPIError { - constructor() { - super("Authentication Failed", ErrorKind.NotAuthenticated); - } -} -export class InvalidCredentials extends AuthAPIError { - constructor() { - super("Invalid Credentials", ErrorKind.BadRequest); - } -} -export class InvalidRequestBodyError extends AuthAPIError { - constructor() { - super("Wrong request body. Missing parameters", ErrorKind.BadRequest); - } -} -export class EmailAlreadyExistError extends AuthAPIError { - constructor() { - super("Email is already taken", ErrorKind.Conflict); - } -} -export class InternalServerError extends AuthAPIError { - constructor() { - super("Something went wrong. Server failure", ErrorKind.BadRequest); - } -} -export class MissingOrInvalidVerification extends AuthAPIError { - constructor() { - super("Verification failed. Missing or invalid verification code.", ErrorKind.BadRequest); - } -} -export class MissingCollection extends AuthAPIError { - constructor() { - super("Missing collection", ErrorKind.NotFound); - } -} -//# sourceMappingURL=apiErrors.js.map \ No newline at end of file diff --git a/dist/core/errors/apiErrors.js.map b/dist/core/errors/apiErrors.js.map deleted file mode 100644 index 9fadbd9..0000000 --- a/dist/core/errors/apiErrors.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"apiErrors.js","sourceRoot":"","sources":["../../../src/core/errors/apiErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,YAAY,GAAG;IACnB,CAAC,SAAS,CAA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,YAAY;IACjD;QACE,KAAK,CAAC,qBAAqB,EAAE,SAAS,CAAC,UAAU,CAAC,CAAA;IACpD,CAAC;CACF;AAED,MAAM,OAAO,sBAAuB,SAAQ,YAAY;IACtD;QACE,KAAK,CAAC,qBAAqB,EAAE,SAAS,CAAC,aAAa,CAAC,CAAA;IACvD,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ,YAAY;IACpD;QACE,KAAK,CAAC,uBAAuB,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAA;IAC5D,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,YAAY;IAClD;QACE,KAAK,CAAC,qBAAqB,EAAE,SAAS,CAAC,UAAU,CAAC,CAAA;IACpD,CAAC;CACF;AAED,MAAM,OAAO,uBAAwB,SAAQ,YAAY;IACvD;QACE,KAAK,CAAC,wCAAwC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAA;IACvE,CAAC;CACF;AAED,MAAM,OAAO,sBAAuB,SAAQ,YAAY;IACtD;QACE,KAAK,CAAC,wBAAwB,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAA;IACrD,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,YAAY;IACnD;QACE,KAAK,CAAC,sCAAsC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAA;IACrE,CAAC;CACF;AAED,MAAM,OAAO,4BAA6B,SAAQ,YAAY;IAC5D;QACE,KAAK,CACH,4DAA4D,EAC5D,SAAS,CAAC,UAAU,CACrB,CAAA;IACH,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IACjD;QACE,KAAK,CAAC,oBAAoB,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAA;IACjD,CAAC;CACF"} \ No newline at end of file diff --git a/dist/core/errors/consoleErrors.d.ts b/dist/core/errors/consoleErrors.d.ts deleted file mode 100644 index 5b09baa..0000000 --- a/dist/core/errors/consoleErrors.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -declare class PluginError extends Error { - constructor(message: string, cause?: string); -} -export declare class MissingPayloadAuthBaseURL extends PluginError { - constructor(); -} -export declare class InvalidServerURL extends PluginError { - constructor(); -} -export declare class InvalidProvider extends PluginError { - constructor(); -} -export declare class ProviderAlreadyExists extends PluginError { - constructor(); -} -export declare class InvalidOAuthAlgorithm extends PluginError { - constructor(); -} -export declare class InvalidOAuthResource extends PluginError { - constructor(); -} -export declare class MissingOrInvalidSession extends PluginError { - constructor(); -} -export declare class MissingOrInvalidParams extends PluginError { - constructor(); -} -export declare class MissingSecret extends PluginError { - constructor(); -} -export declare class AuthenticationFailed extends PluginError { - constructor(); -} -export declare class UserNotFound extends PluginError { - constructor(); -} -export declare class InvalidCredentials extends PluginError { - constructor(); -} -export declare class MissingUsersCollection extends PluginError { - constructor(); -} -export declare class InvalidPasskeyRequest extends PluginError { - constructor(); -} -export declare class InvalidCollectionSlug extends PluginError { - constructor(); -} -export declare class MissingCollections extends PluginError { - constructor(); -} -export declare class MissingEnv extends PluginError { - constructor(env: string); -} -export declare class MissingEmailAdapter extends PluginError { - constructor(); -} -export declare class MissingCollectionSlug extends PluginError { - constructor(); -} -export declare class WrongClientUsage extends PluginError { - constructor(); -} -export {}; -//# sourceMappingURL=consoleErrors.d.ts.map \ No newline at end of file diff --git a/dist/core/errors/consoleErrors.d.ts.map b/dist/core/errors/consoleErrors.d.ts.map deleted file mode 100644 index b7937f1..0000000 --- a/dist/core/errors/consoleErrors.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"consoleErrors.d.ts","sourceRoot":"","sources":["../../../src/core/errors/consoleErrors.ts"],"names":[],"mappings":"AAAA,cAAM,WAAY,SAAQ,KAAK;gBACjB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;CAO5C;AACD,qBAAa,yBAA0B,SAAQ,WAAW;;CAIzD;AACD,qBAAa,gBAAiB,SAAQ,WAAW;;CAMhD;AACD,qBAAa,eAAgB,SAAQ,WAAW;;CAI/C;AAED,qBAAa,qBAAsB,SAAQ,WAAW;;CAIrD;AAED,qBAAa,qBAAsB,SAAQ,WAAW;;CAMrD;AAED,qBAAa,oBAAqB,SAAQ,WAAW;;CAIpD;AAED,qBAAa,uBAAwB,SAAQ,WAAW;;CAIvD;AAED,qBAAa,sBAAuB,SAAQ,WAAW;;CAItD;AAED,qBAAa,aAAc,SAAQ,WAAW;;CAI7C;AAED,qBAAa,oBAAqB,SAAQ,WAAW;;CAIpD;AAED,qBAAa,YAAa,SAAQ,WAAW;;CAI5C;AAED,qBAAa,kBAAmB,SAAQ,WAAW;;CAIlD;AAED,qBAAa,sBAAuB,SAAQ,WAAW;;CAItD;AAED,qBAAa,qBAAsB,SAAQ,WAAW;;CAIrD;AAED,qBAAa,qBAAsB,SAAQ,WAAW;;CAIrD;AAED,qBAAa,kBAAmB,SAAQ,WAAW;;CAIlD;AAED,qBAAa,UAAW,SAAQ,WAAW;gBAC7B,GAAG,EAAE,MAAM;CAGxB;AAED,qBAAa,mBAAoB,SAAQ,WAAW;;CAMnD;AAED,qBAAa,qBAAsB,SAAQ,WAAW;;CAIrD;AAED,qBAAa,gBAAiB,SAAQ,WAAW;;CAIhD"} \ No newline at end of file diff --git a/dist/core/errors/consoleErrors.js b/dist/core/errors/consoleErrors.js deleted file mode 100644 index 1d1b4ea..0000000 --- a/dist/core/errors/consoleErrors.js +++ /dev/null @@ -1,110 +0,0 @@ -class PluginError extends Error { - constructor(message, cause) { - super(message); - this.name = "PAYLOAD_AUTH_PLUGIN_ERROR"; - this.message = message; - this.cause = cause; - this.stack = ""; - } -} -export class MissingPayloadAuthBaseURL extends PluginError { - constructor() { - super("Missing or invalid Payload Auth base URL"); - } -} -export class InvalidServerURL extends PluginError { - constructor() { - super("Missing or invalid server URL. Please set serverURL in your Payload config"); - } -} -export class InvalidProvider extends PluginError { - constructor() { - super("Invalid Provider"); - } -} -export class ProviderAlreadyExists extends PluginError { - constructor() { - super("Duplicate provider found"); - } -} -export class InvalidOAuthAlgorithm extends PluginError { - constructor() { - super("Invalid OAuth Algorithm. Plugin only support OIDC and OAuth2 algorithms"); - } -} -export class InvalidOAuthResource extends PluginError { - constructor() { - super("Invalid resource request. Check docs before initiating requests"); - } -} -export class MissingOrInvalidSession extends PluginError { - constructor() { - super("Missing or invalid session."); - } -} -export class MissingOrInvalidParams extends PluginError { - constructor() { - super("Missing or invalid params"); - } -} -export class MissingSecret extends PluginError { - constructor() { - super("Missing secret in the options"); - } -} -export class AuthenticationFailed extends PluginError { - constructor() { - super("Failed to authenticate"); - } -} -export class UserNotFound extends PluginError { - constructor() { - super("User not found"); - } -} -export class InvalidCredentials extends PluginError { - constructor() { - super("Invalid credentials"); - } -} -export class MissingUsersCollection extends PluginError { - constructor() { - super("Missing users collection"); - } -} -export class InvalidPasskeyRequest extends PluginError { - constructor() { - super("Invalid or missing request"); - } -} -export class InvalidCollectionSlug extends PluginError { - constructor() { - super("Missing or invalid collection slug"); - } -} -export class MissingCollections extends PluginError { - constructor() { - super("Missing collections"); - } -} -export class MissingEnv extends PluginError { - constructor(env) { - super("Missing ENV " + env); - } -} -export class MissingEmailAdapter extends PluginError { - constructor() { - super("Email adapter is required. Check the docs for the setup: https://payloadcms.com/docs/email/overview"); - } -} -export class MissingCollectionSlug extends PluginError { - constructor() { - super("Missing collection slug"); - } -} -export class WrongClientUsage extends PluginError { - constructor() { - super("Using client only code in server side"); - } -} -//# sourceMappingURL=consoleErrors.js.map \ No newline at end of file diff --git a/dist/core/errors/consoleErrors.js.map b/dist/core/errors/consoleErrors.js.map deleted file mode 100644 index a153469..0000000 --- a/dist/core/errors/consoleErrors.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"consoleErrors.js","sourceRoot":"","sources":["../../../src/core/errors/consoleErrors.ts"],"names":[],"mappings":"AAAA,MAAM,WAAY,SAAQ,KAAK;IAC7B,YAAY,OAAe,EAAE,KAAc;QACzC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,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ACzB,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,WAAW;IACjD;QACE,KAAK,CAAC,qBAAqB,CAAC,CAAA;IAC9B,CAAC;CACF;AAED,MAAM,OAAO,sBAAuB,SAAQ,WAAW;IACrD;QACE,KAAK,CAAC,0BAA0B,CAAC,CAAA;IACnC,CAAC;CACF;AAED,MAAM,OAAO,qBAAsB,SAAQ,WAAW;IACpD;QACE,KAAK,CAAC,4BAA4B,CAAC,CAAA;IACrC,CAAC;CACF;AAED,MAAM,OAAO,qBAAsB,SAAQ,WAAW;IACpD;QACE,KAAK,CAAC,oCAAoC,CAAC,CAAA;IAC7C,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,WAAW;IACjD;QACE,KAAK,CAAC,qBAAqB,CAAC,CAAA;IAC9B,CAAC;CACF;AAED,MAAM,OAAO,UAAW,SAAQ,WAAW;IACzC,YAAY,GAAW;QACrB,KAAK,CAAC,cAAc,GAAG,GAAG,CAAC,CAAA;IAC7B,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,WAAW;IAClD;QACE,KAAK,CACH,qGAAqG,CACtG,CAAA;IACH,CAAC;CACF;AAED,MAAM,OAAO,qBAAsB,SAAQ,WAAW;IACpD;QACE,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAClC,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IAC/C;QACE,KAAK,CAAC,uCAAuC,CAAC,CAAA;IAChD,CAAC;CACF"} \ No newline at end of file diff --git a/dist/core/preflights/collections.d.ts b/dist/core/preflights/collections.d.ts deleted file mode 100644 index b6ce710..0000000 --- a/dist/core/preflights/collections.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { CollectionConfig } from "payload"; -export declare function preflightCollectionCheck(slugs: string[], collections: CollectionConfig[] | undefined): void; -//# sourceMappingURL=collections.d.ts.map \ No newline at end of file diff --git a/dist/core/preflights/collections.d.ts.map b/dist/core/preflights/collections.d.ts.map deleted file mode 100644 index 8464498..0000000 --- a/dist/core/preflights/collections.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../../src/core/preflights/collections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAM1C,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,EAAE,EACf,WAAW,EAAE,gBAAgB,EAAE,GAAG,SAAS,QAW5C"} \ No newline at end of file diff --git a/dist/core/preflights/collections.js b/dist/core/preflights/collections.js deleted file mode 100644 index 2b736fa..0000000 --- a/dist/core/preflights/collections.js +++ /dev/null @@ -1,13 +0,0 @@ -import { InvalidCollectionSlug, MissingCollections, } from "../errors/consoleErrors.js"; -export function preflightCollectionCheck(slugs, collections) { - if (!collections?.length) { - throw new MissingCollections(); - } - slugs.forEach((slug) => { - if (!collections.some((c) => c.slug === slug)) { - throw new InvalidCollectionSlug(); - } - }); - return; -} -//# sourceMappingURL=collections.js.map \ No newline at end of file diff --git a/dist/core/preflights/collections.js.map b/dist/core/preflights/collections.js.map deleted file mode 100644 index f3234fc..0000000 --- a/dist/core/preflights/collections.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../../src/core/preflights/collections.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,4BAA4B,CAAA;AAEnC,MAAM,UAAU,wBAAwB,CACtC,KAAe,EACf,WAA2C;IAE3C,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;QACzB,MAAM,IAAI,kBAAkB,EAAE,CAAA;IAChC,CAAC;IACD,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;YAC9C,MAAM,IAAI,qBAAqB,EAAE,CAAA;QACnC,CAAC;IACH,CAAC,CAAC,CAAA;IACF,OAAM;AACR,CAAC"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth2_authorization.d.ts b/dist/core/protocols/oauth/oauth2_authorization.d.ts deleted file mode 100644 index be90a39..0000000 --- a/dist/core/protocols/oauth/oauth2_authorization.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { OAuth2ProviderConfig, ParsedOAuthState } from "../../../types"; -import type { PayloadRequest } from "payload"; -export declare function OAuth2Authorization(pluginType: string, request: PayloadRequest, providerConfig: OAuth2ProviderConfig, clientOrigin?: string | undefined, parsedState?: ParsedOAuthState | null): Promise; -//# sourceMappingURL=oauth2_authorization.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth2_authorization.d.ts.map b/dist/core/protocols/oauth/oauth2_authorization.d.ts.map deleted file mode 100644 index 9f79b18..0000000 --- a/dist/core/protocols/oauth/oauth2_authorization.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oauth2_authorization.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oauth2_authorization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAEhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,EACvB,cAAc,EAAE,oBAAoB,EACpC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,EACjC,WAAW,CAAC,EAAE,gBAAgB,GAAG,IAAI,GACpC,OAAO,CAAC,QAAQ,CAAC,CAsEnB"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth2_authorization.js b/dist/core/protocols/oauth/oauth2_authorization.js deleted file mode 100644 index 05d8764..0000000 --- a/dist/core/protocols/oauth/oauth2_authorization.js +++ /dev/null @@ -1,51 +0,0 @@ -import { createOAuthState } from "../../routeHandlers/oauth"; -import { getCallbackURL } from "../../utils/cb"; -import * as oauth from "oauth4webapi"; -export async function OAuth2Authorization(pluginType, request, providerConfig, clientOrigin, parsedState) { - const callback_url = getCallbackURL(request.payload.config.serverURL, pluginType, providerConfig.id); - const code_verifier = parsedState?.codeVerifier || oauth.generateRandomCodeVerifier(); - const code_challenge = await oauth.calculatePKCECodeChallenge(code_verifier); - const code_challenge_method = "S256"; - const { authorization_server, client_id, scope, params } = providerConfig; - const client = { - client_id, - }; - const as = authorization_server; - const cookies = []; - const cookieMaxage = new Date(Date.now() + 300 * 1000); - const authorizationURL = new URL(as.authorization_endpoint); - authorizationURL.searchParams.set("client_id", client.client_id); - authorizationURL.searchParams.set("redirect_uri", callback_url.toString()); - authorizationURL.searchParams.set("response_type", "code"); - authorizationURL.searchParams.set("scope", scope); - authorizationURL.searchParams.set("code_challenge", code_challenge); - authorizationURL.searchParams.set("code_challenge_method", code_challenge_method); - if (parsedState) { - authorizationURL.searchParams.set("state", createOAuthState(parsedState)); - } - if (params) { - Object.entries(params).map(([key, value]) => { - authorizationURL.searchParams.set(key, value); - }); - } - if (as.code_challenge_methods_supported?.includes("S256") !== true) { - const state = oauth.generateRandomState(); - authorizationURL.searchParams.set("state", state); - cookies.push(`__session-oauth-state=${state};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`); - } - cookies.push(`__session-code-verifier=${code_verifier};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`); - if (clientOrigin && clientOrigin !== undefined) { - cookies.push(`__session-client-origin=${clientOrigin};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`); - } - const res = new Response(null, { - status: 302, - headers: { - Location: authorizationURL.href, - }, - }); - for (const c of cookies) { - res.headers.append("Set-Cookie", c); - } - return res; -} -//# sourceMappingURL=oauth2_authorization.js.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth2_authorization.js.map b/dist/core/protocols/oauth/oauth2_authorization.js.map deleted file mode 100644 index 60b1219..0000000 --- a/dist/core/protocols/oauth/oauth2_authorization.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oauth2_authorization.js","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oauth2_authorization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAGrC,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,UAAkB,EAClB,OAAuB,EACvB,cAAoC,EACpC,YAAiC,EACjC,WAAqC;IAErC,MAAM,YAAY,GAAG,cAAc,CACjC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAChC,UAAU,EACV,cAAc,CAAC,EAAE,CAClB,CAAA;IACD,MAAM,aAAa,GACjB,WAAW,EAAE,YAAY,IAAI,KAAK,CAAC,0BAA0B,EAAE,CAAA;IAEjE,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,0BAA0B,CAAC,aAAa,CAAC,CAAA;IAC5E,MAAM,qBAAqB,GAAG,MAAM,CAAA;IACpC,MAAM,EAAE,oBAAoB,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,cAAc,CAAA;IAEzE,MAAM,MAAM,GAAiB;QAC3B,SAAS;KACV,CAAA;IAED,MAAM,EAAE,GAAG,oBAAoB,CAAA;IAE/B,MAAM,OAAO,GAAa,EAAE,CAAA;IAC5B,MAAM,YAAY,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,CAAA;IAEtD,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC,sBAAgC,CAAC,CAAA;IACrE,gBAAgB,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,EAAE,M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AA;IACD,IAAI,YAAY,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/C,OAAO,CAAC,IAAI,CACV,2BAA2B,YAAY,yCAAyC,YAAY,CAAC,WAAW,EAAE,EAAE,CAC7G,CAAA;IACH,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE;QAC7B,MAAM,EAAE,GAAG;QACX,OAAO,EAAE;YACP,QAAQ,EAAE,gBAAgB,CAAC,IAAI;SAChC;KACF,CAAC,CAAA;IAEF,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAA;IACrC,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth2_callback.d.ts b/dist/core/protocols/oauth/oauth2_callback.d.ts deleted file mode 100644 index 3a4d2ba..0000000 --- a/dist/core/protocols/oauth/oauth2_callback.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { OAuthCallbackParams, ParsedOAuthState } from "../../../types"; -export declare function OAuth2Callback(params: OAuthCallbackParams, parsedState: ParsedOAuthState | null): Promise; -//# sourceMappingURL=oauth2_callback.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth2_callback.d.ts.map b/dist/core/protocols/oauth/oauth2_callback.d.ts.map deleted file mode 100644 index 691a092..0000000 --- a/dist/core/protocols/oauth/oauth2_callback.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oauth2_callback.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oauth2_callback.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAIjB,MAAM,SAAS,CAAA;AAEhB,wBAAsB,cAAc,CAClC,MAAM,EAAE,mBAAmB,EAC3B,WAAW,EAAE,gBAAgB,GAAG,IAAI,GACnC,OAAO,CAAC,QAAQ,CAAC,CAuHnB"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth2_callback.js b/dist/core/protocols/oauth/oauth2_callback.js deleted file mode 100644 index 82ffb31..0000000 --- a/dist/core/protocols/oauth/oauth2_callback.js +++ /dev/null @@ -1,60 +0,0 @@ -import * as oauth from "oauth4webapi"; -import { parseCookies } from "payload"; -import { OAuthAuthentication } from "./oauth_authentication"; -import { MissingOrInvalidSession } from "../../errors/consoleErrors"; -import { createOAuthState } from "../../routeHandlers/oauth"; -import { getCallbackURL } from "../../utils/cb"; -export async function OAuth2Callback(params, parsedState) { - const { pluginType, request, provider, collections, allowOAuthAutoSignUp, useAdmin, secret, successRedirectPath, errorRedirectPath, } = params; - const providerConfig = provider; - const parsedCookies = parseCookies(request.headers); - const code_verifier = parsedState?.codeVerifier || parsedCookies.get("__session-code-verifier"); - const state = parsedState - ? createOAuthState(parsedState) - : parsedCookies.get("__session-oauth-state"); - if (!code_verifier) { - throw new MissingOrInvalidSession(); - } - const { client_id, client_secret, authorization_server, client_auth_type, profile, } = providerConfig; - const client = { - client_id, - }; - const clientAuth = client_auth_type === "client_secret_basic" - ? oauth.ClientSecretBasic(client_secret ?? "") - : oauth.ClientSecretPost(client_secret ?? ""); - const current_url = new URL(request.url); - const callback_url = getCallbackURL(request.payload.config.serverURL, pluginType, providerConfig.id); - const as = authorization_server; - const params_oauth = oauth.validateAuthResponse(as, client, current_url, state); - const grantResponse = await oauth.authorizationCodeGrantRequest(as, client, clientAuth, params_oauth, callback_url.toString(), code_verifier); - const body = (await grantResponse.json()); - let response = new Response(JSON.stringify(body), grantResponse); - if (Array.isArray(body.scope)) { - body.scope = body.scope.join(" "); - response = new Response(JSON.stringify(body), grantResponse); - } - const token_result = await oauth.processAuthorizationCodeResponse(as, client, response); - const userInfoResponse = await oauth.userInfoRequest(as, client, token_result.access_token); - const userInfo = (await userInfoResponse.json()); - // Use the provider's profile callback if available - let accountInfo; - if (profile) { - accountInfo = profile(userInfo); - } - else { - accountInfo = { - sub: userInfo.sub ?? "", - name: userInfo.name ?? "", - email: userInfo.email ?? "", - picture: userInfo.picture ?? "", - }; - } - const userData = { - ...accountInfo, - scope: providerConfig.scope, - issuer: providerConfig.authorization_server.issuer, - access_token: token_result.access_token, - }; - return await OAuthAuthentication(pluginType, collections, allowOAuthAutoSignUp, useAdmin, secret, request, successRedirectPath, errorRedirectPath, userData); -} -//# sourceMappingURL=oauth2_callback.js.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth2_callback.js.map b/dist/core/protocols/oauth/oauth2_callback.js.map deleted file mode 100644 index 086773f..0000000 --- a/dist/core/protocols/oauth/oauth2_callback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oauth2_callback.js","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oauth2_callback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAShD,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAA2B,EAC3B,WAAoC;IAEpC,MAAM,EACJ,UAAU,EACV,OAAO,EACP,QAAQ,EACR,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACR,MAAM,EACN,mBAAmB,EACnB,iBAAiB,GAClB,GAAG,MAAM,CAAA;IAEV,MAAM,cAAc,GAAG,QAAgC,CAAA;IACvD,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAEnD,MAAM,aAAa,GACjB,WAAW,EAAE,YAAY,IAAI,aAAa,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA;IA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ACjB,QAAQ,CACT,CAAA;AACH,CAAC"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth_authentication.d.ts b/dist/core/protocols/oauth/oauth_authentication.d.ts deleted file mode 100644 index d43b8c7..0000000 --- a/dist/core/protocols/oauth/oauth_authentication.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { PayloadRequest } from "payload"; -import { OAuthAccountData, OAuthCollections } from "../../../types"; -export declare function OAuthAuthentication(pluginType: string, collections: OAuthCollections, allowOAuthAutoSignUp: boolean, useAdmin: boolean, secret: string, request: PayloadRequest, successRedirectPath: string, errorRedirectPath: string, userData: OAuthAccountData): Promise; -//# sourceMappingURL=oauth_authentication.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth_authentication.d.ts.map b/dist/core/protocols/oauth/oauth_authentication.d.ts.map deleted file mode 100644 index 7ce3695..0000000 --- a/dist/core/protocols/oauth/oauth_authentication.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oauth_authentication.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oauth_authentication.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,cAAc,EAGf,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAY5D,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,gBAAgB,EAC7B,oBAAoB,EAAE,OAAO,EAC7B,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,cAAc,EACvB,mBAAmB,EAAE,MAAM,EAC3B,iBAAiB,EAAE,MAAM,EACzB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,QAAQ,CAAC,CAoLnB"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth_authentication.js b/dist/core/protocols/oauth/oauth_authentication.js deleted file mode 100644 index f1c27cc..0000000 --- a/dist/core/protocols/oauth/oauth_authentication.js +++ /dev/null @@ -1,143 +0,0 @@ -import * as jose from "jose"; -import { v4 as uuid } from "uuid"; -import { parseCookies } from "payload"; -import { APP_COOKIE_SUFFIX } from "../../../constants"; -import { UserNotFoundAPIError, MissingCollection, } from "../../errors/apiErrors"; -import { createSessionCookies, invalidateOAuthCookies, } from "../../utils/cookies"; -import { removeExpiredSessions } from "../../utils/session"; -export async function OAuthAuthentication(pluginType, collections, allowOAuthAutoSignUp, useAdmin, secret, request, successRedirectPath, errorRedirectPath, userData) { - const { email: _email, sub, name, scope, issuer, picture, access_token, } = userData; - const { payload } = request; - const email = _email.toLowerCase(); - const userRecords = await payload.find({ - collection: collections.usersCollection, - where: { - email: { - equals: email, - }, - }, - }); - let userRecord; - if (userRecords.docs.length === 1 && userRecords.docs[0]) { - userRecord = userRecords.docs[0]; - } - else if (allowOAuthAutoSignUp) { - const data = { - email, - name, - _verified: true, - }; - const hasAuthEnabled = Boolean(payload.collections[collections.usersCollection]?.config.auth); - if (hasAuthEnabled) { - data.password = jose.base64url.encode(crypto.getRandomValues(new Uint8Array(16))); - } - const userRecords = await payload.create({ - collection: collections.usersCollection, - data, - }); - userRecord = userRecords; - } - else { - return new UserNotFoundAPIError(); - } - const accountData = { - scope, - name, - picture, - issuerName: issuer, - access_token, - }; - const accountRecords = await payload.find({ - collection: collections.accountsCollection, - where: { - sub: { equals: sub }, - }, - }); - if (accountRecords.docs && - accountRecords.docs.length === 1 && - accountRecords.docs[0]) { - await payload.update({ - collection: collections.accountsCollection, - id: accountRecords.docs[0].id, - data: accountData, - }); - } - else { - accountData.sub = sub; - accountData.user = userRecord.id; - await payload.create({ - collection: collections.accountsCollection, - data: accountData, - }); - } - let cookies = []; - const collectionConfig = payload.config.collections.find((collection) => collection.slug === collections.usersCollection); - if (!collectionConfig) { - return new MissingCollection(); - } - const sessionID = collectionConfig?.auth.useSessions ? uuid() : null; - if (collectionConfig?.auth.useSessions) { - const now = new Date(); - const tokenExpInMs = collectionConfig.auth.tokenExpiration * 1000; - const expiresAt = new Date(now.getTime() + tokenExpInMs); - const session = { - id: sessionID, - createdAt: now, - expiresAt, - }; - if (!userRecord["sessions"]?.length) { - userRecord["sessions"] = [session]; - } - else { - userRecord.sessions = removeExpiredSessions(userRecord.sessions); - userRecord.sessions.push(session); - } - await payload.db.updateOne({ - id: userRecord.id, - collection: collections.usersCollection, - data: userRecord, - req: request, - returning: false, - }); - } - const cookieName = useAdmin - ? `${payload.config.cookiePrefix}-token` - : `__${pluginType}-${APP_COOKIE_SUFFIX}`; - cookies = [ - ...(await createSessionCookies(cookieName, secret, { - id: userRecord.id, - email: email, - sid: sessionID, - collection: collections.usersCollection, - }, useAdmin ? collectionConfig?.auth.tokenExpiration : undefined)), - ]; - cookies = invalidateOAuthCookies(cookies); - // Get the state data from cookies and pass it as a query parameter - const parsedCookies = parseCookies(request.headers); - const cookieState = parsedCookies.get("__session-oauth-state"); - const successRedirectionURL = new URL(`${payload.config.serverURL}${successRedirectPath}`); - // Add the state as a query parameter if it exists - if (cookieState) { - try { - // Validate that it's proper JSON - JSON.parse(cookieState); - // Add the state as a query parameter (URL encode it) - successRedirectionURL.searchParams.set("state", encodeURIComponent(cookieState)); - console.log("Added state to redirect URL:", cookieState); - } - catch (error) { - console.error("Failed to parse state data, continuing without state:", error); - } - } - const res = new Response(null, { - status: 302, - headers: { - Location: successRedirectionURL.href, - }, - }); - for (const c of cookies) { - res.headers.append("Set-Cookie", c); - } - return res; -} -//# sourceMappingURL=oauth_authentication.js.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oauth_authentication.js.map b/dist/core/protocols/oauth/oauth_authentication.js.map deleted file mode 100644 index e206126..0000000 --- a/dist/core/protocols/oauth/oauth_authentication.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oauth_authentication.js","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oauth_authentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,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8BAA8B,EAAE,WAAW,CAAC,CAAA;QAC1D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CACX,uDAAuD,EACvD,KAAK,CACN,CAAA;QACH,CAAC;IACH,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE;QAC7B,MAAM,EAAE,GAAG;QACX,OAAO,EAAE;YACP,QAAQ,EAAE,qBAAqB,CAAC,IAAI;SACrC;KACF,CAAC,CAAA;IAEF,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAA;IACrC,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oidc_authorization.d.ts b/dist/core/protocols/oauth/oidc_authorization.d.ts deleted file mode 100644 index a3fe23b..0000000 --- a/dist/core/protocols/oauth/oidc_authorization.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { PayloadRequest } from "payload"; -import { OIDCProviderConfig, ParsedOAuthState } from "../../../types"; -export declare function OIDCAuthorization(pluginType: string, request: PayloadRequest, providerConfig: OIDCProviderConfig, parsedState?: ParsedOAuthState | null): Promise; -//# sourceMappingURL=oidc_authorization.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oidc_authorization.d.ts.map b/dist/core/protocols/oauth/oidc_authorization.d.ts.map deleted file mode 100644 index 8769001..0000000 --- a/dist/core/protocols/oauth/oidc_authorization.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oidc_authorization.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oidc_authorization.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAG7C,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE9D,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,EACvB,cAAc,EAAE,kBAAkB,EAClC,WAAW,CAAC,EAAE,gBAAgB,GAAG,IAAI,GACpC,OAAO,CAAC,QAAQ,CAAC,CAsFnB"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oidc_authorization.js b/dist/core/protocols/oauth/oidc_authorization.js deleted file mode 100644 index 14bbc60..0000000 --- a/dist/core/protocols/oauth/oidc_authorization.js +++ /dev/null @@ -1,63 +0,0 @@ -import * as oauth from "oauth4webapi"; -import { createOAuthState } from "../../routeHandlers/oauth"; -import { getCallbackURL } from "../../utils/cb"; -export async function OIDCAuthorization(pluginType, request, providerConfig, parsedState) { - const callback_url = getCallbackURL(request.payload.config.serverURL, pluginType, providerConfig.id); - const code_verifier = parsedState?.codeVerifier || oauth.generateRandomCodeVerifier(); - const code_challenge = await oauth.calculatePKCECodeChallenge(code_verifier); - const code_challenge_method = "S256"; - const { client_id, issuer, algorithm, scope, params } = providerConfig; - const client = { - client_id, - }; - const issuer_url = new URL(issuer); - const as = await oauth - .discoveryRequest(issuer_url, { algorithm }) - .then((response) => oauth.processDiscoveryResponse(issuer_url, response)); - const cookies = []; - const cookieMaxage = new Date(Date.now() + 300 * 1000); - const authorizationURL = new URL(as.authorization_endpoint); - authorizationURL.searchParams.set("client_id", client.client_id); - authorizationURL.searchParams.set("redirect_uri", callback_url.toString()); - authorizationURL.searchParams.set("response_type", "code"); - authorizationURL.searchParams.set("scope", scope); - authorizationURL.searchParams.set("code_challenge", code_challenge); - authorizationURL.searchParams.set("code_challenge_method", code_challenge_method); - // Create and store state parameter - let stateValue; - if (parsedState) { - stateValue = createOAuthState(parsedState); - authorizationURL.searchParams.set("state", stateValue); - // Store the state in a cookie for callback validation - cookies.push(`__session-oauth-state=${stateValue};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`); - } - if (params) { - Object.entries(params).map(([key, value]) => { - // Don't override the state if we already set it - if (key !== "state" || !stateValue) { - authorizationURL.searchParams.set(key, value); - // If state comes from params and we haven't set it yet, store it in cookie - if (key === "state" && !stateValue) { - cookies.push(`__session-oauth-state=${value};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`); - } - } - }); - } - if (as.code_challenge_methods_supported?.includes("S256") !== true) { - const nonce = parsedState?.nonce || oauth.generateRandomNonce(); - authorizationURL.searchParams.set("nonce", nonce); - cookies.push(`__session-oauth-nonce=${nonce};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`); - } - cookies.push(`__session-code-verifier=${code_verifier};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`); - const res = new Response(null, { - status: 302, - headers: { - Location: authorizationURL.href, - }, - }); - for (const c of cookies) { - res.headers.append("Set-Cookie", c); - } - return res; -} -//# sourceMappingURL=oidc_authorization.js.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oidc_authorization.js.map b/dist/core/protocols/oauth/oidc_authorization.js.map deleted file mode 100644 index a4ddedd..0000000 --- a/dist/core/protocols/oauth/oidc_authorization.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oidc_authorization.js","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oidc_authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAGhD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,UAAkB,EAClB,OAAuB,EACvB,cAAkC,EAClC,WAAqC;IAErC,MAAM,YAAY,GAAG,cAAc,CACjC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAChC,UAAU,EACV,cAAc,CAAC,EAAE,CAClB,CAAA;IAED,MAAM,aAAa,GACjB,WAAW,EAAE,YAAY,IAAI,KAAK,CAAC,0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ACV,2BAA2B,aAAa,yCAAyC,YAAY,CAAC,WAAW,EAAE,EAAE,CAC9G,CAAA;IAED,MAAM,GAAG,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE;QAC7B,MAAM,EAAE,GAAG;QACX,OAAO,EAAE;YACP,QAAQ,EAAE,gBAAgB,CAAC,IAAI;SAChC;KACF,CAAC,CAAA;IAEF,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAA;IACrC,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oidc_callback.d.ts b/dist/core/protocols/oauth/oidc_callback.d.ts deleted file mode 100644 index f159f96..0000000 --- a/dist/core/protocols/oauth/oidc_callback.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { OAuthCallbackParams, ParsedOAuthState } from "../../../types"; -export declare function OIDCCallback(params: OAuthCallbackParams, parsedState: ParsedOAuthState | null): Promise; -//# sourceMappingURL=oidc_callback.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oidc_callback.d.ts.map b/dist/core/protocols/oauth/oidc_callback.d.ts.map deleted file mode 100644 index a092e80..0000000 --- a/dist/core/protocols/oauth/oidc_callback.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oidc_callback.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oidc_callback.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,mBAAmB,EACnB,gBAAgB,EAEjB,MAAM,SAAS,CAAA;AAWhB,wBAAsB,YAAY,CAChC,MAAM,EAAE,mBAAmB,EAC3B,WAAW,EAAE,gBAAgB,GAAG,IAAI,GACnC,OAAO,CAAC,QAAQ,CAAC,CAiKnB"} \ No newline at end of file diff --git a/dist/core/protocols/oauth/oidc_callback.js b/dist/core/protocols/oauth/oidc_callback.js deleted file mode 100644 index 06cee2b..0000000 --- a/dist/core/protocols/oauth/oidc_callback.js +++ /dev/null @@ -1,92 +0,0 @@ -import * as oauth from "oauth4webapi"; -import { parseCookies } from "payload"; -import { InternalServerError, MissingEmailAPIError, UnVerifiedAccountAPIError, } from "../../errors/apiErrors"; -import { MissingOrInvalidSession } from "../../errors/consoleErrors"; -import { getCallbackURL } from "../../utils/cb"; -import { OAuthAuthentication } from "./oauth_authentication"; -export async function OIDCCallback(params, parsedState) { - const { pluginType, request, provider, collections, allowOAuthAutoSignUp, useAdmin, secret, successRedirectPath, errorRedirectPath, } = params; - const providerConfig = provider; - const parsedCookies = parseCookies(request.headers); - const code_verifier = parsedState?.codeVerifier || parsedCookies.get("__session-code-verifier"); - const nonce = parsedState?.nonce || parsedCookies.get("__session-oauth-nonce"); - if (!code_verifier) { - throw new MissingOrInvalidSession(); - } - const { client_id, client_secret, issuer, algorithm, profile } = providerConfig; - const client = { - client_id, - }; - const clientAuth = oauth.ClientSecretPost(client_secret ?? ""); - const current_url = new URL(request.url); - const callback_url = getCallbackURL(request.payload.config.serverURL, pluginType, providerConfig.id); - const issuer_url = new URL(issuer); - const as = await oauth - .discoveryRequest(issuer_url, { algorithm }) - .then((response) => oauth.processDiscoveryResponse(issuer_url, response)); - // Handle state validation manually since we're using it for redirect logic - const cookieState = parsedCookies.get("__session-oauth-state"); - const urlState = current_url.searchParams.get("state"); - const urlStateDecoded = urlState ? decodeURIComponent(urlState) : null; - console.error("Cookie state:", cookieState); - console.error("URL state (from callback):", urlState); - console.error("URL state decoded:", urlStateDecoded); - // Validate state manually for security - if (cookieState && urlStateDecoded && cookieState !== urlStateDecoded) { - throw new Error("State parameter mismatch - possible CSRF attack"); - } - // Remove state from URL for OAuth validation since we handle it separately - const urlWithoutState = new URL(current_url.toString()); - urlWithoutState.searchParams.delete("state"); - // Pass undefined for state since we're handling it manually - const params_oauth = oauth.validateAuthResponse(as, client, urlWithoutState, // URL without state parameter - undefined); - console.error("OIDC Callback params_oauth:", params_oauth); - const grantResponse = await oauth.authorizationCodeGrantRequest(as, client, clientAuth, params_oauth, callback_url.toString(), code_verifier); - const body = (await grantResponse.json()); - let response = new Response(JSON.stringify(body), grantResponse); - if (Array.isArray(body.scope)) { - body.scope = body.scope.join(" "); - response = new Response(JSON.stringify(body), grantResponse); - } - const token_result = await oauth.processAuthorizationCodeResponse(as, client, response, { - expectedNonce: nonce, - requireIdToken: true, - }); - const claims = oauth.getValidatedIdTokenClaims(token_result); - if (!claims?.sub) { - return new InternalServerError(); - } - const userInfoResponse = await oauth.userInfoRequest(as, client, token_result.access_token); - const result = await oauth.processUserInfoResponse(as, client, claims?.sub, userInfoResponse); - if (!result.email) { - return new MissingEmailAPIError(); - } - // Remove skip_email_verification check since it's not in your types - // Only check email_verified if it exists in the result - if (result.email_verified === false) { - return new UnVerifiedAccountAPIError(); - } - // Use the provider's profile callback if available, otherwise use direct mapping - let accountInfo; - if (profile) { - const filteredResult = Object.fromEntries(Object.entries(result).filter(([_, v]) => v !== undefined)); - accountInfo = profile(filteredResult); - } - else { - accountInfo = { - sub: result.sub, - name: result.name ?? "", - email: result.email, - picture: result.picture ?? "", - }; - } - const userData = { - ...accountInfo, - scope: providerConfig.scope, - issuer: providerConfig.issuer, - access_token: token_result.access_token, - }; - return await OAuthAuthentication(pluginType, collections, allowOAuthAutoSignUp, useAdmin, secret, request, successRedirectPath, errorRedirectPath, userData); -} -//# sourceMappingURL=oidc_callback.js.map \ No newline at end of file diff --git a/dist/core/protocols/oauth/oidc_callback.js.map b/dist/core/protocols/oauth/oidc_callback.js.map deleted file mode 100644 index 8bf5d31..0000000 --- a/dist/core/protocols/oauth/oidc_callback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oidc_callback.js","sourceRoot":"","sources":["../../../../src/core/protocols/oauth/oidc_callback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AA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BAAoB,EAAE,CAAA;IACnC,CAAC;IAED,oEAAoE;IACpE,uDAAuD;IACvD,IAAI,MAAM,CAAC,cAAc,KAAK,KAAK,EAAE,CAAC;QACpC,OAAO,IAAI,yBAAyB,EAAE,CAAA;IACxC,CAAC;IAED,iFAAiF;IACjF,IAAI,WAAwB,CAAA;IAC5B,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,CACvC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CACL,CAAA;QACvD,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;IACvC,CAAC;SAAM,CAAC;QACN,WAAW,GAAG;YACZ,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE;SAC9B,CAAA;IACH,CAAC;IAED,MAAM,QAAQ,GAAqB;QACjC,GAAG,WAAW;QACd,KAAK,EAAE,cAAc,CAAC,KAAK;QAC3B,MAAM,EAAE,cAAc,CAAC,MAAM;QAC7B,YAAY,EAAE,YAAY,CAAC,YAAY;KACxC,CAAA;IAED,OAAO,MAAM,mBAAmB,CAC9B,UAAU,EACV,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACR,MAAM,EACN,OAAO,EACP,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,CACT,CAAA;AACH,CAAC"} \ No newline at end of file diff --git a/dist/core/protocols/passkey/authentication.d.ts b/dist/core/protocols/passkey/authentication.d.ts deleted file mode 100644 index 769d8e6..0000000 --- a/dist/core/protocols/passkey/authentication.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { PayloadRequest } from "payload"; -import { AccountInfo } from "../../../types.js"; -export declare function GeneratePasskeyAuthentication(request: PayloadRequest, rpID: string): Promise; -export declare function VerifyPasskeyAuthentication(request: PayloadRequest, rpID: string, session_callback: (accountInfo: AccountInfo) => Promise): Promise; -//# sourceMappingURL=authentication.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/passkey/authentication.d.ts.map b/dist/core/protocols/passkey/authentication.d.ts.map deleted file mode 100644 index 794eb62..0000000 --- a/dist/core/protocols/passkey/authentication.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols/passkey/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,MAAM,SAAS,CAAA;AAUtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAG/C,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,QAAQ,CAAC,CAqCnB;AAED,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,GAChE,OAAO,CAAC,QAAQ,CAAC,CA6DnB"} \ No newline at end of file diff --git a/dist/core/protocols/passkey/authentication.js b/dist/core/protocols/passkey/authentication.js deleted file mode 100644 index 3ac19dd..0000000 --- a/dist/core/protocols/passkey/authentication.js +++ /dev/null @@ -1,73 +0,0 @@ -import { parseCookies } from "payload"; -import { generateAuthenticationOptions, verifyAuthenticationResponse, } from "@simplewebauthn/server"; -import { PasskeyVerificationAPIError } from "../../errors/apiErrors.js"; -import { MissingOrInvalidSession } from "../../errors/consoleErrors.js"; -import { hashCode } from "../../utils/hash.js"; -export async function GeneratePasskeyAuthentication(request, rpID) { - // @ts-expect-error TODO: Fix undefined object method - const { data } = (await request.json()); - const registrationOptions = { - rpID, - timeout: 60000, - allowCredentials: [ - { - id: data.passkey.credentialId, - transports: data.passkey.transports, - }, - ], - userVerification: "required", - }; - const options = await generateAuthenticationOptions(registrationOptions); - const cookieMaxage = new Date(Date.now() + 300 * 1000); - const cookies = []; - cookies.push(`__session-webpk-challenge=${options.challenge};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`); - const res = new Response(JSON.stringify({ options }), { status: 201 }); - cookies.forEach((cookie) => { - res.headers.append("Set-Cookie", cookie); - }); - return res; -} -export async function VerifyPasskeyAuthentication(request, rpID, session_callback) { - try { - const parsedCookies = parseCookies(request.headers); - const challenge = parsedCookies.get("__session-webpk-challenge"); - if (!challenge) { - throw new MissingOrInvalidSession(); - } - // @ts-expect-error TODO: Fix undefined object method - const { data } = (await request.json()); - const verification = await verifyAuthenticationResponse({ - response: data.authentication, - expectedChallenge: challenge, - expectedOrigin: request.payload.config.serverURL, - expectedRPID: rpID, - credential: { - id: data.passkey.credentialId, - publicKey: new Uint8Array(Object.values(data.passkey.publicKey)), - counter: data.passkey.counter, - transports: data.passkey.transports, - }, - }); - if (!verification.verified) { - throw new PasskeyVerificationAPIError(); - } - const { credentialID, credentialDeviceType, credentialBackedUp, newCounter, } = verification.authenticationInfo; - return await session_callback({ - sub: hashCode(data.email + request.payload.secret).toString(), - name: "", - picture: "", - email: data.email, - passKey: { - credentialId: credentialID, - counter: newCounter, - deviceType: credentialDeviceType, - backedUp: credentialBackedUp, - }, - }); - } - catch (error) { - console.error(error); - return Response.json({}); - } -} -//# sourceMappingURL=authentication.js.map \ No newline at end of file diff --git a/dist/core/protocols/passkey/authentication.js.map b/dist/core/protocols/passkey/authentication.js.map deleted file mode 100644 index d375b97..0000000 --- a/dist/core/protocols/passkey/authentication.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../../../src/core/protocols/passkey/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,SAAS,CAAA;AACtD,OAAO,EAG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AC,MAAM,CAAC,CAAC,QAAQ,EAAE;YAC7D,IAAI,EAAE,EAAE;YACR,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE;gBACP,YAAY,EAAE,YAAY;gBAC1B,OAAO,EAAE,UAAU;gBACnB,UAAU,EAAE,oBAAoB;gBAChC,QAAQ,EAAE,kBAAkB;aAC7B;SACF,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACpB,OAAO,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC1B,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/dist/core/protocols/passkey/index.d.ts b/dist/core/protocols/passkey/index.d.ts deleted file mode 100644 index 2a007dc..0000000 --- a/dist/core/protocols/passkey/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { PayloadRequest } from "payload"; -export declare function InitPasskey(request: PayloadRequest): Promise; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/passkey/index.d.ts.map b/dist/core/protocols/passkey/index.d.ts.map deleted file mode 100644 index aeca202..0000000 --- a/dist/core/protocols/passkey/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols/passkey/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAIxC,wBAAsB,WAAW,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,CAsB5E"} \ No newline at end of file diff --git a/dist/core/protocols/passkey/index.js b/dist/core/protocols/passkey/index.js deleted file mode 100644 index fb593d3..0000000 --- a/dist/core/protocols/passkey/index.js +++ /dev/null @@ -1,24 +0,0 @@ -import { MissingEmailAPIError } from "../../errors/apiErrors.js"; -import { hashCode } from "../../utils/hash.js"; -export async function InitPasskey(request) { - // @ts-expect-error TODO: Fix undefined object method - const { data } = (await request.json()); - if (!data.email) { - throw new MissingEmailAPIError(); - } - const existingRecord = await request.payload.find({ - collection: "accounts", - where: { - sub: { - equals: hashCode(data.email + request.payload.secret).toString(), - }, - }, - }); - if (existingRecord.totalDocs !== 1) { - return new Response(JSON.stringify({ data: {} }), { status: 200 }); - } - return new Response(JSON.stringify({ data: existingRecord.docs[0] }), { - status: 200, - }); -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/core/protocols/passkey/index.js.map b/dist/core/protocols/passkey/index.js.map deleted file mode 100644 index 09a59cf..0000000 --- a/dist/core/protocols/passkey/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/protocols/passkey/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAuB;IACvD,qDAAqD;IACrD,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,EAAE,CAAgC,CAAA;IAEtE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,oBAAoB,EAAE,CAAA;IAClC,CAAC;IAED,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;QAChD,UAAU,EAAE,UAAU;QACtB,KAAK,EAAE;YACL,GAAG,EAAE;gBACH,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;aACjE;SACF;KACF,CAAC,CAAA;IACF,IAAI,cAAc,CAAC,SAAS,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;IACpE,CAAC;IACD,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;QACpE,MAAM,EAAE,GAAG;KACZ,CAAC,CAAA;AACJ,CAAC"} \ No newline at end of file diff --git a/dist/core/protocols/passkey/registration.d.ts b/dist/core/protocols/passkey/registration.d.ts deleted file mode 100644 index 0735bda..0000000 --- a/dist/core/protocols/passkey/registration.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { PayloadRequest } from "payload"; -import { AccountInfo } from "../../../types.js"; -export declare function GeneratePasskeyRegistration(request: PayloadRequest, rpID: string): Promise; -export declare function VerifyPasskeyRegistration(request: PayloadRequest, rpID: string, session_callback: (accountInfo: AccountInfo) => Promise): Promise; -//# sourceMappingURL=registration.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/passkey/registration.d.ts.map b/dist/core/protocols/passkey/registration.d.ts.map deleted file mode 100644 index a3cb467..0000000 --- a/dist/core/protocols/passkey/registration.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols/passkey/registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,MAAM,SAAS,CAAA;AAStD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAG/C,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,QAAQ,CAAC,CA2BnB;AAED,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,GAChE,OAAO,CAAC,QAAQ,CAAC,CA0CnB"} \ No newline at end of file diff --git a/dist/core/protocols/passkey/registration.js b/dist/core/protocols/passkey/registration.js deleted file mode 100644 index a408a5e..0000000 --- a/dist/core/protocols/passkey/registration.js +++ /dev/null @@ -1,70 +0,0 @@ -import { parseCookies } from "payload"; -import { generateRegistrationOptions, verifyRegistrationResponse, } from "@simplewebauthn/server"; -import { PasskeyVerificationAPIError } from "../../errors/apiErrors.js"; -import { MissingOrInvalidSession } from "../../errors/consoleErrors.js"; -import { hashCode } from "../../utils/hash.js"; -export async function GeneratePasskeyRegistration(request, rpID) { - // @ts-expect-error TODO: Fix undefined object method - const { data } = (await request.json()); - const registrationOptions = { - rpName: "Payload Passkey Webauth", - rpID, - userName: data.email, - timeout: 60000, - attestationType: "none", - authenticatorSelection: { - residentKey: "required", - userVerification: "required", - }, - supportedAlgorithmIDs: [-7, -257], - }; - const options = await generateRegistrationOptions(registrationOptions); - const cookieMaxage = new Date(Date.now() + 300 * 1000); - const cookies = []; - cookies.push(`__session-webpk-challenge=${options.challenge};Path=/;HttpOnly;SameSite=lax;Expires=${cookieMaxage.toUTCString()}`); - const res = new Response(JSON.stringify({ options }), { status: 201 }); - cookies.forEach((cookie) => { - res.headers.append("Set-Cookie", cookie); - }); - return res; -} -export async function VerifyPasskeyRegistration(request, rpID, session_callback) { - try { - const parsedCookies = parseCookies(request.headers); - const challenge = parsedCookies.get("__session-webpk-challenge"); - if (!challenge) { - throw new MissingOrInvalidSession(); - } - // @ts-expect-error TODO: Fix undefined object method - const body = (await request.json()); - const verification = await verifyRegistrationResponse({ - response: body.data.registration, - expectedChallenge: challenge, - expectedOrigin: request.payload.config.serverURL, - expectedRPID: rpID, - }); - if (!verification.verified) { - throw new PasskeyVerificationAPIError(); - } - const { credential, credentialDeviceType, credentialBackedUp } = verification.registrationInfo; - return await session_callback({ - sub: hashCode(body.data.email + request.payload.secret).toString(), - name: "", - picture: "", - email: body.data.email, - passKey: { - credentialId: credential.id, - publicKey: credential.publicKey, - counter: credential.counter, - transports: credential.transports, - deviceType: credentialDeviceType, - backedUp: credentialBackedUp, - }, - }); - } - catch (error) { - console.error(error); - return Response.json({}); - } -} -//# sourceMappingURL=registration.js.map \ No newline at end of file diff --git a/dist/core/protocols/passkey/registration.js.map b/dist/core/protocols/passkey/registration.js.map deleted file mode 100644 index 8ccd72c..0000000 --- a/dist/core/protocols/passkey/registration.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../../src/core/protocols/passkey/registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,SAAS,CAAA;AACtD,OAAO,EACL,2BAA2B,EAG3B,0BAA0B,GAC3B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAA;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,OAAuB,EACvB,IAAY;IAEZ,qDAAqD;IACrD,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,EAAE,CAAgC,CAAA;IAEtE,MAAM,mBAAmB,GAAoC;QAC3D,MAAM,EAAE,yBAAyB;QACjC,IAAI;QACJ,QAAQ,EAAE,IAAI,CAAC,KAAK;QACpB,OAAO,EAAE,KAAK;QACd,eAAe,EAAE,MAAM;QACvB,sBAAsB,EAAE;YACtB,WAAW,EAAE,UAAU;YACvB,gBAAgB,EAAE,UAAU;SAC7B;QACD,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC;KAClC,CAAA;IACD,MAAM,OAAO,GAAG,MAAM,2BAA2B,CAAC,mBAAmB,CAAC,CAAA;IACtE,MAAM,YAAY,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,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AAC;QACD,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,GAC5D,YAAY,CAAC,gBAAiB,CAAA;QAEhC,OAAO,MAAM,gBAAgB,CAAC;YAC5B,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;YAClE,IAAI,EAAE,EAAE;YACR,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK;YACtB,OAAO,EAAE;gBACP,YAAY,EAAE,UAAU,CAAC,EAAE;gBAC3B,SAAS,EAAE,UAAU,CAAC,SAAS;gBAC/B,OAAO,EAAE,UAAU,CAAC,OAAO;gBAC3B,UAAU,EAAE,UAAU,CAAC,UAAW;gBAClC,UAAU,EAAE,oBAAoB;gBAChC,QAAQ,EAAE,kBAAkB;aAC7B;SACF,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACpB,OAAO,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC1B,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/dist/core/protocols/password.d.ts b/dist/core/protocols/password.d.ts deleted file mode 100644 index b4da05d..0000000 --- a/dist/core/protocols/password.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { type PayloadRequest } from "payload"; -export declare const PasswordSignin: (pluginType: string, request: PayloadRequest, internal: { - usersCollectionSlug: string; -}, useAdmin: boolean, secret: string, successRedirectPath: string, errorRedirectPath: string) => Promise; -export declare const PasswordSignup: (pluginType: string, request: PayloadRequest, internal: { - usersCollectionSlug: string; -}, useAdmin: boolean, secret: string, successRedirectPath: string, errorRedirectPath: string) => Promise; -export declare const ForgotPasswordInit: (request: PayloadRequest, internal: { - usersCollectionSlug: string; -}, emailTemplate: any) => Promise; -export declare const ForgotPasswordVerify: (request: PayloadRequest, internal: { - usersCollectionSlug: string; -}) => Promise; -export declare const ResetPassword: (cookieName: string, secret: string, internal: { - usersCollectionSlug: string; -}, request: PayloadRequest) => Promise; -//# sourceMappingURL=password.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/password.d.ts.map b/dist/core/protocols/password.d.ts.map deleted file mode 100644 index 3eb752e..0000000 --- a/dist/core/protocols/password.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../../src/core/protocols/password.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;AAwD3D,eAAO,MAAM,cAAc,GACzB,YAAY,MAAM,EAClB,SAAS,cAAc,EACvB,UAAU;IACR,mBAAmB,EAAE,MAAM,CAAA;CAC5B,EACD,UAAU,OAAO,EACjB,QAAQ,MAAM,EACd,qBAAqB,MAAM,EAC3B,mBAAmB,MAAM,sBAyF1B,CAAA;AAED,eAAO,MAAM,cAAc,GACzB,YAAY,MAAM,EAClB,SAAS,cAAc,EACvB,UAAU;IACR,mBAAmB,EAAE,MAAM,CAAA;CAC5B,EACD,UAAU,OAAO,EACjB,QAAQ,MAAM,EACd,qBAAqB,MAAM,EAC3B,mBAAmB,MAAM,sBAwG1B,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC7B,SAAS,cAAc,EACvB,UAAU;IACR,mBAAmB,EAAE,MAAM,CAAA;CAC5B,EACD,eAAe,GAAG,sBA8DnB,CAAA;AAED,eAAO,MAAM,oBAAoB,GAC/B,SAAS,cAAc,EACvB,UAAU;IACR,mBAAmB,EAAE,MAAM,CAAA;CAC5B,sBAyEF,CAAA;AAED,eAAO,MAAM,aAAa,GACxB,YAAY,MAAM,EAClB,QAAQ,MAAM,EACd,UAAU;IACR,mBAAmB,EAAE,MAAM,CAAA;CAC5B,EACD,SAAS,cAAc,sBAyFxB,CAAA"} \ No newline at end of file diff --git a/dist/core/protocols/password.js b/dist/core/protocols/password.js deleted file mode 100644 index fd68f0d..0000000 --- a/dist/core/protocols/password.js +++ /dev/null @@ -1,326 +0,0 @@ -import { parseCookies } from "payload"; -import { EmailAlreadyExistError, InvalidCredentials, InvalidRequestBodyError, MissingCollection, MissingOrInvalidVerification, UnauthorizedAPIRequest, UserNotFoundAPIError, } from "../errors/apiErrors.js"; -import { hashPassword, verifyPassword } from "../utils/password.js"; -import { SuccessKind } from "../../types.js"; -import { ephemeralCode, verifyEphemeralCode } from "../utils/hash.js"; -import { APP_COOKIE_SUFFIX } from "../../constants.js"; -import { createSessionCookies, invalidateOAuthCookies, verifySessionCookie, } from "../utils/cookies.js"; -import { v4 as uuid } from "uuid"; -import { removeExpiredSessions } from "../utils/session.js"; -const redirectWithSession = async (cookieName, path, secret, fields, request, tokenExpiration) => { - let cookies = []; - cookies = [ - ...(await createSessionCookies(cookieName, secret, fields, tokenExpiration)), - ]; - cookies = invalidateOAuthCookies(cookies); - const successRedirectionURL = new URL(`${request.origin}${path}`); - const res = new Response(null, { - status: 302, - headers: { - Location: successRedirectionURL.href, - }, - }); - for (const c of cookies) { - res.headers.append("Set-Cookie", c); - } - return res; -}; -export const PasswordSignin = async (pluginType, request, internal, useAdmin, secret, successRedirectPath, errorRedirectPath) => { - const body = request.json && - (await request.json()); - if (!body?.email || !body.password) { - return new InvalidRequestBodyError(); - } - const email = body.email.toLowerCase(); - const { payload } = request; - const { docs } = await payload.find({ - collection: internal.usersCollectionSlug, - where: { - email: { equals: email }, - }, - limit: 1, - }); - if (docs.length !== 1) { - return new UserNotFoundAPIError(); - } - const userRecord = docs[0]; - if (!userRecord) { - return new UserNotFoundAPIError(); - } - if (!userRecord.hashedPassword) { - return new InvalidCredentials(); - } - const isVerifed = await verifyPassword(body.password, userRecord.hashedPassword, userRecord.hashSalt, userRecord.hashIterations); - if (!isVerifed) { - return new InvalidCredentials(); - } - const collectionConfig = payload.config.collections.find((collection) => collection.slug === internal.usersCollectionSlug); - if (!collectionConfig) { - return new MissingCollection(); - } - const sessionID = collectionConfig?.auth.useSessions ? uuid() : null; - if (collectionConfig?.auth.useSessions) { - const now = new Date(); - const tokenExpInMs = collectionConfig.auth.tokenExpiration * 1000; - const expiresAt = new Date(now.getTime() + tokenExpInMs); - const session = { id: sessionID, createdAt: now, expiresAt }; - if (!userRecord["sessions"]?.length) { - userRecord["sessions"] = [session]; - } - else { - userRecord.sessions = removeExpiredSessions(userRecord.sessions); - userRecord.sessions.push(session); - } - await payload.db.updateOne({ - id: userRecord.id, - collection: internal.usersCollectionSlug, - data: userRecord, - req: request, - returning: false, - }); - } - const cookieName = useAdmin - ? `${payload.config.cookiePrefix}-token` - : `__${pluginType}-${APP_COOKIE_SUFFIX}`; - const signinFields = { - id: userRecord.id, - email, - sid: sessionID, - collection: internal.usersCollectionSlug, - }; - return await redirectWithSession(cookieName, successRedirectPath, secret, signinFields, request, useAdmin ? collectionConfig.auth.tokenExpiration : undefined); -}; -export const PasswordSignup = async (pluginType, request, internal, useAdmin, secret, successRedirectPath, errorRedirectPath) => { - const body = request.json && - (await request.json()); - if (!body?.email || !body.password) { - return new InvalidRequestBodyError(); - } - const email = body.email.toLowerCase(); - const { payload } = request; - const { docs } = await payload.find({ - collection: internal.usersCollectionSlug, - where: { - email: { equals: email }, - }, - limit: 1, - }); - if (docs.length > 0) { - return new EmailAlreadyExistError(); - } - const { hash: hashedPassword, salt: hashSalt, iterations, } = await hashPassword(body.password); - const userRecord = await payload.create({ - collection: internal.usersCollectionSlug, - data: { - email, - hashedPassword: hashedPassword, - hashIterations: iterations, - hashSalt, - ...body.userInfo, - }, - }); - if (body.allowAutoSignin) { - const collectionConfig = payload.config.collections.find((collection) => collection.slug === internal.usersCollectionSlug); - if (!collectionConfig) { - return new MissingCollection(); - } - const sessionID = collectionConfig?.auth.useSessions ? uuid() : null; - if (collectionConfig?.auth.useSessions) { - const now = new Date(); - const tokenExpInMs = collectionConfig.auth.tokenExpiration * 1000; - const expiresAt = new Date(now.getTime() + tokenExpInMs); - const session = { id: sessionID, createdAt: now, expiresAt }; - if (!userRecord["sessions"]?.length) { - userRecord["sessions"] = [session]; - } - else { - userRecord.sessions = removeExpiredSessions(userRecord.sessions); - userRecord.sessions.push(session); - } - await payload.db.updateOne({ - id: userRecord.id, - collection: internal.usersCollectionSlug, - data: userRecord, - req: request, - returning: false, - }); - } - const cookieName = useAdmin - ? `${payload.config.cookiePrefix}-token` - : `__${pluginType}-${APP_COOKIE_SUFFIX}`; - const signinFields = { - id: userRecord.id, - email, - sid: sessionID, - collection: internal.usersCollectionSlug, - }; - return await redirectWithSession(cookieName, successRedirectPath, secret, signinFields, request, useAdmin ? collectionConfig.auth.tokenExpiration : undefined); - } - return Response.json({ - message: "Signed up successfully", - kind: SuccessKind.Created, - isSuccess: true, - isError: false, - }, { status: 201 }); -}; -export const ForgotPasswordInit = async (request, internal, emailTemplate) => { - const { payload } = request; - const body = request.json && - (await request.json()); - if (!body?.email) { - return new InvalidRequestBodyError(); - } - const email = body.email.toLowerCase(); - const { docs } = await payload.find({ - collection: internal.usersCollectionSlug, - where: { - email: { equals: email }, - }, - limit: 1, - }); - if (docs.length !== 1) { - return new UserNotFoundAPIError(); - } - const { code, hash } = await ephemeralCode(6, payload.secret); - await payload.sendEmail({ - to: email, - subject: "Password recovery", - html: await emailTemplate({ - verificationCode: code, - }), - }); - const res = new Response(JSON.stringify({ - message: "Verification email sent", - kind: SuccessKind.Created, - isSuccess: true, - isError: false, - }), { status: 201 }); - const verification_token_expires = new Date(); - verification_token_expires.setDate(verification_token_expires.getDate() + 7); - if (!docs[0]) { - return new MissingOrInvalidVerification(); - } - await payload.update({ - collection: internal.usersCollectionSlug, - id: docs[0].id, - data: { - verificationHash: hash, - verificationCode: code, - verificationTokenExpire: Math.floor(verification_token_expires.getTime() / 1000), - verificationKind: "PASSWORD_RESTORE", - }, - }); - return res; -}; -export const ForgotPasswordVerify = async (request, internal) => { - const { payload } = request; - const body = request.json && - (await request.json()); - if (!body?.password || !body.code) { - return new InvalidRequestBodyError(); - } - const { docs } = await payload.find({ - collection: internal.usersCollectionSlug, - where: { - verificationCode: { equals: body.code }, - }, - }); - if (docs.length === 0 || !docs[0]) { - return new MissingOrInvalidVerification(); - } - const currentDate = Date.now(); - if (docs.length === 0 || - docs[0].verificationCode !== body.code || - !docs[0].verificationHash || - Math.floor(currentDate / 1000) > docs[0].verificationTokenExpire || - docs[0].verificationKind !== "PASSWORD_RESTORE") { - return new MissingOrInvalidVerification(); - } - const { verificationHash: hash, id: userId } = docs[0]; - const isVerified = await verifyEphemeralCode(body.code, hash, payload.secret); - if (!isVerified) { - return new MissingOrInvalidVerification(); - } - const { hash: hashedPassword, salt: hashSalt, iterations, } = await hashPassword(body.password); - await payload.update({ - collection: internal.usersCollectionSlug, - id: userId, - data: { - hashedPassword, - hashSalt, - hashIterations: iterations, - verificationHash: null, - verificationCode: null, - verificationTokenExpire: null, - verificationKind: null, - }, - }); - const res = new Response(JSON.stringify({ - message: "Password recovered successfully", - kind: SuccessKind.Updated, - isSuccess: true, - isError: false, - }), { status: 201 }); - return res; -}; -export const ResetPassword = async (cookieName, secret, internal, request) => { - const { payload } = request; - const cookies = parseCookies(request.headers); - const token = cookies.get(cookieName); - if (!token) { - return new UnauthorizedAPIRequest(); - } - const jwtResponse = await verifySessionCookie(token, secret); - if (!jwtResponse.payload) { - return new UnauthorizedAPIRequest(); - } - const body = request.json && - (await request.json()); - if (!body?.email || !body?.currentPassword || !body?.newPassword) { - return new InvalidRequestBodyError(); - } - const email = body.email.toLowerCase(); - const { docs } = await payload.find({ - collection: internal.usersCollectionSlug, - where: { - email: { equals: email }, - }, - limit: 1, - }); - if (docs.length !== 1) { - return new UserNotFoundAPIError(); - } - const user = docs[0]; - if (!user) { - return new UserNotFoundAPIError(); - } - const isVerifed = await verifyPassword(body.currentPassword, user?.hashedPassword, user?.hashSalt, user?.hashIterations); - if (!isVerifed) { - return new InvalidCredentials(); - } - const { hash: hashedPassword, salt: hashSalt, iterations, } = await hashPassword(body.newPassword); - await payload.update({ - collection: internal.usersCollectionSlug, - id: user.id, - data: { - hashedPassword, - hashSalt, - hashIterations: iterations, - }, - }); - // if (body.signoutOnUpdate) { - // let cookies: string[] = [] - // cookies = [...invalidateSessionCookies(cookieName, cookies)] - // return - // } - const res = new Response(JSON.stringify({ - message: "Password reset complete", - kind: SuccessKind.Updated, - isSuccess: true, - isError: false, - }), { - status: 201, - }); - return res; -}; -//# sourceMappingURL=password.js.map \ No newline at end of file diff --git a/dist/core/protocols/password.js.map b/dist/core/protocols/password.js.map deleted file mode 100644 index 39b14cc..0000000 --- a/dist/core/protocols/password.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"password.js","sourceRoot":"","sources":["../../../src/core/protocols/password.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,SAAS,CAAA;AAC3D,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,4BAA4B,EAC5B,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAA;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAE3D,MAAM,mBAAmB,GAAG,KAAK,EAC/B,UAAkB,EAClB,IAAY,EACZ,MAAc,EACd,MAA8C,EAC9C,OAAuB,EACvB,eAAwB,EACxB,EAAE;IACF,IA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D,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,IAAI,kBAAkB,EAAE,CAAA;IACjC,CAAC;IAED,MAAM,EACJ,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,QAAQ,EACd,UAAU,GACX,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;IAExC,MAAM,OAAO,CAAC,MAAM,CAAC;QACnB,UAAU,EAAE,QAAQ,CAAC,mBAAmB;QACxC,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,IAAI,EAAE;YACJ,cAAc;YACd,QAAQ;YACR,cAAc,EAAE,UAAU;SAC3B;KACF,CAAC,CAAA;IAEF,8BAA8B;IAC9B,+BAA+B;IAC/B,iEAAiE;IACjE,WAAW;IACX,IAAI;IAEJ,MAAM,GAAG,GAAG,IAAI,QAAQ,CACtB,IAAI,CAAC,SAAS,CAAC;QACb,OAAO,EAAE,yBAAyB;QAClC,IAAI,EAAE,WAAW,CAAC,OAAO;QACzB,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,KAAK;KACf,CAAC,EACF;QACE,MAAM,EAAE,GAAG;KACZ,CACF,CAAA;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/core/protocols/session.d.ts b/dist/core/protocols/session.d.ts deleted file mode 100644 index 1c79c61..0000000 --- a/dist/core/protocols/session.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { type PayloadRequest } from "payload"; -export declare const SessionRefresh: (cookieName: string, request: PayloadRequest) => Promise; -export declare const SessionUser: (cookieName: string, request: PayloadRequest, internal: { - usersCollectionSlug: string; -}, fields: string[]) => Promise; -export declare const SessionSignout: (cookieName: string, request: PayloadRequest) => Promise; -//# sourceMappingURL=session.d.ts.map \ No newline at end of file diff --git a/dist/core/protocols/session.d.ts.map b/dist/core/protocols/session.d.ts.map deleted file mode 100644 index 6ef719c..0000000 --- a/dist/core/protocols/session.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/core/protocols/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;AAQ3D,eAAO,MAAM,cAAc,GACzB,YAAY,MAAM,EAClB,SAAS,cAAc,sBAsCxB,CAAA;AAED,eAAO,MAAM,WAAW,GACtB,YAAY,MAAM,EAClB,SAAS,cAAc,EACvB,UAAU;IACR,mBAAmB,EAAE,MAAM,CAAA;CAC5B,EACD,QAAQ,MAAM,EAAE,sBAgEjB,CAAA;AAED,eAAO,MAAM,cAAc,GACzB,YAAY,MAAM,EAClB,SAAS,cAAc,sBAqCxB,CAAA"} \ No newline at end of file diff --git a/dist/core/protocols/session.js b/dist/core/protocols/session.js deleted file mode 100644 index 3f30b88..0000000 --- a/dist/core/protocols/session.js +++ /dev/null @@ -1,110 +0,0 @@ -import { parseCookies } from "payload"; -import { UnauthorizedAPIRequest, UserNotFoundAPIError, } from "../errors/apiErrors.js"; -import { createSessionCookies, verifySessionCookie } from "../utils/cookies.js"; -import { ErrorKind, SuccessKind } from "../../types.js"; -export const SessionRefresh = async (cookieName, request) => { - const { payload } = request; - const cookies = parseCookies(request.headers); - const token = cookies.get(cookieName); - if (!token) { - return new UnauthorizedAPIRequest(); - } - const jwtResponse = await verifySessionCookie(token, payload.secret); - if (!jwtResponse.payload) { - return new UnauthorizedAPIRequest(); - } - let refreshCookies = []; - refreshCookies = [ - ...(await createSessionCookies(cookieName, payload.secret, jwtResponse.payload)), - ]; - const res = new Response(JSON.stringify({ - message: "Session refreshed", - kind: SuccessKind.Updated, - isSuccess: true, - isError: false, - }), { - status: 201, - }); - for (const cookie of refreshCookies) { - res.headers.append("Set-Cookie", cookie); - } - return res; -}; -export const SessionUser = async (cookieName, request, internal, fields) => { - const { payload } = request; - const cookies = parseCookies(request.headers); - const token = cookies.get(cookieName); - if (!token) { - return new Response(JSON.stringify({ - message: "Missing user session", - kind: ErrorKind.NotAuthenticated, - data: {}, - isSuccess: false, - isError: true, - }), { - status: 403, - }); - } - const jwtResponse = await verifySessionCookie(token, payload.secret); - if (!jwtResponse.payload) { - return new Response(JSON.stringify({ - message: "Invalid user session", - kind: ErrorKind.NotAuthenticated, - data: {}, - isSuccess: false, - isError: true, - }), { - status: 401, - }); - } - const doc = await request.payload.findByID({ - collection: internal.usersCollectionSlug, - id: jwtResponse.payload.id, - }); - if (!doc?.id) { - return new UserNotFoundAPIError(); - } - return new Response(JSON.stringify({ - message: "Fetched user session", - kind: SuccessKind.Retrieved, - data: { - isAuthenticated: true, - user: { - id: doc.id, - email: doc.email, - }, - }, - isSuccess: true, - isError: false, - }), { - status: 200, - }); -}; -export const SessionSignout = async (cookieName, request) => { - const searchParams = request.query; - const expired = "Thu, 01 Jan 1970 00:00:00 GMT"; - const cookies = []; - cookies.push(`${cookieName}=; Path=/; HttpOnly; SameSite=Lax; Expires=${expired}`); - let res = new Response(JSON.stringify({ - message: "Signed Out", - kind: SuccessKind.Deleted, - isSuccess: true, - isError: false, - }), { - status: 200, - }); - if (searchParams.returnTo) { - const returnToURL = new URL(`${request.origin}/${searchParams.returnTo}`); - res = new Response(null, { - status: 302, - headers: { - Location: returnToURL.href, - }, - }); - } - for (const cookie of cookies) { - res.headers.append("Set-Cookie", cookie); - } - return res; -}; -//# sourceMappingURL=session.js.map \ No newline at end of file diff --git a/dist/core/protocols/session.js.map b/dist/core/protocols/session.js.map deleted file mode 100644 index 8f547fd..0000000 --- a/dist/core/protocols/session.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/core/protocols/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,SAAS,CAAA;AAC3D,OAAO,EACL,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC/E,OAAO,EA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AM,CAAC,CAAA;IAC1C,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/core/routeHandlers/oauth.d.ts b/dist/core/routeHandlers/oauth.d.ts deleted file mode 100644 index f86c1c3..0000000 --- a/dist/core/routeHandlers/oauth.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { OAuthHandlersParams, ParsedOAuthState } from "../../types"; -/** - * Create OAuth state parameter - */ -export declare function createOAuthState(data: ParsedOAuthState): string; -/** - * Main OAuth handler that routes to appropriate authorization or callback handlers - */ -export declare function OAuthHandlers(params: OAuthHandlersParams): Promise; -//# sourceMappingURL=oauth.d.ts.map \ No newline at end of file diff --git a/dist/core/routeHandlers/oauth.d.ts.map b/dist/core/routeHandlers/oauth.d.ts.map deleted file mode 100644 index 7fde8e2..0000000 --- a/dist/core/routeHandlers/oauth.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../src/core/routeHandlers/oauth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EAEnB,gBAAgB,EACjB,MAAM,SAAS,CAAA;AAyBhB;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAO/D;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,QAAQ,CAAC,CAgEnB"} \ No newline at end of file diff --git a/dist/core/routeHandlers/oauth.js b/dist/core/routeHandlers/oauth.js deleted file mode 100644 index 267f8da..0000000 --- a/dist/core/routeHandlers/oauth.js +++ /dev/null @@ -1,76 +0,0 @@ -import { InvalidOAuthAlgorithm, InvalidOAuthResource, InvalidProvider, } from "../errors/consoleErrors"; -import { OIDCAuthorization } from "../protocols/oauth/oidc_authorization"; -import { OAuth2Authorization } from "../protocols/oauth/oauth2_authorization"; -import { OIDCCallback } from "../protocols/oauth/oidc_callback"; -import { OAuth2Callback } from "../protocols/oauth/oauth2_callback"; -/** - * Safely parse OAuth state parameter - */ -function parseOAuthState(state) { - if (!state) - return null; - try { - return JSON.parse(decodeURIComponent(state)); - } - catch (error) { - console.warn("Failed to parse OAuth state:", error); - return null; - } -} -/** - * Create OAuth state parameter - */ -export function createOAuthState(data) { - return encodeURIComponent(JSON.stringify({ - ...data, - timestamp: Date.now(), - })); -} -/** - * Main OAuth handler that routes to appropriate authorization or callback handlers - */ -export async function OAuthHandlers(params) { - const { pluginType, collections, allowOAuthAutoSignUp, secret, useAdmin, request, provider, successRedirectPath, errorRedirectPath, state, } = params; - if (!provider) { - throw new InvalidProvider(); - } - const resource = request.routeParams?.resource; - const parsedState = parseOAuthState(state); - // Create callback params with parsed state - const callbackParams = { - pluginType, - collections, - allowOAuthAutoSignUp, - secret, - useAdmin, - request, - provider, - successRedirectPath: parsedState?.redirectPath || successRedirectPath, - errorRedirectPath, - }; - switch (resource) { - case "authorization": - switch (provider.algorithm) { - case "oidc": - return OIDCAuthorization(pluginType, request, provider, parsedState); - case "oauth2": - return OAuth2Authorization(pluginType, request, provider, undefined, parsedState); - default: - throw new InvalidOAuthAlgorithm(); - } - case "callback": - switch (provider.algorithm) { - case "oidc": { - return OIDCCallback(callbackParams, parsedState); - } - case "oauth2": { - return OAuth2Callback(callbackParams, parsedState); - } - default: - throw new InvalidOAuthAlgorithm(); - } - default: - throw new InvalidOAuthResource(); - } -} -//# sourceMappingURL=oauth.js.map \ No newline at end of file diff --git a/dist/core/routeHandlers/oauth.js.map b/dist/core/routeHandlers/oauth.js.map deleted file mode 100644 index b190a4d..0000000 --- a/dist/core/routeHandlers/oauth.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../../src/core/routeHandlers/oauth.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,GAChB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,i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,QAAQ;QACR,OAAO;QACP,QAAQ;QACR,mBAAmB,EAAE,WAAW,EAAE,YAAY,IAAI,mBAAmB;QACrE,iBAAiB;KAClB,CAAA;IAED,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,eAAe;YAClB,QAAQ,QAAQ,CAAC,SAAS,EAAE,CAAC;gBAC3B,KAAK,MAAM;oBACT,OAAO,iBAAiB,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAA;gBACtE,KAAK,QAAQ;oBACX,OAAO,mBAAmB,CACxB,UAAU,EACV,OAAO,EACP,QAAQ,EACR,SAAS,EACT,WAAW,CACZ,CAAA;gBACH;oBACE,MAAM,IAAI,qBAAqB,EAAE,CAAA;YACrC,CAAC;QACH,KAAK,UAAU;YACb,QAAQ,QAAQ,CAAC,SAAS,EAAE,CAAC;gBAC3B,KAAK,MAAM,CAAC,CAAC,CAAC;oBACZ,OAAO,YAAY,CAAC,cAAc,EAAE,WAAW,CAAC,CAAA;gBAClD,CAAC;gBACD,KAAK,QAAQ,CAAC,CAAC,CAAC;oBACd,OAAO,cAAc,CAAC,cAAc,EAAE,WAAW,CAAC,CAAA;gBACpD,CAAC;gBACD;oBACE,MAAM,IAAI,qBAAqB,EAAE,CAAA;YACrC,CAAC;QACH;YACE,MAAM,IAAI,oBAAoB,EAAE,CAAA;IACpC,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/dist/core/routeHandlers/passkey.d.ts b/dist/core/routeHandlers/passkey.d.ts deleted file mode 100644 index 7c56de4..0000000 --- a/dist/core/routeHandlers/passkey.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { PayloadRequest } from "payload"; -import type { AccountInfo } from "../../types.js"; -export declare function PasskeyHandlers(request: PayloadRequest, resource: string, rpID: string, sessionCallBack: (accountInfo: AccountInfo) => Promise): Promise; -//# sourceMappingURL=passkey.d.ts.map \ No newline at end of file diff --git a/dist/core/routeHandlers/passkey.d.ts.map b/dist/core/routeHandlers/passkey.d.ts.map deleted file mode 100644 index 1207927..0000000 --- a/dist/core/routeHandlers/passkey.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"passkey.d.ts","sourceRoot":"","sources":["../../../src/core/routeHandlers/passkey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAG7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAUjD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,GAC/D,OAAO,CAAC,QAAQ,CAAC,CAenB"} \ No newline at end of file diff --git a/dist/core/routeHandlers/passkey.js b/dist/core/routeHandlers/passkey.js deleted file mode 100644 index 9700a58..0000000 --- a/dist/core/routeHandlers/passkey.js +++ /dev/null @@ -1,21 +0,0 @@ -import { InvalidAPIRequest } from "../errors/apiErrors.js"; -import { InitPasskey } from "../protocols/passkey/index.js"; -import { GeneratePasskeyRegistration, VerifyPasskeyRegistration, } from "../protocols/passkey/registration.js"; -import { GeneratePasskeyAuthentication, VerifyPasskeyAuthentication, } from "../protocols/passkey/authentication.js"; -export function PasskeyHandlers(request, resource, rpID, sessionCallBack) { - switch (resource) { - case "init": - return InitPasskey(request); - case "generate-registration-options": - return GeneratePasskeyRegistration(request, rpID); - case "verify-registration": - return VerifyPasskeyRegistration(request, rpID, sessionCallBack); - case "generate-authentication-options": - return GeneratePasskeyAuthentication(request, rpID); - case "verify-authentication": - return VerifyPasskeyAuthentication(request, rpID, sessionCallBack); - default: - throw new InvalidAPIRequest(); - } -} -//# sourceMappingURL=passkey.js.map \ No newline at end of file diff --git a/dist/core/routeHandlers/passkey.js.map b/dist/core/routeHandlers/passkey.js.map deleted file mode 100644 index 5db4e23..0000000 --- a/dist/core/routeHandlers/passkey.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"passkey.js","sourceRoot":"","sources":["../../../src/core/routeHandlers/passkey.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAE3D,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,GAC1B,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,wCAAwC,CAAA;AAE/C,MAAM,UAAU,eAAe,CAC7B,OAAuB,EACvB,QAAgB,EAChB,IAAY,EACZ,eAAgE;IAEhE,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,MAAM;YACT,OAAO,WAAW,CAAC,OAAO,CAAC,CAAA;QAC7B,KAAK,+BAA+B;YAClC,OAAO,2BAA2B,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QACnD,KAAK,qBAAqB;YACxB,OAAO,yBAAyB,CAAC,OAAO,EAAE,IAAI,EAAE,eAAe,CAAC,CAAA;QAClE,KAAK,iCAAiC;YACpC,OAAO,6BAA6B,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QACrD,KAAK,uBAAuB;YAC1B,OAAO,2BAA2B,CAAC,OAAO,EAAE,IAAI,EAAE,eAAe,CAAC,CAAA;QACpE;YACE,MAAM,IAAI,iBAAiB,EAAE,CAAA;IACjC,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/dist/core/routeHandlers/password.d.ts b/dist/core/routeHandlers/password.d.ts deleted file mode 100644 index c21c9a3..0000000 --- a/dist/core/routeHandlers/password.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { PayloadRequest } from "payload"; -import type { PasswordProviderConfig } from "../../types.js"; -export declare function PasswordAuthHandlers(request: PayloadRequest, pluginType: string, kind: string, internal: { - usersCollectionSlug: string; -}, secret: string, useAdmin: boolean, successRedirectPath: string, errorRedirectPath: string, providerConfig: PasswordProviderConfig, stage?: string | undefined): Promise; -//# sourceMappingURL=password.d.ts.map \ No newline at end of file diff --git a/dist/core/routeHandlers/password.d.ts.map b/dist/core/routeHandlers/password.d.ts.map deleted file mode 100644 index bf14710..0000000 --- a/dist/core/routeHandlers/password.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../../src/core/routeHandlers/password.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAU7C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAE5D,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE;IACR,mBAAmB,EAAE,MAAM,CAAA;CAC5B,EACD,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,OAAO,EACjB,mBAAmB,EAAE,MAAM,EAC3B,iBAAiB,EAAE,MAAM,EACzB,cAAc,EAAE,sBAAsB,EACtC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GACzB,OAAO,CAAC,QAAQ,CAAC,CA6CnB"} \ No newline at end of file diff --git a/dist/core/routeHandlers/password.js b/dist/core/routeHandlers/password.js deleted file mode 100644 index c4ba03a..0000000 --- a/dist/core/routeHandlers/password.js +++ /dev/null @@ -1,25 +0,0 @@ -import { ForgotPasswordInit, ForgotPasswordVerify, PasswordSignin, PasswordSignup, ResetPassword, } from "../protocols/password.js"; -import { InvalidAPIRequest } from "../errors/apiErrors.js"; -import { APP_COOKIE_SUFFIX } from "../../constants.js"; -export function PasswordAuthHandlers(request, pluginType, kind, internal, secret, useAdmin, successRedirectPath, errorRedirectPath, providerConfig, stage) { - switch (kind) { - case "signin": - return PasswordSignin(pluginType, request, internal, useAdmin, secret, successRedirectPath, errorRedirectPath); - case "signup": - return PasswordSignup(pluginType, request, internal, useAdmin, secret, successRedirectPath, errorRedirectPath); - case "forgot-password": - switch (stage) { - case "init": - return ForgotPasswordInit(request, internal, providerConfig.emailTemplates.forgotPassword); - case "verify": - return ForgotPasswordVerify(request, internal); - default: - throw new InvalidAPIRequest(); - } - case "reset-password": - return ResetPassword(`__${pluginType}-${APP_COOKIE_SUFFIX}`, secret, internal, request); - default: - throw new InvalidAPIRequest(); - } -} -//# sourceMappingURL=password.js.map \ No newline at end of file diff --git a/dist/core/routeHandlers/password.js.map b/dist/core/routeHandlers/password.js.map deleted file mode 100644 index 996f09a..0000000 --- a/dist/core/routeHandlers/password.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"password.js","sourceRoot":"","sources":["../../../src/core/routeHandlers/password.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,aAAa,GACd,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAGtD,MAAM,UAAU,oBAAoB,CAClC,OAAuB,EACvB,UAAkB,EAClB,IAAY,EACZ,QAEC,EACD,MAAc,EACd,QAAiB,EACjB,mBAA2B,EAC3B,iBAAyB,EACzB,cAAsC,EACtC,KAA0B;IAE1B,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,QAAQ;YACX,OAAO,cAAc,CACnB,UAAU,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,mBAAmB,EACnB,iBAAiB,CAClB,CAAA;QACH,KAAK,QAAQ;YACX,OAAO,cAAc,CACnB,UAAU,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,mBAAmB,EACnB,iBAAiB,CAClB,CAAA;QACH,KAAK,iBAAiB;YACpB,QAAQ,KAAK,EAAE,CAAC;gBACd,KAAK,MAAM;oBACT,OAAO,kBAAkB,CACvB,OAAO,EACP,QAAQ,EACR,cAAc,CAAC,cAAc,CAAC,cAAc,CAC7C,CAAA;gBACH,KAAK,QAAQ;oBACX,OAAO,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;gBAChD;oBACE,MAAM,IAAI,iBAAiB,EAAE,CAAA;YACjC,CAAC;QACH,KAAK,gBAAgB;YACnB,OAAO,aAAa,CAClB,KAAK,UAAU,IAAI,iBAAiB,EAAE,EACtC,MAAM,EACN,QAAQ,EACR,OAAO,CACR,CAAA;QACH;YACE,MAAM,IAAI,iBAAiB,EAAE,CAAA;IACjC,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/dist/core/routeHandlers/session.d.ts b/dist/core/routeHandlers/session.d.ts deleted file mode 100644 index 2585a26..0000000 --- a/dist/core/routeHandlers/session.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { PayloadRequest } from "payload"; -export declare function SessionHandlers(request: PayloadRequest, pluginType: string, internals: { - usersCollectionSlug: string; -}): Promise; -//# sourceMappingURL=session.d.ts.map \ No newline at end of file diff --git a/dist/core/routeHandlers/session.d.ts.map b/dist/core/routeHandlers/session.d.ts.map deleted file mode 100644 index d250a69..0000000 --- a/dist/core/routeHandlers/session.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/core/routeHandlers/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAS7C,wBAAgB,eAAe,CAC7B,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE;IACT,mBAAmB,EAAE,MAAM,CAAA;CAC5B,qBAwBF"} \ No newline at end of file diff --git a/dist/core/routeHandlers/session.js b/dist/core/routeHandlers/session.js deleted file mode 100644 index 832ef9d..0000000 --- a/dist/core/routeHandlers/session.js +++ /dev/null @@ -1,21 +0,0 @@ -import { InvalidAPIRequest } from "../errors/apiErrors.js"; -import { SessionRefresh, SessionSignout, SessionUser, } from "../protocols/session.js"; -import { APP_COOKIE_SUFFIX } from "../../constants.js"; -export function SessionHandlers(request, pluginType, internals) { - if (pluginType === "admin") { - // TODO: Implementation is not necessary as it is already handled by Payload. But can be customised. - throw new InvalidAPIRequest(); - } - const kind = request.routeParams?.kind; - switch (kind) { - case "refresh": - return SessionRefresh(`__${pluginType}-${APP_COOKIE_SUFFIX}`, request); - case "user": - return SessionUser(`__${pluginType}-${APP_COOKIE_SUFFIX}`, request, internals, []); - case "signout": - return SessionSignout(`__${pluginType}-${APP_COOKIE_SUFFIX}`, request); - default: - throw new InvalidAPIRequest(); - } -} -//# sourceMappingURL=session.js.map \ No newline at end of file diff --git a/dist/core/routeHandlers/session.js.map b/dist/core/routeHandlers/session.js.map deleted file mode 100644 index 78b8802..0000000 --- a/dist/core/routeHandlers/session.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/core/routeHandlers/session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EACL,cAAc,EACd,cAAc,EACd,WAAW,GACZ,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAEtD,MAAM,UAAU,eAAe,CAC7B,OAAuB,EACvB,UAAkB,EAClB,SAEC;IAED,IAAI,UAAU,KAAK,OAAO,EAAE,CAAC;QAC3B,oGAAoG;QACpG,MAAM,IAAI,iBAAiB,EAAE,CAAA;IAC/B,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,IAAc,CAAA;IAEhD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,SAAS;YACZ,OAAO,cAAc,CAAC,KAAK,UAAU,IAAI,iBAAiB,EAAE,EAAE,OAAO,CAAC,CAAA;QACxE,KAAK,MAAM;YACT,OAAO,WAAW,CAChB,KAAK,UAAU,IAAI,iBAAiB,EAAE,EACtC,OAAO,EACP,SAAS,EACT,EAAE,CACH,CAAA;QACH,KAAK,SAAS;YACZ,OAAO,cAAc,CAAC,KAAK,UAAU,IAAI,iBAAiB,EAAE,EAAE,OAAO,CAAC,CAAA;QACxE;YACE,MAAM,IAAI,iBAAiB,EAAE,CAAA;IACjC,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/dist/core/utils/cb.d.ts b/dist/core/utils/cb.d.ts deleted file mode 100644 index 703c194..0000000 --- a/dist/core/utils/cb.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function getCallbackURL(baseURL: string, pluginType: string, provider: string): URL; -//# sourceMappingURL=cb.d.ts.map \ No newline at end of file diff --git a/dist/core/utils/cb.d.ts.map b/dist/core/utils/cb.d.ts.map deleted file mode 100644 index 7bcc43d..0000000 --- a/dist/core/utils/cb.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cb.d.ts","sourceRoot":"","sources":["../../../src/core/utils/cb.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,GAAG,CAKL"} \ No newline at end of file diff --git a/dist/core/utils/cb.js b/dist/core/utils/cb.js deleted file mode 100644 index 94b01a1..0000000 --- a/dist/core/utils/cb.js +++ /dev/null @@ -1,7 +0,0 @@ -export function getCallbackURL(baseURL, pluginType, provider) { - const callback_url = new URL(baseURL); - callback_url.pathname = `/api/${pluginType}/oauth/callback/${provider}`; - callback_url.search = ""; - return callback_url; -} -//# sourceMappingURL=cb.js.map \ No newline at end of file diff --git a/dist/core/utils/cb.js.map b/dist/core/utils/cb.js.map deleted file mode 100644 index 9b49687..0000000 --- a/dist/core/utils/cb.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cb.js","sourceRoot":"","sources":["../../../src/core/utils/cb.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc,CAC5B,OAAe,EACf,UAAkB,EAClB,QAAgB;IAEhB,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,OAAO,CAAQ,CAAA;IAC5C,YAAY,CAAC,QAAQ,GAAG,QAAQ,UAAU,mBAAmB,QAAQ,EAAE,CAAA;IACvE,YAAY,CAAC,MAAM,GAAG,EAAE,CAAA;IACxB,OAAO,YAAY,CAAA;AACrB,CAAC"} \ No newline at end of file diff --git a/dist/core/utils/cookies.d.ts b/dist/core/utils/cookies.d.ts deleted file mode 100644 index 95f0dde..0000000 --- a/dist/core/utils/cookies.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import * as jwt from "jose"; -export declare function createSessionCookies(name: string, secret: string, fieldsToSign: Record, expiration?: number): Promise; -export declare function verifySessionCookie(token: string, secret: string): Promise>; -export declare function invalidateOAuthCookies(cookies: string[]): string[]; -export declare const invalidateSessionCookies: (name: string, cookies: string[]) => string[]; -//# sourceMappingURL=cookies.d.ts.map \ No newline at end of file diff --git a/dist/core/utils/cookies.d.ts.map b/dist/core/utils/cookies.d.ts.map deleted file mode 100644 index 0d55b36..0000000 --- a/dist/core/utils/cookies.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../../src/core/utils/cookies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,MAAM,CAAA;AAG3B,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,UAAU,CAAC,EAAE,MAAM,qBAsBpB;AAED,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;QAG/D,MAAM;WACH,MAAM;gBACD,MAAM;SACb,MAAM;SACN,MAAM;IAEd;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,YAevD;AAED,eAAO,MAAM,wBAAwB,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,EAAE,aAIvE,CAAA"} \ No newline at end of file diff --git a/dist/core/utils/cookies.js b/dist/core/utils/cookies.js deleted file mode 100644 index ec13912..0000000 --- a/dist/core/utils/cookies.js +++ /dev/null @@ -1,37 +0,0 @@ -import * as jwt from "jose"; -import { getCookieExpiration } from "payload"; -export async function createSessionCookies(name, secret, fieldsToSign, expiration) { - const tokenExpiration = expiration ?? - getCookieExpiration({ - seconds: 7200, - }).getTime(); - const secretKey = new TextEncoder().encode(secret); - const issuedAt = Math.floor(Date.now() / 1000); - const exp = issuedAt + tokenExpiration; - const token = await new jwt.SignJWT(fieldsToSign) - .setProtectedHeader({ alg: "HS256", typ: "JWT" }) - .setIssuedAt(issuedAt) - .setExpirationTime(exp) - .sign(secretKey); - const cookies = []; - cookies.push(`${name}=${token};Path=/;HttpOnly;SameSite=lax;Expires=${getCookieExpiration({ seconds: expiration }).toUTCString()}`); - return cookies; -} -export async function verifySessionCookie(token, secret) { - const secretKey = new TextEncoder().encode(secret); - return await jwt.jwtVerify(token, secretKey); -} -export function invalidateOAuthCookies(cookies) { - const expired = "Thu, 01 Jan 1970 00:00:00 GMT"; - cookies.push(`__session-oauth-state=; Path=/; HttpOnly; SameSite=Lax; Expires=${expired}`); - cookies.push(`__session-oauth-nonce=; Path=/; HttpOnly; SameSite=Lax; Expires=${expired}`); - cookies.push(`__session-code-verifier=; Path=/; HttpOnly; SameSite=Lax; Expires=${expired}`); - cookies.push(`__session-webpk-challenge=; Path=/; HttpOnly; SameSite=Lax; Expires=${expired}`); - return cookies; -} -export const invalidateSessionCookies = (name, cookies) => { - const expired = "Thu, 01 Jan 1970 00:00:00 GMT"; - cookies.push(`${name}=; Path=/; HttpOnly; SameSite=Lax; Expires=${expired}`); - return cookies; -}; -//# sourceMappingURL=cookies.js.map \ No newline at end of file diff --git a/dist/core/utils/cookies.js.map b/dist/core/utils/cookies.js.map deleted file mode 100644 index 26647ab..0000000 --- a/dist/core/utils/cook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AA;IAClD,OAAO,MAAM,GAAG,CAAC,SAAS,CAMvB,KAAK,EAAE,SAAS,CAAC,CAAA;AACtB,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,OAAiB;IACtD,MAAM,OAAO,GAAG,+BAA+B,CAAA;IAC/C,OAAO,CAAC,IAAI,CACV,mEAAmE,OAAO,EAAE,CAC7E,CAAA;IACD,OAAO,CAAC,IAAI,CACV,mEAAmE,OAAO,EAAE,CAC7E,CAAA;IACD,OAAO,CAAC,IAAI,CACV,qEAAqE,OAAO,EAAE,CAC/E,CAAA;IACD,OAAO,CAAC,IAAI,CACV,uEAAuE,OAAO,EAAE,CACjF,CAAA;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,IAAY,EAAE,OAAiB,EAAE,EAAE;IAC1E,MAAM,OAAO,GAAG,+BAA+B,CAAA;IAC/C,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,8CAA8C,OAAO,EAAE,CAAC,CAAA;IAC5E,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/core/utils/hash.d.ts b/dist/core/utils/hash.d.ts deleted file mode 100644 index 1e84f6a..0000000 --- a/dist/core/utils/hash.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export declare function hashCode(s: string): number; -export declare const ephemeralCode: (length: number, secret: string) => Promise<{ - hash: string; - code: string; -}>; -export declare const verifyEphemeralCode: (code: string, hashB64: string, secret: string) => Promise; -//# sourceMappingURL=hash.d.ts.map \ No newline at end of file diff --git a/dist/core/utils/hash.d.ts.map b/dist/core/utils/hash.d.ts.map deleted file mode 100644 index 8b0d52f..0000000 --- a/dist/core/utils/hash.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../../src/core/utils/hash.ts"],"names":[],"mappings":"AAEA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,UAMjC;AAED,eAAO,MAAM,aAAa,GAAU,QAAQ,MAAM,EAAE,QAAQ,MAAM;;;EAqCjE,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC9B,MAAM,MAAM,EACZ,SAAS,MAAM,EACf,QAAQ,MAAM,qBAqBf,CAAA"} \ No newline at end of file diff --git a/dist/core/utils/hash.js b/dist/core/utils/hash.js deleted file mode 100644 index f09b101..0000000 --- a/dist/core/utils/hash.js +++ /dev/null @@ -1,54 +0,0 @@ -import * as jose from "jose"; -export function hashCode(s) { - let h = 0; - const l = s.length; - let i = 0; - if (l > 0) - while (i < l) - h = ((h << 5) + h + s.charCodeAt(i++)) | 0; - return h; -} -export const ephemeralCode = async (length, secret) => { - const code = []; - while (code.length < length) { - const buffer = crypto.getRandomValues(new Uint8Array(length * 2)); - for (const byte of buffer) { - if (byte < 250 && code.length < length) { - code.push(byte % 10); - } - } - } - const codeStr = code.join(""); - const iterations = 600000; - const encoder = new TextEncoder(); - const bytes = encoder.encode(codeStr); - const salt = encoder.encode(secret); - const keyMaterial = await crypto.subtle.importKey("raw", bytes, "PBKDF2", false, ["deriveBits"]); - const hash = await crypto.subtle.deriveBits({ - name: "PBKDF2", - hash: "SHA-256", - salt: salt, - iterations, - }, keyMaterial, 256); - const hashB64 = jose.base64url.encode(new Uint8Array(hash)); - return { - hash: hashB64, - code: codeStr, - }; -}; -export const verifyEphemeralCode = async (code, hashB64, secret) => { - const encoder = new TextEncoder(); - const codeBytes = encoder.encode(code); - const salt = encoder.encode(secret); - const params = { - name: "PBKDF2", - hash: "SHA-256", - salt, - iterations: 600000, - }; - const keyMaterial = await crypto.subtle.importKey("raw", codeBytes, "PBKDF2", false, ["deriveBits"]); - const hash = await crypto.subtle.deriveBits(params, keyMaterial, 256); - const hashBase64 = jose.base64url.encode(new Uint8Array(hash)); - return hashBase64 === hashB64; -}; -//# sourceMappingURL=hash.js.map \ No newline at end of file diff --git a/dist/core/utils/hash.js.map b/dist/core/utils/hash.js.map deleted file mode 100644 index 9d9d60f..0000000 --- a/dist/core/utils/hash.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../../src/core/utils/hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,MAAM,UAAU,QAAQ,CAAC,CAAS;IAChC,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAA;IAClB,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,GAAG,CAAC;YAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAA;IACnE,OAAO,CAAC,CAAA;AACV,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,MAAc,EAAE,MAAc,EAAE,EAAE;IACpE,MAAM,IAAI,GAAa,EAAE,CAAA;IACzB,OAAO,IAAI,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAA;QACjE,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;YAC1B,IAAI,IAAI,GAAG,GAAG,IAAI,IAAI,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;gBACvC,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,CAAA;YACtB,CAAC;QACH,CAAC;IACH,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC7B,MAAM,UAAU,GAAG,MAAM,CAAA;IACzB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;IACjC,MAAM,KAAK,GAAG,OAAO,C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G,CAAC,CAAA;IACrE,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA;IAC9D,OAAO,UAAU,KAAK,OAAO,CAAA;AAC/B,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/core/utils/password.d.ts b/dist/core/utils/password.d.ts deleted file mode 100644 index e789731..0000000 --- a/dist/core/utils/password.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export declare const hashPassword: (password: string) => Promise<{ - hash: string; - salt: string; - iterations: number; -}>; -export declare const verifyPassword: (password: string, hashB64: string, saltB64: string, iterations: number) => Promise; -//# sourceMappingURL=password.d.ts.map \ No newline at end of file diff --git a/dist/core/utils/password.d.ts.map b/dist/core/utils/password.d.ts.map deleted file mode 100644 index 068e09b..0000000 --- a/dist/core/utils/password.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../../src/core/utils/password.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,GAAU,UAAU,MAAM;;;;EA6BlD,CAAA;AAED,eAAO,MAAM,cAAc,GACzB,UAAU,MAAM,EAChB,SAAS,MAAM,EACf,SAAS,MAAM,EACf,YAAY,MAAM,qBAqBnB,CAAA"} \ No newline at end of file diff --git a/dist/core/utils/password.js b/dist/core/utils/password.js deleted file mode 100644 index 2a3834d..0000000 --- a/dist/core/utils/password.js +++ /dev/null @@ -1,37 +0,0 @@ -import * as jose from "jose"; -export const hashPassword = async (password) => { - const iterations = 600000; - const encoder = new TextEncoder(); - const bytes = encoder.encode(password); - const salt = crypto.getRandomValues(new Uint8Array(16)); - const keyMaterial = await crypto.subtle.importKey("raw", bytes, "PBKDF2", false, ["deriveBits"]); - const hash = await crypto.subtle.deriveBits({ - name: "PBKDF2", - hash: "SHA-256", - salt: salt, - iterations, - }, keyMaterial, 256); - const hashB64 = jose.base64url.encode(new Uint8Array(hash)); - const saltB64 = jose.base64url.encode(salt); - return { - hash: hashB64, - salt: saltB64, - iterations, - }; -}; -export const verifyPassword = async (password, hashB64, saltB64, iterations) => { - const encoder = new TextEncoder(); - const passwordBytes = encoder.encode(password); - const salt = jose.base64url.decode(saltB64); - const params = { - name: "PBKDF2", - hash: "SHA-256", - salt, - iterations, - }; - const keyMaterial = await crypto.subtle.importKey("raw", passwordBytes, "PBKDF2", false, ["deriveBits"]); - const hash = await crypto.subtle.deriveBits(params, keyMaterial, 256); - const hashBase64 = jose.base64url.encode(new Uint8Array(hash)); - return hashBase64 === hashB64; -}; -//# sourceMappingURL=password.js.map \ No newline at end of file diff --git a/dist/core/utils/password.js.map b/dist/core/utils/password.js.map deleted file mode 100644 index de90461..0000000 --- a/dist/core/utils/password.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"password.js","sourceRoot":"","sources":["../../../src/core/utils/password.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,QAAgB,EAAE,EAAE;IACrD,MAAM,UAAU,GAAG,MAAM,CAAA;IACzB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;IACjC,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IACtC,MAAM,IAAI,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAA;IACvD,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAC/C,KAAK,EACL,KAAK,EACL,QAAQ,EACR,KAAK,EACL,CAAC,YAAY,CAAC,CACf,CAAA;IACD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,UAAU,CACzC;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,IAAI;QACV,UAAU;KACX,EACD,WAAW,EACX,GAAG,CACJ,CAAA;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA;IAC3D,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC3C,OAAO;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,OAAO;QACb,UAAU;KACX,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,QAAgB,EAChB,OAAe,EACf,OAAe,EACf,UAAkB,EAClB,EAAE;IACF,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;IACjC,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAC3C,MAAM,MAAM,GAAG;QACb,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,SAAS;QACf,IAAI;QACJ,UAAU;KACX,CAAA;IACD,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAC/C,KAAK,EACL,aAAa,EACb,QAAQ,EACR,KAAK,EACL,CAAC,YAAY,CAAC,CACf,CAAA;IACD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,CAAA;IACrE,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA;IAC9D,OAAO,UAAU,KAAK,OAAO,CAAA;AAC/B,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/core/utils/session.d.ts b/dist/core/utils/session.d.ts deleted file mode 100644 index 162a50a..0000000 --- a/dist/core/utils/session.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { UserSession } from "../../types.js"; -export declare const removeExpiredSessions: (sessions: UserSession[]) => UserSession[]; -//# sourceMappingURL=session.d.ts.map \ No newline at end of file diff --git a/dist/core/utils/session.d.ts.map b/dist/core/utils/session.d.ts.map deleted file mode 100644 index 54f89e0..0000000 --- a/dist/core/utils/session.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/core/utils/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,eAAO,MAAM,qBAAqB,GAAI,UAAU,WAAW,EAAE,kBAO5D,CAAA"} \ No newline at end of file diff --git a/dist/core/utils/session.js b/dist/core/utils/session.js deleted file mode 100644 index c43293d..0000000 --- a/dist/core/utils/session.js +++ /dev/null @@ -1,8 +0,0 @@ -export const removeExpiredSessions = (sessions) => { - const now = new Date(); - return sessions.filter(({ expiresAt }) => { - const expiry = expiresAt instanceof Date ? expiresAt : new Date(expiresAt); - return expiry > now; - }); -}; -//# sourceMappingURL=session.js.map \ No newline at end of file diff --git a/dist/core/utils/session.js.map b/dist/core/utils/session.js.map deleted file mode 100644 index 0b904e4..0000000 --- a/dist/core/utils/session.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/core/utils/session.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAAuB,EAAE,EAAE;IAC/D,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAA;IAEtB,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;QACvC,MAAM,MAAM,GAAG,SAAS,YAAY,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,CAAA;QAC1E,OAAO,MAAM,GAAG,GAAG,CAAA;IACrB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/core/utils/slug.d.ts b/dist/core/utils/slug.d.ts deleted file mode 100644 index 32b5dc2..0000000 --- a/dist/core/utils/slug.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const formatSlug: (val: string) => string; -//# sourceMappingURL=slug.d.ts.map \ No newline at end of file diff --git a/dist/core/utils/slug.d.ts.map b/dist/core/utils/slug.d.ts.map deleted file mode 100644 index 748c035..0000000 --- a/dist/core/utils/slug.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"slug.d.ts","sourceRoot":"","sources":["../../../src/core/utils/slug.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,KAAG,MAIvB,CAAA"} \ No newline at end of file diff --git a/dist/core/utils/slug.js b/dist/core/utils/slug.js deleted file mode 100644 index 2a385b4..0000000 --- a/dist/core/utils/slug.js +++ /dev/null @@ -1,5 +0,0 @@ -export const formatSlug = (val) => val - .replace(/ /g, "-") - .replace(/[^\w-]+/g, "") - .toLowerCase(); -//# sourceMappingURL=slug.js.map \ No newline at end of file diff --git a/dist/core/utils/slug.js.map b/dist/core/utils/slug.js.map deleted file mode 100644 index 228391a..0000000 --- a/dist/core/utils/slug.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"slug.js","sourceRoot":"","sources":["../../../src/core/utils/slug.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAW,EAAU,EAAE,CAChD,GAAG;KACA,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;KAClB,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;KACvB,WAAW,EAAE,CAAA"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1bbade4..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { authPlugin } from "./plugin.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map deleted file mode 100644 index a09ab36..0000000 --- a/dist/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 662800e..0000000 --- a/dist/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { authPlugin } from "./plugin.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 4a9a15f..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA"} \ No newline at end of file diff --git a/dist/plugin.d.ts b/dist/plugin.d.ts deleted file mode 100644 index 9d9a64b..0000000 --- a/dist/plugin.d.ts +++ /dev/null @@ -1,90 +0,0 @@ -/** - * The App plugin is used for authenticating users in the frontent app of the Payload CMS application. - * It support magic link, password, OAuth, and Passkey based authentications. - * - * On top of it, to add additional security it also support 2FA using OTP, and TOTP. - * - * The set up is very lean and flexible to tailor the auth process in a specific way. - * - * ```ts - * import {authPlugin} from "payload-auth-plugin"; - * - * export const plugins = [ - * authPlugin({ - * name: "a-unique-name", - * usersCollectionSlug: "users-collection-slug", - * accountsCollectionSlug: "accounts-collection-slug", - * providers:[] - * }) - * ] - * - * ``` - * @packageDocumentation - */ -import type { Plugin } from "payload"; -import type { PasswordProviderConfig, OAuthProviderConfig, PasskeyProviderConfig } from "./types.js"; -/** - * Adds authentication to the Payload app. - */ -interface PluginOptions { - /** - * Enable or disable plugin - * - * @default true - * - */ - enabled?: boolean | undefined; - /** - * This name will be used to created endpoints, tokens, and etc. - * For example, if you want to pass - */ - name: string; - /** - * - * Enable authuentication only-for Admin - * - */ - useAdmin?: boolean | undefined; - /** - * Auth providers supported by the plugin - * - */ - providers: (OAuthProviderConfig | PasskeyProviderConfig | PasswordProviderConfig)[]; - /** - * Users collection slug. - * - * The collection to store all the user records. - * - */ - usersCollectionSlug: string; - /** - * User accounts collection slug. - * - * The collection to store all the account records thant belongs to a user. - * Multiple accounts can belong to one user - * - */ - accountsCollectionSlug: string; - /** - * Allow auto signup if user doesn't have an account. - * - * @default false - * - */ - allowOAuthAutoSignUp?: boolean | undefined; - /** - * Path to redirect upon successful signin, signups and etc - * - * Example: /dashboard or /admin or /profile - */ - successRedirectPath: string; - /** - * Path to redirect upon failed signin, signups and etc. - * - * Example: /dashboard or /admin or /profile - */ - errorRedirectPath: string; -} -export declare const authPlugin: (pluginOptions: PluginOptions) => Plugin; -export {}; -//# sourceMappingURL=plugin.d.ts.map \ No newline at end of file diff --git a/dist/plugin.d.ts.map b/dist/plugin.d.ts.map deleted file mode 100644 index f4c3ee9..0000000 --- a/dist/plugin.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAoB,MAAM,EAAE,MAAM,SAAS,CAAA;AACvD,OAAO,KAAK,EACV,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,YAAY,CAAA;AAoBnB;;GAEG;AACH,UAAU,aAAa;IACrB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;;;OAIG;IAEH,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAE9B;;;OAGG;IACH,SAAS,EAAE,CACP,mBAAmB,GACnB,qBAAqB,GACrB,sBAAsB,CACzB,EAAE,CAAA;IAEH;;;;;OAKG;IACH,mBAAmB,EAAE,MAAM,CAAA;IAE3B;;;;;;OAMG;IACH,sBAAsB,EAAE,MAAM,CAAA;IAE9B;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAE1C;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,CAAA;IAE3B;;;;OAIG;IACH,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AAED,eAAO,MAAM,UAAU,GACpB,eAAe,aAAa,KAAG,MA+F/B,CAAA"} \ No newline at end of file diff --git a/dist/plugin.js b/dist/plugin.js deleted file mode 100644 index 42d863f..0000000 --- a/dist/plugin.js +++ /dev/null @@ -1,78 +0,0 @@ -/** - * The App plugin is used for authenticating users in the frontent app of the Payload CMS application. - * It support magic link, password, OAuth, and Passkey based authentications. - * - * On top of it, to add additional security it also support 2FA using OTP, and TOTP. - * - * The set up is very lean and flexible to tailor the auth process in a specific way. - * - * ```ts - * import {authPlugin} from "payload-auth-plugin"; - * - * export const plugins = [ - * authPlugin({ - * name: "a-unique-name", - * usersCollectionSlug: "users-collection-slug", - * accountsCollectionSlug: "accounts-collection-slug", - * providers:[] - * }) - * ] - * - * ``` - * @packageDocumentation - */ -import { InvalidServerURL, MissingEmailAdapter, } from "./core/errors/consoleErrors.js"; -import { getPasswordProvider, getOAuthProviders, getPasskeyProvider, } from "./providers/utils.js"; -import { PasswordAuthEndpointStrategy, EndpointsFactory, OAuthEndpointStrategy, PasskeyEndpointStrategy, SessionEndpointStrategy, } from "./core/endpoints.js"; -import { formatSlug } from "./core/utils/slug.js"; -import { preflightCollectionCheck } from "./core/preflights/collections.js"; -export const authPlugin = (pluginOptions) => (incomingConfig) => { - const config = { ...incomingConfig }; - if (pluginOptions.enabled === false) { - return config; - } - if (!config.serverURL) { - throw new InvalidServerURL(); - } - const { usersCollectionSlug, accountsCollectionSlug, providers, allowOAuthAutoSignUp, useAdmin, successRedirectPath, errorRedirectPath, } = pluginOptions; - preflightCollectionCheck([usersCollectionSlug, accountsCollectionSlug], config.collections); - const name = formatSlug(pluginOptions.name); - const oauthProviders = getOAuthProviders(providers); - const passkeyProvider = getPasskeyProvider(providers); - const passwordProvider = getPasswordProvider(providers); - const endpointsFactory = new EndpointsFactory(name, { - usersCollection: usersCollectionSlug, - accountsCollection: accountsCollectionSlug, - }, allowOAuthAutoSignUp ?? false, !!useAdmin, successRedirectPath, errorRedirectPath); - let oauthEndpoints = []; - let passkeyEndpoints = []; - let passwordEndpoints = []; - if (Object.keys(oauthProviders).length > 0) { - endpointsFactory.registerStrategy("oauth", new OAuthEndpointStrategy(oauthProviders)); - oauthEndpoints = endpointsFactory.createEndpoints("oauth"); - } - if (passkeyProvider) { - endpointsFactory.registerStrategy("passkey", new PasskeyEndpointStrategy()); - passkeyEndpoints = endpointsFactory.createEndpoints("passkey"); - } - if (passwordProvider) { - if (!config.email) { - throw new MissingEmailAdapter(); - } - endpointsFactory.registerStrategy("password", new PasswordAuthEndpointStrategy({ - usersCollectionSlug, - }, passwordProvider)); - passwordEndpoints = endpointsFactory.createEndpoints("password"); - } - endpointsFactory.registerStrategy("session", new SessionEndpointStrategy({ usersCollectionSlug })); - const sessionEndpoints = endpointsFactory.createEndpoints("session"); - config.endpoints = [ - ...(config.endpoints ?? []), - ...oauthEndpoints, - ...passkeyEndpoints, - ...passwordEndpoints, - ...sessionEndpoints, - ]; - return config; -}; -//# sourceMappingURL=plugin.js.map \ No newline at end of file diff --git a/dist/plugin.js.map b/dist/plugin.js.map deleted file mode 100644 index b378a8e..0000000 --- a/dist/plugin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAQH,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,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f,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/providers/index.d.ts b/dist/providers/index.d.ts deleted file mode 100644 index edef66e..0000000 --- a/dist/providers/index.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import GoogleAuthProvider from "./oidc/google.js"; -import GitHubAuthProvider from "./oauth2/github.js"; -import GitLabAuthProvider from "./oidc/gitlab.js"; -import AtlassianAuthProvider from "./oauth2/atlassian.js"; -import DiscordAuthProvider from "./oauth2/discord.js"; -import FacebookAuthProvider from "./oauth2/facebook.js"; -import SlackAuthProvider from "./oidc/slack.js"; -import Auth0AuthProvider from "./oauth2/auth0.js"; -import OktaAuthProvider from "./oidc/okta.js"; -import CognitoAuthProvider from "./oidc/cognito.js"; -import KeyCloakAuthProvider from "./oidc/keycloak.js"; -import PasskeyAuthProvider from "./passkey.js"; -import MicrosoftEntraAuthProvider from "./oidc/microsoft-entra.js"; -import AppleOIDCAuthProvider from "./oidc/apple.js"; -import AppleOAuth2Provider from "./oauth2/apple.js"; -import JumpCloudAuthProvider from "./oauth2/jumpcloud.js"; -import TwitchAuthProvider from "./oauth2/twitch.js"; -import PasswordProvider from "./password.js"; -export { GoogleAuthProvider, GitHubAuthProvider, GitLabAuthProvider, AtlassianAuthProvider, DiscordAuthProvider, FacebookAuthProvider, SlackAuthProvider, Auth0AuthProvider, CognitoAuthProvider, KeyCloakAuthProvider, PasskeyAuthProvider, MicrosoftEntraAuthProvider, AppleOIDCAuthProvider, AppleOAuth2Provider, JumpCloudAuthProvider, TwitchAuthProvider, PasswordProvider, OktaAuthProvider, }; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/providers/index.d.ts.map b/dist/providers/index.d.ts.map deleted file mode 100644 index 0a72904..0000000 --- a/dist/providers/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,kBAAkB,CAAA;AACjD,OAAO,kBAAkB,MAAM,oBAAoB,CAAA;AACnD,OAAO,kBAAkB,MAAM,kBAAkB,CAAA;AACjD,OAAO,qBAAqB,MAAM,uBAAuB,CAAA;AACzD,OAAO,mBAAmB,MAAM,qBAAqB,CAAA;AACrD,OAAO,oBAAoB,MAAM,sBAAsB,CAAA;AACvD,OAAO,iBAAiB,MAAM,iBAAiB,CAAA;AAC/C,OAAO,iBAAiB,MAAM,mBAAmB,CAAA;AACjD,OAAO,gBAAgB,MAAM,gBAAgB,CAAA;AAC7C,OAAO,mBAAmB,MAAM,mBAAmB,CAAA;AACnD,OAAO,oBAAoB,MAAM,oBAAoB,CAAA;AACrD,OAAO,mBAAmB,MAAM,cAAc,CAAA;AAC9C,OAAO,0BAA0B,MAAM,2BAA2B,CAAA;AAClE,OAAO,qBAAqB,MAAM,iBAAiB,CAAA;AACnD,OAAO,mBAAmB,MAAM,mBAAmB,CAAA;AACnD,OAAO,qBAAqB,MAAM,uBAAuB,CAAA;AACzD,OAAO,kBAAkB,MAAM,oBAAoB,CAAA;AACnD,OAAO,gBAAgB,MAAM,eAAe,CAAA;AAE5C,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,GACjB,CAAA"} \ No newline at end of file diff --git a/dist/providers/index.js b/dist/providers/index.js deleted file mode 100644 index 2d321ff..0000000 --- a/dist/providers/index.js +++ /dev/null @@ -1,20 +0,0 @@ -import GoogleAuthProvider from "./oidc/google.js"; -import GitHubAuthProvider from "./oauth2/github.js"; -import GitLabAuthProvider from "./oidc/gitlab.js"; -import AtlassianAuthProvider from "./oauth2/atlassian.js"; -import DiscordAuthProvider from "./oauth2/discord.js"; -import FacebookAuthProvider from "./oauth2/facebook.js"; -import SlackAuthProvider from "./oidc/slack.js"; -import Auth0AuthProvider from "./oauth2/auth0.js"; -import OktaAuthProvider from "./oidc/okta.js"; -import CognitoAuthProvider from "./oidc/cognito.js"; -import KeyCloakAuthProvider from "./oidc/keycloak.js"; -import PasskeyAuthProvider from "./passkey.js"; -import MicrosoftEntraAuthProvider from "./oidc/microsoft-entra.js"; -import AppleOIDCAuthProvider from "./oidc/apple.js"; -import AppleOAuth2Provider from "./oauth2/apple.js"; -import JumpCloudAuthProvider from "./oauth2/jumpcloud.js"; -import TwitchAuthProvider from "./oauth2/twitch.js"; -import PasswordProvider from "./password.js"; -export { GoogleAuthProvider, GitHubAuthProvider, GitLabAuthProvider, AtlassianAuthProvider, DiscordAuthProvider, FacebookAuthProvider, SlackAuthProvider, Auth0AuthProvider, CognitoAuthProvider, KeyCloakAuthProvider, PasskeyAuthProvider, MicrosoftEntraAuthProvider, AppleOIDCAuthProvider, AppleOAuth2Provider, JumpCloudAuthProvider, TwitchAuthProvider, PasswordProvider, OktaAuthProvider, }; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/providers/index.js.map b/dist/providers/index.js.map deleted file mode 100644 index 4c8f659..0000000 --- a/dist/providers/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,kBAAkB,CAAA;AACjD,OAAO,kBAAkB,MAAM,oBAAoB,CAAA;AACnD,OAAO,kBAAkB,MAAM,kBAAkB,CAAA;AACjD,OAAO,qBAAqB,MAAM,uBAAuB,CAAA;AACzD,OAAO,mBAAmB,MAAM,qBAAqB,CAAA;AACrD,OAAO,oBAAoB,MAAM,sBAAsB,CAAA;AACvD,OAAO,iBAAiB,MAAM,iBAAiB,CAAA;AAC/C,OAAO,iBAAiB,MAAM,mBAAmB,CAAA;AACjD,OAAO,gBAAgB,MAAM,gBAAgB,CAAA;AAC7C,OAAO,mBAAmB,MAAM,mBAAmB,CAAA;AACnD,OAAO,oBAAoB,MAAM,oBAAoB,CAAA;AACrD,OAAO,mBAAmB,MAAM,cAAc,CAAA;AAC9C,OAAO,0BAA0B,MAAM,2BAA2B,CAAA;AAClE,OAAO,qBAAqB,MAAM,iBAAiB,CAAA;AACnD,OAAO,mBAAmB,MAAM,mBAAmB,CAAA;AACnD,OAAO,qBAAqB,MAAM,uBAAuB,CAAA;AACzD,OAAO,kBAAkB,MAAM,oBAAoB,CAAA;AACnD,OAAO,gBAAgB,MAAM,eAAe,CAAA;AAE5C,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,GACjB,CAAA"} \ No newline at end of file diff --git a/dist/providers/magiclink.d.ts b/dist/providers/magiclink.d.ts deleted file mode 100644 index 8fab843..0000000 --- a/dist/providers/magiclink.d.ts +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=magiclink.d.ts.map \ No newline at end of file diff --git a/dist/providers/magiclink.d.ts.map b/dist/providers/magiclink.d.ts.map deleted file mode 100644 index 222d950..0000000 --- a/dist/providers/magiclink.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"magiclink.d.ts","sourceRoot":"","sources":["../../src/providers/magiclink.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/providers/magiclink.js b/dist/providers/magiclink.js deleted file mode 100644 index 4523629..0000000 --- a/dist/providers/magiclink.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -// NOT IMPLEMENTED YET -//# sourceMappingURL=magiclink.js.map \ No newline at end of file diff --git a/dist/providers/magiclink.js.map b/dist/providers/magiclink.js.map deleted file mode 100644 index 001cb64..0000000 --- a/dist/providers/magiclink.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"magiclink.js","sourceRoot":"","sources":["../../src/providers/magiclink.ts"],"names":[],"mappings":";AAAA,sBAAsB"} \ No newline at end of file diff --git a/dist/providers/oauth2/apple.d.ts b/dist/providers/oauth2/apple.d.ts deleted file mode 100644 index 14b555b..0000000 --- a/dist/providers/oauth2/apple.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { OAuth2ProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; -type AppleAuthConfig = OAuthBaseProviderConfig; -/** - * Add Apple OAuth2 Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/apple - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {AppleOAuth2Provider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * AppleOAuth2Provider({ - * client_id: process.env.APPLE_CLIENT_ID as string, - * client_secret: process.env.APPLE_CLIENT_SECRET as string, - * }) - * ] - * }) - * - * ] - * ``` - * - */ -declare function AppleOAuth2Provider(config: AppleAuthConfig): OAuth2ProviderConfig; -export default AppleOAuth2Provider; -//# sourceMappingURL=apple.d.ts.map \ No newline at end of file diff --git a/dist/providers/oauth2/apple.d.ts.map b/dist/providers/oauth2/apple.d.ts.map deleted file mode 100644 index 7f7d915..0000000 --- a/dist/providers/oauth2/apple.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"apple.d.ts","sourceRoot":"","sources":["../../../src/providers/oauth2/apple.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,KAAK,eAAe,GAAG,uBAAuB,CAAA;AAQ9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,iBAAS,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,oBAAoB,CAwB1E;AAED,eAAe,mBAAmB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/apple.js b/dist/providers/oauth2/apple.js deleted file mode 100644 index 84eb1cc..0000000 --- a/dist/providers/oauth2/apple.js +++ /dev/null @@ -1,61 +0,0 @@ -const authorization_server = { - issuer: "https://appleid.apple.com", - authorization_endpoint: "https://appleid.apple.com/auth/authorize", - token_endpoint: "https://appleid.apple.com/auth/token", -}; -/** - * Add Apple OAuth2 Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/apple - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {AppleOAuth2Provider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * AppleOAuth2Provider({ - * client_id: process.env.APPLE_CLIENT_ID as string, - * client_secret: process.env.APPLE_CLIENT_SECRET as string, - * }) - * ] - * }) - * - * ] - * ``` - * - */ -function AppleOAuth2Provider(config) { - const { overrideScope, ...restConfig } = config; - return { - ...restConfig, - id: "apple", - scope: overrideScope ?? "name email", - authorization_server, - name: "Apple", - algorithm: "oauth2", - params: { - ...config.params, - response_mode: "form_post", - }, - kind: "oauth", - profile: (profile) => { - return { - sub: profile.sub, - name: profile.name, - email: profile.email, - picture: profile.picture, - }; - }, - }; -} -export default AppleOAuth2Provider; -//# sourceMappingURL=apple.js.map \ No newline at end of file diff --git a/dist/providers/oauth2/apple.js.map b/dist/providers/oauth2/apple.js.map deleted file mode 100644 index bab769a..0000000 --- a/dist/providers/oauth2/apple.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"apple.js","sourceRoot":"","sources":["../../../src/providers/oauth2/apple.ts"],"names":[],"mappings":"AASA,MAAM,oBAAoB,GAAwB;IAChD,MAAM,EAAE,2BAA2B;IACnC,sBAAsB,EAAE,0CAA0C;IAClE,cAAc,EAAE,sCAAsC;CACvD,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,SAAS,mBAAmB,CAAC,MAAuB;IAClD,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,aAAa,IAAI,YAAY;QACpC,oBAAoB;QACpB,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,QAAQ;QACnB,MAAM,EAAE;YACN,GAAG,MAAM,CAAC,MAAM;YAChB,aAAa,EAAE,WAAW;SAC3B;QACD,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,mBAAmB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/atlassian.d.ts b/dist/providers/oauth2/atlassian.d.ts deleted file mode 100644 index 5b2ea85..0000000 --- a/dist/providers/oauth2/atlassian.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { OAuth2ProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; -type AtlassianAuthConfig = OAuthBaseProviderConfig; -/** - * Add Atlassian OAuth2 Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/atlassian - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {AtlassianAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugins[] = [ - * authPlugin({ - * providers:[ - * AtlassianAuthProvider({ - * client_id: process.env.ATLASSIAN_CLIENT_ID as string, - * client_secret: process.env.ATLASSIAN_CLIENT_SECRET as string, - * }) - * ] - * }) - * - * ] - * ``` - * - */ -declare function AtlassianAuthProvider(config: AtlassianAuthConfig): OAuth2ProviderConfig; -export default AtlassianAuthProvider; -//# sourceMappingURL=atlassian.d.ts.map \ No newline at end of file diff --git a/dist/providers/oauth2/atlassian.d.ts.map b/dist/providers/oauth2/atlassian.d.ts.map deleted file mode 100644 index 705ab22..0000000 --- a/dist/providers/oauth2/atlassian.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"atlassian.d.ts","sourceRoot":"","sources":["../../../src/providers/oauth2/atlassian.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EAEpB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAWvB,KAAK,mBAAmB,GAAG,uBAAuB,CAAA;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,iBAAS,qBAAqB,CAC5B,MAAM,EAAE,mBAAmB,GAC1B,oBAAoB,CAmBtB;AAED,eAAe,qBAAqB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/atlassian.js b/dist/providers/oauth2/atlassian.js deleted file mode 100644 index d13e203..0000000 --- a/dist/providers/oauth2/atlassian.js +++ /dev/null @@ -1,59 +0,0 @@ -const algorithm = "oauth2"; -const authorization_server = { - issuer: "https://auth.atlassian.com", - authorization_endpoint: "https://auth.atlassian.com/authorize", - token_endpoint: "https://auth.atlassian.com/oauth/token", - userinfo_endpoint: "https://api.atlassian.com/me", -}; -/** - * Add Atlassian OAuth2 Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/atlassian - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {AtlassianAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugins[] = [ - * authPlugin({ - * providers:[ - * AtlassianAuthProvider({ - * client_id: process.env.ATLASSIAN_CLIENT_ID as string, - * client_secret: process.env.ATLASSIAN_CLIENT_SECRET as string, - * }) - * ] - * }) - * - * ] - * ``` - * - */ -function AtlassianAuthProvider(config) { - const { overrideScope, ...restConfig } = config; - return { - ...restConfig, - id: "atlassian", - authorization_server, - name: "Atlassian", - algorithm, - scope: overrideScope ?? "read:me read:account", - kind: "oauth", - profile: (profile) => { - return { - sub: profile.account_id, - name: profile.name, - email: profile.email, - picture: profile.picture, - }; - }, - }; -} -export default AtlassianAuthProvider; -//# sourceMappingURL=atlassian.js.map \ No newline at end of file diff --git a/dist/providers/oauth2/atlassian.js.map b/dist/providers/oauth2/atlassian.js.map deleted file mode 100644 index 10d4822..0000000 --- a/dist/providers/oauth2/atlassian.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"atlassian.js","sourceRoot":"","sources":["../../../src/providers/oauth2/atlassian.ts"],"names":[],"mappings":"AAOA,MAAM,SAAS,GAAG,QAAQ,CAAA;AAE1B,MAAM,oBAAoB,GAA8B;IACtD,MAAM,EAAE,4BAA4B;IACpC,sBAAsB,EAAE,sCAAsC;IAC9D,cAAc,EAAE,wCAAwC;IACxD,iBAAiB,EAAE,8BAA8B;CAClD,CAAA;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,SAAS,qBAAqB,CAC5B,MAA2B;IAE3B,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAC/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,WAAW;QACf,oBAAoB;QACpB,IAAI,EAAE,WAAW;QACjB,SAAS;QACT,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,UAAoB;gBACjC,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,qBAAqB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/auth0.d.ts b/dist/providers/oauth2/auth0.d.ts deleted file mode 100644 index 71e93c0..0000000 --- a/dist/providers/oauth2/auth0.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { OAuth2ProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; -interface Auth0AuthConfig extends OAuthBaseProviderConfig { - domain: string; -} -/** - * Add Auth0 OAuth2 Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/auth0 - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {Auth0AuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * Auth0AuthProvider({ - * client_id: process.env.AUTH0_CLIENT_ID as string, - * client_secret: process.env.AUTH0_CLIENT_SECRET as string, - * domain: process.env.AUTH0_DOMAIN as string, - * }) - * ] - * }) - * ] - * ``` - * - */ -declare function Auth0AuthProvider(config: Auth0AuthConfig): OAuth2ProviderConfig; -export default Auth0AuthProvider; -//# sourceMappingURL=auth0.d.ts.map \ No newline at end of file diff --git a/dist/providers/oauth2/auth0.d.ts.map b/dist/providers/oauth2/auth0.d.ts.map deleted file mode 100644 index 500dc43..0000000 --- a/dist/providers/oauth2/auth0.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"auth0.d.ts","sourceRoot":"","sources":["../../../src/providers/oauth2/auth0.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EAEpB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,UAAU,eAAgB,SAAQ,uBAAuB;IACvD,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,iBAAS,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,oBAAoB,CA0BxE;AAED,eAAe,iBAAiB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/auth0.js b/dist/providers/oauth2/auth0.js deleted file mode 100644 index c2d0352..0000000 --- a/dist/providers/oauth2/auth0.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Add Auth0 OAuth2 Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/auth0 - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {Auth0AuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * Auth0AuthProvider({ - * client_id: process.env.AUTH0_CLIENT_ID as string, - * client_secret: process.env.AUTH0_CLIENT_SECRET as string, - * domain: process.env.AUTH0_DOMAIN as string, - * }) - * ] - * }) - * ] - * ``` - * - */ -function Auth0AuthProvider(config) { - const { domain, overrideScope, ...restConfig } = config; - const authorization_server = { - issuer: `https://${domain}/`, - authorization_endpoint: `https://${domain}/authorize`, - token_endpoint: `https://${domain}/oauth/token`, - userinfo_endpoint: `https://${domain}/userinfo`, - }; - return { - ...restConfig, - id: "auth0", - scope: overrideScope ?? "openid email profile", - authorization_server, - name: "Auth0", - algorithm: "oauth2", - kind: "oauth", - profile: (profile) => { - return { - sub: profile.sub, - name: profile.name, - email: profile.email, - picture: profile.picture, - }; - }, - }; -} -export default Auth0AuthProvider; -//# sourceMappingURL=auth0.js.map \ No newline at end of file diff --git a/dist/providers/oauth2/auth0.js.map b/dist/providers/oauth2/auth0.js.map deleted file mode 100644 index b408042..0000000 --- a/dist/providers/oauth2/auth0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"auth0.js","sourceRoot":"","sources":["../../../src/providers/oauth2/auth0.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,SAAS,iBAAiB,CAAC,MAAuB;IAChD,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IACvD,MAAM,oBAAoB,GAA8B;QACtD,MAAM,EAAE,WAAW,MAAM,GAAG;QAC5B,sBAAsB,EAAE,WAAW,MAAM,YAAY;QACrD,cAAc,EAAE,WAAW,MAAM,cAAc;QAC/C,iBAAiB,EAAE,WAAW,MAAM,WAAW;KAChD,CAAA;IAED,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,oBAAoB;QACpB,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,QAAQ;QACnB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,iBAAiB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/discord.d.ts b/dist/providers/oauth2/discord.d.ts deleted file mode 100644 index 4a02ca8..0000000 --- a/dist/providers/oauth2/discord.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { OAuth2ProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; -type DiscordAuthConfig = OAuthBaseProviderConfig; -/** - * Add Discord OAuth2 Provider - * - * ``` - * https://example.com/api/{name}/oauth/callback/discord - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {DiscordAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * DiscordAuthProvider({ - * client_id: process.env.DISCORD_CLIENT_ID as string, - * client_secret: process.env.DISCORD_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - * - */ -declare function DiscordAuthProvider(config: DiscordAuthConfig): OAuth2ProviderConfig; -export default DiscordAuthProvider; -//# sourceMappingURL=discord.d.ts.map \ No newline at end of file diff --git a/dist/providers/oauth2/discord.d.ts.map b/dist/providers/oauth2/discord.d.ts.map deleted file mode 100644 index 2a1020a..0000000 --- a/dist/providers/oauth2/discord.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"discord.d.ts","sourceRoot":"","sources":["../../../src/providers/oauth2/discord.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EAEpB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAQvB,KAAK,iBAAiB,GAAG,uBAAuB,CAAA;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,iBAAS,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,GAAG,oBAAoB,CAsB5E;AAED,eAAe,mBAAmB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/discord.js b/dist/providers/oauth2/discord.js deleted file mode 100644 index e5ebb61..0000000 --- a/dist/providers/oauth2/discord.js +++ /dev/null @@ -1,56 +0,0 @@ -const authorization_server = { - issuer: "https://discord.com", - authorization_endpoint: "https://discord.com/api/oauth2/authorize", - token_endpoint: "https://discord.com/api/oauth2/token", - userinfo_endpoint: "https://discord.com/api/users/@me", -}; -/** - * Add Discord OAuth2 Provider - * - * ``` - * https://example.com/api/{name}/oauth/callback/discord - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {DiscordAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * DiscordAuthProvider({ - * client_id: process.env.DISCORD_CLIENT_ID as string, - * client_secret: process.env.DISCORD_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - * - */ -function DiscordAuthProvider(config) { - const { overrideScope, ...restConfig } = config; - return { - ...restConfig, - id: "discord", - scope: overrideScope ?? "identify email", - authorization_server, - name: "Discord", - algorithm: "oauth2", - kind: "oauth", - profile: (profile) => { - const format = profile.avatar?.toString().startsWith("a_") ? "gif" : "png"; - return { - sub: profile.id, - name: profile.username ?? profile.global_name, - email: profile.email, - picture: `https://cdn.discordapp.com/avatars/${profile.id}/${profile.avatar}.${format}`, - }; - }, - }; -} -export default DiscordAuthProvider; -//# sourceMappingURL=discord.js.map \ No newline at end of file diff --git a/dist/providers/oauth2/discord.js.map b/dist/providers/oauth2/discord.js.map deleted file mode 100644 index ebe9b0a..0000000 --- a/dist/providers/oauth2/discord.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"discord.js","sourceRoot":"","sources":["../../../src/providers/oauth2/discord.ts"],"names":[],"mappings":"AAOA,MAAM,oBAAoB,GAA8B;IACtD,MAAM,EAAE,qBAAqB;IAC7B,sBAAsB,EAAE,0CAA0C;IAClE,cAAc,EAAE,sCAAsC;IACtD,iBAAiB,EAAE,mCAAmC;CACvD,CAAA;AAGD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,SAAS,mBAAmB,CAAC,MAAyB;IACpD,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,aAAa,IAAI,gBAAgB;QACxC,oBAAoB;QACpB,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,QAAQ;QACnB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;YAE1E,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,EAAY;gBACzB,IAAI,EAAG,OAAO,CAAC,QAAmB,IAAK,OAAO,CAAC,WAAsB;gBACrE,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,sCAAsC,OAAO,CAAC,EAAE,IAAI,OAAO,CAAC,MAAM,IAAI,MAAM,EAAE;aACxF,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,mBAAmB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/facebook.d.ts b/dist/providers/oauth2/facebook.d.ts deleted file mode 100644 index 0ffff67..0000000 --- a/dist/providers/oauth2/facebook.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import type { OAuth2ProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; -type FacebookAuthConfig = OAuthBaseProviderConfig; -/** - * Add Facebook OAuth2 Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/facebook - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {FacebookAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * FacebookAuthProvider({ - * client_id: process.env.FACEBOOK_CLIENT_ID as string, - * client_secret: process.env.FACEBOOK_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - */ -declare function FacebookAuthProvider(config: FacebookAuthConfig): OAuth2ProviderConfig; -export default FacebookAuthProvider; -//# sourceMappingURL=facebook.d.ts.map \ No newline at end of file diff --git a/dist/providers/oauth2/facebook.d.ts.map b/dist/providers/oauth2/facebook.d.ts.map deleted file mode 100644 index aebda92..0000000 --- a/dist/providers/oauth2/facebook.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"facebook.d.ts","sourceRoot":"","sources":["../../../src/providers/oauth2/facebook.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EAEpB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAUvB,KAAK,kBAAkB,GAAG,uBAAuB,CAAA;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,iBAAS,oBAAoB,CAC3B,MAAM,EAAE,kBAAkB,GACzB,oBAAoB,CA6BtB;AAED,eAAe,oBAAoB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/facebook.js b/dist/providers/oauth2/facebook.js deleted file mode 100644 index 3c36b75..0000000 --- a/dist/providers/oauth2/facebook.js +++ /dev/null @@ -1,64 +0,0 @@ -const authorization_server = { - issuer: "https://www.facebook.com", - authorization_endpoint: "https://www.facebook.com/v19.0/dialog/oauth", - token_endpoint: "https://graph.facebook.com/oauth/access_token", - userinfo_endpoint: "https://graph.facebook.com/me?fields=id,name,email,picture", -}; -/** - * Add Facebook OAuth2 Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/facebook - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {FacebookAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * FacebookAuthProvider({ - * client_id: process.env.FACEBOOK_CLIENT_ID as string, - * client_secret: process.env.FACEBOOK_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - */ -function FacebookAuthProvider(config) { - const { overrideScope, ...restConfig } = config; - return { - ...restConfig, - id: "facebook", - scope: overrideScope ?? "email", - authorization_server, - name: "Facebook", - algorithm: "oauth2", - kind: "oauth", - profile: (profile) => { - let picture; - if (typeof profile.picture === "object" && profile.picture !== null) { - // Type assertion - const dataContainer = profile.picture; - if ("data" in dataContainer) { - picture = dataContainer.data.url; - } - } - return { - sub: profile.id, - name: profile.name, - email: profile.email, - picture: picture, - }; - }, - }; -} -export default FacebookAuthProvider; -//# sourceMappingURL=facebook.js.map \ No newline at end of file diff --git a/dist/providers/oauth2/facebook.js.map b/dist/providers/oauth2/facebook.js.map deleted file mode 100644 index 42af266..0000000 --- a/dist/providers/oauth2/facebook.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"facebook.js","sourceRoot":"","sources":["../../../src/providers/oauth2/facebook.ts"],"names":[],"mappings":"AAOA,MAAM,oBAAoB,GAA8B;IACtD,MAAM,EAAE,0BAA0B;IAClC,sBAAsB,EAAE,6CAA6C;IACrE,cAAc,EAAE,+CAA+C;IAC/D,iBAAiB,EACf,4DAA4D;CAC/D,CAAA;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,SAAS,oBAAoB,CAC3B,MAA0B;IAE1B,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,aAAa,IAAI,OAAO;QAC/B,oBAAoB;QACpB,IAAI,EAAE,UAAU;QAChB,SAAS,EAAE,QAAQ;QACnB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,IAAI,OAAO,CAAA;YAEX,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;gBACpE,iBAAiB;gBACjB,MAAM,aAAa,GAAG,OAAO,CAAC,OAAoC,CAAA;gBAClE,IAAI,MAAM,IAAI,aAAa,EAAE,CAAC;oBAC5B,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,GAAG,CAAA;gBAClC,CAAC;YACH,CAAC;YACD,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,EAAY;gBACzB,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAiB;aAC3B,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,oBAAoB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/github.d.ts b/dist/providers/oauth2/github.d.ts deleted file mode 100644 index e9e7444..0000000 --- a/dist/providers/oauth2/github.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { OAuth2ProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; -type GitHubAuthConfig = OAuthBaseProviderConfig; -/** - * Add Github OAuth2 Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/github - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {GithubAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * GithubAuthProvider({ - * client_id: process.env.GITHUB_CLIENT_ID as string, - * client_secret: process.env.GITHUB_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - * - */ -declare function GitHubAuthProvider(config: GitHubAuthConfig): OAuth2ProviderConfig; -export default GitHubAuthProvider; -//# sourceMappingURL=github.d.ts.map \ No newline at end of file diff --git a/dist/providers/oauth2/github.d.ts.map b/dist/providers/oauth2/github.d.ts.map deleted file mode 100644 index 39f5cfd..0000000 --- a/dist/providers/oauth2/github.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../src/providers/oauth2/github.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EAEpB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AASvB,KAAK,gBAAgB,GAAG,uBAAuB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,iBAAS,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,oBAAoB,CAoB1E;AAED,eAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/github.js b/dist/providers/oauth2/github.js deleted file mode 100644 index e5b4507..0000000 --- a/dist/providers/oauth2/github.js +++ /dev/null @@ -1,57 +0,0 @@ -const authorization_server = { - issuer: "https://github.com", - authorization_endpoint: "https://github.com/login/oauth/authorize", - token_endpoint: "https://github.com/login/oauth/access_token", - userinfo_endpoint: "https://api.github.com/user", -}; -/** - * Add Github OAuth2 Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/github - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {GithubAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * GithubAuthProvider({ - * client_id: process.env.GITHUB_CLIENT_ID as string, - * client_secret: process.env.GITHUB_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - * - */ -function GitHubAuthProvider(config) { - const { overrideScope, ...restConfig } = config; - return { - ...restConfig, - id: "github", - scope: overrideScope ?? "openid email profile", - authorization_server, - name: "GitHub", - algorithm: "oauth2", - kind: "oauth", - profile: (profile) => { - return { - sub: profile.id, - name: profile.name, - email: profile.email, - picture: profile.picture, - }; - }, - }; -} -export default GitHubAuthProvider; -//# sourceMappingURL=github.js.map \ No newline at end of file diff --git a/dist/providers/oauth2/github.js.map b/dist/providers/oauth2/github.js.map deleted file mode 100644 index 9bc8053..0000000 --- a/dist/providers/oauth2/github.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"github.js","sourceRoot":"","sources":["../../../src/providers/oauth2/github.ts"],"names":[],"mappings":"AAOA,MAAM,oBAAoB,GAA8B;IACtD,MAAM,EAAE,oBAAoB;IAC5B,sBAAsB,EAAE,0CAA0C;IAClE,cAAc,EAAE,6CAA6C;IAC7D,iBAAiB,EAAE,6BAA6B;CACjD,CAAA;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,SAAS,kBAAkB,CAAC,MAAwB;IAClD,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,oBAAoB;QACpB,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,QAAQ;QACnB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,EAAY;gBACzB,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/jumpcloud.d.ts b/dist/providers/oauth2/jumpcloud.d.ts deleted file mode 100644 index 3d1f65d..0000000 --- a/dist/providers/oauth2/jumpcloud.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { OAuthBaseProviderConfig, OAuth2ProviderConfig } from "../../types.js"; -type JumpCloudAuthConfig = OAuthBaseProviderConfig; -/** - * Add Jump Cloud OAuth2 Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/jumpcloud - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {JumpCloudAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * JumpCloudAuthProvider({ - * client_id: process.env.JUMP_CLOUD_CLIENT_ID as string, - * client_secret: process.env.JUMP_CLOUD_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - */ -declare function JumpCloudAuthProvider(config: JumpCloudAuthConfig): OAuth2ProviderConfig; -export default JumpCloudAuthProvider; -//# sourceMappingURL=jumpcloud.d.ts.map \ No newline at end of file diff --git a/dist/providers/oauth2/jumpcloud.d.ts.map b/dist/providers/oauth2/jumpcloud.d.ts.map deleted file mode 100644 index 4b58c85..0000000 --- a/dist/providers/oauth2/jumpcloud.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"jumpcloud.d.ts","sourceRoot":"","sources":["../../../src/providers/oauth2/jumpcloud.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,gBAAgB,CAAA;AASvB,KAAK,mBAAmB,GAAG,uBAAuB,CAAA;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,iBAAS,qBAAqB,CAC5B,MAAM,EAAE,mBAAmB,GAC1B,oBAAoB,CAoBtB;AAED,eAAe,qBAAqB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/jumpcloud.js b/dist/providers/oauth2/jumpcloud.js deleted file mode 100644 index b828d28..0000000 --- a/dist/providers/oauth2/jumpcloud.js +++ /dev/null @@ -1,55 +0,0 @@ -const authorization_server = { - issuer: "https://oauth.id.jumpcloud.com/", - authorization_endpoint: "https://oauth.id.jumpcloud.com/oauth2/auth", - token_endpoint: "https://oauth.id.jumpcloud.com/oauth2/token", - userinfo_endpoint: "https://oauth.id.jumpcloud.com/userinfo", -}; -/** - * Add Jump Cloud OAuth2 Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/jumpcloud - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {JumpCloudAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * JumpCloudAuthProvider({ - * client_id: process.env.JUMP_CLOUD_CLIENT_ID as string, - * client_secret: process.env.JUMP_CLOUD_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - */ -function JumpCloudAuthProvider(config) { - const { overrideScope, ...restConfig } = config; - return { - ...restConfig, - id: "jumpcloud", - scope: overrideScope ?? "openid email profile", - authorization_server, - name: "Jump Cloud", - algorithm: "oauth2", - kind: "oauth", - profile: (profile) => { - return { - sub: profile.email, - name: profile.name, - email: profile.email, - picture: profile.picture, - }; - }, - }; -} -export default JumpCloudAuthProvider; -//# sourceMappingURL=jumpcloud.js.map \ No newline at end of file diff --git a/dist/providers/oauth2/jumpcloud.js.map b/dist/providers/oauth2/jumpcloud.js.map deleted file mode 100644 index ec628ef..0000000 --- a/dist/providers/oauth2/jumpcloud.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"jumpcloud.js","sourceRoot":"","sources":["../../../src/providers/oauth2/jumpcloud.ts"],"names":[],"mappings":"AAOA,MAAM,oBAAoB,GAA8B;IACtD,MAAM,EAAE,iCAAiC;IACzC,sBAAsB,EAAE,4CAA4C;IACpE,cAAc,EAAE,6CAA6C;IAC7D,iBAAiB,EAAE,yCAAyC;CAC7D,CAAA;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,SAAS,qBAAqB,CAC5B,MAA2B;IAE3B,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,oBAAoB;QACpB,IAAI,EAAE,YAAY;QAClB,SAAS,EAAE,QAAQ;QACnB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,KAAe;gBAC5B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,qBAAqB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/twitch.d.ts b/dist/providers/oauth2/twitch.d.ts deleted file mode 100644 index b0f00bc..0000000 --- a/dist/providers/oauth2/twitch.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import type { OAuth2ProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; -type TwitchAuthConfig = OAuthBaseProviderConfig; -/** - * Add Twitch OAuth2 Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/twitch - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {TwitchAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * TwitchAuthProvider({ - * client_id: process.env.TWITCH_CLIENT_ID as string, - * client_secret: process.env.TWITCH_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - */ -declare function TwitchAuthProvider(config: TwitchAuthConfig): OAuth2ProviderConfig; -export default TwitchAuthProvider; -//# sourceMappingURL=twitch.d.ts.map \ No newline at end of file diff --git a/dist/providers/oauth2/twitch.d.ts.map b/dist/providers/oauth2/twitch.d.ts.map deleted file mode 100644 index 66f2a1b..0000000 --- a/dist/providers/oauth2/twitch.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"twitch.d.ts","sourceRoot":"","sources":["../../../src/providers/oauth2/twitch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EAEpB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AASvB,KAAK,gBAAgB,GAAG,uBAAuB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,iBAAS,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,oBAAoB,CA2B1E;AAED,eAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oauth2/twitch.js b/dist/providers/oauth2/twitch.js deleted file mode 100644 index 9691d24..0000000 --- a/dist/providers/oauth2/twitch.js +++ /dev/null @@ -1,63 +0,0 @@ -const authorization_server = { - issuer: "https://id.twitch.tv/oauth2", - authorization_endpoint: "https://id.twitch.tv/oauth2/authorize", - token_endpoint: "https://id.twitch.tv/oauth2/token", - userinfo_endpoint: "https://id.twitch.tv/oauth2/userinfo", -}; -/** - * Add Twitch OAuth2 Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/twitch - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {TwitchAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * TwitchAuthProvider({ - * client_id: process.env.TWITCH_CLIENT_ID as string, - * client_secret: process.env.TWITCH_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - */ -function TwitchAuthProvider(config) { - const { overrideScope, ...restConfig } = config; - return { - ...restConfig, - id: "twitch", - scope: overrideScope ?? "openid user:read:email", - authorization_server, - name: "Twitch", - algorithm: "oauth2", - kind: "oauth", - params: { - scope: overrideScope ?? "openid user:read:email", - claims: JSON.stringify({ - id_token: { email: null, picture: null, preferred_username: null }, - userinfo: { email: null, picture: null, preferred_username: null }, - }), - }, - profile: (profile) => { - return { - sub: profile.sub, - name: profile.name, - email: profile.email, - picture: profile.picture, - }; - }, - }; -} -export default TwitchAuthProvider; -//# sourceMappingURL=twitch.js.map \ No newline at end of file diff --git a/dist/providers/oauth2/twitch.js.map b/dist/providers/oauth2/twitch.js.map deleted file mode 100644 index 6071420..0000000 --- a/dist/providers/oauth2/twitch.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"twitch.js","sourceRoot":"","sources":["../../../src/providers/oauth2/twitch.ts"],"names":[],"mappings":"AAOA,MAAM,oBAAoB,GAA8B;IACtD,MAAM,EAAE,6BAA6B;IACrC,sBAAsB,EAAE,uCAAuC;IAC/D,cAAc,EAAE,mCAAmC;IACnD,iBAAiB,EAAE,sCAAsC;CAC1D,CAAA;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,SAAS,kBAAkB,CAAC,MAAwB;IAClD,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,aAAa,IAAI,wBAAwB;QAChD,oBAAoB;QACpB,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,QAAQ;QACnB,IAAI,EAAE,OAAO;QACb,MAAM,EAAE;YACN,KAAK,EAAE,aAAa,IAAI,wBAAwB;YAChD,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC;gBACrB,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE;gBAClE,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE;aACnE,CAAC;SACH;QACD,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/apple.d.ts b/dist/providers/oidc/apple.d.ts deleted file mode 100644 index e25aefc..0000000 --- a/dist/providers/oidc/apple.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { OAuthBaseProviderConfig, OIDCProviderConfig } from "../../types.js"; -interface AppleAuthConfig extends OAuthBaseProviderConfig { - client_id: string; - params?: Record; -} -/** - * Add Apple OIDC Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/apple - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import { authPlugin } from "payload-auth-plugin" - * import { AppleOIDCAuthProvider } from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * AppleOIDCAuthProvider({ - * client_id: process.env.APPLE_CLIENT_ID as string, - * }) - * ] - * }) - * ``` - * - */ -declare function AppleOIDCAuthProvider(config: AppleAuthConfig): OIDCProviderConfig; -export default AppleOIDCAuthProvider; -//# sourceMappingURL=apple.d.ts.map \ No newline at end of file diff --git a/dist/providers/oidc/apple.d.ts.map b/dist/providers/oidc/apple.d.ts.map deleted file mode 100644 index c8c2af1..0000000 --- a/dist/providers/oidc/apple.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"apple.d.ts","sourceRoot":"","sources":["../../../src/providers/oidc/apple.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,gBAAgB,CAAA;AAEvB,UAAU,eAAgB,SAAQ,uBAAuB;IACvD,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,iBAAS,qBAAqB,CAAC,MAAM,EAAE,eAAe,GAAG,kBAAkB,CAmB1E;AAED,eAAe,qBAAqB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/apple.js b/dist/providers/oidc/apple.js deleted file mode 100644 index 9d9b345..0000000 --- a/dist/providers/oidc/apple.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Add Apple OIDC Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/apple - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import { authPlugin } from "payload-auth-plugin" - * import { AppleOIDCAuthProvider } from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * AppleOIDCAuthProvider({ - * client_id: process.env.APPLE_CLIENT_ID as string, - * }) - * ] - * }) - * ``` - * - */ -function AppleOIDCAuthProvider(config) { - const { overrideScope, ...restConfig } = config; - return { - ...restConfig, - id: "apple", - scope: overrideScope ?? "openid name email", - issuer: "https://appleid.apple.com", - name: "Apple", - algorithm: "oidc", - kind: "oauth", - profile: (profile) => { - return { - sub: profile.sub, - name: profile.name, - email: profile.email, - picture: profile.picture, - }; - }, - }; -} -export default AppleOIDCAuthProvider; -//# sourceMappingURL=apple.js.map \ No newline at end of file diff --git a/dist/providers/oidc/apple.js.map b/dist/providers/oidc/apple.js.map deleted file mode 100644 index 96c1294..0000000 --- a/dist/providers/oidc/apple.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"apple.js","sourceRoot":"","sources":["../../../src/providers/oidc/apple.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,SAAS,qBAAqB,CAAC,MAAuB;IACpD,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAC/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,aAAa,IAAI,mBAAmB;QAC3C,MAAM,EAAE,2BAA2B;QACnC,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,qBAAqB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/cognito.d.ts b/dist/providers/oidc/cognito.d.ts deleted file mode 100644 index a4e5aaa..0000000 --- a/dist/providers/oidc/cognito.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { OIDCProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; -interface CognitoAuthConfig extends OAuthBaseProviderConfig { - domain: string; -} -/** - * Add Cognito OIDC Provider - * - * #### Callback or Redirect URL pattern - * ``` - * https://example.com/api/{name}/oauth/callback/cognito - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import { authPlugin } from "payload-auth-plugin" - * import { CognitoAuthProvider } from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * CognitoAuthProvider({ - * client_id: process.env.COGNITO_CLIENT_ID as string, - * client_secret: process.env.COGNITO_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - * - */ -declare function CognitoAuthProvider(config: CognitoAuthConfig): OIDCProviderConfig; -export default CognitoAuthProvider; -//# sourceMappingURL=cognito.d.ts.map \ No newline at end of file diff --git a/dist/providers/oidc/cognito.d.ts.map b/dist/providers/oidc/cognito.d.ts.map deleted file mode 100644 index 8b635e5..0000000 --- a/dist/providers/oidc/cognito.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cognito.d.ts","sourceRoot":"","sources":["../../../src/providers/oidc/cognito.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,UAAU,iBAAkB,SAAQ,uBAAuB;IACzD,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,iBAAS,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,GAAG,kBAAkB,CAmB1E;AAED,eAAe,mBAAmB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/cognito.js b/dist/providers/oidc/cognito.js deleted file mode 100644 index 72ce563..0000000 --- a/dist/providers/oidc/cognito.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Add Cognito OIDC Provider - * - * #### Callback or Redirect URL pattern - * ``` - * https://example.com/api/{name}/oauth/callback/cognito - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import { authPlugin } from "payload-auth-plugin" - * import { CognitoAuthProvider } from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * CognitoAuthProvider({ - * client_id: process.env.COGNITO_CLIENT_ID as string, - * client_secret: process.env.COGNITO_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - * - */ -function CognitoAuthProvider(config) { - const { domain, overrideScope, ...restConfig } = config; - return { - ...restConfig, - id: "cognito", - scope: overrideScope ?? "email openid profile", - issuer: domain, - name: "Congnito", - algorithm: "oidc", - kind: "oauth", - profile: (profile) => { - return { - sub: profile.sub, - name: profile.name, - email: profile.email, - picture: profile.picture, - }; - }, - }; -} -export default CognitoAuthProvider; -//# sourceMappingURL=cognito.js.map \ No newline at end of file diff --git a/dist/providers/oidc/cognito.js.map b/dist/providers/oidc/cognito.js.map deleted file mode 100644 index 49f9b00..0000000 --- a/dist/providers/oidc/cognito.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cognito.js","sourceRoot":"","sources":["../../../src/providers/oidc/cognito.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,SAAS,mBAAmB,CAAC,MAAyB;IACpD,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IACvD,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,UAAU;QAChB,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,mBAAmB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/gitlab.d.ts b/dist/providers/oidc/gitlab.d.ts deleted file mode 100644 index 2a676e1..0000000 --- a/dist/providers/oidc/gitlab.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { OIDCProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; -type GitLabAuthConfig = OAuthBaseProviderConfig; -/** - * Add GitLab OIDC Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/gitlab - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import { authPlugin } from "payload-auth-plugin" - * import { GitLabAuthProvider } from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * GitLabAuthProvider({ - * client_id: process.env.GITLAB_CLIENT_ID as string, - * client_secret: process.env.GITLAB_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - * - */ -declare function GitLabAuthProvider(config: GitLabAuthConfig): OIDCProviderConfig; -export default GitLabAuthProvider; -//# sourceMappingURL=gitlab.d.ts.map \ No newline at end of file diff --git a/dist/providers/oidc/gitlab.d.ts.map b/dist/providers/oidc/gitlab.d.ts.map deleted file mode 100644 index c38a115..0000000 --- a/dist/providers/oidc/gitlab.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gitlab.d.ts","sourceRoot":"","sources":["../../../src/providers/oidc/gitlab.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,KAAK,gBAAgB,GAAG,uBAAuB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,iBAAS,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,kBAAkB,CAoBxE;AAED,eAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/gitlab.js b/dist/providers/oidc/gitlab.js deleted file mode 100644 index 2fe077b..0000000 --- a/dist/providers/oidc/gitlab.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Add GitLab OIDC Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/gitlab - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import { authPlugin } from "payload-auth-plugin" - * import { GitLabAuthProvider } from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * GitLabAuthProvider({ - * client_id: process.env.GITLAB_CLIENT_ID as string, - * client_secret: process.env.GITLAB_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - * - */ -function GitLabAuthProvider(config) { - const { overrideScope, ...restConfig } = config; - return { - ...restConfig, - id: "gitlab", - scope: overrideScope ?? "openid email profile", - issuer: "https://gitlab.com", - name: "GitLab", - algorithm: "oidc", - kind: "oauth", - profile: (profile) => { - return { - sub: profile.sub, - name: profile.name, - email: profile.email, - picture: profile.picture, - }; - }, - }; -} -export default GitLabAuthProvider; -//# sourceMappingURL=gitlab.js.map \ No newline at end of file diff --git a/dist/providers/oidc/gitlab.js.map b/dist/providers/oidc/gitlab.js.map deleted file mode 100644 index 2ac70b7..0000000 --- a/dist/providers/oidc/gitlab.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gitlab.js","sourceRoot":"","sources":["../../../src/providers/oidc/gitlab.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,SAAS,kBAAkB,CAAC,MAAwB;IAClD,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,MAAM,EAAE,oBAAoB;QAC5B,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/google.d.ts b/dist/providers/oidc/google.d.ts deleted file mode 100644 index 876cdbb..0000000 --- a/dist/providers/oidc/google.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import type { OIDCProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; -type GoogleAuthConfig = OAuthBaseProviderConfig; -/** - * Add Google OIDC Provider - * - * ``` - * https://example.com/api/{name}/oauth/callback/google - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {GoogleAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * GoogleAuthProvider({ - * client_id: process.env.GOOGLE_CLIENT_ID as string, - * client_secret: process.env.GOOGLE_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - */ -declare function GoogleAuthProvider(config: GoogleAuthConfig): OIDCProviderConfig; -export default GoogleAuthProvider; -//# sourceMappingURL=google.d.ts.map \ No newline at end of file diff --git a/dist/providers/oidc/google.d.ts.map b/dist/providers/oidc/google.d.ts.map deleted file mode 100644 index 08349e7..0000000 --- a/dist/providers/oidc/google.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/providers/oidc/google.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,KAAK,gBAAgB,GAAG,uBAAuB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,iBAAS,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,kBAAkB,CAoBxE;AAED,eAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/google.js b/dist/providers/oidc/google.js deleted file mode 100644 index 02a9be9..0000000 --- a/dist/providers/oidc/google.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Add Google OIDC Provider - * - * ``` - * https://example.com/api/{name}/oauth/callback/google - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {GoogleAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * GoogleAuthProvider({ - * client_id: process.env.GOOGLE_CLIENT_ID as string, - * client_secret: process.env.GOOGLE_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - */ -function GoogleAuthProvider(config) { - const { overrideScope, ...restConfig } = config; - return { - ...config, - id: "google", - scope: overrideScope ?? "openid email profile", - issuer: "https://accounts.google.com", - name: "Google", - algorithm: "oidc", - kind: "oauth", - profile: (profile) => { - return { - sub: profile.sub, - name: profile.name, - email: profile.email, - picture: profile.picture, - }; - }, - }; -} -export default GoogleAuthProvider; -//# sourceMappingURL=google.js.map \ No newline at end of file diff --git a/dist/providers/oidc/google.js.map b/dist/providers/oidc/google.js.map deleted file mode 100644 index 6eabe3b..0000000 --- a/dist/providers/oidc/google.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"google.js","sourceRoot":"","sources":["../../../src/providers/oidc/google.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,SAAS,kBAAkB,CAAC,MAAwB;IAClD,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,MAAM;QACT,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,MAAM,EAAE,6BAA6B;QACrC,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/keycloak.d.ts b/dist/providers/oidc/keycloak.d.ts deleted file mode 100644 index 93bc4b7..0000000 --- a/dist/providers/oidc/keycloak.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import type { OIDCProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; -interface KeyCloakAuthConfig extends OAuthBaseProviderConfig { - realm: string; - domain: string; - identifier: string; - name: string; -} -/** - * Add KeyCloak OIDC Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{app_name}/oauth/callback/{name} - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {KeyCloakAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * KeyCloakAuthProvider({ - * realm: process.env.KEYCLOAK_REALM as string, - * domain: process.env.KEYCLOAK_DOMAIN as string, - * identifier: process.env.KEYCLOAK_IDENTIFIER as string, - * name: process.env.KEYCLOAK_NAME as string, - * client_id: process.env.KEYCLOAK_CLIENT_ID as string, - * client_secret: process.env.KEYCLOAK_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - * - */ -declare function KeyCloakAuthProvider(config: KeyCloakAuthConfig): OIDCProviderConfig; -export default KeyCloakAuthProvider; -//# sourceMappingURL=keycloak.d.ts.map \ No newline at end of file diff --git a/dist/providers/oidc/keycloak.d.ts.map b/dist/providers/oidc/keycloak.d.ts.map deleted file mode 100644 index 22833f0..0000000 --- a/dist/providers/oidc/keycloak.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keycloak.d.ts","sourceRoot":"","sources":["../../../src/providers/oidc/keycloak.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,UAAU,kBAAmB,SAAQ,uBAAuB;IAC1D,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,iBAAS,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAoB5E;AAED,eAAe,oBAAoB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/keycloak.js b/dist/providers/oidc/keycloak.js deleted file mode 100644 index 3c19b0a..0000000 --- a/dist/providers/oidc/keycloak.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Add KeyCloak OIDC Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{app_name}/oauth/callback/{name} - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {KeyCloakAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * KeyCloakAuthProvider({ - * realm: process.env.KEYCLOAK_REALM as string, - * domain: process.env.KEYCLOAK_DOMAIN as string, - * identifier: process.env.KEYCLOAK_IDENTIFIER as string, - * name: process.env.KEYCLOAK_NAME as string, - * client_id: process.env.KEYCLOAK_CLIENT_ID as string, - * client_secret: process.env.KEYCLOAK_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - * - */ -function KeyCloakAuthProvider(config) { - const { realm, domain, identifier, name, overrideScope, ...restConfig } = config; - return { - ...restConfig, - id: identifier, - scope: overrideScope ?? "email openid profile", - issuer: `https://${domain}/realms/${realm}`, - name, - algorithm: "oidc", - kind: "oauth", - profile: (profile) => { - return { - sub: profile.sub, - name: profile.name, - email: profile.email, - picture: profile.picture, - }; - }, - }; -} -export default KeyCloakAuthProvider; -//# sourceMappingURL=keycloak.js.map \ No newline at end of file diff --git a/dist/providers/oidc/keycloak.js.map b/dist/providers/oidc/keycloak.js.map deleted file mode 100644 index 96040e9..0000000 --- a/dist/providers/oidc/keycloak.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keycloak.js","sourceRoot":"","sources":["../../../src/providers/oidc/keycloak.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,SAAS,oBAAoB,CAAC,MAA0B;IACtD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GACrE,MAAM,CAAA;IACR,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,MAAM,EAAE,WAAW,MAAM,WAAW,KAAK,EAAE;QAC3C,IAAI;QACJ,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,oBAAoB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/microsoft-entra.d.ts b/dist/providers/oidc/microsoft-entra.d.ts deleted file mode 100644 index e155e0d..0000000 --- a/dist/providers/oidc/microsoft-entra.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -import type { OIDCProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; -type MicrosoftEntraAuthConfig = OAuthBaseProviderConfig & { - tenant_id: string; - skip_email_verification?: boolean | undefined; -}; -/** - * Add Microsoft Entra OIDC Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/msft-entra - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import { authPlugin } from "payload-auth-plugin" - * import { MicrosoftEntraAuthProvider } from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * MicrosoftEntraAuthProvider({ - * tenant_id: process.env.MICROSOFTENTRA_TENANT_ID as string, - * client_id: process.env.MICROSOFTENTRA_CLIENT_ID as string, - * client_secret: process.env.MICROSOFTENTRA_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - * - */ -declare function MicrosoftEntraAuthProvider(config: MicrosoftEntraAuthConfig): OIDCProviderConfig; -export default MicrosoftEntraAuthProvider; -//# sourceMappingURL=microsoft-entra.d.ts.map \ No newline at end of file diff --git a/dist/providers/oidc/microsoft-entra.d.ts.map b/dist/providers/oidc/microsoft-entra.d.ts.map deleted file mode 100644 index aa12c53..0000000 --- a/dist/providers/oidc/microsoft-entra.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"microsoft-entra.d.ts","sourceRoot":"","sources":["../../../src/providers/oidc/microsoft-entra.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,KAAK,wBAAwB,GAAG,uBAAuB,GAAG;IACxD,SAAS,EAAE,MAAM,CAAA;IAIjB,uBAAuB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9C,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,iBAAS,0BAA0B,CACjC,MAAM,EAAE,wBAAwB,GAC/B,kBAAkB,CAqBpB;AAED,eAAe,0BAA0B,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/microsoft-entra.js b/dist/providers/oidc/microsoft-entra.js deleted file mode 100644 index 8fa6e7e..0000000 --- a/dist/providers/oidc/microsoft-entra.js +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Add Microsoft Entra OIDC Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/msft-entra - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import { authPlugin } from "payload-auth-plugin" - * import { MicrosoftEntraAuthProvider } from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * MicrosoftEntraAuthProvider({ - * tenant_id: process.env.MICROSOFTENTRA_TENANT_ID as string, - * client_id: process.env.MICROSOFTENTRA_CLIENT_ID as string, - * client_secret: process.env.MICROSOFTENTRA_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - * - */ -function MicrosoftEntraAuthProvider(config) { - const { overrideScope, ...restConfig } = config; - return { - ...restConfig, - id: "msft-entra", - scope: overrideScope ?? "openid profile email offline_access", - issuer: `https://login.microsoftonline.com/${config.tenant_id}/v2.0`, - name: "Microsoft Entra", - algorithm: "oidc", - kind: "oauth", - profile: (profile) => { - const email = profile.email; - return { - sub: profile.sub, - name: profile.name, - email: email.toLowerCase(), - picture: profile.picture, - }; - }, - }; -} -export default MicrosoftEntraAuthProvider; -//# sourceMappingURL=microsoft-entra.js.map \ No newline at end of file diff --git a/dist/providers/oidc/microsoft-entra.js.map b/dist/providers/oidc/microsoft-entra.js.map deleted file mode 100644 index 3dad1bd..0000000 --- a/dist/providers/oidc/microsoft-entra.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"microsoft-entra.js","sourceRoot":"","sources":["../../../src/providers/oidc/microsoft-entra.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,SAAS,0BAA0B,CACjC,MAAgC;IAEhC,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,aAAa,IAAI,qCAAqC;QAC7D,MAAM,EAAE,qCAAqC,MAAM,CAAC,SAAS,OAAO;QACpE,IAAI,EAAE,iBAAiB;QACvB,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAe,CAAA;YACrC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE;gBAC1B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,0BAA0B,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/okta.d.ts b/dist/providers/oidc/okta.d.ts deleted file mode 100644 index b89df09..0000000 --- a/dist/providers/oidc/okta.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { OIDCProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; -interface OktaAuthConfig extends OAuthBaseProviderConfig { - domain: string; -} -declare function OktaAuthProvider(config: OktaAuthConfig): OIDCProviderConfig; -export default OktaAuthProvider; -//# sourceMappingURL=okta.d.ts.map \ No newline at end of file diff --git a/dist/providers/oidc/okta.d.ts.map b/dist/providers/oidc/okta.d.ts.map deleted file mode 100644 index 7f0d1c7..0000000 --- a/dist/providers/oidc/okta.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"okta.d.ts","sourceRoot":"","sources":["../../../src/providers/oidc/okta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,UAAU,cAAe,SAAQ,uBAAuB;IACtD,MAAM,EAAE,MAAM,CAAA;CACf;AA6CD,iBAAS,gBAAgB,CAAC,MAAM,EAAE,cAAc,GAAG,kBAAkB,CAyBpE;AAED,eAAe,gBAAgB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/okta.js b/dist/providers/oidc/okta.js deleted file mode 100644 index 9752ee3..0000000 --- a/dist/providers/oidc/okta.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Add Okta OIDC Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/{name} - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {OktaAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * OktaAuthProvider({g, - * domain: process.env.KEYCLOAK_DOMAIN as string, - * client_id: process.env.KEYCLOAK_CLIENT_ID as string, - * client_secret: process.env.KEYCLOAK_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - * - */ -function encodeString(s) { - let h = 0; - const l = s.length; - let i = 0; - if (l > 0) { - while (i < l) { - h = ((h << 5) - h + s.charCodeAt(i++)) | 0; // Bitwise operations to create a hash - } - } - return h; -} -function OktaAuthProvider(config) { - const { domain, overrideScope, ...restConfig } = config; - const stateCode = encodeString(config.client_id).toString(); - return { - ...restConfig, - id: "okta", - scope: overrideScope ?? "email openid profile", - issuer: `https://${domain}`, - name: "Okta", - algorithm: "oidc", - kind: "oauth", - params: { - state: `state-${stateCode}`, - }, - profile: (profile) => { - return { - sub: profile.sub, - name: profile.name, - email: profile.email, - picture: profile.picture, - }; - }, - }; -} -export default OktaAuthProvider; -//# sourceMappingURL=okta.js.map \ No newline at end of file diff --git a/dist/providers/oidc/okta.js.map b/dist/providers/oidc/okta.js.map deleted file mode 100644 index 0887968..0000000 --- a/dist/providers/oidc/okta.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"okta.js","sourceRoot":"","sources":["../../../src/providers/oidc/okta.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,SAAS,YAAY,CAAC,CAAS;IAC7B,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAA;IAClB,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACV,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACb,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAA,CAAC,sCAAsC;QACnF,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAsB;IAC9C,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAEvD,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAA;IAE3D,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,MAAM;QACV,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,MAAM,EAAE,WAAW,MAAM,EAAE;QAC3B,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,OAAO;QACb,MAAM,EAAE;YACN,KAAK,EAAE,SAAS,SAAS,EAAE;SAC5B;QACD,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,gBAAgB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/slack.d.ts b/dist/providers/oidc/slack.d.ts deleted file mode 100644 index 8fe7dca..0000000 --- a/dist/providers/oidc/slack.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { OIDCProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; -type SlackAuthConfig = OAuthBaseProviderConfig; -/** - * Add Slack OIDC Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/slack - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {SlackAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * SlackAuthProvider({ - * client_id: process.env.SLACK_CLIENT_ID as string, - * client_secret: process.env.SLACK_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - * - */ -declare function SlackAuthProvider(config: SlackAuthConfig): OIDCProviderConfig; -export default SlackAuthProvider; -//# sourceMappingURL=slack.d.ts.map \ No newline at end of file diff --git a/dist/providers/oidc/slack.d.ts.map b/dist/providers/oidc/slack.d.ts.map deleted file mode 100644 index 9aa3567..0000000 --- a/dist/providers/oidc/slack.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"slack.d.ts","sourceRoot":"","sources":["../../../src/providers/oidc/slack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,KAAK,eAAe,GAAG,uBAAuB,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,iBAAS,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,kBAAkB,CAoBtE;AAED,eAAe,iBAAiB,CAAA"} \ No newline at end of file diff --git a/dist/providers/oidc/slack.js b/dist/providers/oidc/slack.js deleted file mode 100644 index 20bbbf7..0000000 --- a/dist/providers/oidc/slack.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Add Slack OIDC Provider - * - * #### Callback or Redirect URL pattern - * - * ``` - * https://example.com/api/{name}/oauth/callback/slack - * ``` - * - * #### Plugin Setup - * - * ```ts - * import { Plugin } from 'payload' - * import {authPlugin} from "payload-auth-plugin" - * import {SlackAuthProvider} from "payload-auth-plugin/providers" - * - * export const plugins: Plugin[] = [ - * authPlugin({ - * providers:[ - * SlackAuthProvider({ - * client_id: process.env.SLACK_CLIENT_ID as string, - * client_secret: process.env.SLACK_CLIENT_SECRET as string, - * }) - * ] - * }) - * ] - * ``` - * - */ -function SlackAuthProvider(config) { - const { overrideScope, ...restConfig } = config; - return { - ...restConfig, - id: "slack", - scope: overrideScope ?? "openid email profile", - issuer: "https://slack.com", - name: "Slack", - algorithm: "oidc", - kind: "oauth", - profile: (profile) => { - return { - sub: profile.sub, - name: profile.name, - email: profile.email, - picture: profile.picture, - }; - }, - }; -} -export default SlackAuthProvider; -//# sourceMappingURL=slack.js.map \ No newline at end of file diff --git a/dist/providers/oidc/slack.js.map b/dist/providers/oidc/slack.js.map deleted file mode 100644 index 9bcc001..0000000 --- a/dist/providers/oidc/slack.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"slack.js","sourceRoot":"","sources":["../../../src/providers/oidc/slack.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,SAAS,iBAAiB,CAAC,MAAuB;IAChD,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAE/C,OAAO;QACL,GAAG,UAAU;QACb,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,aAAa,IAAI,sBAAsB;QAC9C,MAAM,EAAE,mBAAmB;QAC3B,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,EAAe,EAAE;YAChC,OAAO;gBACL,GAAG,EAAE,OAAO,CAAC,GAAa;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAc;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAe;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAiB;aACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,iBAAiB,CAAA"} \ No newline at end of file diff --git a/dist/providers/passkey.d.ts b/dist/providers/passkey.d.ts deleted file mode 100644 index a36b75b..0000000 --- a/dist/providers/passkey.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { PasskeyProviderConfig } from "../types.js"; -declare function PasskeyAuthProvider(): PasskeyProviderConfig; -export default PasskeyAuthProvider; -//# sourceMappingURL=passkey.d.ts.map \ No newline at end of file diff --git a/dist/providers/passkey.d.ts.map b/dist/providers/passkey.d.ts.map deleted file mode 100644 index e218b98..0000000 --- a/dist/providers/passkey.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"passkey.d.ts","sourceRoot":"","sources":["../../src/providers/passkey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAEnD,iBAAS,mBAAmB,IAAI,qBAAqB,CAKpD;AAED,eAAe,mBAAmB,CAAA"} \ No newline at end of file diff --git a/dist/providers/passkey.js b/dist/providers/passkey.js deleted file mode 100644 index 32f2197..0000000 --- a/dist/providers/passkey.js +++ /dev/null @@ -1,8 +0,0 @@ -function PasskeyAuthProvider() { - return { - id: "passkey", - kind: "passkey", - }; -} -export default PasskeyAuthProvider; -//# sourceMappingURL=passkey.js.map \ No newline at end of file diff --git a/dist/providers/passkey.js.map b/dist/providers/passkey.js.map deleted file mode 100644 index e03dda1..0000000 --- a/dist/providers/passkey.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"passkey.js","sourceRoot":"","sources":["../../src/providers/passkey.ts"],"names":[],"mappings":"AAEA,SAAS,mBAAmB;IAC1B,OAAO;QACL,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,SAAS;KAChB,CAAA;AACH,CAAC;AAED,eAAe,mBAAmB,CAAA"} \ No newline at end of file diff --git a/dist/providers/password.d.ts b/dist/providers/password.d.ts deleted file mode 100644 index fc069a3..0000000 --- a/dist/providers/password.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { PasswordProviderConfig } from "../types.js"; -type PasswordProviderOptions = { - /** - * Email templates - */ - emailTemplates: { - forgotPassword: any; - }; -}; -declare function PasswordProvider(options: PasswordProviderOptions): PasswordProviderConfig; -export default PasswordProvider; -//# sourceMappingURL=password.d.ts.map \ No newline at end of file diff --git a/dist/providers/password.d.ts.map b/dist/providers/password.d.ts.map deleted file mode 100644 index c8b3e89..0000000 --- a/dist/providers/password.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../src/providers/password.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD,KAAK,uBAAuB,GAAG;IAC7B;;OAEG;IACH,cAAc,EAAE;QACd,cAAc,EAAE,GAAG,CAAA;KACpB,CAAA;CACF,CAAA;AAED,iBAAS,gBAAgB,CACvB,OAAO,EAAE,uBAAuB,GAC/B,sBAAsB,CAMxB;AACD,eAAe,gBAAgB,CAAA"} \ No newline at end of file diff --git a/dist/providers/password.js b/dist/providers/password.js deleted file mode 100644 index d72f4a7..0000000 --- a/dist/providers/password.js +++ /dev/null @@ -1,9 +0,0 @@ -function PasswordProvider(options) { - return { - id: "password", - kind: "password", - ...options, - }; -} -export default PasswordProvider; -//# sourceMappingURL=password.js.map \ No newline at end of file diff --git a/dist/providers/password.js.map b/dist/providers/password.js.map deleted file mode 100644 index 16bc060..0000000 --- a/dist/providers/password.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"password.js","sourceRoot":"","sources":["../../src/providers/password.ts"],"names":[],"mappings":"AAWA,SAAS,gBAAgB,CACvB,OAAgC;IAEhC,OAAO;QACL,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,UAAU;QAChB,GAAG,OAAO;KACX,CAAA;AACH,CAAC;AACD,eAAe,gBAAgB,CAAA"} \ No newline at end of file diff --git a/dist/providers/utils.d.ts b/dist/providers/utils.d.ts deleted file mode 100644 index 7667a49..0000000 --- a/dist/providers/utils.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { ProvidersConfig, OAuthProviderConfig, PasskeyProviderConfig, PasswordProviderConfig } from "../types.js"; -/** - * Reducer function to extract the OAuth providers - * - * @internal - * @param {ProvidersConfig[]} providers - * @returns {Record} - */ -export declare function getOAuthProviders(providers: ProvidersConfig[]): Record; -/** - * Function to get the Passkey provider - * - * @export - * @param {ProvidersConfig[]} providers - * @returns {(PasskeyProviderConfig | null)} - */ -export declare function getPasskeyProvider(providers: ProvidersConfig[]): PasskeyProviderConfig | null; -/** - * Function to get the Password provider - * - * @internal - */ -export declare function getPasswordProvider(providers: ProvidersConfig[]): PasswordProviderConfig | null; -//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/dist/providers/utils.d.ts.map b/dist/providers/utils.d.ts.map deleted file mode 100644 index 9762eb9..0000000 --- a/dist/providers/utils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/providers/utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,aAAa,CAAA;AAEpB;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,eAAe,EAAE,GAC3B,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAWrC;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,eAAe,EAAE,GAC3B,qBAAqB,GAAG,IAAI,CAQ9B;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,eAAe,EAAE,GAC3B,sBAAsB,GAAG,IAAI,CAM/B"} \ No newline at end of file diff --git a/dist/providers/utils.js b/dist/providers/utils.js deleted file mode 100644 index 1bca23f..0000000 --- a/dist/providers/utils.js +++ /dev/null @@ -1,47 +0,0 @@ -import { ProviderAlreadyExists } from "../core/errors/consoleErrors.js"; -/** - * Reducer function to extract the OAuth providers - * - * @internal - * @param {ProvidersConfig[]} providers - * @returns {Record} - */ -export function getOAuthProviders(providers) { - const records = {}; - providers.map((provider) => { - if (records[provider.id]) { - throw new ProviderAlreadyExists(); - } - if (provider.kind === "oauth") { - records[provider.id] = provider; - } - }); - return records; -} -/** - * Function to get the Passkey provider - * - * @export - * @param {ProvidersConfig[]} providers - * @returns {(PasskeyProviderConfig | null)} - */ -export function getPasskeyProvider(providers) { - const passkeyProvider = providers.find((provider) => provider.kind === "passkey"); - if (passkeyProvider) { - return passkeyProvider; - } - return null; -} -/** - * Function to get the Password provider - * - * @internal - */ -export function getPasswordProvider(providers) { - const provider = providers.find((provider) => provider.kind === "password"); - if (provider) { - return provider; - } - return null; -} -//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/dist/providers/utils.js.map b/dist/providers/utils.js.map deleted file mode 100644 index 67d55dc..0000000 --- a/dist/providers/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/providers/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAQvE;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAC/B,SAA4B;IAE5B,MAAM,OAAO,GAAwC,EAAE,CAAA;IACvD,SAAS,CAAC,GAAG,CAAC,CAAC,QAAyB,EAAE,EAAE;QAC1C,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,qBAAqB,EAAE,CAAA;QACnC,CAAC;QACD,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC9B,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAA;QACjC,CAAC;IACH,CAAC,CAAC,CAAA;IACF,OAAO,OAAO,CAAA;AAChB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,SAA4B;IAE5B,MAAM,eAAe,GAAG,SAAS,CAAC,IAAI,CACpC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,CAC1C,CAAA;IACD,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,eAAe,CAAA;IACxB,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,SAA4B;IAE5B,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,UAAU,CAAC,CAAA;IAC3E,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,QAAQ,CAAA;IACjB,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"} \ No newline at end of file diff --git a/dist/types.d.ts b/dist/types.d.ts deleted file mode 100644 index 10006d1..0000000 --- a/dist/types.d.ts +++ /dev/null @@ -1,151 +0,0 @@ -import type { AuthorizationServer } from "oauth4webapi"; -import { PayloadRequest } from "payload"; -export declare enum ErrorKind { - NotFound = "NotFound", - InternalServer = "InternalServer", - BadRequest = "BadRequest", - NotAuthorized = "NotAuthorized", - NotAuthenticated = "NotAuthenticated", - Conflict = "Conflict" -} -export declare enum SuccessKind { - Created = "Created", - Updated = "Updated", - Retrieved = "Retrieved", - Deleted = "Deleted" -} -export interface AuthPluginOutput { - message: string; - kind: ErrorKind | SuccessKind; - data: unknown; - isSuccess: boolean; - isError: boolean; -} -/** - * Generic OAuth provider callback output - * - * @interface OAuthProviderOutput - * @internal - */ -interface OAuthProviderOutput { - /** - * OAuth Provider ID. Usually the slugified provider name - * - * @type {string} - */ - id: string; - /** - * OAuth provider name. For example Google, Apple - * - * @type {string} - */ - name: string; - /** - * Scope of account attributes to request from the provider - * - * @type {string} - */ - scope: string; - /** - * Profile callback that returns account information requried to link with users - * - * @type {( - * profile: Record, - * ) => AccountInfo} - */ - profile: (profile: Record) => AccountInfo; -} -export interface OAuthBaseProviderConfig { - client_id: string; - client_secret?: string; - client_auth_type?: "client_secret_basic" | "client_secret_post"; - params?: Record; - /** - * Override default scope of the provider - */ - overrideScope?: string | undefined; -} -export interface OIDCProviderConfig extends OAuthProviderOutput, OAuthBaseProviderConfig { - issuer: string; - algorithm: "oidc"; - kind: "oauth"; - skip_email_verification?: boolean | undefined; -} -export interface OAuth2ProviderConfig extends OAuthProviderOutput, OAuthBaseProviderConfig { - authorization_server: AuthorizationServer; - algorithm: "oauth2"; - kind: "oauth"; -} -export type OAuthProviderConfig = OIDCProviderConfig | OAuth2ProviderConfig; -export interface AccountInfo { - sub: string; - name: string; - picture: string; - email: string; - passKey?: { - credentialId: string; - publicKey?: Uint8Array; - counter: number; - transports?: string[]; - deviceType: string; - backedUp: boolean; - }; - access_token?: string; -} -export type PasswordProviderConfig = { - id: string; - kind: "password"; - emailTemplates: { - forgotPassword: any; - }; -}; -export interface CredentialsAccountInfo { - name: string; - email: string; -} -export type PasskeyProviderConfig = { - id: string; - kind: "passkey"; -}; -export type ProvidersConfig = OAuthProviderConfig | PasskeyProviderConfig | PasswordProviderConfig; -export type AuthenticationStrategy = "Cookie"; -export type UserSession = { - createdAt: Date | string; - expiresAt: Date | string; - id: string; -}; -export interface OAuthCollections { - usersCollection: string; - accountsCollection: string; -} -export interface OAuthBaseParams { - pluginType: string; - collections: OAuthCollections; - allowOAuthAutoSignUp: boolean; - secret: string; - useAdmin: boolean; - request: PayloadRequest; - provider: OAuthProviderConfig; - successRedirectPath: string; - errorRedirectPath: string; -} -export interface OAuthHandlersParams extends OAuthBaseParams { - state?: string; -} -export interface OAuthCallbackParams extends OAuthBaseParams { -} -export interface OAuthAccountData extends Omit { - scope: string; - issuer: string; - access_token: string; -} -export interface ParsedOAuthState { - redirectPath?: string; - provider?: string; - timestamp?: number; - nonce?: string; - codeVerifier?: string; - [key: string]: unknown; -} -export {}; -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/dist/types.d.ts.map b/dist/types.d.ts.map deleted file mode 100644 index 753b49d..0000000 --- a/dist/types.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAExC,oBAAY,SAAS;IACnB,QAAQ,aAAa;IACrB,cAAc,mBAAmB;IACjC,UAAU,eAAe;IACzB,aAAa,kBAAkB;IAC/B,gBAAgB,qBAAqB;IACrC,QAAQ,aAAa;CACtB;AAED,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,OAA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EAAE,gBAAgB,CAAA;IAC7B,oBAAoB,EAAE,OAAO,CAAA;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,cAAc,CAAA;IACvB,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AACD,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,mBAAoB,SAAQ,eAAe;CAAG;AAE/D,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC;IACpE,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB"} \ No newline at end of file diff --git a/dist/types.js b/dist/types.js deleted file mode 100644 index cb54075..0000000 --- a/dist/types.js +++ /dev/null @@ -1,17 +0,0 @@ -export var ErrorKind; -(function (ErrorKind) { - ErrorKind["NotFound"] = "NotFound"; - ErrorKind["InternalServer"] = "InternalServer"; - ErrorKind["BadRequest"] = "BadRequest"; - ErrorKind["NotAuthorized"] = "NotAuthorized"; - ErrorKind["NotAuthenticated"] = "NotAuthenticated"; - ErrorKind["Conflict"] = "Conflict"; -})(ErrorKind || (ErrorKind = {})); -export var SuccessKind; -(function (SuccessKind) { - SuccessKind["Created"] = "Created"; - SuccessKind["Updated"] = "Updated"; - SuccessKind["Retrieved"] = "Retrieved"; - SuccessKind["Deleted"] = "Deleted"; -})(SuccessKind || (SuccessKind = {})); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/dist/types.js.map b/dist/types.js.map deleted file mode 100644 index 48ae2b0..0000000 --- a/dist/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,MAAM,CAAN,IAAY,SAOX;AAPD,WAAY,SAAS;IACnB,kCAAqB,CAAA;IACrB,8CAAiC,CAAA;IACjC,sCAAyB,CAAA;IACzB,4CAA+B,CAAA;IAC/B,kDAAqC,CAAA;IACrC,kCAAqB,CAAA;AACvB,CAAC,EAPW,SAAS,KAAT,SAAS,QAOpB;AAED,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,sCAAuB,CAAA;IACvB,kCAAmB,CAAA;AACrB,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB"} \ No newline at end of file