9e8f550e6d
* Add placeholder client for implementing coconut interactions * Add db for persistance * Add nymd client * Add new coconut-bandwidth contract * Call deposit function * Introduce error handling * Call the old flow of getting a signature * List available tx hashes * Add signed req in body * Save signature received * Add event generation * Checks in validator-api * Fail with error instead of panic in validator-api route * Fix contract address and small bug * Add file db for storing previous signatures * Encrypt and store data in validator-api * Decrypt the received signature * Remove tx hashes after getting credentials * Small listing changes in client * Change response so that it easier to serialize * Error message is sent to client for display * Remove already signed error and return the previous sig * Merge signature with deposit data in client * Entrypoint for getting the encrypted signature * Refactor blinding stuff so that it can be backed up * Backed up the blind sign request * Client can re-request the encrypted signature shares * Update crypto features * Fix clippy * Activate instantiate test and remove unused code * Add tx tests * Add verification key endpoint test * Voucher consistency test * Test for some errors and a race condition on blind signing * Refactor and add client trait for enabling better testing env * Test some more of blind sign * Finished testing all extract_encryption_key paths * Split into function test and endpoint test * Test for correct signature * Test for state functions * Remove print * Test blind_sign endpoint * Test for cached signature endpoint * Stricter types in voucher * Rename signature with partial_bandwidth_credential * Extra route levels * Length check and remove some unused code from coconut interface * Renamed coconut-bandwidth common crate * Renamed verification_key to identity_key * Use const instead of hardcoded values * Use type aliases for crypto algorithms * Remove unused mods, until needed * Remove unneeded unwrap * Fix some coconut issues that were blocking the wasm client build * Move from sled to existing sql database * Update tests for new db type * Fix wasm for coconut too * Remove sled from dependencies
42 lines
1.2 KiB
Rust
42 lines
1.2 KiB
Rust
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
use thiserror::Error;
|
|
|
|
use credentials::error::Error as CredentialError;
|
|
use crypto::asymmetric::encryption::KeyRecoveryError;
|
|
use crypto::asymmetric::identity::Ed25519RecoveryError;
|
|
use validator_client::nymd::error::NymdError;
|
|
|
|
pub type Result<T> = std::result::Result<T, CredentialClientError>;
|
|
|
|
#[derive(Error, Debug)]
|
|
pub enum CredentialClientError {
|
|
#[error("Nymd error: {0}")]
|
|
Nymd(#[from] NymdError),
|
|
|
|
#[error("Credential error: {0}")]
|
|
Credential(#[from] CredentialError),
|
|
|
|
#[error("No previous deposit with that tx hash")]
|
|
NoDeposit,
|
|
|
|
#[error("Wrong number of attributes")]
|
|
WrongAttributeNumber,
|
|
|
|
#[error("Could not find any backed up blind sign request data")]
|
|
NoLocalBlindSignRequest,
|
|
|
|
#[error("The local blind sign request data is corrupted")]
|
|
CorruptedBlindSignRequest,
|
|
|
|
#[error("The tx hash provided is not valid")]
|
|
InvalidTxHash,
|
|
|
|
#[error("Could not parse Ed25519 data")]
|
|
Ed25519ParseError(#[from] Ed25519RecoveryError),
|
|
|
|
#[error("Could not parse X25519 data")]
|
|
X25519ParseError(#[from] KeyRecoveryError),
|
|
}
|