Reorder cryptography folder (#5711)
Co-authored-by: ernestognw <ernestognw@gmail.com>
This commit is contained in:
@ -4,7 +4,7 @@ pragma solidity ^0.8.20;
|
||||
|
||||
import {PackedUserOperation, IAccount, IEntryPoint} from "../interfaces/draft-IERC4337.sol";
|
||||
import {ERC4337Utils} from "./utils/draft-ERC4337Utils.sol";
|
||||
import {AbstractSigner} from "../utils/cryptography/AbstractSigner.sol";
|
||||
import {AbstractSigner} from "../utils/cryptography/signers/AbstractSigner.sol";
|
||||
|
||||
/**
|
||||
* @dev A simple ERC4337 account implementation. This base implementation only includes the minimal logic to process
|
||||
|
||||
@ -8,15 +8,15 @@ import {AccountERC7579Hooked} from "../../account/extensions/AccountERC7579Hooke
|
||||
import {ERC721Holder} from "../../token/ERC721/utils/ERC721Holder.sol";
|
||||
import {ERC1155Holder} from "../../token/ERC1155/utils/ERC1155Holder.sol";
|
||||
import {ERC4337Utils} from "../../account/utils/draft-ERC4337Utils.sol";
|
||||
import {ERC7739} from "../../utils/cryptography/ERC7739.sol";
|
||||
import {ERC7739} from "../../utils/cryptography/signers/ERC7739.sol";
|
||||
import {ERC7821} from "../../account/extensions/ERC7821.sol";
|
||||
import {MODULE_TYPE_VALIDATOR} from "../../interfaces/draft-IERC7579.sol";
|
||||
import {PackedUserOperation} from "../../interfaces/draft-IERC4337.sol";
|
||||
import {AbstractSigner} from "../../utils/cryptography/AbstractSigner.sol";
|
||||
import {SignerECDSA} from "../../utils/cryptography/SignerECDSA.sol";
|
||||
import {SignerP256} from "../../utils/cryptography/SignerP256.sol";
|
||||
import {SignerRSA} from "../../utils/cryptography/SignerRSA.sol";
|
||||
import {SignerERC7702} from "../../utils/cryptography/SignerERC7702.sol";
|
||||
import {AbstractSigner} from "../../utils/cryptography/signers/AbstractSigner.sol";
|
||||
import {SignerECDSA} from "../../utils/cryptography/signers/SignerECDSA.sol";
|
||||
import {SignerP256} from "../../utils/cryptography/signers/SignerP256.sol";
|
||||
import {SignerRSA} from "../../utils/cryptography/signers/SignerRSA.sol";
|
||||
import {SignerERC7702} from "../../utils/cryptography/signers/SignerERC7702.sol";
|
||||
|
||||
abstract contract AccountMock is Account, ERC7739, ERC7821, ERC721Holder, ERC1155Holder {
|
||||
/// Validates a user operation with a boolean signature.
|
||||
|
||||
@ -4,10 +4,10 @@ pragma solidity ^0.8.20;
|
||||
|
||||
import {ECDSA} from "../../../utils/cryptography/ECDSA.sol";
|
||||
import {EIP712} from "../../../utils/cryptography/EIP712.sol";
|
||||
import {ERC7739} from "../../../utils/cryptography/ERC7739.sol";
|
||||
import {SignerECDSA} from "../../../utils/cryptography/SignerECDSA.sol";
|
||||
import {SignerP256} from "../../../utils/cryptography/SignerP256.sol";
|
||||
import {SignerRSA} from "../../../utils/cryptography/SignerRSA.sol";
|
||||
import {ERC7739} from "../../../utils/cryptography/signers/ERC7739.sol";
|
||||
import {SignerECDSA} from "../../../utils/cryptography/signers/SignerECDSA.sol";
|
||||
import {SignerP256} from "../../../utils/cryptography/signers/SignerP256.sol";
|
||||
import {SignerRSA} from "../../../utils/cryptography/signers/SignerRSA.sol";
|
||||
|
||||
contract ERC7739ECDSAMock is ERC7739, SignerECDSA {
|
||||
constructor(address signerAddr) EIP712("ERC7739ECDSA", "1") {
|
||||
|
||||
@ -7,13 +7,6 @@ Miscellaneous contracts and libraries containing utility functions you can use t
|
||||
|
||||
* {Math}, {SignedMath}: Implementation of various arithmetic functions.
|
||||
* {SafeCast}: Checked downcasting functions to avoid silent truncation.
|
||||
* {ECDSA}, {MessageHashUtils}: Libraries for interacting with ECDSA signatures.
|
||||
* {P256}: Library for verifying and recovering public keys from secp256r1 signatures.
|
||||
* {RSA}: Library with RSA PKCS#1 v1.5 signature verification utilities.
|
||||
* {SignatureChecker}: A library helper to support regular ECDSA from EOAs as well as ERC-1271 signatures for smart contracts.
|
||||
* {Hashes}: Commonly used hash functions.
|
||||
* {MerkleProof}: Functions for verifying https://en.wikipedia.org/wiki/Merkle_tree[Merkle Tree] proofs.
|
||||
* {EIP712}: Contract with functions to allow processing signed typed structure data according to https://eips.ethereum.org/EIPS/eip-712[EIP-712].
|
||||
* {ReentrancyGuard}: A modifier that can prevent reentrancy during certain functions.
|
||||
* {ReentrancyGuardTransient}: Variant of {ReentrancyGuard} that uses transient storage (https://eips.ethereum.org/EIPS/eip-1153[EIP-1153]).
|
||||
* {Pausable}: A common emergency response mechanism that can pause functionality while a remediation is pending.
|
||||
@ -47,11 +40,6 @@ Miscellaneous contracts and libraries containing utility functions you can use t
|
||||
* {CAIP2}, {CAIP10}: Libraries for formatting and parsing CAIP-2 and CAIP-10 identifiers.
|
||||
* {Blockhash}: A library for accessing historical block hashes beyond the standard 256 block limit utilizing EIP-2935's historical blockhash functionality.
|
||||
* {Time}: A library that provides helpers for manipulating time-related objects, including a `Delay` type.
|
||||
* {AbstractSigner}: Abstract contract for internal signature validation in smart contracts.
|
||||
* {ERC7739}: An abstract contract to validate signatures following the rehashing scheme from `ERC7739Utils`.
|
||||
* {ERC7739Utils}: Utilities library that implements a defensive rehashing mechanism to prevent replayability of smart contract signatures based on ERC-7739.
|
||||
* {SignerECDSA}, {SignerP256}, {SignerRSA}: Implementations of an {AbstractSigner} with specific signature validation algorithms.
|
||||
* {SignerERC7702}: Implementation of {AbstractSigner} that validates signatures using the contract's own address as the signer, useful for delegated accounts following EIP-7702.
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
@ -66,40 +54,6 @@ Because Solidity does not support generic types, {EnumerableMap} and {Enumerable
|
||||
|
||||
{{SafeCast}}
|
||||
|
||||
== Cryptography
|
||||
|
||||
{{ECDSA}}
|
||||
|
||||
{{P256}}
|
||||
|
||||
{{RSA}}
|
||||
|
||||
{{EIP712}}
|
||||
|
||||
{{MessageHashUtils}}
|
||||
|
||||
{{SignatureChecker}}
|
||||
|
||||
{{Hashes}}
|
||||
|
||||
{{MerkleProof}}
|
||||
|
||||
{{ERC7739}}
|
||||
|
||||
{{ERC7739Utils}}
|
||||
|
||||
=== Abstract Signers
|
||||
|
||||
{{AbstractSigner}}
|
||||
|
||||
{{SignerECDSA}}
|
||||
|
||||
{{SignerP256}}
|
||||
|
||||
{{SignerERC7702}}
|
||||
|
||||
{{SignerRSA}}
|
||||
|
||||
== Security
|
||||
|
||||
{{ReentrancyGuard}}
|
||||
|
||||
53
contracts/utils/cryptography/README.adoc
Normal file
53
contracts/utils/cryptography/README.adoc
Normal file
@ -0,0 +1,53 @@
|
||||
= Cryptography
|
||||
|
||||
[.readme-notice]
|
||||
NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/utils/cryptography
|
||||
|
||||
A collection of contracts and libraries that implement various signature validation schemes and cryptographic primitives. These utilities enable secure authentication, multisignature operations, and advanced cryptographic operations in smart contracts.
|
||||
|
||||
* {ECDSA}, {MessageHashUtils}: Libraries for interacting with ECDSA signatures.
|
||||
* {P256}: Library for verifying and recovering public keys from secp256r1 signatures.
|
||||
* {RSA}: Library with RSA PKCS#1 v1.5 signature verification utilities.
|
||||
* {SignatureChecker}: A library helper to support regular ECDSA from EOAs as well as ERC-1271 signatures for smart contracts.
|
||||
* {Hashes}: Commonly used hash functions.
|
||||
* {MerkleProof}: Functions for verifying https://en.wikipedia.org/wiki/Merkle_tree[Merkle Tree] proofs.
|
||||
* {EIP712}: Contract with functions to allow processing signed typed structure data according to https://eips.ethereum.org/EIPS/eip-712[EIP-712].
|
||||
* {ERC7739Utils}: Utilities library that implements a defensive rehashing mechanism to prevent replayability of smart contract signatures based on ERC-7739.
|
||||
* {AbstractSigner}: Abstract contract for internal signature validation in smart contracts.
|
||||
* {ERC7739}: An abstract contract to validate signatures following the rehashing scheme from {ERC7739Utils}.
|
||||
* {SignerECDSA}, {SignerP256}, {SignerRSA}: Implementations of an {AbstractSigner} with specific signature validation algorithms.
|
||||
* {SignerERC7702}: Implementation of {AbstractSigner} that validates signatures using the contract's own address as the signer, useful for delegated accounts following EIP-7702.
|
||||
|
||||
== Utils
|
||||
|
||||
{{ECDSA}}
|
||||
|
||||
{{MessageHashUtils}}
|
||||
|
||||
{{P256}}
|
||||
|
||||
{{RSA}}
|
||||
|
||||
{{SignatureChecker}}
|
||||
|
||||
{{Hashes}}
|
||||
|
||||
{{MerkleProof}}
|
||||
|
||||
{{EIP712}}
|
||||
|
||||
{{ERC7739Utils}}
|
||||
|
||||
== Abstract Signers
|
||||
|
||||
{{AbstractSigner}}
|
||||
|
||||
{{ERC7739}}
|
||||
|
||||
{{SignerECDSA}}
|
||||
|
||||
{{SignerP256}}
|
||||
|
||||
{{SignerRSA}}
|
||||
|
||||
{{SignerERC7702}}
|
||||
@ -2,12 +2,12 @@
|
||||
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {IERC1271} from "../../interfaces/IERC1271.sol";
|
||||
import {EIP712} from "../cryptography/EIP712.sol";
|
||||
import {MessageHashUtils} from "../cryptography/MessageHashUtils.sol";
|
||||
import {ShortStrings} from "../ShortStrings.sol";
|
||||
import {AbstractSigner} from "./AbstractSigner.sol";
|
||||
import {ERC7739Utils} from "./ERC7739Utils.sol";
|
||||
import {EIP712} from "../EIP712.sol";
|
||||
import {ERC7739Utils} from "../ERC7739Utils.sol";
|
||||
import {IERC1271} from "../../../interfaces/IERC1271.sol";
|
||||
import {MessageHashUtils} from "../MessageHashUtils.sol";
|
||||
import {ShortStrings} from "../../ShortStrings.sol";
|
||||
|
||||
/**
|
||||
* @dev Validates signatures wrapping the message hash in a nested EIP712 type. See {ERC7739Utils}.
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {ECDSA} from "../cryptography/ECDSA.sol";
|
||||
import {AbstractSigner} from "./AbstractSigner.sol";
|
||||
import {ECDSA} from "../ECDSA.sol";
|
||||
|
||||
/**
|
||||
* @dev Implementation of {AbstractSigner} using xref:api:utils#ECDSA[ECDSA] signatures.
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {ECDSA} from "./ECDSA.sol";
|
||||
import {AbstractSigner} from "./AbstractSigner.sol";
|
||||
import {ECDSA} from "../ECDSA.sol";
|
||||
|
||||
/**
|
||||
* @dev Implementation of {AbstractSigner} for implementation for an EOA. Useful for ERC-7702 accounts.
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {P256} from "./P256.sol";
|
||||
import {AbstractSigner} from "./AbstractSigner.sol";
|
||||
import {P256} from "../P256.sol";
|
||||
|
||||
/**
|
||||
* @dev Implementation of {AbstractSigner} using xref:api:utils#P256[P256] signatures.
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {RSA} from "./RSA.sol";
|
||||
import {AbstractSigner} from "./AbstractSigner.sol";
|
||||
import {RSA} from "../RSA.sol";
|
||||
|
||||
/**
|
||||
* @dev Implementation of {AbstractSigner} using xref:api:utils#RSA[RSA] signatures.
|
||||
Reference in New Issue
Block a user