d126d8e5a0
* placeholder handling of wg registration with upgrade mode token * include upgrade mode credentials as part of credential storage * introduce helper for decoding JWT payload * expose methods for removing emergency credentials from the storage * don't allow duplicate emergency credentials with the same content * added authenticator ClientMessage for upgrade mode check * retrieve credentials with longest expiration first * post rebasing fixes * fixed gateway config * feat: allow specifying minimum node performance for client init * nym-node UM improvements * fixed upgrade mode bandwidth on initial authentication * fix: logs and thresholds * expose attestation information from nym-node http api * additional logs * post rebasing fixes * make @simonwicky happy by removing empty lines in emergency_credential table definition * chore: remove '_' prefix for internal counters within in-mem ecash storage * improved import of 'UpgradeModeState' within the nym-node * use explicit time dependency within credential-storage * re-order imports within the gateway-client * moved 'AvailableBandwidth' definition to the monorepo
99 lines
2.5 KiB
Rust
99 lines
2.5 KiB
Rust
// Copyright 2022-2024 - Nym Technologies SA <contact@nymtech.net>
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
use nym_credentials::{IssuanceTicketBook, IssuedTicketBook};
|
|
use nym_ecash_time::Date;
|
|
use time::OffsetDateTime;
|
|
use zeroize::{Zeroize, ZeroizeOnDrop};
|
|
|
|
pub struct RetrievedTicketbook {
|
|
pub ticketbook_id: i64,
|
|
pub total_tickets: u32,
|
|
pub ticketbook: IssuedTicketBook,
|
|
}
|
|
|
|
pub struct RetrievedPendingTicketbook {
|
|
pub pending_id: i64,
|
|
pub pending_ticketbook: IssuanceTicketBook,
|
|
}
|
|
|
|
#[cfg_attr(not(target_arch = "wasm32"), derive(sqlx::FromRow))]
|
|
pub struct BasicTicketbookInformation {
|
|
pub id: i64,
|
|
pub expiration_date: Date,
|
|
pub ticketbook_type: String,
|
|
pub epoch_id: u32,
|
|
pub total_tickets: u32,
|
|
pub used_tickets: u32,
|
|
}
|
|
|
|
#[cfg_attr(not(target_arch = "wasm32"), derive(sqlx::FromRow))]
|
|
#[derive(Zeroize, ZeroizeOnDrop, Clone)]
|
|
pub struct StoredIssuedTicketbook {
|
|
pub id: i64,
|
|
|
|
pub serialization_revision: u8,
|
|
|
|
pub ticketbook_type: String,
|
|
|
|
pub ticketbook_data: Vec<u8>,
|
|
|
|
#[zeroize(skip)]
|
|
pub expiration_date: Date,
|
|
|
|
pub epoch_id: u32,
|
|
|
|
pub total_tickets: u32,
|
|
pub used_tickets: u32,
|
|
}
|
|
|
|
#[cfg_attr(not(target_arch = "wasm32"), derive(sqlx::FromRow))]
|
|
#[derive(Zeroize, ZeroizeOnDrop, Clone)]
|
|
pub struct StoredPendingTicketbook {
|
|
pub deposit_id: i64,
|
|
|
|
pub serialization_revision: u8,
|
|
|
|
pub pending_ticketbook_data: Vec<u8>,
|
|
|
|
#[zeroize(skip)]
|
|
pub expiration_date: Date,
|
|
}
|
|
|
|
#[cfg_attr(not(target_arch = "wasm32"), derive(sqlx::FromRow))]
|
|
pub struct RawExpirationDateSignatures {
|
|
pub serialised_signatures: Vec<u8>,
|
|
pub serialization_revision: u8,
|
|
}
|
|
|
|
#[cfg_attr(not(target_arch = "wasm32"), derive(sqlx::FromRow))]
|
|
pub struct RawCoinIndexSignatures {
|
|
pub epoch_id: u32,
|
|
pub serialised_signatures: Vec<u8>,
|
|
pub serialization_revision: u8,
|
|
}
|
|
|
|
#[cfg_attr(not(target_arch = "wasm32"), derive(sqlx::FromRow))]
|
|
pub struct RawVerificationKey {
|
|
pub epoch_id: u32,
|
|
pub serialised_key: Vec<u8>,
|
|
pub serialization_revision: u8,
|
|
}
|
|
|
|
#[derive(Clone, Debug)]
|
|
#[cfg_attr(not(target_arch = "wasm32"), derive(sqlx::FromRow))]
|
|
pub struct EmergencyCredential {
|
|
pub id: i64,
|
|
#[cfg_attr(not(target_arch = "wasm32"), sqlx(flatten))]
|
|
pub data: EmergencyCredentialContent,
|
|
}
|
|
|
|
#[derive(Clone, Debug)]
|
|
#[cfg_attr(not(target_arch = "wasm32"), derive(sqlx::FromRow))]
|
|
pub struct EmergencyCredentialContent {
|
|
#[cfg_attr(not(target_arch = "wasm32"), sqlx(rename = "type"))]
|
|
pub typ: String,
|
|
pub content: Vec<u8>,
|
|
pub expiration: Option<OffsetDateTime>,
|
|
}
|