Skip to content

Commit fa24635

Browse files
authored
fix: fix padding on client side (#420)
1 parent 04a969d commit fa24635

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.github/workflows/tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ jobs:
102102
run: |
103103
composer update --no-interaction --no-progress --prefer-dist
104104
105+
- name: Setup problem matchers
106+
run: |
107+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
108+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
109+
105110
- name: Run test suite
106111
run: vendor/bin/phpunit -c phpunit.xml --log-junit ./results/results_${{ matrix.psr7 }}.xml --coverage-clover ./results/coverage_${{ matrix.psr7 }}.xml
107112

resources/js/webauthn.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ WebAuthn.prototype._registerCallback = function(publicKey, callback) {
5858
rawId: this._bufferEncode(publicKey.rawId),
5959
response: {
6060
/** @see https://www.w3.org/TR/webauthn/#authenticatorattestationresponse */
61-
clientDataJSON: this._bufferEncode(publicKey.response.clientDataJSON),
61+
clientDataJSON: this._bufferEncode(publicKey.response.clientDataJSON).replace(/=/g, ''),
6262
attestationObject: this._bufferEncode(publicKey.response.attestationObject)
6363
}
6464
};
@@ -103,8 +103,8 @@ WebAuthn.prototype._signCallback = function(publicKey, callback) {
103103
rawId: this._bufferEncode(publicKey.rawId),
104104
response: {
105105
/** @see https://www.w3.org/TR/webauthn/#iface-authenticatorassertionresponse */
106-
authenticatorData: this._bufferEncode(publicKey.response.authenticatorData),
107-
clientDataJSON: this._bufferEncode(publicKey.response.clientDataJSON),
106+
authenticatorData: this._bufferEncode(publicKey.response.authenticatorData).replace(/=/g, ''),
107+
clientDataJSON: this._bufferEncode(publicKey.response.clientDataJSON).replace(/=/g, ''),
108108
signature: this._bufferEncode(publicKey.response.signature),
109109
userHandle: (publicKey.response.userHandle ? this._bufferEncode(publicKey.response.userHandle) : null),
110110
}
@@ -130,7 +130,7 @@ WebAuthn.prototype._bufferEncode = function(value) {
130130
* @return {string}
131131
*/
132132
WebAuthn.prototype._bufferDecode = function(value) {
133-
var t = window.atob(value)
133+
var t = window.atob(value);
134134
return Uint8Array.from(t, c => c.charCodeAt(0));
135135
}
136136

0 commit comments

Comments
 (0)