Getting started
CheckNSignatures is a Solidity library that can be installed in different ways. Below, you will find instructions for using it together with Foundry.
Installation
Using a package manager
npm i https://github.com/rhinestonewtf/checknsignatures
Using git submodules
forge install rhinestonewtf/checknsignatures
Quick Start
In a contract, you can use the CheckNSignatures
library to verify multiple signatures:
import { CheckSignatures } from "checknsignatures/CheckNSignatures.sol";
contract Example {
using CheckSignatures for bytes32;
function verify(bytes32 hash, bytes memory signatures) external view returns (bool) {
// Determine the number of required signatures
uint256 requiredSignatures = 2;
// Recover the signers
address[] memory recoveredSigners = hash.recoverNSignatures(signatures, requiredSignatures);
// Check if the signers are the expected ones
// ...
}
}