PHPackages                             danielburger1337/openid-hash - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. danielburger1337/openid-hash

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

danielburger1337/openid-hash
============================

Create/Verify OpenID Connect (OIDC) verification hashes.

v1.0.0(2y ago)3358↓50%MITPHPPHP ^8.2

Since Feb 24Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/danielburger1337/openid-hash-php)[ Packagist](https://packagist.org/packages/danielburger1337/openid-hash)[ Docs](https://github.com/danielburger1337/openid-hash-php)[ RSS](/packages/danielburger1337-openid-hash/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

[![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)[![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)[![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)[![Packagist Version](https://camo.githubusercontent.com/d360bb3633d67e00f98b72ed19fb1328b2797724ed017a6b082cd5485e3dfc9e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64616e69656c627572676572313333372f6f70656e69642d686173683f6c696e6b3d68747470732533412532462532467061636b61676973742e6f72672532467061636b6167657325324664616e69656c627572676572313333372532466f70656e69642d68617368)](https://camo.githubusercontent.com/d360bb3633d67e00f98b72ed19fb1328b2797724ed017a6b082cd5485e3dfc9e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64616e69656c627572676572313333372f6f70656e69642d686173683f6c696e6b3d68747470732533412532462532467061636b61676973742e6f72672532467061636b6167657325324664616e69656c627572676572313333372532466f70656e69642d68617368)[![Packagist Downloads](https://camo.githubusercontent.com/8b423ed29991fedd30edb41af30bfc3c634c3f47f50c45e5e51a348a8c30de15/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64616e69656c627572676572313333372f6f70656e69642d686173683f6c696e6b3d68747470732533412532462532467061636b61676973742e6f72672532467061636b6167657325324664616e69656c627572676572313333372532466f70656e69642d68617368)](https://camo.githubusercontent.com/8b423ed29991fedd30edb41af30bfc3c634c3f47f50c45e5e51a348a8c30de15/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64616e69656c627572676572313333372f6f70656e69642d686173683f6c696e6b3d68747470732533412532462532467061636b61676973742e6f72672532467061636b6167657325324664616e69656c627572676572313333372532466f70656e69642d68617368)

openid-hash
===========

[](#openid-hash)

Create and/or verify OpenID Connect 1.0 ID Token hashes (`at_hash`, `c_hash`, `s_hash`).

This 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).

```
composer require danielburger1337/openid-hash
```

This library requires a 64-bit version of PHP.

---

**How To Use**
--------------

[](#how-to-use)

The 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.

The 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.

---

To verify a hash, you can use the `verify*Hash` methods:

```
