Skip to content

Commit b6a5e89

Browse files
authored
Fix docs references to cryptographic utilities (#5717)
1 parent 37f873d commit b6a5e89

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

contracts/utils/cryptography/ERC7739Utils.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {Calldata} from "../Calldata.sol";
99
* that are specific to an EIP-712 domain.
1010
*
1111
* This library provides methods to wrap, unwrap and operate over typed data signatures with a defensive
12-
* rehashing mechanism that includes the application's xref:api:utils#EIP712-_domainSeparatorV4[EIP-712]
12+
* rehashing mechanism that includes the app's xref:api:utils/cryptography#EIP712-_domainSeparatorV4[EIP-712]
1313
* and preserves readability of the signed content using an EIP-712 nested approach.
1414
*
1515
* A smart contract domain can validate a signature for a typed data structure in two ways:
@@ -20,8 +20,8 @@ import {Calldata} from "../Calldata.sol";
2020
* NOTE: A provider for a smart contract wallet would need to return this signature as the
2121
* result of a call to `personal_sign` or `eth_signTypedData`, and this may be unsupported by
2222
* API clients that expect a return value of 129 bytes, or specifically the `r,s,v` parameters
23-
* of an xref:api:utils#ECDSA[ECDSA] signature, as is for example specified for
24-
* xref:api:utils#EIP712[EIP-712].
23+
* of an xref:api:utils/cryptography#ECDSA[ECDSA] signature, as is for example specified for
24+
* xref:api:utils/cryptography#EIP712[EIP-712].
2525
*/
2626
library ERC7739Utils {
2727
/**

contracts/utils/cryptography/signers/AbstractSigner.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ abstract contract AbstractSigner {
1515
*
1616
* WARNING: Implementing a signature validation algorithm is a security-sensitive operation as it involves
1717
* cryptographic verification. It is important to review and test thoroughly before deployment. Consider
18-
* using one of the signature verification libraries (xref:api:utils#ECDSA[ECDSA], xref:api:utils#P256[P256]
19-
* or xref:api:utils#RSA[RSA]).
18+
* using one of the signature verification libraries (xref:api:utils/cryptography#ECDSA[ECDSA],
19+
* xref:api:utils/cryptography#P256[P256] or xref:api:utils/cryptography#RSA[RSA]).
2020
*/
2121
function _rawSignatureValidation(bytes32 hash, bytes calldata signature) internal view virtual returns (bool);
2222
}

contracts/utils/cryptography/signers/ERC7739.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import {ShortStrings} from "../../ShortStrings.sol";
1818
* This contract requires implementing the {_rawSignatureValidation} function, which passes the wrapped message hash,
1919
* which may be either an typed data or a personal sign nested type.
2020
*
21-
* NOTE: xref:api:utils#EIP712[EIP-712] uses xref:api:utils#ShortStrings[ShortStrings] to optimize gas
22-
* costs for short strings (up to 31 characters). Consider that strings longer than that will use storage,
21+
* NOTE: xref:api:utils/cryptography#EIP712[EIP-712] uses xref:api:utils/cryptography#ShortStrings[ShortStrings] to
22+
* optimize gas costs for short strings (up to 31 characters). Consider that strings longer than that will use storage,
2323
* which may limit the ability of the signer to be used within the ERC-4337 validation phase (due to
2424
* https://eips.ethereum.org/EIPS/eip-7562#storage-rules[ERC-7562 storage access rules]).
2525
*/

contracts/utils/cryptography/signers/SignerECDSA.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {AbstractSigner} from "./AbstractSigner.sol";
66
import {ECDSA} from "../ECDSA.sol";
77

88
/**
9-
* @dev Implementation of {AbstractSigner} using xref:api:utils#ECDSA[ECDSA] signatures.
9+
* @dev Implementation of {AbstractSigner} using xref:api:utils/cryptography#ECDSA[ECDSA] signatures.
1010
*
1111
* For {Account} usage, a {_setSigner} function is provided to set the {signer} address.
1212
* Doing so is easier for a factory, who is likely to use initializable clones of this contract.

contracts/utils/cryptography/signers/SignerP256.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {AbstractSigner} from "./AbstractSigner.sol";
66
import {P256} from "../P256.sol";
77

88
/**
9-
* @dev Implementation of {AbstractSigner} using xref:api:utils#P256[P256] signatures.
9+
* @dev Implementation of {AbstractSigner} using xref:api:utils/cryptography#P256[P256] signatures.
1010
*
1111
* For {Account} usage, a {_setSigner} function is provided to set the {signer} public key.
1212
* Doing so is easier for a factory, who is likely to use initializable clones of this contract.

contracts/utils/cryptography/signers/SignerRSA.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {AbstractSigner} from "./AbstractSigner.sol";
66
import {RSA} from "../RSA.sol";
77

88
/**
9-
* @dev Implementation of {AbstractSigner} using xref:api:utils#RSA[RSA] signatures.
9+
* @dev Implementation of {AbstractSigner} using xref:api:utils/cryptography#RSA[RSA] signatures.
1010
*
1111
* For {Account} usage, a {_setSigner} function is provided to set the {signer} public key.
1212
* Doing so is easier for a factory, who is likely to use initializable clones of this contract.
@@ -44,7 +44,7 @@ abstract contract SignerRSA is AbstractSigner {
4444

4545
/**
4646
* @dev See {AbstractSigner-_rawSignatureValidation}. Verifies a PKCSv1.5 signature by calling
47-
* xref:api:utils.adoc#RSA-pkcs1Sha256-bytes-bytes-bytes-bytes-[RSA.pkcs1Sha256].
47+
* xref:api:utils/cryptography.adoc#RSA-pkcs1Sha256-bytes-bytes-bytes-bytes-[RSA.pkcs1Sha256].
4848
*
4949
* IMPORTANT: Following the RSASSA-PKCS1-V1_5-VERIFY procedure outlined in RFC8017 (section 8.2.2), the
5050
* provided `hash` is used as the `M` (message) and rehashed using SHA256 according to EMSA-PKCS1-v1_5

docs/modules/ROOT/pages/utilities.adoc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ At a high level, signatures are a set of cryptographic algorithms that allow for
1212

1313
==== Ethereum Signatures (secp256k1)
1414

15-
xref:api:utils.adoc#ECDSA[`ECDSA`] provides functions for recovering and managing Ethereum account ECDSA signatures. These are often generated via https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#sign[`web3.eth.sign`], and form a 65-byte array (of type `bytes` in Solidity) arranged the following way: `[[v (1)], [r (32)], [s (32)]]`.
15+
xref:api:utils/cryptography.adoc#ECDSA[`ECDSA`] provides functions for recovering and managing Ethereum account ECDSA signatures. These are often generated via https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#sign[`web3.eth.sign`], and form a 65-byte array (of type `bytes` in Solidity) arranged the following way: `[[v (1)], [r (32)], [s (32)]]`.
1616

17-
The data signer can be recovered with xref:api:utils.adoc#ECDSA-recover-bytes32-bytes-[`ECDSA.recover`], and its address compared to verify the signature. Most wallets will hash the data to sign and add the prefix `\x19Ethereum Signed Message:\n`, so when attempting to recover the signer of an Ethereum signed message hash, you'll want to use xref:api:utils.adoc#MessageHashUtils-toEthSignedMessageHash-bytes32-[`toEthSignedMessageHash`].
17+
The data signer can be recovered with xref:api:utils/cryptography.adoc#ECDSA-recover-bytes32-bytes-[`ECDSA.recover`], and its address compared to verify the signature. Most wallets will hash the data to sign and add the prefix `\x19Ethereum Signed Message:\n`, so when attempting to recover the signer of an Ethereum signed message hash, you'll want to use xref:api:utils/cryptography.adoc#MessageHashUtils-toEthSignedMessageHash-bytes32-[`toEthSignedMessageHash`].
1818

1919
[source,solidity]
2020
----
@@ -28,7 +28,7 @@ function _verify(bytes32 data, bytes memory signature, address account) internal
2828
}
2929
----
3030

31-
WARNING: Getting signature verification right is not trivial: make sure you fully read and understand xref:api:utils.adoc#MessageHashUtils[`MessageHashUtils`]'s and xref:api:utils.adoc#ECDSA[`ECDSA`]'s documentation.
31+
WARNING: Getting signature verification right is not trivial: make sure you fully read and understand xref:api:utils/cryptography.adoc#MessageHashUtils[`MessageHashUtils`]'s and xref:api:utils/cryptography.adoc#ECDSA[`ECDSA`]'s documentation.
3232

3333
==== P256 Signatures (secp256r1)
3434

@@ -79,7 +79,7 @@ This cryptosystem consists of using a private key that's the product of 2 large
7979

8080
RSA signatures are known for being less efficient than elliptic curve signatures given the size of the keys, which are big compared to ECDSA keys with the same security level. Using plain RSA is considered unsafe, this is why the implementation uses the `EMSA-PKCS1-v1_5` encoding method from https://datatracker.ietf.org/doc/html/rfc8017[RFC8017] to include padding to the signature.
8181

82-
To verify a signature using RSA, you can leverage the xref:api:utils.adoc#RSA[`RSA`] library that exposes a method for verifying RSA with the PKCS 1.5 standard:
82+
To verify a signature using RSA, you can leverage the xref:api:utils/cryptography.adoc#RSA[`RSA`] library that exposes a method for verifying RSA with the PKCS 1.5 standard:
8383

8484
[source,solidity]
8585
----
@@ -103,11 +103,11 @@ Developers can build a Merkle Tree off-chain, which allows for verifying that an
103103

104104
TIP: OpenZeppelin Contracts provides a https://github.com/OpenZeppelin/merkle-tree[JavaScript library] for building trees off-chain and generating proofs.
105105

106-
xref:api:utils.adoc#MerkleProof[`MerkleProof`] provides:
106+
xref:api:utils/cryptography.adoc#MerkleProof[`MerkleProof`] provides:
107107

108-
* xref:api:utils.adoc#MerkleProof-verify-bytes32---bytes32-bytes32-[`verify`] - can prove that some value is part of a https://en.wikipedia.org/wiki/Merkle_tree[Merkle tree].
108+
* xref:api:utils/cryptography.adoc#MerkleProof-verify-bytes32---bytes32-bytes32-[`verify`] - can prove that some value is part of a https://en.wikipedia.org/wiki/Merkle_tree[Merkle tree].
109109

110-
* xref:api:utils.adoc#MerkleProof-multiProofVerify-bytes32-bytes32---bytes32---bool---[`multiProofVerify`] - can prove multiple values are part of a Merkle tree.
110+
* xref:api:utils/cryptography.adoc#MerkleProof-multiProofVerify-bytes32-bytes32---bytes32---bool---[`multiProofVerify`] - can prove multiple values are part of a Merkle tree.
111111

112112
For an on-chain Merkle Tree, see the xref:api:utils.adoc#MerkleTree[`MerkleTree`] library.
113113

@@ -482,4 +482,4 @@ function _setTargetAdminDelay(address target, uint32 newDelay) internal virtual
482482
483483
emit TargetAdminDelayUpdated(target, newDelay, effect);
484484
}
485-
----
485+
----

0 commit comments

Comments
 (0)