Skip to content

PHP implementation of the Extensions for the Public Key Directory project

License

Notifications You must be signed in to change notification settings

fedi-e2ee/pkd-extensions-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

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

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

About

PHP implementation of the Extensions for the Public Key Directory project

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages