mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
ircd:Ⓜ️:event: Minor rename; additional diagnostic arguments.
This commit is contained in:
parent
7880f01ef4
commit
bc1e54aa12
3 changed files with 31 additions and 7 deletions
|
@ -121,7 +121,7 @@ struct ircd::m::event
|
|||
static conf::item<size_t> max_size;
|
||||
|
||||
static bool my(const idx &);
|
||||
static json::object referential(const mutable_buffer &, const json::object &);
|
||||
static json::object preimage(const mutable_buffer &, const json::object &);
|
||||
static void essential(json::iov &event, const json::iov &content, const closure_iov_mutable &);
|
||||
static bool verify(const json::object &, const ed25519::pk &, const ed25519::sig &sig);
|
||||
static ed25519::sig sign(const string_view &, const ed25519::sk &);
|
||||
|
|
|
@ -182,14 +182,14 @@ ircd::sha256::buf
|
|||
ircd::m::event::hash(const json::object &event_)
|
||||
{
|
||||
thread_local char buf[event::MAX_SIZE];
|
||||
const json::object event
|
||||
const json::object preimage
|
||||
{
|
||||
referential(buf, event_)
|
||||
event::preimage(buf, event_)
|
||||
};
|
||||
|
||||
return sha256
|
||||
{
|
||||
event
|
||||
preimage
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -915,7 +915,7 @@ catch(const json::not_found &e)
|
|||
}
|
||||
|
||||
ircd::json::object
|
||||
ircd::m::event::referential(const mutable_buffer &buf,
|
||||
ircd::m::event::preimage(const mutable_buffer &buf_,
|
||||
const json::object &event)
|
||||
try
|
||||
{
|
||||
|
@ -936,9 +936,10 @@ try
|
|||
member.at(i++) = m;
|
||||
}
|
||||
|
||||
mutable_buffer buf{buf_};
|
||||
const string_view ret
|
||||
{
|
||||
json::stringify(mutable_buffer(buf), member.data(), member.data() + i)
|
||||
json::stringify(buf, member.data(), member.data() + i)
|
||||
};
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -14296,6 +14296,29 @@ console_cmd__fed__event(opt &out, const string_view &line)
|
|||
return true;
|
||||
}
|
||||
|
||||
if(has(op, "essential"))
|
||||
{
|
||||
const unique_mutable_buffer buf
|
||||
{
|
||||
m::event::MAX_SIZE
|
||||
};
|
||||
|
||||
out << m::essential(response, buf) << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(has(op, "preimage"))
|
||||
{
|
||||
const unique_mutable_buffer buf
|
||||
{
|
||||
m::event::MAX_SIZE
|
||||
};
|
||||
|
||||
const string_view preimage(m::event::preimage(buf, response));
|
||||
out << preimage << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
m::event::id::buf _event_id;
|
||||
const m::event event
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue