NoneAttestationVerifier   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 87.5%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 16
ccs 7
cts 8
cp 0.875
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSupportedFormat() 0 6 1
A verify() 0 6 2
1
<?php
2
3
namespace MadWizard\WebAuthn\Attestation\Verifier;
4
5
use MadWizard\WebAuthn\Attestation\AttestationType;
6
use MadWizard\WebAuthn\Attestation\AuthenticatorData;
7
use MadWizard\WebAuthn\Attestation\Registry\AttestationFormatInterface;
8
use MadWizard\WebAuthn\Attestation\Registry\BuiltInAttestationFormat;
9
use MadWizard\WebAuthn\Attestation\Statement\AttestationStatementInterface;
10
use MadWizard\WebAuthn\Attestation\Statement\NoneAttestationStatement;
11
use MadWizard\WebAuthn\Attestation\TrustPath\EmptyTrustPath;
12
use MadWizard\WebAuthn\Exception\VerificationException;
13
14
final class NoneAttestationVerifier implements AttestationVerifierInterface
15
{
16 1
    public function verify(AttestationStatementInterface $attStmt, AuthenticatorData $authenticatorData, string $clientDataHash): VerificationResult
17
    {
18 1
        if (!($attStmt instanceof NoneAttestationStatement)) {
19
            throw new VerificationException('Expecting NoneAttestationStatement.');
20
        }
21 1
        return new VerificationResult(AttestationType::NONE, new EmptyTrustPath());
22
    }
23
24 19
    public function getSupportedFormat(): AttestationFormatInterface
25
    {
26 19
        return new BuiltInAttestationFormat(
27 19
            NoneAttestationStatement::FORMAT_ID,
28 19
            NoneAttestationStatement::class,
29
            $this
30
        );
31
    }
32
}
33