-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
13d0c3f
commit f22c95a
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity =0.8.19; | ||
|
||
/// @title Keyring Checker Interface | ||
/// @notice Interface for a contract that checks credentials against a Keyring contract. | ||
interface IKeyringChecker { | ||
/** | ||
* @notice Checks if an entity has a valid credential and supports legacy interface. | ||
* @param policyId The ID of the policy. | ||
* @param entity The address of the entity to check. | ||
* @return True if the entity has a valid credential, false otherwise. | ||
*/ | ||
function checkCredential(uint256 policyId, address entity) external view returns (bool); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity =0.8.19; | ||
|
||
import { IKeyringChecker } from "../interfaces/IKeyringChecker.sol"; | ||
|
||
/// @title Mocked Keyring Checker | ||
/// @notice A mock implementation of IKeyringChecker for testing purposes | ||
contract MockedKeyringChecker is IKeyringChecker { | ||
/// @notice Whether to allow the user or not. | ||
bool public allow = false; | ||
|
||
/// @notice Sets the allow flag. | ||
/// @param _allow Whether to allow the user or not. | ||
function setAllow(bool _allow) external { | ||
allow = _allow; | ||
} | ||
|
||
/// @notice Checks if the user satisfies the policy. | ||
/// @param policyId The policy ID to check against (unused in mock). | ||
/// @param entity The address to check. | ||
/// @return result True if the user satisfies the policy, false otherwise. | ||
/* solhint-disable-next-line no-unused-vars */ | ||
function checkCredential(uint256 policyId, address entity) external view returns (bool) { | ||
return allow; | ||
} | ||
} |