webauthn-server
webauthn-server copied to clipboard
Feature Request: Make RegistrationOptions function chainable
Would it be possible to change the setter functions in the RegistrationOptions to return self instead of void? This would make it possible to be able to chain those and write something like this:
$opts = RegistrationOptions::createForUser($userIdentity)
->setExcludeExistingCredentials(true);
->setTimeout(20);
->setResidentKey(ResidentKeyRequirement::REQUIRED);
->setUserVerification(\MadWizard\WebAuthn\Dom\UserVerificationRequirement::REQUIRED);
instead of this
$opts = RegistrationOptions::createForUser($userIdentity);
$opts->setExcludeExistingCredentials(true);
$opts->setTimeout(20);
$opts->setResidentKey(ResidentKeyRequirement::REQUIRED);
$opts->setUserVerification(\MadWizard\WebAuthn\Dom\UserVerificationRequirement::REQUIRED);
kinda like the ServerBuilder works, this could be done without breaking existing code i think
Yes I don't think that would break anything so it would be a good improvement. If you want you can create a PR, otherwise I'll look into it in a later update.