*/ protected array $providers; public function __construct(array $providers) { $this->providers = array_filter( $providers, static fn($provider) => $provider instanceof SigningProviderInterface ); } /** * Resolves a signing provider by its type (e.g. `NoncePool` from type `'nonce'`) */ public function findByType(string $type): ?SigningProviderInterface { return $this->providers[$type] ?? null; } /** * Resolves a specific signing secret by its public identifier * (e.g. specific `Nonce` from `NoncePool` by given public identifier "nonce:[public-name]") */ public function findByIdentifier(SecretIdentifier $identifier): ?SigningSecretInterface { if (!isset($this->providers[$identifier->type])) { return null; } return $this->providers[$identifier->type]->findSigningSecret($identifier->name); } /** * Revokes a specific signing secret. */ public function revokeIdentifier(SecretIdentifier $identifier): void { if (!isset($this->providers[$identifier->type])) { return; } $this->providers[$identifier->type]->revokeSigningSecret($identifier->name); } }