-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathISafeSignerFactory.sol
64 lines (59 loc) · 2.7 KB
/
ISafeSignerFactory.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.20;
import {P256} from "../libraries/P256.sol";
/**
* @title Signer Factory for Custom P-256 Signing Schemes
* @dev Interface for a factory contract that can create ERC-1271 compatible signers, and verify
* signatures for custom P-256 signing schemes.
* @custom:security-contact [email protected]
*/
interface ISafeSignerFactory {
/**
* @notice Emitted when a new signer is created.
* @param signer The signer address.
* @param x The x-coordinate of the public key.
* @param y The y-coordinate of the public key.
* @param verifiers The P-256 verifiers to use.
*/
event Created(address indexed signer, uint256 x, uint256 y, P256.Verifiers verifiers);
/**
* @notice Gets the unique signer address for the specified data.
* @dev The unique signer address must be unique for some given data. The signer is not
* guaranteed to be created yet.
* @param x The x-coordinate of the public key.
* @param y The y-coordinate of the public key.
* @param verifiers The P-256 verifiers to use.
* @return signer The signer address.
*/
function getSigner(uint256 x, uint256 y, P256.Verifiers verifiers) external view returns (address signer);
/**
* @notice Create a new unique signer for the specified data.
* @dev The unique signer address must be unique for some given data. This must not revert if
* the unique owner already exists.
* @param x The x-coordinate of the public key.
* @param y The y-coordinate of the public key.
* @param verifiers The P-256 verifiers to use.
* @return signer The signer address.
*/
function createSigner(uint256 x, uint256 y, P256.Verifiers verifiers) external returns (address signer);
/**
* @notice Verifies a signature for the specified address without deploying it.
* @dev This must be equivalent to first deploying the signer with the factory, and then
* verifying the signature with it directly:
* `factory.createSigner(signerData).isValidSignature(message, signature)`
* @param message The signed message.
* @param signature The signature bytes.
* @param x The x-coordinate of the public key.
* @param y The y-coordinate of the public key.
* @param verifiers The P-256 verifiers to use.
* @return magicValue Returns the ERC-1271 magic value when the signature is valid. Reverting or
* returning any other value implies an invalid signature.
*/
function isValidSignatureForSigner(
bytes32 message,
bytes calldata signature,
uint256 x,
uint256 y,
P256.Verifiers verifiers
) external view returns (bytes4 magicValue);
}