Skip to content

Conversation

@mohamadhammoud
Copy link
Collaborator

No description provided.

@mohamadhammoud mohamadhammoud self-assigned this Jan 3, 2026
import { KeyTypes } from "../libraries/KeyTypes.sol";

contract IdFactory is IIdFactory, Ownable {
using ECDSA for bytes32;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unneeded as you are using ECDSA.* syntax

bytes calldata signature,
uint256 expiry
) external override {
if (wallet == address(0)) {
Copy link
Collaborator

@pgonday pgonday Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use require
I don't understand this mlx of if...revert and require ??

if (wallet == address(0)) {
revert Errors.ZeroAddress();
}
if (block.timestamp > expiry) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use require

revert Errors.ZeroAddress();
}
if (block.timestamp > expiry) {
revert Errors.SignatureExpired(expiry);
Copy link
Collaborator

@pgonday pgonday Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use existing error ExpiredSignature

abi.encode(wallet, identity, expiry, address(this), block.chainid)
);

address signer = _recoverWalletSigner(structHash, signature);
Copy link
Collaborator

@pgonday pgonday Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unneeded orphan internal function, inline

* @dev See {IdFactory-unregisterWalletFromIdentity}.
*/
function unregisterWalletFromIdentity(address wallet) external override {
if (wallet == address(0)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use require

if (wallet == address(0)) {
revert Errors.ZeroAddress();
}
if (_userIdentity[wallet] != msg.sender) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use require

revert Errors.ZeroAddress();
}
if (_userIdentity[wallet] != msg.sender) {
revert Errors.WalletNotLinked();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use existing error WalletNotLinkedToIdentity

bytes32 structHash,
bytes calldata signature
) internal pure returns (address) {
bytes32 digest = keccak256(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use MessageHashUtils.toEthSignedMessageHash

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some branches are not covered (3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants