Skip to content

Commit

Permalink
Merge pull request #487 from web-auth/features/optional-pkcParams
Browse files Browse the repository at this point in the history
The list of PKC Params is empty by default and not required anymore
  • Loading branch information
Spomky authored Sep 29, 2023
2 parents fbdcf73 + 903c0f0 commit c2c9f69
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 30 deletions.
4 changes: 2 additions & 2 deletions src/webauthn/src/PublicKeyCredentialCreationOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct(
public readonly PublicKeyCredentialUserEntity $user,
string $challenge,
/** @readonly */
public array $pubKeyCredParams,
public array $pubKeyCredParams = [],
/** @readonly */
public null|AuthenticatorSelectionCriteria $authenticatorSelection = null,
/** @readonly */
Expand Down Expand Up @@ -84,7 +84,7 @@ public static function create(
PublicKeyCredentialRpEntity $rp,
PublicKeyCredentialUserEntity $user,
string $challenge,
array $pubKeyCredParams,
array $pubKeyCredParams = [],
/** @readonly */
null|AuthenticatorSelectionCriteria $authenticatorSelection = null,
/** @readonly */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@

namespace Webauthn\Tests\Functional;

use Cose\Algorithms;
use Http\Mock\Client;
use Nyholm\Psr7\Factory\Psr17Factory;
use Nyholm\Psr7\Response;
use PHPUnit\Framework\Attributes\Test;
use Webauthn\AuthenticatorAttestationResponse;
use Webauthn\MetadataService\Exception\CertificateChainException;
use Webauthn\PublicKeyCredentialCreationOptions;
use Webauthn\PublicKeyCredentialParameters;
use Webauthn\PublicKeyCredentialRpEntity;
use Webauthn\PublicKeyCredentialUserEntity;

Expand All @@ -37,7 +35,6 @@ public function anExpiredAndroidSafetyNetAttestationCannotBeVerified(): void
'kmns43CWVswbMovrKPkgd1lEpc6LZdfk0UQ/nuZbp00jW5C61PEW1dNaptZ0GkrIK9WRtaAXWkndIEEBgNICRw',
true
),
[PublicKeyCredentialParameters::create('public-key', Algorithms::COSE_ALGORITHM_ES256)]
);
$publicKeyCredentialCreationOptions->attestation = PublicKeyCredentialCreationOptions::ATTESTATION_CONVEYANCE_PREFERENCE_DIRECT;
$publicKeyCredential = $this->getPublicKeyCredentialLoader()
Expand Down
3 changes: 0 additions & 3 deletions tests/library/Functional/AppleAttestationStatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Webauthn\Tests\Functional;

use Cose\Algorithms;
use DateTimeImmutable;
use ParagonIE\ConstantTime\Base64UrlSafe;
use PHPUnit\Framework\Attributes\Test;
Expand All @@ -14,7 +13,6 @@
use Webauthn\AuthenticatorData;
use Webauthn\PublicKeyCredentialCreationOptions;
use Webauthn\PublicKeyCredentialDescriptor;
use Webauthn\PublicKeyCredentialParameters;
use Webauthn\PublicKeyCredentialRpEntity;
use Webauthn\PublicKeyCredentialUserEntity;

Expand All @@ -35,7 +33,6 @@ public function anAppleAttestationCanBeVerified(): void
'Test PublicKeyCredentialUserEntity'
),
base64_decode('h5xSyIRMx2IQPr1mQk6GD98XSQOBHgMHVpJIkMV9Nkc=', true),
[PublicKeyCredentialParameters::create('public-key', Algorithms::COSE_ALGORITHM_ES256)]
);
$publicKeyCredentialCreationOptions->attestation = PublicKeyCredentialCreationOptions::ATTESTATION_CONVEYANCE_PREFERENCE_DIRECT;
$publicKeyCredential = $this->getPublicKeyCredentialLoader()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@

namespace Webauthn\Tests\Functional;

use Cose\Algorithms;
use ParagonIE\ConstantTime\Base64UrlSafe;
use PHPUnit\Framework\Attributes\Test;
use Webauthn\AttestedCredentialData;
use Webauthn\AuthenticatorAttestationResponse;
use Webauthn\AuthenticatorData;
use Webauthn\PublicKeyCredentialCreationOptions;
use Webauthn\PublicKeyCredentialDescriptor;
use Webauthn\PublicKeyCredentialParameters;
use Webauthn\PublicKeyCredentialRpEntity;
use Webauthn\PublicKeyCredentialUserEntity;

