Skip to content

Commit 83b8060

Browse files
committed
typo, composer requires, git ignores, empty check on test
1 parent 20adb4a commit 83b8060

4 files changed

Lines changed: 24 additions & 16 deletions

File tree

.gitignore

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
# Netbeans project
2-
nbproject/
3-
/index.php
1+
# ide folders
2+
nbproject
3+
.idea
44

5+
# redirect page
6+
index.php
7+
8+
# composer things
9+
composer.lock
10+
vendor
511

612
# .pem files from FIDO Alliance Metadata Service (MDS)
713
_test/rootCertificates/mds/*.pem

_test/server.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,14 @@
200200
// ------------------------------------
201201

202202
} else if ($fn === 'processCreate') {
203-
$clientDataJSON = base64_decode($post->clientDataJSON);
204-
$attestationObject = base64_decode($post->attestationObject);
205-
$challenge = $_SESSION['challenge'];
203+
$clientDataJSON = !empty($post->clientDataJSON) ? base64_decode($post->clientDataJSON) : null;
204+
$attestationObject = !empty($post->attestationObject) ? base64_decode($post->attestationObject) : null;
205+
$challenge = $_SESSION['challenge'] ?? null;
206206

207207
// processCreate returns data to be stored for future logins.
208208
// in this example we store it in the php session.
209-
// Normaly you have to store the data in a database connected
210-
// with the user name.
209+
// Normally you have to store the data in a database connected
210+
// with the username.
211211
$data = $WebAuthn->processCreate($clientDataJSON, $attestationObject, $challenge, $userVerification === 'required', true, false);
212212

213213
// add user infos
@@ -239,11 +239,11 @@
239239
// ------------------------------------
240240

241241
} else if ($fn === 'processGet') {
242-
$clientDataJSON = base64_decode($post->clientDataJSON);
243-
$authenticatorData = base64_decode($post->authenticatorData);
244-
$signature = base64_decode($post->signature);
245-
$userHandle = base64_decode($post->userHandle);
246-
$id = base64_decode($post->id);
242+
$clientDataJSON = !empty($post->clientDataJSON) ? base64_decode($post->clientDataJSON) : null;
243+
$authenticatorData = !empty($post->authenticatorData) ? base64_decode($post->authenticatorData) : null;
244+
$signature = !empty($post->signature) ? base64_decode($post->signature) : null;
245+
$userHandle = !empty($post->userHandle) ? base64_decode($post->userHandle) : null;
246+
$id = !empty($post->id) ? base64_decode($post->id) : null;
247247
$challenge = $_SESSION['challenge'] ?? '';
248248
$credentialPublicKey = null;
249249

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "lbuchs/webauthn",
33
"description": "A simple PHP WebAuthn (FIDO2) server library",
44
"keywords": [
5-
"webauthn", "authentication"
5+
"webauthn", "authentication", "passkey"
66
],
77
"homepage": "https://github.com/lbuchs/webauthn",
88
"license": "MIT",
@@ -13,7 +13,9 @@
1313
}
1414
],
1515
"require": {
16-
"php" : ">=8.0.0"
16+
"php" : ">=8.0.0",
17+
"ext-openssl": "*",
18+
"ext-mbstring": "*"
1719
},
1820
"autoload": {
1921
"psr-4": {

src/WebAuthn.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public function getCreateArgs($userId, $userName, $userDisplayName, $timeout=20,
172172
$args->publicKey->authenticatorSelection->requireResidentKey = $requireResidentKey === 'required';
173173
}
174174

175-
// filte authenticators attached with the specified authenticator attachment modality
175+
// filter authenticators attached with the specified authenticator attachment modality
176176
if (\is_bool($crossPlatformAttachment)) {
177177
$args->publicKey->authenticatorSelection->authenticatorAttachment = $crossPlatformAttachment ? 'cross-platform' : 'platform';
178178
}

0 commit comments

Comments
 (0)