@@ -284,7 +284,7 @@ |
||
284 | 284 | |
285 | 285 | $extensionData = CborDecoder::decode($data); |
286 | 286 | |
287 | - if (! is_array($extensionData)) { |
|
287 | + if (!is_array($extensionData)) { |
|
288 | 288 | throw new WebauthnException('Invalid extension data'); |
289 | 289 | } |
290 | 290 |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | 'hash' => 'SHA1', |
189 | 189 | 'openssl' => OPENSSL_ALGO_SHA1, |
190 | 190 | 'cose' => [ |
191 | - -65535, // RS1 |
|
191 | + -65535, // RS1 |
|
192 | 192 | ], |
193 | 193 | ], |
194 | 194 | [ |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | 'openssl' => OPENSSL_ALGO_SHA256, |
197 | 197 | 'cose' => [ |
198 | 198 | -257, // RS256 |
199 | - -37, // PS256 |
|
200 | - -7, // ES256 |
|
201 | - 5, // HMAC256 |
|
199 | + -37, // PS256 |
|
200 | + -7, // ES256 |
|
201 | + 5, // HMAC256 |
|
202 | 202 | ], |
203 | 203 | ], |
204 | 204 | [ |
@@ -206,9 +206,9 @@ discard block |
||
206 | 206 | 'openssl' => OPENSSL_ALGO_SHA384, |
207 | 207 | 'cose' => [ |
208 | 208 | -258, // RS384 |
209 | - -38, // PS384 |
|
210 | - -35, // ES384 |
|
211 | - 6, // HMAC384 |
|
209 | + -38, // PS384 |
|
210 | + -35, // ES384 |
|
211 | + 6, // HMAC384 |
|
212 | 212 | ], |
213 | 213 | ], |
214 | 214 | [ |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | 'openssl' => OPENSSL_ALGO_SHA512, |
217 | 217 | 'cose' => [ |
218 | 218 | -259, // RS512 |
219 | - -39, // PS512 |
|
220 | - -36, // ES512 |
|
221 | - 7, // HMAC512 |
|
219 | + -39, // PS512 |
|
220 | + -36, // ES512 |
|
221 | + 7, // HMAC512 |
|
222 | 222 | ], |
223 | 223 | ], |
224 | 224 | ]; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $attestationStatement = $this->attestationData['attStmt']; |
63 | 63 | |
64 | 64 | if ( |
65 | - ! array_key_exists('ver', $attestationStatement) || |
|
65 | + !array_key_exists('ver', $attestationStatement) || |
|
66 | 66 | $attestationStatement['ver'] !== '2.0' |
67 | 67 | ) { |
68 | 68 | throw new WebauthnException(sprintf( |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | if ( |
75 | - ! array_key_exists('alg', $attestationStatement) || |
|
75 | + !array_key_exists('alg', $attestationStatement) || |
|
76 | 76 | $this->getCoseAlgorithm($attestationStatement['alg']) === null |
77 | 77 | ) { |
78 | 78 | throw new WebauthnException(sprintf( |
@@ -82,22 +82,22 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | if ( |
85 | - ! array_key_exists('sig', $attestationStatement) || |
|
86 | - ! $attestationStatement['sig'] instanceof ByteBuffer |
|
85 | + !array_key_exists('sig', $attestationStatement) || |
|
86 | + !$attestationStatement['sig'] instanceof ByteBuffer |
|
87 | 87 | ) { |
88 | 88 | throw new WebauthnException('No signature found'); |
89 | 89 | } |
90 | 90 | |
91 | 91 | if ( |
92 | - ! array_key_exists('certInfo', $attestationStatement) || |
|
93 | - ! $attestationStatement['certInfo'] instanceof ByteBuffer |
|
92 | + !array_key_exists('certInfo', $attestationStatement) || |
|
93 | + !$attestationStatement['certInfo'] instanceof ByteBuffer |
|
94 | 94 | ) { |
95 | 95 | throw new WebauthnException('No certificate information found'); |
96 | 96 | } |
97 | 97 | |
98 | 98 | if ( |
99 | - ! array_key_exists('pubArea', $attestationStatement) || |
|
100 | - ! $attestationStatement['pubArea'] instanceof ByteBuffer |
|
99 | + !array_key_exists('pubArea', $attestationStatement) || |
|
100 | + !$attestationStatement['pubArea'] instanceof ByteBuffer |
|
101 | 101 | ) { |
102 | 102 | throw new WebauthnException('No public area information found'); |
103 | 103 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | ) { |
115 | 115 | // The attestation certificate attestnCert MUST be the first element in the array |
116 | 116 | $attestCert = array_shift($attestationStatement['x5c']); |
117 | - if (! $attestCert instanceof ByteBuffer) { |
|
117 | + if (!$attestCert instanceof ByteBuffer) { |
|
118 | 118 | throw new WebauthnException('Invalid X5C certificate'); |
119 | 119 | } |
120 | 120 |
@@ -90,14 +90,14 @@ |
||
90 | 90 | */ |
91 | 91 | public function __construct(int $binaryFlag) |
92 | 92 | { |
93 | - $this->bit0 = !! ($binaryFlag & 1); |
|
94 | - $this->bit1 = !! ($binaryFlag & 2); |
|
95 | - $this->bit2 = !! ($binaryFlag & 4); |
|
96 | - $this->bit3 = !! ($binaryFlag & 8); |
|
97 | - $this->bit4 = !! ($binaryFlag & 16); |
|
98 | - $this->bit5 = !! ($binaryFlag & 32); |
|
99 | - $this->bit6 = !! ($binaryFlag & 64); |
|
100 | - $this->bit7 = !! ($binaryFlag & 128); |
|
93 | + $this->bit0 = !!($binaryFlag & 1); |
|
94 | + $this->bit1 = !!($binaryFlag & 2); |
|
95 | + $this->bit2 = !!($binaryFlag & 4); |
|
96 | + $this->bit3 = !!($binaryFlag & 8); |
|
97 | + $this->bit4 = !!($binaryFlag & 16); |
|
98 | + $this->bit5 = !!($binaryFlag & 32); |
|
99 | + $this->bit6 = !!($binaryFlag & 64); |
|
100 | + $this->bit7 = !!($binaryFlag & 128); |
|
101 | 101 | |
102 | 102 | $this->userPresent = $this->bit0; |
103 | 103 | $this->userVerified = $this->bit2; |
@@ -40,7 +40,7 @@ |
||
40 | 40 | */ |
41 | 41 | public function __construct(string $binaryData) |
42 | 42 | { |
43 | - $this->data = (string)$binaryData; |
|
43 | + $this->data = (string) $binaryData; |
|
44 | 44 | $this->length = strlen($binaryData); |
45 | 45 | } |
46 | 46 |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | { |
78 | 78 | $enc = CborDecoder::decode($binary); |
79 | 79 | |
80 | - if (! is_array($enc) || ! array_key_exists('fmt', $enc) || ! is_string($enc['fmt'])) { |
|
80 | + if (!is_array($enc) || !array_key_exists('fmt', $enc) || !is_string($enc['fmt'])) { |
|
81 | 81 | throw new WebauthnException('Invalid attestation format provided'); |
82 | 82 | } |
83 | 83 | |
84 | - if (! array_key_exists('attStmt', $enc) || ! is_array($enc['attStmt'])) { |
|
84 | + if (!array_key_exists('attStmt', $enc) || !is_array($enc['attStmt'])) { |
|
85 | 85 | throw new WebauthnException('Invalid attestation format provided (attStmt not available)'); |
86 | 86 | } |
87 | 87 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | */ |
236 | 236 | protected function setAuthenticatorData(array $enc): void |
237 | 237 | { |
238 | - if (! array_key_exists('authData', $enc) || ! $enc['authData'] instanceof ByteBuffer) { |
|
238 | + if (!array_key_exists('authData', $enc) || !$enc['authData'] instanceof ByteBuffer) { |
|
239 | 239 | throw new WebauthnException('Invalid attestation format provided (authData not available)'); |
240 | 240 | } |
241 | 241 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | protected function createAttestationFormat(array $enc, array $allowedFormats): void |
252 | 252 | { |
253 | - if (! in_array($this->formatName, $allowedFormats)) { |
|
253 | + if (!in_array($this->formatName, $allowedFormats)) { |
|
254 | 254 | throw new WebauthnException(sprintf( |
255 | 255 | 'Invalid attestation format [%s], allowed [%s]', |
256 | 256 | $this->formatName, |
@@ -85,21 +85,21 @@ |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | if ( |
88 | - ! array_key_exists('sig', $attestationStatement) || |
|
89 | - ! $attestationStatement['sig'] instanceof ByteBuffer |
|
88 | + !array_key_exists('sig', $attestationStatement) || |
|
89 | + !$attestationStatement['sig'] instanceof ByteBuffer |
|
90 | 90 | ) { |
91 | 91 | throw new WebauthnException('No signature found'); |
92 | 92 | } |
93 | 93 | |
94 | 94 | if ( |
95 | - ! array_key_exists('x5c', $attestationStatement) || |
|
96 | - ! is_array($attestationStatement['x5c']) || |
|
95 | + !array_key_exists('x5c', $attestationStatement) || |
|
96 | + !is_array($attestationStatement['x5c']) || |
|
97 | 97 | count($attestationStatement['x5c']) !== 1 |
98 | 98 | ) { |
99 | 99 | throw new WebauthnException('Invalid X5C certificate'); |
100 | 100 | } |
101 | 101 | |
102 | - if (! $attestationStatement['x5c'][0] instanceof ByteBuffer) { |
|
102 | + if (!$attestationStatement['x5c'][0] instanceof ByteBuffer) { |
|
103 | 103 | throw new WebauthnException('Invalid X5C certificate must be Byte Buffer)'); |
104 | 104 | } |
105 | 105 |
@@ -75,15 +75,15 @@ discard block |
||
75 | 75 | // check u2f data |
76 | 76 | $attestationStatement = $this->attestationData['attStmt']; |
77 | 77 | if ( |
78 | - ! array_key_exists('alg', $attestationStatement) || |
|
78 | + !array_key_exists('alg', $attestationStatement) || |
|
79 | 79 | $this->getCoseAlgorithm($attestationStatement['alg']) === null |
80 | 80 | ) { |
81 | 81 | throw new WebauthnException('Unsupported algorithm or not provided'); |
82 | 82 | } |
83 | 83 | |
84 | 84 | if ( |
85 | - ! array_key_exists('sig', $attestationStatement) || |
|
86 | - ! $attestationStatement['sig'] instanceof ByteBuffer |
|
85 | + !array_key_exists('sig', $attestationStatement) || |
|
86 | + !$attestationStatement['sig'] instanceof ByteBuffer |
|
87 | 87 | ) { |
88 | 88 | throw new WebauthnException('No signature found'); |
89 | 89 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | ) { |
99 | 99 | // The attestation certificate attestnCert MUST be the first element in the array |
100 | 100 | $attestCert = array_shift($attestationStatement['x5c']); |
101 | - if (! $attestCert instanceof ByteBuffer) { |
|
101 | + if (!$attestCert instanceof ByteBuffer) { |
|
102 | 102 | throw new WebauthnException('Invalid X5C certificate'); |
103 | 103 | } |
104 | 104 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function validateAttestation(string $clientData): bool |
132 | 132 | { |
133 | - if (! empty($this->x5c)) { |
|
133 | + if (!empty($this->x5c)) { |
|
134 | 134 | return $this->validateOverX5C($clientData); |
135 | 135 | } |
136 | 136 |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public static function decode($data) |
59 | 59 | { |
60 | - if (! $data instanceof ByteBuffer) { |
|
60 | + if (!$data instanceof ByteBuffer) { |
|
61 | 61 | $data = new ByteBuffer($data); |
62 | 62 | } |
63 | 63 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public static function decodeInPlace($data, int $startoffset, ?int $endOffset = null) |
84 | 84 | { |
85 | - if (! $data instanceof ByteBuffer) { |
|
85 | + if (!$data instanceof ByteBuffer) { |
|
86 | 86 | $data = new ByteBuffer($data); |
87 | 87 | } |
88 | 88 |