Skip to content

fedi-e2ee/pkd-client-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fediverse Public Key Directory PHP Client

CI Psalm

This is an implementation of the client-side component of the Public Key Directory specification, written in PHP. See fedi-e2ee/pkd-server-go for the reference implementation of the server-side component written in Go.

Installation

composer require fedi-e2ee/pkd-client

Usage

<?php
use FediE2EE\PKD\ReadOnlyClient;
use FediE2EE\PKD\Crypto\PublicKey;

// Setup client
$directoryPublicKey = new PublicKey('public key goes here', 'ed25519');
$client = new ReadonlyClient('https://pkd.example.com', $directoryPublicKey);

// Grab public keys for ActivityPub actor
$publicKeys = $client->fetchPublicKeys('soatok@furry.engineer');
var_dump($publicKeys); // array<PublicKey>

// 'age' is an alias for the latest version; i.e., 'age-v1'.
$auxData = $client->fetchAuxData('soatok@furry.engineer', 'age');
var_dump($auxData); // array<AuxData>