aboutsummaryrefslogtreecommitdiffhomepage
path: root/tde2e/td/e2e/CheckSharedSecret.h
blob: 2d7c71d8a4f7fe27f89fb0df7f4f145eb655d377 (plain)
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
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2025
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once

#include "td/e2e/utils.h"

#include "td/utils/optional.h"
#include "td/utils/Slice.h"
#include "td/utils/Status.h"
#include "td/utils/UInt.h"

namespace tde2e_core {

struct CheckSharedSecret {
  td::UInt256 nonce_;
  td::UInt256 nonce_hash_;
  td::optional<td::UInt256> o_other_nonce_hash_;
  td::optional<td::UInt256> o_other_nonce_;

  static CheckSharedSecret create();
  td::UInt256 commit_nonce() const;
  td::Result<td::UInt256> reveal_nonce() const;
  td::Status recive_commit_nonce(const td::UInt256 &other_nonce_hash);
  td::Status receive_reveal_nonce(const td::UInt256 &other_nonce);
  td::Result<td::UInt256> finalize_hash(td::Slice shared_secret) const;
};

}  // namespace tde2e_core