nym_mixnode_common/packet_processor/
processor.rs

1// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
2// SPDX-License-Identifier: Apache-2.0
3
4use std::sync::Arc;
5
6use nym_sphinx_types::PrivateKey;
7
8#[derive(Clone)]
9pub struct SphinxPacketProcessor {
10    /// Private sphinx key of this node required to unwrap received sphinx packet.
11    sphinx_key: Arc<PrivateKey>,
12}
13
14impl SphinxPacketProcessor {
15    /// Creates new instance of `CachedPacketProcessor`
16    pub fn new(sphinx_key: PrivateKey) -> Self {
17        SphinxPacketProcessor {
18            sphinx_key: Arc::new(sphinx_key),
19        }
20    }
21
22    pub fn sphinx_key(&self) -> &PrivateKey {
23        &self.sphinx_key
24    }
25}