diff --git a/modules/passkey/contracts/SafeWebAuthnSigner.sol b/modules/passkey/contracts/SafeWebAuthnSigner.sol deleted file mode 100644 index 22197294..00000000 --- a/modules/passkey/contracts/SafeWebAuthnSigner.sol +++ /dev/null @@ -1,48 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-only -pragma solidity >=0.8.0; - -import {SignatureValidatorProxy} from "./base/SignatureValidatorProxy.sol"; -import {IP256Verifier} from "./interfaces/IP256Verifier.sol"; -import {WebAuthn} from "./libraries/WebAuthn.sol"; - -/** - * @title WebAuthn Safe Signature Validator - * @dev A Safe signature validator implementation for a WebAuthn P-256 credential. - * @custom:security-contact bounty@safe.global - */ -contract SafeWebAuthnSigner is SignatureValidatorProxy { - /** - * @notice The X coordinate of the P-256 public key of the WebAuthn credential. - */ - uint256 public immutable X; - - /** - * @notice The Y coordinate of the P-256 public key of the WebAuthn credential. - */ - uint256 public immutable Y; - - /** - * @notice The P-256 verifier used for ECDSA signature validation. - */ - IP256Verifier public immutable VERIFIER; - - /** - * @dev Constructor function. - * @param x The X coordinate of the P-256 public key of the WebAuthn credential. - * @param y The Y coordinate of the P-256 public key of the WebAuthn credential. - * @param verifier The P-256 verifier to use for signature validation. It MUST implement the - * same interface as the EIP-7212 precompile. - */ - constructor(uint256 x, uint256 y, address verifier) { - X = x; - Y = y; - VERIFIER = IP256Verifier(verifier); - } - - /** - * @inheritdoc SignatureValidator - */ - function _verifySignature(bytes32 message, bytes calldata signature) internal view virtual override returns (bool success) { - success = WebAuthn.verifySignature(message, signature, WebAuthn.USER_VERIFICATION, X, Y, VERIFIER); - } -} diff --git a/modules/passkey/contracts/SafeWebAuthnSignerProxy.sol b/modules/passkey/contracts/SafeWebAuthnSignerProxy.sol index df3486aa..5cc5952f 100644 --- a/modules/passkey/contracts/SafeWebAuthnSignerProxy.sol +++ b/modules/passkey/contracts/SafeWebAuthnSignerProxy.sol @@ -7,9 +7,24 @@ import {IP256Verifier} from "./interfaces/IP256Verifier.sol"; * @dev A proxy contract that points to SafeWebAuthnSigner singleton. */ contract SafeWebAuthnSignerProxy { - uint256 internal immutable X; - uint256 internal immutable Y; - IP256Verifier internal immutable VERIFIER; + /** + * @notice The X coordinate of the P-256 public key of the WebAuthn credential. + */ + uint256 public immutable X; + + /** + * @notice The Y coordinate of the P-256 public key of the WebAuthn credential. + */ + uint256 public immutable Y; + + /** + * @notice The P-256 verifier used for ECDSA signature validation. + */ + IP256Verifier public immutable VERIFIER; + + /* + * @notice The singleton contract address. + */ address internal immutable SINGLETON; constructor(address implementation, uint256 x, uint256 y, address verifier) { SINGLETON = implementation; diff --git a/modules/passkey/contracts/SafeWebAuthnSignerSingleton.sol b/modules/passkey/contracts/SafeWebAuthnSignerSingleton.sol index 32cbae21..c272b4b5 100644 --- a/modules/passkey/contracts/SafeWebAuthnSignerSingleton.sol +++ b/modules/passkey/contracts/SafeWebAuthnSignerSingleton.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.0; -import {SignatureValidatorProxy} from "./base/SignatureValidatorProxy.sol"; +import {SignatureValidator} from "./base/SignatureValidator.sol"; import {IP256Verifier} from "./interfaces/IP256Verifier.sol"; import {WebAuthn} from "./libraries/WebAuthn.sol"; /** @@ -9,9 +9,9 @@ import {WebAuthn} from "./libraries/WebAuthn.sol"; * @dev A contract that represents a WebAuthn signer. * @custom:security-contact bounty@safe.global */ -contract SafeWebAuthnSignerSingleton is SignatureValidatorProxy { +contract SafeWebAuthnSignerSingleton is SignatureValidator { /** - * @inheritdoc SignatureValidatorProxy + * @inheritdoc SignatureValidator */ function _verifySignature( bytes32 message, diff --git a/modules/passkey/contracts/base/SignatureValidatorProxy.sol b/modules/passkey/contracts/base/SignatureValidator.sol similarity index 98% rename from modules/passkey/contracts/base/SignatureValidatorProxy.sol rename to modules/passkey/contracts/base/SignatureValidator.sol index 7c9dc89c..b593ea91 100644 --- a/modules/passkey/contracts/base/SignatureValidatorProxy.sol +++ b/modules/passkey/contracts/base/SignatureValidator.sol @@ -7,7 +7,7 @@ import {ERC1271} from "../libraries/ERC1271.sol"; * @dev A interface for smart contract Safe owners that supports multiple ERC-1271 `isValidSignature` versions. * @custom:security-contact bounty@safe.global */ -abstract contract SignatureValidatorProxy { +abstract contract SignatureValidator { /** * @dev Validates the signature for the given data. * @param data The signed data bytes.