No description
Find a file
Chuck Adams 0f09a655a2
harden GH actions
Signed-off-by: Chuck Adams <cja987@gmail.com>
2026-05-18 12:13:22 -06:00
.github/workflows harden GH actions 2026-05-18 12:13:22 -06:00
docs Add packagist documentation 2026-01-08 14:43:06 -06:00
examples Mago Analyse and Format 2026-03-13 23:55:25 +05:30
src/FAIR/DID per linter 2026-05-16 21:15:40 +03:00
tests/Unit/FAIR/DID per linter and phpstan 2026-05-16 20:27:09 +03:00
.gitattributes Switch to phpcs and phpstan for PHP 8.0 compat 2026-05-16 20:25:00 +03:00
.gitignore Switch to phpcs and phpstan for PHP 8.0 compat 2026-05-16 20:25:00 +03:00
composer.json rely on CI to run the checks 2026-05-16 21:11:35 +03:00
composer.lock finally to PHP 8.0 2026-05-16 20:39:28 +03:00
LICENSE.md Switch license to GPL-3.0-or-later 2026-01-13 22:39:57 +05:30
phpcs.xml.dist Switch to phpcs and phpstan for PHP 8.0 compat 2026-05-16 20:25:00 +03:00
phpstan.neon.dist Switch to phpcs and phpstan for PHP 8.0 compat 2026-05-16 20:25:00 +03:00
phpunit.xml.dist Switch to phpcs and phpstan for PHP 8.0 compat 2026-05-16 20:25:00 +03:00
README.md Switch to phpcs and phpstan for PHP 8.0 compat 2026-05-16 20:25:00 +03:00

FAIR DID Manager

fairpm/did-manager is the core FAIR DID library. It contains generic DID lifecycle management, PLC operations, key generation/export, and local key storage.

Features

  • Create, resolve, update, rotate, and deactivate did:plc identifiers
  • Generate secp256k1 rotation keys and Ed25519 verification keys
  • Encode/sign PLC operations with CBOR and multibase helpers
  • Store DIDs, keys, and generic metadata locally
  • Export keys in JSON, text, and environment-variable formats

Requirements

  • PHP 8.0 or higher
  • Composer
  • Extensions: curl, json

Installation

git clone https://github.com/fairpm/did-manager.git
cd did-manager
composer install

For WordPress package metadata parsing, install fairpm/did-manager-wordpress alongside this package.

Quick Start

<?php

require_once 'vendor/autoload.php';

use FAIR\DID\DIDManager;
use FAIR\DID\PLC\PlcClient;
use FAIR\DID\Storage\KeyStore;

$store = new KeyStore(__DIR__ . '/keys.json');
$client = new PlcClient();
$manager = new DIDManager($store, $client);

$result = $manager->create_did(
	handle: 'example-package',
	service_endpoint: 'https://example.com/did-endpoint',
	type: 'package',
	metadata: ['owner' => 'Example Org'],
);

echo $result['did'] . PHP_EOL;

Namespaces

  • FAIR\DID\Crypto for encoding, canonicalization, and DID helpers
  • FAIR\DID\Keys for key generation, decoding, and export
  • FAIR\DID\PLC for PLC client and operation objects
  • FAIR\DID\Storage for local key/DID persistence
  • FAIR\DID for high-level DID lifecycle orchestration

Examples

Core examples remain in examples:

  • 01-generate-keys.php
  • 02-plc-operations.php
  • 03-key-storage.php
  • 04-export-keys.php
  • 05-generate-and-submit-did.php

WordPress examples were moved to the did-manager-wordpress package.

Testing

composer lint
composer analyze
composer test

Formatting can be applied with:

composer lint
composer format

The project uses a custom PSR-12-derived PHPCS ruleset for coding standards, PHPStan for static analysis, and PHPUnit for tests.

  • fairpm/did-manager-wordpress for WordPress header parsing, readme parsing, and FAIR metadata generation

Security

Never commit private keys or generated keystore files to version control.

License

GPL-3.0-or-later. See LICENSE.md for details.