mirror of
https://github.com/luxfi/fhe.git
synced 2026-09-24 00:27:17 +00:00
- Remove old Go FHE code (now in lux/fhe) - Remove old Zama compatibility layers - Update CI for TypeScript/JS SDK only - This repo is now purely the @luxfhe npm package ecosystem
25 lines
754 B
Solidity
25 lines
754 B
Solidity
// SPDX-License-Identifier: BSD-3-Clause-Clear
|
|
|
|
pragma solidity ^0.8.20;
|
|
|
|
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
|
|
import "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
|
|
|
|
abstract contract EIP712Reencrypt is EIP712 {
|
|
constructor() EIP712("Authorization token", "1") {}
|
|
|
|
modifier signedBySender(bytes32 publicKey, bytes memory signature) {
|
|
bytes32 digest = _hashTypedDataV4(
|
|
keccak256(
|
|
abi.encode(keccak256("Reencrypt(bytes32 publicKey)"), publicKey)
|
|
)
|
|
);
|
|
address signer = ECDSA.recover(digest, signature);
|
|
require(
|
|
signer == msg.sender,
|
|
"EIP712 signer and transaction signer do not match"
|
|
);
|
|
_;
|
|
}
|
|
}
|