ProofRequestLibrary
State Variables
PROOF_REQUEST_TYPE
Id is uint256 as for user defined types, the eip712 type hash uses the underlying type.
string constant PROOF_REQUEST_TYPE =
"ProofRequest(uint256 id,Requirements requirements,string imageUrl,Input input,Offer offer)";
PROOF_REQUEST_TYPEHASH
bytes32 constant PROOF_REQUEST_TYPEHASH = keccak256(
abi.encodePacked(
PROOF_REQUEST_TYPE,
CallbackLibrary.CALLBACK_TYPE,
InputLibrary.INPUT_TYPE,
OfferLibrary.OFFER_TYPE,
PredicateLibrary.PREDICATE_TYPE,
RequirementsLibrary.REQUIREMENTS_TYPE
)
);
Functions
eip712Digest
Computes the EIP-712 digest for the given proof request.
function eip712Digest(ProofRequest memory request) internal pure returns (bytes32);
Name | Type | Description |
---|---|---|
request | ProofRequest | The proof request to compute the digest for. |
Name | Type | Description |
---|---|---|
<none> | bytes32 | The EIP-712 digest of the proof request. |
verifyClientSignature
Verifies the client's signature over the proof request.
function verifyClientSignature(ProofRequest calldata, bytes32 structHash, address addr, bytes calldata signature)
internal
pure
returns (bytes32);
Name | Type | Description |
---|---|---|
<none> | ProofRequest | |
structHash | bytes32 | The EIP-712 struct hash of the proof request. |
addr | address | The address of the client. |
signature | bytes | The signature to validate. |
Name | Type | Description |
---|---|---|
<none> | bytes32 | The struct hash if the signature is valid. |
extractProverSignature
Extracts the prover's signature for the given proof request.
function extractProverSignature(ProofRequest calldata, bytes32 structHash, bytes calldata proverSignature)
internal
pure
returns (address);
Name | Type | Description |
---|---|---|
<none> | ProofRequest | |
structHash | bytes32 | The EIP-712 struct hash of the proof request. |
proverSignature | bytes | The prover's signature to extract. |
Name | Type | Description |
---|---|---|
<none> | address | The address of the prover. |
validateForPriceRequest
Validates the proof request with the intention for it to be priced. Does not check if the request is already locked or fulfilled, but does check if it has expired.
function validateForPriceRequest(ProofRequest calldata request)
internal
view
returns (uint64 lockDeadline1, uint64 deadline1);
Name | Type | Description |
---|---|---|
request | ProofRequest | The proof request to validate. |
Name | Type | Description |
---|---|---|
lockDeadline1 | uint64 | The deadline for when a lock expires for the request. |
deadline1 | uint64 | The deadline for the request as a whole. |
validateForLockRequest
Validates the proof request with the intention for it to be locked. Checks that the request is not already locked or fulfilled.
function validateForLockRequest(
ProofRequest calldata request,
mapping(address => Account) storage accounts,
address client,
uint32 idx
) internal view returns (uint64 lockDeadline1, uint64 deadline1);
Name | Type | Description |
---|---|---|
request | ProofRequest | The proof request to validate. |
accounts | mapping(address => Account) | The mapping of accounts. |
client | address | The address of the client. |
idx | uint32 | The index of the request. |
Name | Type | Description |
---|---|---|
lockDeadline1 | uint64 | The deadline for when a lock expires for the request. |
deadline1 | uint64 | The deadline for the request as a whole. |