Skip to main content

tempo_contracts/precompiles/
signature_verifier.rs

1pub use ISignatureVerifier::ISignatureVerifierErrors as SignatureVerifierError;
2
3crate::sol! {
4    #[derive(Debug, PartialEq, Eq)]
5    #[sol(abi)]
6    interface ISignatureVerifier {
7
8        /// @notice Recovers the signer of a Tempo signature (secp256k1, P256, WebAuthn).
9        /// @param hash The message hash that was signed
10        /// @param signature The encoded signature (see Tempo Transaction spec for formats)
11        /// @return Address of the signer if valid, reverts otherwise
12        function recover(bytes32 hash, bytes calldata signature) external view returns (address signer);
13
14        /// @notice Verifies a signer against a Tempo signature (secp256k1, P256, WebAuthn).
15        /// @param signer The input address verified against the recovered signer
16        /// @param hash The message hash that was signed
17        /// @param signature The encoded signature (see Tempo Transaction spec for formats)
18        /// @return True if the input address signed, false otherwise. Reverts on invalid signatures.
19        function verify(address signer, bytes32 hash, bytes calldata signature) external view returns (bool);
20
21        /// @notice Verifies whether a keychain signature was produced by an active key.
22        /// @param account The expected embedded root account
23        /// @param hash The message hash that was signed
24        /// @param signature The encoded keychain signature
25        /// @dev Does not compare the inner signature type against the stored key type.
26        /// @return True if the keychain access key is active on account.
27        function verifyKeychain(address account, bytes32 hash, bytes calldata signature) external view returns (bool);
28
29        /// @notice Verifies whether a keychain signature was produced by a root or active admin key.
30        /// @param account The expected embedded root account
31        /// @param hash The message hash that was signed
32        /// @param signature The encoded keychain signature
33        /// @dev Does not compare the inner signature type against the stored key type.
34        /// @return True if the recovered key is account or an active admin key on account.
35        function verifyKeychainAdmin(address account, bytes32 hash, bytes calldata signature) external view returns (bool);
36
37        error InvalidFormat();
38        error InvalidSignature();
39    }
40}