| 46 | } |
| 47 | |
| 48 | TreeKEMPublicKey |
| 49 | State::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 | |
| 73 | bool |
| 74 | State::validate_tree() const |
nothing calls this directly
no test coverage detected