{"_id":"@altcha/firebase-app-check","name":"@altcha/firebase-app-check","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@altcha/firebase-app-check","version":"0.0.1","description":"Firebase App Check provider.","author":{"name":"Daniel Regeci","url":"https://altcha.org"},"homepage":"https://altcha.org","repository":{"type":"git","url":"git+https://github.com/altcha-org/firebase-app-check.git"},"license":"MIT","keywords":["altcha","firebase","appcheck"],"main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","type":"module","scripts":{"build":"rimraf dist && rimraf cjs/dist && tsc -b tsconfig.build.json tsconfig.cjs.json","eslint":"eslint ./lib/**/*","format":"prettier --write './(lib|tests)/**/*'","test":"vitest --run","prepare":"husky"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./cjs/dist/index.js","default":"./dist/index.js"}},"devDependencies":{"@types/node":"^20.16.3","@typescript-eslint/eslint-plugin":"^8.4.0","eslint":"^8.57.0","husky":"^9.1.5","prettier":"^3.3.3","rimraf":"^5.0.10","ts-node":"^10.9.2","tsx":"^4.19.0","typescript":"^5.5.4","vitest":"^1.6.0"},"dependencies":{"altcha-lib":"^1.1.0","firebase":"^10.14.1"},"_id":"@altcha/firebase-app-check@0.0.1","gitHead":"9b6ccccf84ae95f9b05bb03dec846be9989a2bd7","bugs":{"url":"https://github.com/altcha-org/firebase-app-check/issues"},"_nodeVersion":"20.18.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-A+TdDRdw17G2IFeqwzqYPtsrtq4W6cpyjbDCj/sYqkHZeh5H7LAHQRCXvMi8Ws1Il0fJKPSEdX9OfXTiO/Y1rQ==","shasum":"4aa130e43ff9fd6378bec44f4ce45718d9e9f0e3","tarball":"https://registry.npmjs.org/@altcha/firebase-app-check/-/firebase-app-check-0.0.1.tgz","fileCount":8,"unpackedSize":9418,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@altcha%2ffirebase-app-check@0.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQChVOePeqTzroOqlkjl/cuIm/DJvAY5M00NLDCBPxqteAIgZptjzAYylM1/dMsEnZ5sEcNqi7d0ijm69DAN6za0hTM="}]},"_npmUser":{"name":"ovx","email":"getc88@gmail.com"},"directories":{},"maintainers":[{"name":"ovx","email":"getc88@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/firebase-app-check_0.0.1_1729509304476_0.7931192436931158"},"_hasShrinkwrap":false}},"time":{"created":"2024-10-21T11:15:04.366Z","0.0.1":"2024-10-21T11:15:04.672Z","modified":"2024-10-21T11:15:05.225Z"},"maintainers":[{"name":"ovx","email":"getc88@gmail.com"}],"description":"Firebase App Check provider.","homepage":"https://altcha.org","keywords":["altcha","firebase","appcheck"],"repository":{"type":"git","url":"git+https://github.com/altcha-org/firebase-app-check.git"},"author":{"name":"Daniel Regeci","url":"https://altcha.org"},"bugs":{"url":"https://github.com/altcha-org/firebase-app-check/issues"},"license":"MIT","readme":"# Firebase App Check Provider with ALTCHA\n\nThis repository provides a custom App Check provider implementation for Firebase using ALTCHA. ALTCHA is a privacy-focused proof-of-work-based system that helps secure websites and APIs from spam and unwanted content.\n\n## Usage\n\n### 1. Install the Firebase extension\n\nInstall the [ALTCHA App Check Provider](https://console.firebase.google.com/u/0/project/_/extensions/install?ref=altcha%2Faltcha-app-check-provider@0.0.4-alpha.0).\n\nDuring the installation, configure your unique secret `HMAC Key` (a sufficiently long random string). You may adjust other configuration options, though the default values are usually sufficient.\n\nCopy the URLs of the two deployed functions—you'll need to configure these in the CustomProvider.\n\n### 2. Integrate CustomProvider in your app\n\nRun the following command to add the ALTCHA provider to your project:\n\n```sh\nnpm install @altcha/firebase-app-check\n```\n\nCreate a new CustomProvider for App Check:\n\n```js\nimport { AltchaProviderOptions } from '@altcha/firebase-app-check';\n\nconst firebaseConfig = {\n  // your usual Firebase config\n  appId: '...'\n};\n\nconst app = initializeApp(firebaseConfig);\n\nconst altchaProviderOptions = new AltchaProviderOptions({\n  appId: firebaseConfig.appId,\n  createAltchaChallengeUrl: 'https://.../ext-altcha-app-check-provider-createAltchaChallenge',\n  createAppCheckTokenUrl: 'https://.../ext-altcha-app-check-provider-createAppCheckToken',\n});\nconst provider = new CustomProvider(altchaProviderOptions);\n\ninitializeAppCheck(app, { provider });\n```\n\nReplace `createAltchaChallengeUrl` and `createAppCheckTokenUrl` with URLs of the functions deployed by the extension (step 1).\n\n### Troubleshooting\n\n#### Permission 'iam.serviceAccounts.signBlob' denied\n\nIf the `createAppCheckToken` function fails with the error `Permission 'iam.serviceAccounts.signBlob' denied...`, you need to grant a new role to the extension's service account:\n\n```sh\ngcloud projects add-iam-policy-binding PROJECT_ID --member=serviceAccount:ext-altcha-app-check-provider@PROJECT_ID.iam.gserviceaccount.com --role='roles/iam.serviceAccountTokenCreator'\n```\n\nReplace `PROJECT_ID` with your actual project ID from the Firebase console.\n\n**Note:** Adding the role via the Google Console UI may not work. It's recommended to use the `gcloud` CLI to apply this role.\n\n## License\n\nMIT","readmeFilename":"README.md"}