MCPcopy Create free account
hub / github.com/brainboxdotcc/DPP / import_tree

Method import_tree

mlspp/src/state.cpp:48–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48TreeKEMPublicKey
49State::import_tree(const bytes& tree_hash,
50 const std::optional<TreeKEMPublicKey>& external,
51 const ExtensionList& extensions)
52{
53 auto tree = TreeKEMPublicKey(_suite);
54 auto maybe_tree_extn = extensions.find<RatchetTreeExtension>();
55 if (external) {
56 tree = opt::get(external);
57 } else if (maybe_tree_extn) {
58 tree = opt::get(maybe_tree_extn).tree;
59 } else {
60 throw InvalidParameterError("No tree available");
61 }
62
63 tree.suite = _suite;
64
65 tree.set_hash_all();
66 if (tree.root_hash() != tree_hash) {
67 throw InvalidParameterError("Tree does not match GroupInfo");
68 }
69
70 return tree;
71}
72
73bool
74State::validate_tree() const

Callers

nothing calls this directly

Calls 5

TreeKEMPublicKeyClass · 0.85
set_hash_allMethod · 0.80
root_hashMethod · 0.80
getFunction · 0.50

Tested by

no test coverage detected