43 static const unsigned Undefined = (unsigned)-1;
70 unsigned workProved()
const;
71 void proveWork(
unsigned _ms);
73 unsigned sent()
const {
return m_expiry - m_ttl; }
74 unsigned expiry()
const {
return m_expiry; }
75 unsigned ttl()
const {
return m_ttl; }
83 Envelope(
unsigned _exp,
unsigned _ttl,
AbridgedTopics const& _topic): m_expiry(_exp), m_ttl(_ttl), m_topic(_topic) {}
85 unsigned m_expiry = 0;
118 operator bool()
const {
return !!m_payload.size() || m_from || m_to; }
121 Envelope seal(
Secret const& _from,
Topics const& _topics,
unsigned _ttl = 50,
unsigned _workToProve = 50)
const;
125 Envelope sealTo(
Secret const& _from,
Public _to,
Topics const& _topics,
unsigned _ttl = 50,
unsigned _workToProve = 50) { m_to = _to;
return seal(_from, _topics, _ttl, _workToProve); }
128 bool populate(
bytes const& _data);
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Message(bytes const &_payload)
h256 sha3(IncludeNonce _withNonce=WithNonce) const
bytes const & data() const
Secret generateGamma(Secret const &_key, h256 const &_salt) const
void swap(dev::eth::Watch &_a, dev::eth::Watch &_b)
void streamRLP(RLPStream &_s, IncludeNonce _withNonce=WithNonce) const
uint64_t utcTime()
Get the current time in seconds since the epoch in UTC.
std::vector< AbridgedTopic > AbridgedTopics
bytes const & out() const
Read the byte stream.
SecureFixedHash< 32 > Secret
AbridgedTopics const & topic() const
bytes const & payload() const
Message(bytesConstRef _payload)
Envelope(unsigned _exp, unsigned _ttl, AbridgedTopics const &_topic)
std::vector< byte > bytes
RLPStream & appendList(size_t _items)
Appends a list.
void setPayload(bytes const &_payload)
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
FilterKey(unsigned _tI, Secret const &_k)
Envelope seal(Topics const &_topics, unsigned _ttl=50, unsigned _workToProve=50) const
void setPayload(bytes &&_payload)
An (unencrypted) message, constructed from the combination of an Envelope, and, potentially, a Secret key to decrypt the Message.
Envelope sealTo(Public _to, Topics const &_topics, unsigned _ttl=50, unsigned _workToProve=50)
bool sha3(bytesConstRef _input, bytesRef o_output)
Calculate SHA3-256 hash of the given input and load it into the given output.
Message(bytes &&_payload)
Class for writing to an RLP bytestream.
Envelope sealTo(Secret const &_from, Public _to, Topics const &_topics, unsigned _ttl=50, unsigned _workToProve=50)
Class for interpreting Recursive Linear-Prefix Data.
void setFrom(Public _from)