mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-12-28 13:33:47 +03:00
Todo: ruma signatures
This commit will get force pushed away later
This commit is contained in:
parent
dba6c46667
commit
22cca206ba
2 changed files with 14 additions and 12 deletions
|
@ -19,3 +19,4 @@ ruma-api = "0.15.0"
|
||||||
ruma-events = "0.18.0"
|
ruma-events = "0.18.0"
|
||||||
js_int = "0.1.3"
|
js_int = "0.1.3"
|
||||||
serde_json = "1.0.50"
|
serde_json = "1.0.50"
|
||||||
|
ruma-signatures = "0.5.0"
|
||||||
|
|
17
src/main.rs
17
src/main.rs
|
@ -218,20 +218,21 @@ fn create_message_event_route(
|
||||||
_txn_id: String,
|
_txn_id: String,
|
||||||
body: Ruma<create_message_event::Request>,
|
body: Ruma<create_message_event::Request>,
|
||||||
) -> MatrixResult<create_message_event::Response> {
|
) -> MatrixResult<create_message_event::Response> {
|
||||||
// Generate event id
|
// Construct event
|
||||||
let event_id = EventId::try_from("$TODOrandomeventid:localhost").unwrap();
|
let event = Event::RoomMessage(MessageEvent {
|
||||||
data.event_add(
|
|
||||||
&body.room_id,
|
|
||||||
&event_id,
|
|
||||||
&Event::RoomMessage(MessageEvent {
|
|
||||||
content: body.data.clone().into_result().unwrap(),
|
content: body.data.clone().into_result().unwrap(),
|
||||||
event_id: event_id.clone(),
|
event_id: event_id.clone(),
|
||||||
origin_server_ts: utils::millis_since_unix_epoch(),
|
origin_server_ts: utils::millis_since_unix_epoch(),
|
||||||
room_id: Some(body.room_id.clone()),
|
room_id: Some(body.room_id.clone()),
|
||||||
sender: body.user_id.clone().expect("user is authenticated"),
|
sender: body.user_id.clone().expect("user is authenticated"),
|
||||||
unsigned: Map::default(),
|
unsigned: Map::default(),
|
||||||
}),
|
});
|
||||||
);
|
|
||||||
|
// Generate event id
|
||||||
|
dbg!(ruma_signatures::reference_hash(event));
|
||||||
|
|
||||||
|
let event_id = EventId::try_from("$TODOrandomeventid:localhost").unwrap();
|
||||||
|
data.event_add(&body.room_id, &event_id, &event);
|
||||||
|
|
||||||
MatrixResult(Ok(create_message_event::Response { event_id }))
|
MatrixResult(Ok(create_message_event::Response { event_id }))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue