@@ -10,6 +10,7 @@ use std::str::FromStr;
1010
1111#[ derive( Clone , Debug ) ]
1212pub struct CalculatorParameters {
13+ pub attestation_issuer : DidDocument ,
1314 pub attestation_model_id : StreamId ,
1415 pub materialization_model_id : StreamId ,
1516}
@@ -23,7 +24,12 @@ impl CalculatorParameters {
2324 std:: env:: var ( "MATERIALIZATION_MODEL_ID" ) . unwrap_or_else ( |_| {
2425 "kjzl6hvfrbw6c88slfzg2mw6jvin2hgv2v24tbl9u0xc97f4pr4755xjr2l6sck" . to_string ( )
2526 } ) ;
27+ let attestation_issuer =
28+ DidDocument :: new ( & std:: env:: var ( "ATTESTATION_ISSUER" ) . unwrap_or_else ( |_| {
29+ "did:key:z6MkhER5181mt9PBCrnVvL9AcdWyzSzj4PLgGVKSFjJ8obMN" . to_string ( )
30+ } ) ) ;
2631 Ok ( Self {
32+ attestation_issuer,
2733 attestation_model_id : StreamId :: from_str ( & attestation_model_id) ?,
2834 materialization_model_id : StreamId :: from_str ( & materialization_model_id) ?,
2935 } )
@@ -56,9 +62,16 @@ impl Calculator {
5662 let attestation_stream_id = StreamId :: from_str ( & event. commit_id ) ?;
5763 match serde_json:: from_str :: < PointAttestations > ( & event. content ) {
5864 Ok ( attestation) => {
65+ if attestation. issuer != self . params . attestation_issuer . id {
66+ tracing:: warn!(
67+ "Attestation issuer {} does not match expected {}" ,
68+ attestation. issuer,
69+ self . params. attestation_issuer. id
70+ ) ;
71+ return Ok ( ( ) ) ;
72+ }
5973 if let Err ( e) = validate_attestation ( & attestation) . await {
6074 tracing:: warn!( "Error validating attestation: {}" , e) ;
61- return Ok ( ( ) ) ;
6275 }
6376 unique_events (
6477 & mut self . cache ,
0 commit comments