diff --git a/src/webauthn/src/Credential.php b/src/webauthn/src/Credential.php index c53e8585..7b0e7b28 100644 --- a/src/webauthn/src/Credential.php +++ b/src/webauthn/src/Credential.php @@ -5,6 +5,7 @@ namespace Webauthn; use InvalidArgumentException; +use ParagonIE\ConstantTime\Base64UrlSafe; /** * @see https://w3c.github.io/webappsec-credential-management/#credential @@ -33,10 +34,10 @@ public function __construct( 'The property "$id" is deprecated and will be removed in 5.0.0. Please set null use "rawId" instead.' ); } else { - $id = base64_encode($rawId); + $id = Base64UrlSafe::encodeUnpadded($rawId); } $this->id = $id; - $this->rawId = $rawId ?? base64_encode($id); + $this->rawId = $rawId ?? Base64UrlSafe::decodeNoPadding($id); } /**