Reorder cryptography folder (#5711)

Co-authored-by: ernestognw <ernestognw@gmail.com>
This commit is contained in:
Hadrien Croubois
2025-06-04 05:40:34 +02:00
committed by GitHub
parent 784d4f71b1
commit f45e9158b7
12 changed files with 130 additions and 83 deletions

View File

@ -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}}

View 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}}

View File

@ -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}.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.