Skip to content

fedi-e2ee/pkd-extensions-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Public Key Directory Extensions

CI Psalm Latest Stable Version License Downloads

This library implements the Aux Data Type validations for clients, middleware, and servers.

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());
}

About

PHP implementation of the Extensions for the Public Key Directory project

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages