Skip to content

Commit

Permalink
fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
davidinsuomi committed Jan 3, 2024
1 parent ff3bb87 commit 5dce926
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 25 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "../keystore/L1/interfaces/IKeyStoreValidator.sol";
import "./libraries/ValidatorSigDecoder.sol";
import "../libraries/WebAuthn.sol";
import "../libraries/Errors.sol";
import "../libraries/TypeConversion.sol";

contract KeyStoreValidator is IKeyStoreValidator{
contract KeyStoreValidator is IKeyStoreValidator {
using TypeConversion for address;

function recoverSignature(
bytes32 rawHash,
bytes calldata rawSignature
) external view returns (bytes32 recovered, bool success) {
function recoverSignature(bytes32 rawHash, bytes calldata rawSignature)
external
view
returns (bytes32 recovered, bool success)
{
uint8 signatureType;
bytes calldata signature;
uint256 validationData;
(signatureType, validationData, signature) = ValidatorSigDecoder
.decodeValidatorSignature(rawSignature);
(signatureType, validationData, signature) = ValidatorSigDecoder.decodeValidatorSignature(rawSignature);

bytes32 hash = _packSignatureHash(
rawHash,
signatureType,
validationData
);
bytes32 hash = _packSignatureHash(rawHash, signatureType, validationData);

(recovered, success) = recover(signatureType, hash, signature);
}

function _packSignatureHash(
bytes32 _hash,
uint8 signatureType,
uint256 validationData
) internal pure returns (bytes32 packedHash) {
function _packSignatureHash(bytes32 _hash, uint8 signatureType, uint256 validationData)
internal
pure
returns (bytes32 packedHash)
{
if (signatureType == 0x0) {
packedHash = _hash;
} else if (signatureType == 0x1) {
Expand All @@ -47,15 +44,14 @@ contract KeyStoreValidator is IKeyStoreValidator{
}
}

function recover(
uint8 signatureType,
bytes32 rawHash,
bytes calldata rawSignature
) internal view returns (bytes32 recovered, bool success) {
function recover(uint8 signatureType, bytes32 rawHash, bytes calldata rawSignature)
internal
view
returns (bytes32 recovered, bool success)
{
if (signatureType == 0x0 || signatureType == 0x1) {
//ecdas recover
(address recoveredAddr, ECDSA.RecoverError error, ) = ECDSA
.tryRecover(rawHash, rawSignature);
(address recoveredAddr, ECDSA.RecoverError error,) = ECDSA.tryRecover(rawHash, rawSignature);
if (error != ECDSA.RecoverError.NoError) {
success = false;
} else {
Expand Down
2 changes: 1 addition & 1 deletion script/PaymasterDeployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.13;

import "forge-std/Script.sol";
import "@account-abstraction/contracts/core/EntryPoint.sol";
import "@source/dev/Tokens/TokenERC20.sol";
import "@source/dev/tokens/TokenERC20.sol";
import "@source/dev/TestOracle.sol";
import "./DeployHelper.sol";
import "@source/paymaster/ERC20Paymaster.sol";
Expand Down

0 comments on commit 5dce926

Please sign in to comment.