plebble
evidence.h
Go to the documentation of this file.
1 /*
2 -------------------------------------------------------------------------------
3  PLEBBLE
4 -------------------------------------------------------------------------------
5  Copyright (C) 2019-2020 KATLAS Technology. (http://katlastechnology.com)
6  Copyright (C) 2017-2020 Marcos Mayorga. (mm@mm-studios.com)
7 
8  This file is part of our Plebble(R) Platform.
9 
10  The code below cannot be copied, used for any purpose other than the one
11  agreed and/or distributed without the express permission of
12  KATLAS Technology.
13 -------------------------------------------------------------------------------
14 
15 
16 */
17 #ifndef USGOV_ce0f37979bb3f36a0a0e6be8535da7b8c6bd6728d662a0c6819e31fb2b47c495
18 #define USGOV_ce0f37979bb3f36a0a0e6be8535da7b8c6bd6728d662a0c6819e31fb2b47c495
19 
20 #include <chrono>
21 #include <string>
23 #include <us/gov/crypto/ec.h>
24 //#include <us/gov/engine/signed_data.h>
25 
26 namespace us{ namespace gov {
27 namespace relay {
28 using namespace std;
29 using namespace chrono;
30 
31  struct evidence {
34 
35  evidence(int app, uint8_t eid);
36  evidence(const evidence&)=delete;
37  virtual ~evidence();
38  virtual hash_t compute_hash() const=0;
40  virtual void hash_data(hasher_t& h) const;
41  virtual void to_stream(ostream&os) const;
42  virtual string name() const=0;
43  static evidence* from_stream(istream&);
44  static evidence* from_stream(int appid, uint8_t evid, istream& is);
45  static evidence* from_b58(const string& b58);
46  static string formatts(uint64_t ts);
47  virtual bool verify(ostream&os) const;
48  virtual void write_pretty(ostream&) const;
49  static void from_stream(evidence&, istream& is);
51  void update_ts(const uint64_t& nsecs_in_future=0);
52 
53  uint64_t ts;
54  uint64_t expires;
55  int app;
56  uint8_t eid;
57  };
58 
59 }
60 }}
61 
62 #endif
us::gov::relay::evidence::write_pretty
virtual void write_pretty(ostream &) const
us::gov::relay::evidence::~evidence
virtual ~evidence()
us::gov::relay::evidence::hash_data_to_sign
virtual void hash_data_to_sign(crypto::ec::sigmsg_hasher_t &h) const
us
Definition: daemon.h:22
us::gov::crypto::ripemd160::value_type
Definition: ripemd160.h:38
us::gov::relay::evidence::app
int app
Definition: evidence.h:55
us::gov::relay::evidence::eid
uint8_t eid
Definition: evidence.h:56
us::gov::relay::evidence::compute_hash
virtual hash_t compute_hash() const =0
us::gov::relay::evidence::hasher_t
crypto::ripemd160 hasher_t
Definition: evidence.h:32
us::gov::relay::evidence::name
virtual string name() const =0
us::gov::relay::evidence::hash_t
hasher_t::value_type hash_t
Definition: evidence.h:33
us::gov::crypto::sha256
Definition: sha256.h:33
us::gov::relay::evidence::formatts
static string formatts(uint64_t ts)
us::gov::relay::evidence::hash_data
virtual void hash_data(hasher_t &h) const
us::gov::relay::evidence::verify
virtual bool verify(ostream &os) const
us::gov::relay::evidence::evidence
evidence(const evidence &)=delete
us::gov::relay::evidence::ts
uint64_t ts
Definition: evidence.h:53
us::gov::crypto::ripemd160
Definition: ripemd160.h:34
ripemd160.h
us::gov::relay::evidence::from_b58
static evidence * from_b58(const string &b58)
us::gov::relay::evidence::expires
uint64_t expires
Definition: evidence.h:54
std
Definition: app.h:380
us::gov::relay::evidence::extract_instance_id
static pair< int, uint8_t > extract_instance_id(istream &is)
us::gov::relay::evidence::evidence
evidence(int app, uint8_t eid)
us::gov::relay::evidence
Definition: evidence.h:31
us.pair
Definition: pair.java:19
ec.h
us::gov::relay::evidence::update_ts
void update_ts(const uint64_t &nsecs_in_future=0)