{"bugs":{"url":"https://github.com/clerkinc/javascript/issues"},"dist":{"shasum":"43c4319e3edc3f92d5ef45dd51b98be175244a0b","tarball":"https://registry.npmjs.org/@clerk/backend-core/-/backend-core-2.11.1-staging.3.tgz","fileCount":347,"integrity":"sha512-tjU0WI7pMMORmQvcc5M/HRDfFfcnF1msl1sA/rwDvR0IalTyznDUrV/D77YJR/zzZmm2e2z0eWsURoHdpPpAYg==","signatures":[{"sig":"MEQCIHic+5mOTp+NLhQt2sf30KBz2534R0S0ADJkL5Jrz5CtAiA/jbiPY6ArONoWsViCvdREqYkwneS0mS1xYVgn+Jx1fw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":581616,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjc2XnACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoTVA//ZE8TUsHkvUgztIaD021QoN7Io0CBJmw+0HRe4PfqHIkva+Qx\r\nMK6qO4zQWlAszjbj49NfWQT2fDoDSSTVVxJYypozWGgyu092IrDje1tkyYPl\r\nsnU4ZU1Kuqpz5vAXf7OYRTvlkS45F2z4gdF8N3N79UNgg7RzJtuiG7TJ7+IL\r\nBD8BDlAUFF0l/hiFYYj/sYCWBxBPs6RuNHy4WQmP/tsU8s2hnUVBgAxj5WRb\r\n+fspJMwUSdjigTREJoqAYue2k/etRH9tHNK/GxVLBsPhvasLTkszL3oK5Qt5\r\nk3tXgRsV0gfVvVz9Ig6kwG7jlVkLTUkET9snL8jLUW45LCcB0XGEqV2Vs36l\r\nvqjBdnDmwXhpSN6Z484Zb4RmsOBaCr31+x8esdE6xmReKUacEulCqeF/gakB\r\n61wEkflSfTgcQRAh3PGmGd3xj7JJerr00YNFgWVfUHlEhp79/Wwj/ao0wsbi\r\nR4k0skR+0pFT1SehDg3vUKyC5wDKsDgV6MHUMvIjO4V6qZiYgMvOOQeE6QBo\r\nOuavLlXrXbyawJZqukS3+0ZQ6OcVcZZZjf2dxiphLjdo5rW6oVif4/wdhTAy\r\npWKwxzzj+viPE00EiurGgnjhPJ/F/LieMplVYllPuVgQU5NX4Gm0L1754a6W\r\nnIAAO0M9w+QSNa9v1TQCvzmxMOzeep/6Vq4=\r\n=xcml\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","name":"@clerk/backend-core","type":"module","module":"dist/mjs/index.js","readme":"<p align=\"center\">\n  <a href=\"https://clerk.dev?utm_source=github&utm_medium=clerk_backend_core\" target=\"_blank\" rel=\"noopener noreferrer\">\n    <img src=\"https://images.clerk.dev/static/clerk.svg\" alt=\"Clerk logo\" height=\"50\">\n  </a>\n  <br />\n</p>\n\n# @clerk/backend-core\n\n<div align=\"center\">\n\n[![Chat on Discord](https://img.shields.io/discord/856971667393609759.svg?logo=discord)](https://discord.com/invite/b5rXHjAg7A)\n[![Clerk documentation](https://img.shields.io/badge/documentation-clerk-green.svg)](https://clerk.dev/docs?utm_source=github&utm_medium=clerk_backend_core)\n[![Follow on Twitter](https://img.shields.io/twitter/follow/ClerkDev?style=social)](https://twitter.com/intent/follow?screen_name=ClerkDev)\n\n[Changelog](https://github.com/clerkinc/javascript/blob/main/packages/backend-core/CHANGELOG.md)\n·\n[Report a Bug](https://github.com/clerkinc/javascript/issues/new?assignees=&labels=bug&template=bug_report.md&title=Bug%3A+)\n·\n[Request a Feature](https://github.com/clerkinc/javascript/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=Feature%3A+)\n·\n[Ask a Question](https://github.com/clerkinc/javascript/issues/new?assignees=&labels=question&template=ask_a_question.md&title=Support%3A+)\n\n</div>\n\n---\n\n## Overview\n\nThis package provides Clerk Backend API core resources and low-level authentication utilities for JavaScript environments. It is mostly used as the base for other Clerk SDKs.\n\n## Getting Started\n\n### Installation\n\n```sh\nnpm install @clerk/backend-core\n```\n\n### Build\n\nTo build the package locally with the TypeScript compiler, run:\n\n```sh\nnpm run build\n```\n\n## Architecture\n\n`@clerk/backend-core` contains all the logic for basic Clerk functionalities, without being platform/environment, specific such as:\n\n- Determining the authentication state of a session.\n- Validating a Clerk token state.\n- Clerk API resource management.\n\n### How it works\n\nThis package is used as the base building block for Clerk JavaScript SDKs and environments. This is achieved by providing all the required business logic if only a few environment-specific utilities are implemented by the client.\n\n<p align=\"center\">\n  <a href=\"https://clerk.dev/\" target=\"_blank\" align=\"center\">\n    <img src=\"https://images.clerk.dev/static/backend_api_architecture.png\" height=\"350\">\n  </a>\n  <br />\n</p>\n\nIn essence, the client should supply these key functions in the Clerk [Base](./src/Base.ts#47) and [ClerkBackendApi](./src/api/ClerkBackendApi.ts) classes:\n\n1. Public key import `importKeyFunction`.\n2. JWT signature verification `verifySignatureFunction`.\n3. Base64 decoding `decodeBase64Function`.\n4. HTTP fetching utility for the API resource management `ClerkFetcher`.\n\nAfter supplying those in the `Base` and `ClerkBackendApi` classes, you can use all the Clerk utilities required for the SDK business logic.\n\n## Usage\n\n### Creating a Base for a new SDK\n\n```ts\nconst importKey = async (jwk: JsonWebKey, algorithm: Algorithm) => {\n  //  ...\n};\n\nconst verifySignature = async (algorithm: Algorithm, key: CryptoKey, signature: Uint8Array, data: Uint8Array) => {\n  // ...\n};\n\nconst decodeBase64 = (base64: string) => {\n  // ...\n};\n\n/** Base initialization */\nconst examplePlatformBase = new Base(importKey, verifySignature, decodeBase64);\n```\n\nAfter creating the `Base` instance you can use core functions such as:\n\n```ts\nexamplePlatformBase.verifySessionToken(...);\n\nexamplePlatformBase.getAuthState(...);\n```\n\nThe `Base` utilities include the building blocks for developing any extra logic and middleware required for the target platform.\n\n### Validate the Authorized Party of a session token\n\nClerk's JWT session token, contains the azp claim, which equals the Origin of the request during token generation. You can provide a list of whitelisted origins to verify against, during every token verification, to protect your application of the subdomain cookie leaking attack. You can find an example below:\n\n```ts\nconst authorizedParties = ['http://localhost:3000', 'https://example.com'];\n\nexamplePlatformBase.verifySessionToken(token > { authorizedParties });\n```\n\n### Clerk API Resources\n\nAPI resource management is also provided by this package through the [ClerkBackendApi](./src/api/ClerkBackendApi.ts) class. For more information on the API resources you can checkout the [resource documentation page](https://reference.clerk.dev/reference/backend-api-reference).\n\nTo use the Clerk Backend API wrapper in any JavaScript platform, you would need to provide some specific SDK information and an HTTP fetching utility. See more at the [ClerkBackendAPIProps](./src/api/ClerkBackendApi.ts#17) implementation.\n\n## Support\n\nYou can get in touch with us in any of the following ways:\n\n- Join our official community [Discord server](https://discord.com/invite/b5rXHjAg7A)\n- Open a [GitHub support issue](https://github.com/clerkinc/javascript/issues/new?assignees=&labels=question&template=ask_a_question.md&title=Support%3A+)\n- Contact options listed on [our Support page](https://clerk.dev/support?utm_source=github&utm_medium=clerk_backend_core)\n\n## Contributing\n\nWe're open to all community contributions! If you'd like to contribute in any way, please read [our contribution guidelines](https://github.com/clerkinc/javascript/blob/main/packages/backend-core/docs/CONTRIBUTING.md).\n\n## Security\n\n`@clerk/backend-core` follows good practices of security, but 100% security cannot be assured.\n\n`@clerk/backend-core` is provided **\"as is\"** without any **warranty**. Use at your own risk.\n\n_For more information and to report security issues, please refer to our [security documentation](https://github.com/clerkinc/javascript/blob/main/packages/backend-core/docs/SECURITY.md)._\n\n## License\n\nThis project is licensed under the **MIT license**.\n\nSee [LICENSE](https://github.com/clerkinc/javascript/blob/main/packages/backend-core/LICENSE) for more information.\n","engines":{"node":">=14"},"gitHead":"d97b61fcb4ff4ff01c7a4446dbe8896b1fe2ea6d","license":"MIT","scripts":{"dev":"tsc -p tsconfig.esm.json --watch","lint":"eslint .","test":"jest","build":"tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && ./moduleTypeFix","clean":"rimraf ./dist"},"_npmUser":{"name":"nikosdouvlis","email":"nikosdouvlis@gmail.com"},"homepage":"https://clerk.dev/","deprecated":"This package has been deprecated - use @clerk/backend instead","repository":{"url":"git+https://github.com/clerkinc/javascript.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v18.12.0+arm64 (darwin)","description":"Clerk Backend API core resources and authentication utilities for JavaScript environments.","directories":{},"maintainers":[{"name":"giannis-clerk","email":"giannis@clerk.dev"},{"name":"igneel64","email":"p.perlepes@gmail.com"},{"name":"chanioxaris","email":"haris@clerk.dev"},{"name":"agis-clerk","email":"agis@clerk.dev"},{"name":"colinclerk","email":"colin@clerk.dev"},{"name":"bradenclerk","email":"braden@clerk.dev"},{"name":"sokratis","email":"sokratis.vidros@gmail.com"},{"name":"yourtallness","email":"mark@clerk.dev"},{"name":"nikosdouvlis","email":"nikosdouvlis@gmail.com"}],"_nodeVersion":"18.12.0","dependencies":{"tslib":"^2.3.1","node-fetch":"^2.6.0","@types/node":"^16.11.55","@clerk/types":"^3.16.0-staging.0","query-string":"^7.0.1","snakecase-keys":"^5.4.4","@types/node-fetch":"^2","@peculiar/webcrypto":"^1.4.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^27.4.7","nock":"^13.2.1","ts-jest":"^27.1.3","typescript":"*","@types/jest":"^27.4.0"},"_npmOperationalInternal":{"tmp":"tmp/backend-core_2.11.1-staging.3_1668507111372_0.030653416502127273","host":"s3://npm-registry-packages"},"_id":"@clerk/backend-core@2.11.1-staging.3","version":"2.11.1-staging.3"}