serde_encrypt_core/key/
combined_key.rs1use super::key_pair::{
8 private_key::{ReceiverPrivateKey, SenderPrivateKey},
9 public_key::{ReceiverPublicKey, SenderPublicKey},
10};
11
12#[derive(Clone, Debug)]
16pub struct SenderCombinedKey<'s, 'r> {
17 sender_private_key: &'s SenderPrivateKey,
18 receiver_public_key: &'r ReceiverPublicKey,
19}
20
21impl<'s, 'r> SenderCombinedKey<'s, 'r> {
22 pub fn new(
24 sender_private_key: &'s SenderPrivateKey,
25 receiver_public_key: &'r ReceiverPublicKey,
26 ) -> Self {
27 Self {
28 sender_private_key,
29 receiver_public_key,
30 }
31 }
32
33 pub(crate) fn sender_private_key(&self) -> &SenderPrivateKey {
34 self.sender_private_key
35 }
36
37 pub(crate) fn receiver_public_key(&self) -> &ReceiverPublicKey {
38 self.receiver_public_key
39 }
40}
41
42#[derive(Clone, Debug)]
46pub struct ReceiverCombinedKey<'s, 'r> {
47 sender_public_key: &'s SenderPublicKey,
48 receiver_private_key: &'r ReceiverPrivateKey,
49}
50
51impl<'s, 'r> ReceiverCombinedKey<'s, 'r> {
52 pub fn new(
54 sender_public_key: &'s SenderPublicKey,
55 receiver_private_key: &'r ReceiverPrivateKey,
56 ) -> Self {
57 Self {
58 sender_public_key,
59 receiver_private_key,
60 }
61 }
62
63 pub(crate) fn receiver_private_key(&self) -> &ReceiverPrivateKey {
64 self.receiver_private_key
65 }
66
67 pub(crate) fn sender_public_key(&self) -> &SenderPublicKey {
68 self.sender_public_key
69 }
70}