Skip to content

Commit 547af0b

Browse files
authored
perf: defer signer() reads until after tryDecodeAuth success (#6070)
1 parent 3f37ada commit 547af0b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

contracts/utils/cryptography/signers/SignerWebAuthn.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ abstract contract SignerWebAuthn is SignerP256 {
4040
bytes32 hash,
4141
bytes calldata signature
4242
) internal view virtual override returns (bool) {
43-
(bytes32 qx, bytes32 qy) = signer();
4443
(bool decodeSuccess, WebAuthn.WebAuthnAuth calldata auth) = WebAuthn.tryDecodeAuth(signature);
45-
46-
return
47-
decodeSuccess
48-
? WebAuthn.verify(abi.encodePacked(hash), auth, qx, qy)
49-
: super._rawSignatureValidation(hash, signature);
44+
if (decodeSuccess) {
45+
(bytes32 qx, bytes32 qy) = signer();
46+
return WebAuthn.verify(abi.encodePacked(hash), auth, qx, qy);
47+
} else {
48+
return super._rawSignatureValidation(hash, signature);
49+
}
5050
}
5151
}

0 commit comments

Comments
 (0)