Loheide-eu-mitarbeiterplatt.../vendor/web-auth/webauthn-lib/src/PublicKeyCredentialCreationOptions.php
Friederich Loheide 9c0f8de791
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
Phase 0: Fundament für Inhaus
- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3)
- Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung
- Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü
- Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person
- Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“
- Benutzerverwaltung im Admin, Zugang vorläufig über is_admin
- vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/
- PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung
- VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 20:35:30 +00:00

127 lines
4.7 KiB
PHP

<?php
declare(strict_types=1);
namespace Webauthn;
use function in_array;
use InvalidArgumentException;
use Webauthn\AuthenticationExtensions\AuthenticationExtensions;
use Webauthn\Exception\InvalidDataException;
final class PublicKeyCredentialCreationOptions extends PublicKeyCredentialOptions
{
public const ATTESTATION_CONVEYANCE_PREFERENCE_DEFAULT = null;
public const ATTESTATION_CONVEYANCE_PREFERENCE_NONE = 'none';
public const ATTESTATION_CONVEYANCE_PREFERENCE_INDIRECT = 'indirect';
public const ATTESTATION_CONVEYANCE_PREFERENCE_DIRECT = 'direct';
public const ATTESTATION_CONVEYANCE_PREFERENCE_ENTERPRISE = 'enterprise';
public const ATTESTATION_CONVEYANCE_PREFERENCES = [
self::ATTESTATION_CONVEYANCE_PREFERENCE_DEFAULT,
self::ATTESTATION_CONVEYANCE_PREFERENCE_NONE,
self::ATTESTATION_CONVEYANCE_PREFERENCE_INDIRECT,
self::ATTESTATION_CONVEYANCE_PREFERENCE_DIRECT,
self::ATTESTATION_CONVEYANCE_PREFERENCE_ENTERPRISE,
];
public const MEDIATION_DEFAULT = 'default';
public const MEDIATION_CONDITIONAL = 'conditional';
public const MEDIATIONS = [self::MEDIATION_DEFAULT, self::MEDIATION_CONDITIONAL];
/**
* Server-side mediation hint. Mirrors the JS `mediation` option of `navigator.credentials.create()`
* but is *not* sent to the browser — it controls how the framework validates the response.
*
* - `MEDIATION_DEFAULT` (default) — full ceremony validation, including User Presence (UP) bit.
* - `MEDIATION_CONDITIONAL` — auto-register flow (e.g. SimpleWebAuthn `useAutoRegister: true`):
* the UP bit is allowed to be false because the user already authenticated through another
* factor (typically password). All other checks remain.
*
* @see https://github.com/w3c/webauthn/wiki/Explainer:-Conditional-Create
*/
public null|string $mediation;
/**
* @param PublicKeyCredentialParameters[] $pubKeyCredParams
* @param PublicKeyCredentialDescriptor[] $excludeCredentials
* @param null|positive-int $timeout
* @param string[] $hints
*/
public function __construct(
public readonly PublicKeyCredentialRpEntity $rp,
public readonly PublicKeyCredentialUserEntity $user,
string $challenge,
public array $pubKeyCredParams = [],
public null|AuthenticatorSelectionCriteria $authenticatorSelection = null,
public null|string $attestation = null,
public array $excludeCredentials = [],
null|int $timeout = null,
null|AuthenticationExtensions $extensions = null,
array $hints = [],
null|string $mediation = null,
) {
foreach ($pubKeyCredParams as $pubKeyCredParam) {
$pubKeyCredParam instanceof PublicKeyCredentialParameters || throw new InvalidArgumentException(
'Invalid type for $pubKeyCredParams'
);
}
foreach ($excludeCredentials as $excludeCredential) {
$excludeCredential instanceof PublicKeyCredentialDescriptor || throw new InvalidArgumentException(
'Invalid type for $excludeCredentials'
);
}
in_array($attestation, self::ATTESTATION_CONVEYANCE_PREFERENCES, true) || throw InvalidDataException::create(
$attestation,
'Invalid attestation conveyance mode'
);
$mediation === null || in_array($mediation, self::MEDIATIONS, true) || throw InvalidDataException::create(
$mediation,
'Invalid mediation requirement'
);
$this->mediation = $mediation;
parent::__construct($challenge, $timeout, $extensions, $hints);
}
/**
* @param PublicKeyCredentialParameters[] $pubKeyCredParams
* @param PublicKeyCredentialDescriptor[] $excludeCredentials
* @param null|positive-int $timeout
* @param string[] $hints
*/
public static function create(
PublicKeyCredentialRpEntity $rp,
PublicKeyCredentialUserEntity $user,
string $challenge,
array $pubKeyCredParams = [],
null|AuthenticatorSelectionCriteria $authenticatorSelection = null,
null|string $attestation = null,
array $excludeCredentials = [],
null|int $timeout = null,
null|AuthenticationExtensions $extensions = null,
array $hints = [],
null|string $mediation = null,
): self {
return new self(
$rp,
$user,
$challenge,
$pubKeyCredParams,
$authenticatorSelection,
$attestation,
$excludeCredentials,
$timeout,
$extensions,
$hints,
$mediation,
);
}
}