Expand All @@ -35,7 +33,6 @@ public function anAttestationWithTokenBindingCanBeVerified(): void
'SkehMoAkGv+cqmuiEqpOgGhswj5oDa9kIPxgG1IihzkxPe4LNfP8bUyFiNn/MXBlqiOY6IpHFZl1XfIM07kRZw==',
true
),
[PublicKeyCredentialParameters::create('public-key', Algorithms::COSE_ALGORITHM_ES256)]
);
$publicKeyCredentialCreationOptions->attestation = PublicKeyCredentialCreationOptions::ATTESTATION_CONVEYANCE_PREFERENCE_DIRECT;
$publicKeyCredential = $this->getPublicKeyCredentialLoader()
Expand Down
3 changes: 0 additions & 3 deletions tests/library/Functional/Fido2AttestationStatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@

namespace Webauthn\Tests\Functional;

use Cose\Algorithms;
use PHPUnit\Framework\Attributes\Test;
use Webauthn\AuthenticatorAttestationResponse;
use Webauthn\PublicKeyCredentialCreationOptions;
use Webauthn\PublicKeyCredentialParameters;
use Webauthn\PublicKeyCredentialRpEntity;
use Webauthn\PublicKeyCredentialUserEntity;

Expand All @@ -31,7 +29,6 @@ public function aFidoU2FAttestationCanBeVerified(): void
'pGRaBff9zpaw3CDAsggpOMRonJaqMXYjkvIGTPt3rHH+53RCW7LQ9l4NmGcv8dNZSNLDrvQDKaSNhFjviggcZA==',
true
),
[PublicKeyCredentialParameters::create('public-key', Algorithms::COSE_ALGORITHM_ES256)]
);
$publicKeyCredentialCreationOptions->attestation = PublicKeyCredentialCreationOptions::ATTESTATION_CONVEYANCE_PREFERENCE_DIRECT;
$publicKeyCredential = $this->getPublicKeyCredentialLoader()
Expand Down
3 changes: 0 additions & 3 deletions tests/library/Functional/NoneAttestationStatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@

namespace Webauthn\Tests\Functional;

use Cose\Algorithms;
use PHPUnit\Framework\Attributes\Test;
use Webauthn\AuthenticatorAttestationResponse;
use Webauthn\PublicKeyCredentialCreationOptions;
use Webauthn\PublicKeyCredentialParameters;
use Webauthn\PublicKeyCredentialRpEntity;
use Webauthn\PublicKeyCredentialUserEntity;

