https://github.com/fedi-e2ee/pkd-extensions-php
PHP implementation of the Extensions for the Public Key Directory project
https://github.com/fedi-e2ee/pkd-extensions-php
Last synced: 2 months ago
JSON representation
PHP implementation of the Extensions for the Public Key Directory project
- Host: GitHub
- URL: https://github.com/fedi-e2ee/pkd-extensions-php
- Owner: fedi-e2ee
- License: isc
- Created: 2025-12-06T19:13:43.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-12-13T17:33:51.000Z (3 months ago)
- Last Synced: 2025-12-14T12:50:06.493Z (3 months ago)
- Language: PHP
- Size: 14.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Public Key Directory Extensions
[](https://github.com/fedi-e2ee/pkd-extensions-php/actions/workflows/ci.yml)
[](https://github.com/fedi-e2ee/pkd-extensions-php/actions/workflows/psalm.yml)
[](https://packagist.org/packages/fedi-e2ee/pkd-extensions)
[](https://packagist.org/packages/fedi-e2ee/pkd-extensions)
[](https://packagist.org/packages/fedi-e2ee/pkd-extensions)
This library implements the Aux Data Type validations for clients, middleware, and servers.
> ![NOTE]
> Additional extensions must be specified [here](https://github.com/fedi-e2ee/fedi-pkd-extensions) before implemented
> in this repository.
## Installing
```terminal
composer require fedi-e2ee/pkd-extensions-php
```
## Usage
This exposes Registry class that will come pre-loaded with the extension types defined in this library.
To extend it further, simply call:
```php
/** @var \FediE2EE\PKD\Extensions\Registry $registry */
$yourClass = new CustomExtensionType();
// ^ must implement \FediE2EE\PKD\Extensions\ExtensionInterface
$registry->addAuxDataType($yourClass, 'optional-alias-to-support-versioning');
$registry->addAuxDataType($yourClass);
```
To check if a specific Auxiliary Data value conforms to your registered type's expected format, simply
call `isValid()`.
```php
if ($yourClass->isValid($userData)) {
// You can proceed with processing it!
} else {
// Rejected. You can call getRejectionReason() to find out why.
throw new CustomException($yourClass->getRejectionReason());
}
```