{"id":17869455,"url":"https://github.com/gorokhovdv/safetynetattestation","last_synced_at":"2025-03-21T11:32:59.349Z","repository":{"id":45408598,"uuid":"297150067","full_name":"GorokhovDV/SafetyNetAttestation","owner":"GorokhovDV","description":"This lib helps develop server-based (PHP) SafetyNet Attestation from Google.","archived":false,"fork":false,"pushed_at":"2021-12-15T11:32:39.000Z","size":20,"stargazers_count":10,"open_issues_count":3,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-27T09:50:54.938Z","etag":null,"topics":["android","composer","google","packagist","php","php-library","safetynet","server-side"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GorokhovDV.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-20T19:38:22.000Z","updated_at":"2023-07-06T12:24:49.000Z","dependencies_parsed_at":"2022-08-31T01:25:21.911Z","dependency_job_id":null,"html_url":"https://github.com/GorokhovDV/SafetyNetAttestation","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GorokhovDV%2FSafetyNetAttestation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GorokhovDV%2FSafetyNetAttestation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GorokhovDV%2FSafetyNetAttestation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GorokhovDV%2FSafetyNetAttestation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GorokhovDV","download_url":"https://codeload.github.com/GorokhovDV/SafetyNetAttestation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221814987,"owners_count":16885087,"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":["android","composer","google","packagist","php","php-library","safetynet","server-side"],"created_at":"2024-10-28T10:05:20.476Z","updated_at":"2024-10-28T10:05:21.635Z","avatar_url":"https://github.com/GorokhovDV.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"SafetyNet offline/online attestation library\n===============================\n* **PHP version:** 7.4+\n* **Packagist:** [gorokhovdv/safetynet-verification](https://packagist.org/packages/gorokhovdv/safetynet-verification) [![Total Downloads](https://poser.pugx.org/gorokhovdv/safetynet-verification/downloads.png)](https://packagist.org/packages/gorokhovdv/safetynet-verification)\n* **Composer:** `composer require gorokhovdv/safetynet-verification`\n\n***\n\n## Quick Start\n\n### Install\n\nIf you use composer in your project then you can install SafetyNetAttestation as package.\n\n`composer require gorokhovdv/safetynet-verification`\n\n### Example for online verification\n\n```php\n\u003c?php\nrequire_once __DIR__ . '/../vendor/autoload.php';\n\nuse \\SafetyNet\\Config\\Config;\nuse \\SafetyNet\\Statement\\Statement;\nuse \\SafetyNet\\Attestation;\nuse \\SafetyNet\\Verifier\\VerifierType;\nuse \\SafetyNet\\Nonce;\nuse \\SafetyNet\\SafetyNetAttestationException;\n\n$attestationStatement = new Statement('RAW-JWS-STATEMENT');\n$nonce = new Nonce('Test-nonce');\n\ntry {\n\n    $attestationConfig = new Config([\n        Config::VERIFIER_TYPE =\u003e VerifierType::ONLINE(),\n        Config::VERIFIER_TIMESTAMP_DIFF =\u003e 10 * 60 * 1000,\n        Config::VERIFIER_CERTIFICATE_DIGEST_SHA256 =\u003e ['SHA-256-FINGERPRINT'],\n        Config::VERIFIER_PACKAGE_NAME =\u003e ['APK-NAME-FOR-TEST'],\n        Config::VERIFIER_API_KEY =\u003e 'GOOGLE-API-KEY',\n        Config::VERIFIER_HARDWARE_BACKED =\u003e true,\n    ]);\n\n    $attestation = new Attestation($attestationConfig);\n\n    if ($attestation-\u003everity($nonce, $attestationStatement)) {\n        echo 'Verification success!' . PHP_EOL;\n    } else {\n        echo 'Verification failed!' . PHP_EOL;\n    }\n} catch (SafetyNetAttestationException $e) {\n    echo $e-\u003egetMessage() . PHP_EOL;\n}\n```\n\n### Example for offline verification\n\n```php\n\u003c?php\nrequire_once __DIR__ . '/../vendor/autoload.php';\n\nuse \\SafetyNet\\Config\\Config;\nuse \\SafetyNet\\Statement\\Statement;\nuse \\SafetyNet\\Attestation;\nuse \\SafetyNet\\Verifier\\VerifierType;\nuse \\SafetyNet\\Nonce;\nuse \\SafetyNet\\SafetyNetAttestationException;\n\n$attestationStatement = new Statement('RAW-JWS-STATEMENT');\n$nonce = new Nonce('Test-nonce');\n\ntry {\n\n    $attestationConfig = new Config([\n        Config::VERIFIER_TYPE =\u003e VerifierType::OFFLINE(),\n        Config::VERIFIER_TIMESTAMP_DIFF =\u003e 10 * 60 * 1000,\n        Config::VERIFIER_CERTIFICATE_DIGEST_SHA256 =\u003e ['SHA-256-FINGERPRINT'],\n        Config::VERIFIER_PACKAGE_NAME =\u003e ['APK-NAME-FOR-TEST'],\n        Config::VERIFIER_HARDWARE_BACKED =\u003e true,\n    ]);\n\n    $attestation = new Attestation($attestationConfig);\n\n    if ($attestation-\u003everity($nonce, $attestationStatement)) {\n        echo 'Verification success!' . PHP_EOL;\n    } else {\n        echo 'Verification failed!' . PHP_EOL;\n    }\n\n} catch (SafetyNetAttestationException $e) {\n    echo $e-\u003egetMessage() . PHP_EOL;\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgorokhovdv%2Fsafetynetattestation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgorokhovdv%2Fsafetynetattestation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgorokhovdv%2Fsafetynetattestation/lists"}