#[allow(clippy::too_many_arguments, unused_attributes)]
mod notary_service_inner {
use alloy::sol;
sol! {
#[sol(rpc)]
interface NotaryService {
function initialize(address owner_, address notary_, uint256 fee_) external;
function fee() external view returns (uint256);
function setFee(uint256 fee_) external;
function setNotary(address key, bool trusted_) external;
function isTrustedNotary(address key) external view returns (bool);
function withdraw(address to, uint256 amount) external;
function owner() external view returns (address);
function pendingOwner() external view returns (address);
function transferOwnership(address newOwner) external;
function acceptOwnership() external;
event FeeChanged(uint256 previousFee, uint256 newFee);
event NotaryTrustChanged(address indexed key, bool trusted);
event FeesWithdrawn(address indexed to, uint256 amount);
}
}
}
pub use notary_service_inner::NotaryService;
#[allow(clippy::too_many_arguments, unused_attributes)]
mod proof_verifier_inner {
use alloy::sol;
sol! {
#[sol(rpc)]
interface CeremonyProofVerifier {
function initialize(address owner_) external;
function setVerifier(bytes32 platformId, uint16 verifierVersion, address verifier) external;
function verifierOf(bytes32 platformId, uint16 verifierVersion) external view returns (address);
function quote(bytes32 platformId, uint16 verifierVersion) external view returns (uint256);
function verifiesPlatform(bytes32 platformId) external view returns (bool);
function chainId() external view returns (bytes32);
function owner() external view returns (address);
function pendingOwner() external view returns (address);
function transferOwnership(address newOwner) external;
function acceptOwnership() external;
event VerifierConfigured(bytes32 indexed platformId, uint16 indexed verifierVersion, address verifier);
}
}
}
pub use proof_verifier_inner::CeremonyProofVerifier;
#[allow(clippy::too_many_arguments, unused_attributes)]
mod google_jwt_roots_inner {
use alloy::sol;
sol! {
#[sol(rpc)]
interface GoogleJwtRoots {
#[derive(Debug, serde::Serialize, serde::Deserialize)]
struct Generation {
uint64 observedAt;
bytes32[] moduli;
}
function initialize(address owner_, address notary_) external;
function notaryService() external view returns (address);
function setNotaryService(address notary_) external;
function quoteRotation() external view returns (uint256);
function rotate(bytes calldata attestedData, bytes calldata proof) external payable;
function trustedHashExpiresAt(bytes32 modulusHash) external view returns (uint256);
function currentKeys() external view returns (Generation memory current, Generation memory previous);
function freshestObservedAt() external view returns (uint256);
function needsRotation() external view returns (bool);
function READING_LIFETIME() external view returns (uint256);
function RENEWAL_MARGIN() external view returns (uint256);
function MAX_KEYS() external view returns (uint256);
function owner() external view returns (address);
function pendingOwner() external view returns (address);
function transferOwnership(address newOwner) external;
function acceptOwnership() external;
event NotaryServiceChanged(address notary);
event KeysRotated(uint64 observedAt, string[] kids, bytes32[] moduli);
event ReadingRefreshed(uint64 observedAt);
}
}
}
pub use google_jwt_roots_inner::GoogleJwtRoots;
#[allow(clippy::too_many_arguments, unused_attributes)]
mod tls_notary_platform_verifier_inner {
use alloy::sol;
sol! {
#[sol(rpc)]
interface TlsNotaryPlatformVerifier {
#[derive(Debug, PartialEq, Eq)]
function initialize(
address owner_,
address notary_,
address honkVerifier_,
bytes32 honkVerifierCodehash_
) external;
function platformId() external view returns (bytes32);
function quote() external view returns (uint256);
function notaryService() external view returns (address);
function honkVerifier() external view returns (address);
function honkVerifierCodehash() external view returns (bytes32);
function protocolParameters()
external
pure
returns (uint64 proofLifetime, uint64 maxFutureAttestationSkew, uint64 futureObservationAllowance);
function setTrustRoots(address notary_, address honkVerifier_, bytes32 honkVerifierCodehash_) external;
function owner() external view returns (address);
function pendingOwner() external view returns (address);
function transferOwnership(address newOwner) external;
function acceptOwnership() external;
event TrustRootsChanged(address notary, address honkVerifier, bytes32 honkVerifierCodehash);
error WrongNotaryForProfile(bytes32 platformId, address notary);
error ZeroAddress();
error WrongVerifierArtifact(bytes32 expected, bytes32 found);
}
}
}
pub use tls_notary_platform_verifier_inner::{
TlsNotaryPlatformVerifier,
TlsNotaryPlatformVerifier as GitHubPlatformVerifier,
TlsNotaryPlatformVerifier as XPlatformVerifier,
};
#[allow(clippy::too_many_arguments, unused_attributes)]
mod google_platform_verifier_inner {
use alloy::sol;
sol! {
#[sol(rpc)]
interface GooglePlatformVerifier {
#[derive(Debug, PartialEq, Eq)]
function initialize(
address owner_,
address notary_,
address honkVerifier_,
bytes32 honkVerifierCodehash_,
address jwtRoots_
) external;
function platformId() external view returns (bytes32);
function quote() external view returns (uint256);
function jwtRoots() external view returns (address);
function setJwtRoots(address roots) external;
function notaryService() external view returns (address);
function honkVerifier() external view returns (address);
function honkVerifierCodehash() external view returns (bytes32);
function protocolParameters()
external
pure
returns (uint64 proofLifetime, uint64 maxFutureAttestationSkew, uint64 futureObservationAllowance);
function setTrustRoots(address notary_, address honkVerifier_, bytes32 honkVerifierCodehash_) external;
function owner() external view returns (address);
function pendingOwner() external view returns (address);
function transferOwnership(address newOwner) external;
function acceptOwnership() external;
event JwtRootsChanged(address roots);
event TrustRootsChanged(address notary, address honkVerifier, bytes32 honkVerifierCodehash);
error WrongNotaryForProfile(bytes32 platformId, address notary);
error ZeroAddress();
error WrongVerifierArtifact(bytes32 expected, bytes32 found);
}
}
}
pub use google_platform_verifier_inner::GooglePlatformVerifier;
#[cfg(test)]
mod tests {
use alloy::sol_types::SolCall;
use super::*;
use crate::Artifacts;
#[test]
fn every_bound_platform_verifier_selector_exists_in_its_artifact() {
let artifacts = Artifacts::embedded();
let check = |contract: &str, sig: &str, selector: [u8; 4]| {
let methods = artifacts.method_identifiers(contract).unwrap();
let found = methods
.get(sig)
.unwrap_or_else(|| panic!("{contract} has no {sig}"));
assert_eq!(*found, alloy::hex::encode(selector), "{contract}.{sig}");
};
macro_rules! bound {
($contract:expr, $iface:ident, [$($call:ident),* $(,)?]) => {
$(check($contract, $iface::$call::SIGNATURE, $iface::$call::SELECTOR);)*
};
}
for contract in ["XPlatformVerifier", "GitHubPlatformVerifier"] {
bound!(
contract,
TlsNotaryPlatformVerifier,
[
initializeCall,
platformIdCall,
quoteCall,
notaryServiceCall,
honkVerifierCall,
honkVerifierCodehashCall,
protocolParametersCall,
setTrustRootsCall,
ownerCall,
pendingOwnerCall,
transferOwnershipCall,
acceptOwnershipCall,
]
);
}
bound!(
"GooglePlatformVerifier",
GooglePlatformVerifier,
[
initializeCall,
platformIdCall,
quoteCall,
jwtRootsCall,
setJwtRootsCall,
notaryServiceCall,
honkVerifierCall,
honkVerifierCodehashCall,
protocolParametersCall,
setTrustRootsCall,
ownerCall,
pendingOwnerCall,
transferOwnershipCall,
acceptOwnershipCall,
]
);
assert_ne!(
TlsNotaryPlatformVerifier::initializeCall::SELECTOR,
GooglePlatformVerifier::initializeCall::SELECTOR
);
let google = artifacts
.method_identifiers("GooglePlatformVerifier")
.unwrap();
assert!(
!google.contains_key(TlsNotaryPlatformVerifier::initializeCall::SIGNATURE)
);
let x = artifacts.method_identifiers("XPlatformVerifier").unwrap();
assert!(!x.contains_key(GooglePlatformVerifier::initializeCall::SIGNATURE));
}
}