64c963e36e
* Reset contract state when dkg needs rerun * Reset nym-api for rerun * Gateway updates signer APIs at runtime * Fix clippy * Add epoch id * Use IndexedMap for shares * Query with epoch id * Add Clone to client traits * Pass nyxd client instead of api data * Get the specific epoch vk * Make wasm work * Remove wasm test runs As there are no wasm tests and the target_arch macros are not compatible with the cargo test environment, we can safely remove (for now) the wasm test target runs. * Put epoch_id in storage pk * Gateway uses old keys but current verifiers * Add group contract to env * Move group msg in common * Only run DKG if part of group * Clippy test * Rename wasm_storage to wasm_mockups * Update changelog
41 lines
1.3 KiB
Rust
41 lines
1.3 KiB
Rust
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
use async_trait::async_trait;
|
|
|
|
use crate::models::CoconutCredential;
|
|
use crate::StorageError;
|
|
|
|
#[async_trait]
|
|
pub trait Storage: Send + Sync {
|
|
/// Inserts provided signature into the database.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `voucher_value`: How much bandwidth is in the credential.
|
|
/// * `voucher_info`: What type of credential it is.
|
|
/// * `serial_number`: Serial number of the credential.
|
|
/// * `binding_number`: Binding number of the credential.
|
|
/// * `signature`: Coconut credential in the form of a signature.
|
|
/// * `epoch_id`: The epoch when it was signed.
|
|
async fn insert_coconut_credential(
|
|
&self,
|
|
voucher_value: String,
|
|
voucher_info: String,
|
|
serial_number: String,
|
|
binding_number: String,
|
|
signature: String,
|
|
epoch_id: String,
|
|
) -> Result<(), StorageError>;
|
|
|
|
/// Tries to retrieve one of the stored, unused credentials.
|
|
async fn get_next_coconut_credential(&self) -> Result<CoconutCredential, StorageError>;
|
|
|
|
/// Marks as consumed in the database the specified credential.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `id`: Id of the credential to be consumed.
|
|
async fn consume_coconut_credential(&self, id: i64) -> Result<(), StorageError>;
|
|
}
|