// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol"; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; /// @dev Test-only ERC-1271 wallet: a contract wallet whose approvals are ECDSA signatures of `owner`. /// Used to prove that AereIdentityRegistry8004V2.setAgentWallet accepts contract wallets (ERC-1271) /// and not only EOAs (EIP-712), as the ERC-8004 draft requires. contract Mock1271Wallet is IERC1271 { address public immutable owner; constructor(address owner_) { owner = owner_; } function isValidSignature(bytes32 hash, bytes memory signature) external view override returns (bytes4) { (address rec, ECDSA.RecoverError err) = ECDSA.tryRecover(hash, signature); if (err == ECDSA.RecoverError.NoError && rec == owner) return IERC1271.isValidSignature.selector; return bytes4(0); } }