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.
composer require fedi-e2ee/pkd-extensions-php
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());
}