b71a8708db
* Reintroduce epoch states Co-authored-by: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com> * Use admin address for sensible txs * Validator-api watch contract and handle events * Handle dealing exchange * Dealing exchange * Recover raw verification keys for 5 dkgs * Test coconut with dkg keys * Split dealing storage * Finish dkg task when it achieved its purpose * Temporary fix for clippy * Fix clippy Co-authored-by: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
28 lines
677 B
Rust
28 lines
677 B
Rust
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
use std::sync::Arc;
|
|
use tokio::sync::{RwLock, RwLockReadGuard};
|
|
|
|
#[derive(Clone, Debug)]
|
|
pub struct KeyPair {
|
|
inner: Arc<RwLock<Option<coconut_interface::KeyPair>>>,
|
|
}
|
|
|
|
impl KeyPair {
|
|
pub fn new() -> Self {
|
|
Self {
|
|
inner: Arc::new(RwLock::new(None)),
|
|
}
|
|
}
|
|
|
|
pub async fn get(&self) -> RwLockReadGuard<'_, Option<nymcoconut::KeyPair>> {
|
|
self.inner.read().await
|
|
}
|
|
|
|
pub async fn set(&self, keypair: coconut_interface::KeyPair) {
|
|
let mut w_lock = self.inner.write().await;
|
|
*w_lock = Some(keypair);
|
|
}
|
|
}
|