AttestationType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 58
ccs 10
cts 10
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isValidType() 0 13 1
A __construct() 0 2 1
1
<?php
2
3
namespace MadWizard\WebAuthn\Attestation;
4
5
final class AttestationType
6
{
7
    /**
8
     * In this case, no attestation information is available.
9
     */
10
    public const NONE = 'None';
11
12
    /**
13
     * The authenticator’s attestation key pair is specific to an authenticator model.
14
     */
15
    public const BASIC = 'Basic';
16
17
    /**
18
     * The Authenticator does not have any specific attestation key. Instead it uses the credential private key to
19
     * create the attestation signature. Authenticators without meaningful protection measures for an attestation
20
     * private key typically use this attestation type.
21
     */
22
    public const SELF = 'Self';
23
24
    /**
25
     * The authenticator is based on a Trusted Platform Module (TPM) and holds an authenticator-specific
26
     * "endorsement key" (EK).
27
     */
28
    public const ATT_CA = 'AttCA';
29
30
    /**
31
     * @deprecated Will be removed in WebAuthn spec v2
32
     * The Authenticator receives direct anonymous attestation (DAA) credentials from a single DAA-Issuer.
33
     */
34
    public const ECDAA = 'ECDAA';
35
36
    /**
37
     * The authenticator works with a cloud-operated Anonymization CA owned by its manufacturer to dynamically generate
38
     * per-credential attestation certificates on the CA such that no identification information of an individual
39
     * authenticator will be revealed to Relying Parties in the attestation statement.
40
     */
41
    public const ANON_CA = 'AnonCA';
42
43
    /**
44
     * @codeCoverageIgnore
45
     */
46
    private function __construct()
47
    {
48
    }
49
50 27
    public static function isValidType(string $type): bool
51
    {
52 27
        return \in_array(
53 27
            $type,
54
            [
55 27
                self::NONE,
56 27
                self::BASIC,
57 27
                self::SELF,
58 27
                self::ATT_CA,
59 27
                self::ECDAA,
0 ignored issues
show
Deprecated Code introduced by
The constant MadWizard\WebAuthn\Attes...\AttestationType::ECDAA has been deprecated: Will be removed in WebAuthn spec v2 The Authenticator receives direct anonymous attestation (DAA) credentials from a single DAA-Issuer. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

59
                /** @scrutinizer ignore-deprecated */ self::ECDAA,

This class constant has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.

Loading history...
60 27
                self::ANON_CA,
61
            ],
62 27
            true
63
        );
64
    }
65
}
66