@@ -294,7 +294,7 @@ public function processRegistration(
294294 throw new WebauthnException ('Invalid origin provided ' );
295295 }
296296
297- $ attestation = new AttestationData ( $ attestationObject , $ this ->formats );
297+ $ attestation = $ this ->createAttestationData ( $ attestationObject );
298298
299299 // 9. Verify that the RP ID hash in authData is indeed the SHA-256
300300 // hash of the RP ID expected by the RP.
@@ -382,7 +382,7 @@ public function processAuthentication(
382382 $ challenge = new ByteBuffer ($ challenge );
383383 }
384384 $ clientDataHash = hash ('sha256 ' , $ clientDataJson , true );
385- $ authenticator = new AuthenticatorData ($ authenticatorData );
385+ $ authenticator = $ this -> createAuthenticatorData ($ authenticatorData );
386386 try {
387387 // 5. Let JSON text be the result of running UTF-8 decode on the value of cData.
388388 $ clientData = Json::decode ($ clientDataJson );
@@ -498,6 +498,26 @@ public function getChallenge(): ?ByteBuffer
498498 }
499499
500500
501+ /**
502+ * Create the attestation data instance
503+ * @param string $attestationObject
504+ * @return AttestationData
505+ */
506+ protected function createAttestationData (string $ attestationObject ): AttestationData
507+ {
508+ return new AttestationData ($ attestationObject , $ this ->formats );
509+ }
510+
511+ /**
512+ * Create the authenticator data instance
513+ * @param string $authenticatorData
514+ * @return AuthenticatorData
515+ */
516+ protected function createAuthenticatorData (string $ authenticatorData ): AuthenticatorData
517+ {
518+ return new AuthenticatorData ($ authenticatorData );
519+ }
520+
501521 /**
502522 * Check the given origin
503523 * @param string $origin
0 commit comments