{"id":19315328,"url":"https://github.com/capacitor-community/play-integrity","last_synced_at":"2025-02-24T04:26:10.054Z","repository":{"id":217372362,"uuid":"743723568","full_name":"capacitor-community/play-integrity","owner":"capacitor-community","description":"A Capacitor plugin to use the Play Integrity API","archived":false,"fork":false,"pushed_at":"2024-04-16T16:07:30.000Z","size":163,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-26T07:25:43.114Z","etag":null,"topics":["capacitor","integrity","play","plugin"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/capacitor-community.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-15T21:05:27.000Z","updated_at":"2024-04-02T17:06:45.000Z","dependencies_parsed_at":"2024-09-18T18:25:40.503Z","dependency_job_id":null,"html_url":"https://github.com/capacitor-community/play-integrity","commit_stats":null,"previous_names":["capacitor-community/play-integrity"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capacitor-community%2Fplay-integrity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capacitor-community%2Fplay-integrity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capacitor-community%2Fplay-integrity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capacitor-community%2Fplay-integrity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/capacitor-community","download_url":"https://codeload.github.com/capacitor-community/play-integrity/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240416980,"owners_count":19797918,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["capacitor","integrity","play","plugin"],"created_at":"2024-11-10T01:06:00.198Z","updated_at":"2025-02-24T04:26:10.009Z","avatar_url":"https://github.com/capacitor-community.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cbr\u003e\u003cimg src=\"https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png\" width=\"128\" height=\"128\" /\u003e\u003c/p\u003e\n\u003ch3 align=\"center\"\u003ePLAY INTEGRITY\u003c/h3\u003e\n\u003cp align=\"center\"\u003e\u003cstrong\u003e\u003ccode\u003e@capacitor-community/play-integrity\u003c/code\u003e\u003c/strong\u003e\u003c/p\u003e\n\u003cbr\u003e\n\nThe Play Integrity API is used to verify that your app is a Genuine App Binary that has not been modified compared to what is available on the Play Store. It validates that the current user account is licensed (the user that installed or paid for your app) and whether the app is free from known malware.\n\nThis plugin calls the Play Integrity API [`requestIntegrityToken`](https://developer.android.com/google/play/integrity/classic) method which returns a token that your App's server must verify with Google Play Servers.\n\nThe call `requestIntegrityToken` will return a `token` on success which you must send to your backend for verification. See [Google's Docs on this](https://developer.android.com/google/play/integrity/classic#decrypt-verify).\n\n## Install\n\n```bash\nnpm install @capacitor-community/play-integrity\nnpx cap sync\n```\n\n## Usage\n\n```typescript\nimport { PlayIntegrity } from '@capacitor-community/play-integrity';\n...\ntry {\n      // Nonce: See https://developer.android.com/google/play/integrity/classic\n      // googleCloudProjectNumber: leave as 0 for the default for the application\n      // or get from https://console.firebase.google.com/ Project Settings \u003e General\n      const result = await PlayIntegrity.requestIntegrityToken({\n        nonce: nonce,\n        googleCloudProjectNumber: 0\n      });\n      // Use result.token and decrypt and verify the integrity verdict\n      // https://developer.android.com/google/play/integrity/classic#decrypt-verify\n      console.log(`Play Integrity Result`, result);\n    } catch (err) {\n        // Recommendation: Report to backend and exit the application\n    }\n```\n## API\n\n\u003cdocgen-index\u003e\n\n* [`requestIntegrityToken(...)`](#requestintegritytoken)\n\n\u003c/docgen-index\u003e\n\n\u003cdocgen-api\u003e\n\u003c!--Update the source file JSDoc comments and rerun docgen to update the docs below--\u003e\n\n### requestIntegrityToken(...)\n\n```typescript\nrequestIntegrityToken(options: { nonce: string; googleCloudProjectNumber: number; }) =\u003e Promise\u003c{ token: string; }\u003e\n```\n\n| Param         | Type                                                              |\n| ------------- | ----------------------------------------------------------------- |\n| **`options`** | \u003ccode\u003e{ nonce: string; googleCloudProjectNumber: number; }\u003c/code\u003e |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ token: string; }\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\u003c/docgen-api\u003e\n\n## Errors\nThe following errors can occur and should be handled.\n\n### Integrity API not available\n```\nError: -1: Integrity API error (-1): Integrity API is not available.\nIntegrity API is not enabled, or the Play Store version might be old.\nRecommended actions:\n1) Make sure that Integrity API is enabled in Google Play Console.\n2) Ask the user to update Play Store.\n (https://developer.android.com/google/play/integrity/reference/com/google/android/play/core/integrity/model/IntegrityErrorCode.html#API_NOT_AVAILABLE).\n```\n\n### Play Services not found\n```\nPlay Services not found\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapacitor-community%2Fplay-integrity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapacitor-community%2Fplay-integrity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapacitor-community%2Fplay-integrity/lists"}