Config
protos::unwrap_config
Unwraps a config message from endless layers of protobuf, extra encryption and then more protobuf as required by older clients for older config message types.
Declaration
Parameters
ed25519_sk
a 32- or 64-byte, libsodium-style secret key value (if 32 then it is just the seed).data
the incoming data that might be protobuf-wrapped
Returns
Returns the unwrapped, inner config value if this is a proper protobuf-wrapped message; throws std::runtime_error if it is not (thus most likely indicating that this is a raw config value). Throws a std::invalid_argument if the given ed25519_sk is invalid. (It is recommended that only the std::runtime_error is caught for detecting non-wrapped input as the invalid secret key is more serious).
protos::wrap_config
Wraps a config message in endless layers of protobuf and unnecessary extra encryption and then more protobuf as required by older clients for older config message types.
Declaration
ustring wrap_config(
ustring_view ed25519_sk, ustring_view data, int64_t seqno, config::Namespace ns);
Parameters
ed25519_sk
a 32- or 64-byte, libsodium-style secret key value (if 32 then it is just the seed).data
the config data to wrapseqno
the seqno value of the datans
the namespace of the config data
Returns
Returns the wrapped config. Will throw on serious errors (e.g. ed25519_sk
or ns
are
invalid).