MCPcopy Create free account
hub / github.com/ceramicnetwork/rust-ceramic / assert_invalid_event

Function assert_invalid_event

validation/src/test.rs:108–138  ·  view source on GitHub ↗
(
    signing_type: SigningType,
    event_type: TestEventType,
    opts: &VerifyJwsOpts,
)

Source from the content-addressed store, hash-verified

106}
107
108pub async fn assert_invalid_event(
109 signing_type: SigningType,
110 event_type: TestEventType,
111 opts: &VerifyJwsOpts,
112) {
113 let (_cid, event) = get_test_event(signing_type, event_type);
114 let controller = extract_init_controller(signing_type, event_type, &event);
115 match event {
116 unvalidated::Event::Time(_) => unreachable!("not a time event"),
117 unvalidated::Event::Signed(s) => {
118 // should verify against init controller and self contained
119 match s.verify_signature(Some(&controller), opts).await {
120 Ok(_) => {
121 panic!("should have been invalid")
122 }
123 Err(e) => {
124 tracing::debug!("failed as expected: {:#}", e);
125 }
126 }
127 match s.verify_signature(None, opts).await {
128 Ok(_) => {
129 panic!("should have been invalid")
130 }
131 Err(e) => {
132 tracing::debug!("failed as expected: {:#}", e);
133 }
134 }
135 }
136 unvalidated::Event::Unsigned(_) => unreachable!("not unsigned"),
137 };
138}
139
140pub async fn verify_event(
141 signing_type: SigningType,

Callers 2

invalid_init_signaturesFunction · 0.85
invalid_data_signaturesFunction · 0.85

Calls 3

get_test_eventFunction · 0.85
extract_init_controllerFunction · 0.85
verify_signatureMethod · 0.45

Tested by

no test coverage detected