{"id":19233849,"url":"https://github.com/danielburger1337/openid-hash-php","last_synced_at":"2025-02-23T11:43:30.710Z","repository":{"id":224149805,"uuid":"762566205","full_name":"danielburger1337/openid-hash-php","owner":"danielburger1337","description":"Create/Verify OpenID Connect (OIDC) verification hashes.","archived":false,"fork":false,"pushed_at":"2024-02-24T04:49:11.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-25T22:40:31.521Z","etag":null,"topics":["hash","oidc","openid","openid-connect"],"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/danielburger1337.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-24T04:21:26.000Z","updated_at":"2024-02-24T04:24:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"0d669bc7-57dc-4f09-a67c-14ace89feed1","html_url":"https://github.com/danielburger1337/openid-hash-php","commit_stats":null,"previous_names":["danielburger1337/openid-hash-php"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielburger1337%2Fopenid-hash-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielburger1337%2Fopenid-hash-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielburger1337%2Fopenid-hash-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielburger1337%2Fopenid-hash-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielburger1337","download_url":"https://codeload.github.com/danielburger1337/openid-hash-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240310873,"owners_count":19781341,"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":["hash","oidc","openid","openid-connect"],"created_at":"2024-11-09T16:12:05.352Z","updated_at":"2025-02-23T11:43:30.664Z","avatar_url":"https://github.com/danielburger1337.png","language":"PHP","readme":"[![PHPCSFixer](https://github.com/danielburger1337/openid-hash-php/actions/workflows/phpcsfixer.yml/badge.svg)](https://github.com/danielburger1337/openid-hash-php/actions/workflows/phpcsfixer.yml)\n[![PHPStan](https://github.com/danielburger1337/openid-hash-php/actions/workflows/phpstan.yml/badge.svg)](https://github.com/danielburger1337/openid-hash-php/actions/workflows/phpstan.yml)\n[![PHPUnit](https://github.com/danielburger1337/openid-hash-php/actions/workflows/phpunit.yml/badge.svg)](https://github.com/danielburger1337/openid-hash-php/actions/workflows/phpunit.yml)\n![Packagist Version](https://img.shields.io/packagist/v/danielburger1337/openid-hash?link=https%3A%2F%2Fpackagist.org%2Fpackages%2Fdanielburger1337%2Fopenid-hash)\n![Packagist Downloads](https://img.shields.io/packagist/dt/danielburger1337/openid-hash?link=https%3A%2F%2Fpackagist.org%2Fpackages%2Fdanielburger1337%2Fopenid-hash)\n\n# openid-hash\n\nCreate and/or verify OpenID Connect 1.0 ID Token hashes (`at_hash`, `c_hash`, `s_hash`).\n\nThis library is [PSR-4](https://www.php-fig.org/psr/psr-4/) compatible and can be installed via PHP's dependency manager [Composer](https://getcomposer.org).\n\n```shell\ncomposer require danielburger1337/openid-hash\n```\n\nThis library requires a 64-bit version of PHP.\n\n---\n\n## **How To Use**\n\nThe constructor takes two arguments. The first argument is the [JWA](https://datatracker.ietf.org/doc/html/rfc7518) algorithm the ID Token is signed with. This value can usally be found in the `alg` header parameter of the ID Token.\n\nThe second argument is only required when the ID Token is signed with the `EdDSA` algorithm. This argument must then contain the `crv` of the [JWK](https://datatracker.ietf.org/doc/html/rfc7517) that was used to sign the ID Token. This value can usually be found in the `crv` header parameter of the ID Token or in the `jwks_uri` document of the OP.\n\n---\n\nTo verify a hash, you can use the `verify*Hash` methods:\n\n```php\n\u003c?php\n    use danielburger1337\\OpenIdHash\\OpenIdHash;\n\n    $instance = new OpenIdHash('RS256');\n    // see also \"verifyCodeHash\", \"verifyStateHash\"\n    $isValid = $instance-\u003everifyAccessTokenHash('access token', 'The \"at_hash\" claim of the ID Token');\n    // bool\n```\n\nTo create a verification hash, you can use the `create*Hash` methods:\n\n```php\n\u003c?php\n    use danielburger1337\\OpenIdHash\\OpenIdHash;\n\n    $instance = new OpenIdHash('EdDSA', 'Ed448');\n    // see also \"createCodeHash\", \"createStateHash\"\n    $hash = $instance-\u003ecreateAccessTokenHash('YmJiZTAwYmYtMzgyOC00NzhkLTkyOTItNjJjNDM3MGYzOWIy9sFhvH8K_x8UIHj1osisS57f5DduL');\n\n    print $hash; // sB_U72jyb0WgtX8TsVoqJnm6CD295W9gfSDRxkilB3LAL7REi9JYutRW_s1yE4lD8cOfMZf83gi4\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielburger1337%2Fopenid-hash-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielburger1337%2Fopenid-hash-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielburger1337%2Fopenid-hash-php/lists"}