removed nym-api placeholders
This commit is contained in:
@@ -5,7 +5,7 @@ use crate::coconut::helpers::issued_credential_plaintext;
|
||||
use cosmrs::AccountId;
|
||||
use nym_credentials_interface::{
|
||||
hash_to_scalar, Attribute, BlindSignRequest, BlindedSignature, Bytable, CoconutError,
|
||||
CredentialSpendingData, Signature, VerificationKey,
|
||||
CredentialSpendingData, VerificationKey,
|
||||
};
|
||||
use nym_crypto::asymmetric::identity;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -100,9 +100,15 @@ pub async fn verify_bandwidth_credential(
|
||||
let theta = &credential_data.verify_credential_request;
|
||||
|
||||
let voucher_value: u64 = if credential_data.typ.is_voucher() {
|
||||
todo!()
|
||||
credential_data
|
||||
.get_bandwidth_attribute()
|
||||
.ok_or(CoconutError::MissingBandwidthValue)?
|
||||
.parse()
|
||||
.map_err(|source| CoconutError::VoucherValueParsingFailure { source })?
|
||||
} else {
|
||||
todo!("return error here")
|
||||
return Err(CoconutError::NotABandwidthVoucher {
|
||||
typ: credential_data.typ,
|
||||
});
|
||||
};
|
||||
|
||||
// TODO: introduce a check to make sure we haven't already voted for this proposal to prevent DDOS
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
use crate::node_status_api::models::NymApiStorageError;
|
||||
use nym_coconut_dkg_common::types::{ChunkIndex, DealingIndex, EpochId};
|
||||
use nym_credentials::coconut::bandwidth::CredentialType;
|
||||
use nym_crypto::asymmetric::{
|
||||
encryption::KeyRecoveryError,
|
||||
identity::{Ed25519RecoveryError, SignatureError},
|
||||
@@ -14,6 +15,7 @@ use rocket::http::{ContentType, Status};
|
||||
use rocket::response::Responder;
|
||||
use rocket::{response, Request, Response};
|
||||
use std::io::Cursor;
|
||||
use std::num::ParseIntError;
|
||||
use thiserror::Error;
|
||||
|
||||
pub type Result<T> = std::result::Result<T, CoconutError>;
|
||||
@@ -23,6 +25,20 @@ pub enum CoconutError {
|
||||
#[error(transparent)]
|
||||
IOError(#[from] std::io::Error),
|
||||
|
||||
#[error("the received bandwidth voucher did not contain deposit value")]
|
||||
MissingBandwidthValue,
|
||||
|
||||
#[error(
|
||||
"the received bandwidth credential is not a bandwidth voucher. the encoded type is: {typ}"
|
||||
)]
|
||||
NotABandwidthVoucher { typ: CredentialType },
|
||||
|
||||
#[error("failed to parse the bandwidth voucher value: {source}")]
|
||||
VoucherValueParsingFailure {
|
||||
#[source]
|
||||
source: ParseIntError,
|
||||
},
|
||||
|
||||
#[error("coconut api query failure: {0}")]
|
||||
CoconutApiError(#[from] CoconutApiError),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user