Expand All @@ -31,7 +29,6 @@ public function aNoneAttestationCanBeVerified(): void
'9WqgpRIYvGMCUYiFT20o1U7hSD193k11zu4tKP7wRcrE26zs1zc4LHyPinvPGS86wu6bDvpwbt8Xp2bQ3VBRSQ==',
true
),
[PublicKeyCredentialParameters::create('public-key', Algorithms::COSE_ALGORITHM_ES256)]
);
$publicKeyCredential = $this->getPublicKeyCredentialLoader()
->load(
Expand Down
4 changes: 0 additions & 4 deletions tests/library/Functional/PackedAttestationStatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@

namespace Webauthn\Tests\Functional;

use Cose\Algorithms;
use ParagonIE\ConstantTime\Base64UrlSafe;
use PHPUnit\Framework\Attributes\Test;
use Webauthn\AttestedCredentialData;
use Webauthn\AuthenticatorAttestationResponse;
use Webauthn\AuthenticatorData;
use Webauthn\PublicKeyCredentialCreationOptions;
use Webauthn\PublicKeyCredentialDescriptor;
use Webauthn\PublicKeyCredentialParameters;
use Webauthn\PublicKeyCredentialRpEntity;
use Webauthn\PublicKeyCredentialUserEntity;

Expand All @@ -35,7 +33,6 @@ public function aPackedAttestationCanBeVerified(): void
'32urRB1LDfyfYeU9myCPfrhrvNoVI27//+PWWYVxAISpIm3GqgX+jNudPgvOZy96UPNvEkCWCArW0jtpQZFGAg==',
true
),
[PublicKeyCredentialParameters::create('public-key', Algorithms::COSE_ALGORITHM_ES256)]
);
$publicKeyCredentialCreationOptions->attestation = PublicKeyCredentialCreationOptions::ATTESTATION_CONVEYANCE_PREFERENCE_DIRECT;
$publicKeyCredential = $this->getPublicKeyCredentialLoader()
Expand Down Expand Up @@ -92,7 +89,6 @@ public function aPackedAttestationWithSelfStatementCanBeVerified(): void
'Test PublicKeyCredentialUserEntity'
),
base64_decode('oFUGhUevQHX7J6o4OFau5PbncCATaHwjHDLLzCTpiyw=', true),
[PublicKeyCredentialParameters::create('public-key', Algorithms::COSE_ALGORITHM_ES256)]
);
$publicKeyCredentialCreationOptions->attestation = PublicKeyCredentialCreationOptions::ATTESTATION_CONVEYANCE_PREFERENCE_DIRECT;
$publicKeyCredential = $this->getPublicKeyCredentialLoader()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Webauthn\MetadataService\CertificateChain\PhpCertificateChainValidator;
use Webauthn\PublicKeyCredentialCreationOptions;
use Webauthn\PublicKeyCredentialLoader;
use Webauthn\PublicKeyCredentialParameters;
use Webauthn\PublicKeyCredentialRpEntity;
use Webauthn\PublicKeyCredentialUserEntity;
use Webauthn\Tests\Unit\DummyMetadataStatementRepository;
Expand All @@ -42,7 +41,6 @@ public function theAttestationStatementIsAValidECC(): void
PublicKeyCredentialRpEntity::create('https://webauthn.firstyear.id.au'),
PublicKeyCredentialUserEntity::create('j.d', '0123456789', 'John Doe'),
base64_decode('E2YebMmG9992XialpFL1lkPptOIBPeKsphNkt1JcbKk', true),
[PublicKeyCredentialParameters::createPk(0)]
);
$options->attestation = PublicKeyCredentialCreationOptions::ATTESTATION_CONVEYANCE_PREFERENCE_DIRECT;
$validator = AuthenticatorAttestationResponseValidator::create(
Expand Down
4 changes: 0 additions & 4 deletions tests/symfony/functional/Attestation/AttestationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Webauthn\Tests\Bundle\Functional\Attestation;

use Cose\Algorithms;
use PHPUnit\Framework\Attributes\Test;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Serializer\SerializerInterface;
Expand All @@ -16,7 +15,6 @@
use Webauthn\PublicKeyCredential;
use Webauthn\PublicKeyCredentialCreationOptions;
use Webauthn\PublicKeyCredentialDescriptor;
use Webauthn\PublicKeyCredentialParameters;
use Webauthn\PublicKeyCredentialRpEntity;
use Webauthn\PublicKeyCredentialUserEntity;
use Webauthn\Tests\Bundle\Functional\PublicKeyCredentialSourceRepository;
Expand Down Expand Up @@ -47,7 +45,6 @@ public function foo(): void
'9WqgpRIYvGMCUYiFT20o1U7hSD193k11zu4tKP7wRcrE26zs1zc4LHyPinvPGS86wu6bDvpwbt8Xp2bQ3VBRSQ==',
true
),
[PublicKeyCredentialParameters::create('public-key', Algorithms::COSE_ALGORITHM_ES256)]
);
/** @var SerializerInterface $serializer */
$serializer = self::getContainer()->get('webauthn-serializer');
Expand Down Expand Up @@ -93,7 +90,6 @@ public function anAttestationResponseCanBeLoadedAndVerified(): void
'9WqgpRIYvGMCUYiFT20o1U7hSD193k11zu4tKP7wRcrE26zs1zc4LHyPinvPGS86wu6bDvpwbt8Xp2bQ3VBRSQ==',
true
),
[PublicKeyCredentialParameters::create('public-key', Algorithms::COSE_ALGORITHM_ES256)]
);
/** @var SerializerInterface $serializer */
$serializer = self::getContainer()->get('webauthn-serializer');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Webauthn\Tests\Bundle\Functional\Attestation;

use Cose\Algorithms;
use PHPUnit\Framework\Attributes\Test;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Serializer\SerializerInterface;
Expand All @@ -14,7 +13,6 @@
use Webauthn\PublicKeyCredential;
use Webauthn\PublicKeyCredentialCreationOptions;
use Webauthn\PublicKeyCredentialDescriptor;
use Webauthn\PublicKeyCredentialParameters;
use Webauthn\PublicKeyCredentialRpEntity;
use Webauthn\PublicKeyCredentialUserEntity;
use Webauthn\Tests\MockedRequestTrait;
Expand All @@ -39,7 +37,6 @@ public function aPackedAttestationWithSelfStatementCanBeVerified(): void
'Test PublicKeyCredentialUserEntity'
),
base64_decode('oFUGhUevQHX7J6o4OFau5PbncCATaHwjHDLLzCTpiyw=', true),
[PublicKeyCredentialParameters::create('public-key', Algorithms::COSE_ALGORITHM_ES256)]
);
$publicKeyCredentialCreationOptions->attestation = PublicKeyCredentialCreationOptions::ATTESTATION_CONVEYANCE_PREFERENCE_DIRECT;
/** @var SerializerInterface $serializer */
Expand Down

0 comments on commit c2c9f69

Please sign in to comment.