diff --git a/modules/passkey/contracts/SafeWebAuthnSignerProxy.sol b/modules/passkey/contracts/SafeWebAuthnSignerProxy.sol index 545d260c..104451b8 100644 --- a/modules/passkey/contracts/SafeWebAuthnSignerProxy.sol +++ b/modules/passkey/contracts/SafeWebAuthnSignerProxy.sol @@ -11,15 +11,15 @@ contract SafeWebAuthnSignerProxy { /** * @notice The X coordinate of the P-256 public key of the WebAuthn credential. */ - uint256 public immutable X; + uint256 internal immutable X; /** * @notice The Y coordinate of the P-256 public key of the WebAuthn credential. */ - uint256 public immutable Y; + uint256 internal immutable Y; /** * @notice The P-256 verifiers used for ECDSA signature validation. */ - P256.Verifiers public immutable VERIFIERS; + P256.Verifiers internal immutable VERIFIERS; /** * @notice The contract address to which proxy contract forwards the call via delegatecall. diff --git a/modules/passkey/contracts/SafeWebAuthnSignerSingleton.sol b/modules/passkey/contracts/SafeWebAuthnSignerSingleton.sol index db009968..b7ac2332 100644 --- a/modules/passkey/contracts/SafeWebAuthnSignerSingleton.sol +++ b/modules/passkey/contracts/SafeWebAuthnSignerSingleton.sol @@ -24,4 +24,25 @@ contract SafeWebAuthnSignerSingleton is SignatureValidator { } success = WebAuthn.verifySignature(message, signature, WebAuthn.USER_VERIFICATION, x, y, verifiers); } + + function getX() external view returns (uint256 x) { + // solhint-disable-next-line no-inline-assembly + assembly { + x := calldataload(sub(calldatasize(), 88)) + } + } + + function getY() external view returns (uint256 y) { + // solhint-disable-next-line no-inline-assembly + assembly { + y := calldataload(sub(calldatasize(), 56)) + } + } + + function getVerifiers() external view returns (P256.Verifiers verifiers) { + // solhint-disable-next-line no-inline-assembly + assembly { + verifiers := shr(64, calldataload(sub(calldatasize(), 24))) + } + } } diff --git a/modules/passkey/contracts/base/SignatureValidator.sol b/modules/passkey/contracts/base/SignatureValidator.sol index ad0baa2f..800282b2 100644 --- a/modules/passkey/contracts/base/SignatureValidator.sol +++ b/modules/passkey/contracts/base/SignatureValidator.sol @@ -2,7 +2,6 @@ pragma solidity >=0.8.0; import {ERC1271} from "../libraries/ERC1271.sol"; -import {P256} from "../libraries/WebAuthn.sol"; /** * @title Signature Validator Base Contract diff --git a/modules/passkey/test/SafeWebAuthnSignerProxy.spec.ts b/modules/passkey/test/SafeWebAuthnSignerProxy.spec.ts index 09157bbb..4698b410 100644 --- a/modules/passkey/test/SafeWebAuthnSignerProxy.spec.ts +++ b/modules/passkey/test/SafeWebAuthnSignerProxy.spec.ts @@ -52,12 +52,9 @@ describe('SafeWebAuthnSignerProxy', () => { describe('constructor', function () { it('Should set immutables', async () => { const { x, y, verifiers, signer } = await setupTests() - - const signerProxy = await ethers.getContractAt('SafeWebAuthnSignerProxy', signer.target) - expect(await signerProxy.X()).to.equal(x) - expect(await signerProxy.Y()).to.equal(y) - - expect(await signerProxy.VERIFIERS()).to.equal(verifiers) + expect(await signer.getX()).to.equal(x) + expect(await signer.getY()).to.equal(y) + expect(await signer.getVerifiers()).to.equal(verifiers) }) })