mirror of
https://github.com/matrix-construct/construct
synced 2024-09-26 18:38:52 +02:00
ircd:Ⓜ️ Add essential key pruning for m.room.redaction sign and verify.
This commit is contained in:
parent
b69848b620
commit
1309565506
1 changed files with 28 additions and 0 deletions
|
@ -1075,6 +1075,29 @@ ircd::m::event::essential(json::iov &event,
|
|||
|
||||
closure(event);
|
||||
}
|
||||
else if(type == "m.room.redaction")
|
||||
{
|
||||
// This simply finds the redacts key and swaps it with jsundefined for
|
||||
// the scope's duration. The redacts key will still be present and
|
||||
// visible in the json::iov which is incorrect if directly serialized.
|
||||
// However, this iov is turned into a json::tuple (m::event) which ends
|
||||
// up being serialized for signing. That serialization is where the
|
||||
// jsundefined redacts value is ignored.
|
||||
auto &redacts{event.at("redacts")};
|
||||
json::value temp(std::move(redacts));
|
||||
redacts = json::value{};
|
||||
const unwind _{[&redacts, &temp]
|
||||
{
|
||||
redacts = std::move(temp);
|
||||
}};
|
||||
|
||||
const json::iov::push _content
|
||||
{
|
||||
event, { "content", "{}" }
|
||||
};
|
||||
|
||||
closure(event);
|
||||
}
|
||||
else
|
||||
{
|
||||
const json::iov::push _content
|
||||
|
@ -1154,6 +1177,11 @@ ircd::m::essential(m::event event,
|
|||
{ "users_default", unquote(content.at("users_default")) },
|
||||
});
|
||||
}
|
||||
else if(type == "m.room.redaction")
|
||||
{
|
||||
json::get<"redacts"_>(event) = string_view{};
|
||||
content = "{}"_sv;
|
||||
}
|
||||
else
|
||||
{
|
||||
content = "{}"_sv;
|
||||
|
|
Loading…
Reference in a new issue