Skip to content

Commit

Permalink
FIX Argument rpId must be of type string
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabina Talipova committed Sep 22, 2023
1 parent 7a95f20 commit af430c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/RegisterHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ protected function getCredentialCreationOptions(
[new PublicKeyCredentialParameters('public-key', Algorithms::COSE_ALGORITHM_ES256)],
$this->getAuthenticatorSelectionCriteria()
);
$credentialOptions->setTimeout(40000);
$credentialOptions->setAuthenticatorSelection($this->getAuthenticatorSelectionCriteria());
$credentialOptions->setAttestation(PublicKeyCredentialCreationOptions::ATTESTATION_CONVEYANCE_PREFERENCE_NONE);

Expand All @@ -282,6 +283,7 @@ protected function getCredentialCreationOptions(
*/
protected function getAuthenticatorSelectionCriteria(): AuthenticatorSelectionCriteria
{
return AuthenticatorSelectionCriteria::create((string) $this->config()->get('authenticator_attachment'));
return AuthenticatorSelectionCriteria::create()
->setAuthenticatorAttachment((string) $this->config()->get('authenticator_attachment'));
}
}
3 changes: 2 additions & 1 deletion src/VerifyHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ protected function getCredentialRequestOptions(
return $source->getPublicKeyCredentialDescriptor();
}, $validCredentials ?? []);

$options = new PublicKeyCredentialRequestOptions(random_bytes(32), 40000);
$options = new PublicKeyCredentialRequestOptions((string) random_bytes(32));
$options->setTimeout(40000)

$options->allowCredentials(...$descriptors);
$options->setUserVerification(PublicKeyCredentialRequestOptions::USER_VERIFICATION_REQUIREMENT_PREFERRED);
Expand Down

0 comments on commit af430c4

Please sign in to comment.