mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 00:32:35 +01:00
ircd:Ⓜ️:event: Add bool argument to skip verify restringify.
This commit is contained in:
parent
06ccb59a77
commit
e1e8286436
2 changed files with 7 additions and 4 deletions
|
@ -123,7 +123,7 @@ struct ircd::m::event
|
||||||
static bool my(const idx &);
|
static bool my(const idx &);
|
||||||
static json::object preimage(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 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 bool verify(const json::object &, const ed25519::pk &, const ed25519::sig &sig, const bool &canonical = false);
|
||||||
static ed25519::sig sign(const string_view &, const ed25519::sk &);
|
static ed25519::sig sign(const string_view &, const ed25519::sk &);
|
||||||
static ed25519::sig sign(const string_view &);
|
static ed25519::sig sign(const string_view &);
|
||||||
static ed25519::sig sign(const json::object &, const ed25519::sk &);
|
static ed25519::sig sign(const json::object &, const ed25519::sk &);
|
||||||
|
|
|
@ -629,11 +629,14 @@ ircd::m::verify(const event &event_,
|
||||||
bool
|
bool
|
||||||
ircd::m::event::verify(const json::object &event,
|
ircd::m::event::verify(const json::object &event,
|
||||||
const ed25519::pk &pk,
|
const ed25519::pk &pk,
|
||||||
const ed25519::sig &sig)
|
const ed25519::sig &sig,
|
||||||
|
const bool &canonical)
|
||||||
{
|
{
|
||||||
const string_view preimage
|
const auto preimage
|
||||||
{
|
{
|
||||||
stringify(buf[3], event)
|
canonical?
|
||||||
|
string_view{event}:
|
||||||
|
stringify(buf[3], event)
|
||||||
};
|
};
|
||||||
|
|
||||||
return pk.verify(preimage, sig);
|
return pk.verify(preimage, sig);
|
||||||
|
|
Loading…
Reference in a new issue