remove secret key from credential storage

This commit is contained in:
Simon Wicky
2023-11-01 09:51:21 +01:00
committed by durch
parent dcfae92bab
commit 0603273a49
8 changed files with 4 additions and 16 deletions
@@ -87,7 +87,6 @@ where
.insert_ecash_credential(
ECASH_INFO.to_string(),
wallet.to_bs58(),
state.voucher.ecash_keypair().secret_key().to_bs58(),
epoch_id.to_string(),
)
.await
@@ -8,7 +8,6 @@ CREATE TABLE ecash_credentials
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
voucher_info TEXT NOT NULL,
wallet TEXT NOT NULL UNIQUE,
secret_key TEXT NOT NULL,
epoch_id TEXT NOT NULL,
consumed BOOLEAN NOT NULL
);
@@ -58,13 +58,11 @@ impl CoconutCredentialManager {
///
/// * `voucher_info`: What type of credential it is.
/// * `signature`: Ecash wallet credential in the form of a wallet.
/// * `secret_key`: The secret key with which this credential has been created.
/// * `epoch_id`: The epoch when it was signed.
pub async fn insert_ecash_credential(
&self,
voucher_info: String,
wallet: String,
secret_key: String,
epoch_id: String,
) {
let mut creds = self.ecash.write().await;
@@ -73,7 +71,6 @@ impl CoconutCredentialManager {
id,
voucher_info,
wallet,
secret_key,
epoch_id,
consumed: false,
});
@@ -51,19 +51,17 @@ impl CoconutCredentialManager {
///
/// * `voucher_info`: What type of credential it is.
/// * `signature`: Ecash wallet credential in the form of a wallet.
/// * `secret_key`: The secret key with which this credential has been created.
/// * `epoch_id`: The epoch when it was signed.
pub async fn insert_ecash_credential(
&self,
voucher_info: String,
wallet: String,
secret_key: String,
epoch_id: String,
) -> Result<(), sqlx::Error> {
sqlx::query!(
"INSERT INTO ecash_credentials(voucher_info, wallet, secret_key, epoch_id, consumed) VALUES (?, ?, ?, ?, ?)",
voucher_info, wallet, secret_key, epoch_id, false
"INSERT INTO ecash_credentials(voucher_info, wallet, epoch_id, consumed) VALUES (?, ?, ?, ?)",
voucher_info, wallet, epoch_id, false
)
.execute(&self.connection_pool)
.await?;
@@ -54,11 +54,10 @@ impl Storage for EphemeralStorage {
&self,
voucher_info: String,
wallet: String,
secret_key: String,
epoch_id: String,
) -> Result<(), StorageError> {
self.coconut_credential_manager
.insert_ecash_credential(voucher_info, wallet, secret_key, epoch_id)
.insert_ecash_credential(voucher_info, wallet, epoch_id)
.await;
Ok(())
-1
View File
@@ -20,7 +20,6 @@ pub struct EcashCredential {
pub id: i64,
pub voucher_info: String,
pub wallet: String,
pub secret_key: String,
pub epoch_id: String,
pub consumed: bool,
}
@@ -85,11 +85,10 @@ impl Storage for PersistentStorage {
&self,
voucher_info: String,
wallet: String,
secret_key: String,
epoch_id: String,
) -> Result<(), StorageError> {
self.coconut_credential_manager
.insert_ecash_credential(voucher_info, wallet, secret_key, epoch_id)
.insert_ecash_credential(voucher_info, wallet, epoch_id)
.await?;
Ok(())
-2
View File
@@ -35,13 +35,11 @@ pub trait Storage: Send + Sync {
///
/// * `voucher_info`: What type of credential it is.
/// * `signature`: Ecash wallet credential in the form of a wallet.
/// * `secret_key`: The secret key with which this credential has been created.
/// * `epoch_id`: The epoch when it was signed.
async fn insert_ecash_credential(
&self,
voucher_info: String,
signature: String,
secret_key: String,
epoch_id: String,
) -> Result<(), Self::StorageError>;