Skip to content

Commit 270e384

Browse files
authored
fix: conflict with web-auth/webauthn-lib:4.7.0 (#439)
1 parent 1400e5b commit 270e384

File tree

4 files changed

+9
-63
lines changed

4 files changed

+9
-63
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ jobs:
152152
153153
- name: SonarCloud Scan
154154
if: env.SONAR_TOKEN != ''
155-
uses: SonarSource/sonarcloud-github-action@v1.9
155+
uses: SonarSource/sonarcloud-github-action@v2.0.0
156156
env:
157157
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
158158
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
"web-auth/webauthn-lib": "^4.0",
2828
"web-token/jwt-signature": "^3.0"
2929
},
30+
"conflict": {
31+
"web-auth/webauthn-lib": "4.7.0"
32+
},
3033
"require-dev": {
3134
"ext-sqlite3": "*",
3235
"guzzlehttp/psr7": "^2.1",

tests/Unit/Models/UserTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
namespace LaravelWebauthn\Tests\Unit\Models;
44

5+
use Illuminate\Foundation\Testing\DatabaseTransactions;
56
use LaravelWebauthn\Models\WebauthnKey;
67
use LaravelWebauthn\Tests\FeatureTestCase;
78

89
class UserTest extends FeatureTestCase
910
{
11+
use DatabaseTransactions;
12+
1013
/**
1114
* @test
1215
*/

tests/Unit/Services/WebauthnTest.php

Lines changed: 2 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use ParagonIE\ConstantTime\Base64UrlSafe;
1818
use Symfony\Component\Uid\NilUuid;
1919
use Symfony\Component\Uid\Uuid;
20+
use Webauthn\AuthenticatorData;
2021
use Webauthn\PublicKeyCredentialSource;
2122

2223
class WebauthnTest extends FeatureTestCase
@@ -93,67 +94,6 @@ public function test_get_authenticate_data()
9394
$this->assertCount(0, $publicKey->getExtensions());
9495
}
9596

96-
/**
97-
* @test
98-
*/
99-
public function test_do_authenticate()
100-
{
101-
$user = $this->signIn();
102-
$webauthnKey = factory(WebauthnKey::class)->create([
103-
'user_id' => $user->getAuthIdentifier(),
104-
'credentialPublicKey' => (string) new MapObject([
105-
new MapItem(
106-
new TextStringObject('1'),
107-
new TextStringObject('0')
108-
),
109-
new MapItem(
110-
new TextStringObject('3'),
111-
new TextStringObject('-7')
112-
),
113-
]),
114-
]);
115-
116-
$publicKey = $this->app[PrepareAssertionData::class]($user);
117-
$this->assertInstanceOf(\Webauthn\PublicKeyCredentialRequestOptions::class, $publicKey);
118-
119-
$data = [
120-
'id' => Base64UrlSafe::encodeUnpadded($webauthnKey->credentialId),
121-
'rawId' => Base64UrlSafe::encode($webauthnKey->credentialId),
122-
'type' => 'public-key',
123-
'response' => [
124-
'clientDataJSON' => Base64UrlSafe::encodeUnpadded(json_encode([
125-
'type' => 'webauthn.get',
126-
'challenge' => Base64UrlSafe::encodeUnpadded($publicKey->getChallenge()),
127-
'origin' => 'https://localhost',
128-
'tokenBinding' => [
129-
'status' => 'supported',
130-
'id' => Base64UrlSafe::encodeUnpadded(1),
131-
],
132-
])),
133-
'authenticatorData' => Base64UrlSafe::encodeUnpadded(
134-
hash('sha256', 'localhost', true). // rp_id_hash
135-
pack('C', 65). // flags
136-
pack('N', 1). // signCount
137-
'0000000000000000'. // aaguid
138-
pack('n', 1).'0'. // credentialLength
139-
((string) new MapObject([
140-
new MapItem(
141-
new TextStringObject('key'),
142-
new TextStringObject('value')
143-
),
144-
])) // credentialPublicKey
145-
),
146-
'signature' => Base64UrlSafe::encode(new TextStringObject('00000100000001000000010000000100000001000000010000000100000001')),
147-
'userHandle' => base64_encode($user->getAuthIdentifier()),
148-
],
149-
];
150-
151-
$this->expectException(\InvalidArgumentException::class);
152-
$result = Webauthn::validateAssertion($user, $data);
153-
154-
$this->assertTrue($result); // Not yet ...
155-
}
156-
15797
/**
15898
* @test
15999
*/
@@ -194,7 +134,7 @@ private function getAttestationData($publicKey)
194134
new TextStringObject('authData'),
195135
new TextStringObject(
196136
hash('sha256', 'localhost', true). // rp_id_hash
197-
pack('C', 65). // flags
137+
pack('C', AuthenticatorData::FLAG_AT | AuthenticatorData::FLAG_UP). // flags
198138
pack('N', 1). // signCount
199139
'0000000000000000'. // aaguid
200140
pack('n', 1).'0'. // credentialLength

0 commit comments

Comments
 (0)