1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//! # hivecomb
//!
//! A Rust library for the [Hive](https://hive.io) blockchain: key handling, Graphene
//! binary serialization, transaction construction, signing and RPC.
//!
//! `hivecomb` is a from-scratch reimplementation, in Rust, of the Python library
//! [`beem`](https://github.com/holgern/beem) by Holger Nahrstaedt, which in turn
//! descends from `python-bitshares` and `python-graphenelib` by Fabian Schuh. See
//! `CREDITS.md` for the full lineage — the design, the wire format and the great
//! majority of the domain knowledge encoded here are theirs.
//!
//! The port exists because `beem` stopped being maintained at version 0.24.26 (its
//! classifiers stop at Python 3.9), because several defects in it are security- rather
//! than convenience-relevant, and because Hive has added operations since that beem
//! cannot serialize at all. Every such defect is documented at the point in the code
//! that fixes it, and collected in `SECURITY_FINDINGS.md`.
//!
//! ## Design rules
//!
//! * **No silent fallbacks.** Where beem swallowed an error and continued with a
//! default — a chain id, an ECDSA backend, a base58 character — `hivecomb` returns an
//! error. A silent fallback in a signing path produces a valid-looking signature
//! over the wrong bytes, which is the worst possible failure mode.
//! * **Signing never needs the network.** The chain id is a compile-time constant and
//! the block reference is cached with an explicit staleness bound, so producing a
//! signature is a pure CPU operation.
//! * **Secrets do not render, and do not linger.** See [`keys`].
//! * **Unknown input is refused, never defaulted.**
/// Doctests the crate README, so the code on the crates.io landing page is compiled
/// and run by `cargo test` like any other example. Documentation that is never
/// executed drifts from the API it describes; this one cannot.
///
/// `#[cfg(doctest)]` keeps it out of the rendered docs — it exists only to be tested.
;
// The fields of these types are hived's schema, name for name, and their meaning is
// the chain's rather than this crate's. Documenting each one individually would be
// transcription rather than explanation, and it would bury the cases that genuinely do
// need a note -- which carry one. The types themselves are documented; so is every
// field whose meaning is not its name.
/// Hex decoding that cannot panic on the text a node or a user hands over.
/// See the note on [`chain`] for why the fields here are not individually documented.
pub use Amount;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use Signature;
pub use TaposCache;
pub use ;
pub use GrapheneSerialize;