Skip to content

Commit

Permalink
refactor session key validator
Browse files Browse the repository at this point in the history
  • Loading branch information
ququzone committed Oct 9, 2023
1 parent 6f99e11 commit ffba5fe
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 88 deletions.
81 changes: 0 additions & 81 deletions contracts/common/Helpers.sol

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
pragma solidity 0.8.19;

import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@account-abstraction/contracts/core/Helpers.sol";

import "../interfaces/IValidator.sol";
import "../common/Contants.sol";
import "../common/Helpers.sol";
import "./BaseValidator.sol";
import "../../interfaces/IValidator.sol";
import "../../common/Contants.sol";
import "../BaseValidator.sol";

struct SessionKeyStorage {
uint48 validUntil;
Expand All @@ -32,7 +32,6 @@ contract OwnerSessionKeyValidator is BaseValidator {

SessionKeyStorage storage sessionKey = sessionKeyStorage[recovered][account];
if (sessionKey.validUntil == 0) {
// we do not allow validUntil == 0 here
return Contants.SIG_VALIDATION_FAILED;
}
validationData = _packValidationData(false, sessionKey.validUntil, sessionKey.validAfter);
Expand All @@ -42,7 +41,7 @@ contract OwnerSessionKeyValidator is BaseValidator {
address sessionKey = address(bytes20(data[0:20]));
uint48 validUntil = uint48(bytes6(data[20:26]));
uint48 validAfter = uint48(bytes6(data[26:32]));
require(validUntil > validAfter, "OwnerSessionKeyValidator: invalid validUntil/validAfter"); // we do not allow validUntil == 0 here use validUntil == 2**48-1 instead
require(validUntil > validAfter, "OwnerSessionKeyValidator: invalid validUntil/validAfter");
sessionKeyStorage[sessionKey][msg.sender] = SessionKeyStorage(validUntil, validAfter);

emit NewSessionKey(msg.sender, sessionKey, validUntil, validAfter);
Expand Down
1 change: 0 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import '@typechain/hardhat'
import 'hardhat-deploy'

import importToml from 'import-toml'
import { BigNumber } from 'ethers'
// @ts-ignore
const foundryConfig = importToml.sync('foundry.toml').profile

Expand Down

0 comments on commit ffba5fe

Please sign in to comment.