fedi-e2ee / pkd-extensions
Extensions for the Public Key Directory software
Installs: 1 380
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/fedi-e2ee/pkd-extensions
Requires
- php: ^8.2
- ext-json: *
Requires (Dev)
- phpunit/phpunit: ^11|^12
README
This library implements the Aux Data Type validations for clients, middleware, and servers.
![NOTE] Additional extensions must be specified here before implemented in this repository.
Installing
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:
/** @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().
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()); }