13 Commits 6929cf6644 ... cb9737756d

Auteur SHA1 Bericht Datum
  Cesar Rodas cb9737756d WIP 2 1 week geleden
  Cesar Rodas 09c2ff44d6 Split the database trait into read and transactions. 1 week geleden
  thesimplekid 5f9788f68c fix: nutshell wallet test 3 weken geleden
  thesimplekid 8d9dea14dd refactor: remove redb mint database 3 weken geleden
  Cesar Rodas 6929cf6644 WIP 2 1 week geleden
  thesimplekid 5ffac76eaa Merge pull request #829 from thesimplekid/convert_redb_to_sqlite 1 week geleden
  thesimplekid 0aada22e62 fix: creating auth keyset when auth disabled (#830) 1 week geleden
  thesimplekid cbb2d5f802 fix: creating auth keyset when auth disabled 1 week geleden
  thesimplekid 7421c1ea12 feat: redb to sqlite migration script 1 week geleden
  Cesar Rodas 8371586941 Split the database trait into read and transactions. 1 week geleden
  Cesar Rodas a32ca9af65 Merge remote-tracking branch 'thesimplekid/remove_redb_mint' 1 week geleden
  thesimplekid 0fa46ecf35 fix: nutshell wallet test 3 weken geleden
  thesimplekid 12adde4dee refactor: remove redb mint database 3 weken geleden

+ 3 - 0
CHANGELOG.md

@@ -16,6 +16,9 @@
 - Docker build workflow for arm64 images [PR](https://github.com/cashubtc/cdk/pull/770) ([asmo]).
 
 ### Changed
+=======
+- cdk-redb: Removed mint storage functionality to be wallet-only ([thesimplekid]).
+- Updated Nix flake to 25.05 and removed Nix cache [PR](https://github.com/cashubtc/cdk/pull/769) ([thesimplekid]).
 - Updated dependencies [PR](https://github.com/cashubtc/cdk/pull/761) ([thesimplekid]).
 - Refactored NUT-04 and NUT-05 [PR](https://github.com/cashubtc/cdk/pull/749) ([thesimplekid]).
 - Updated Nix flake to 25.05 and removed Nix cache [PR](https://github.com/cashubtc/cdk/pull/769) ([thesimplekid]).

+ 1 - 1
crates/cdk-cli/src/sub_commands/check_pending.rs

@@ -26,7 +26,7 @@ pub async fn check_pending(multi_mint_wallet: &MultiMintWallet) -> Result<()> {
         // Try to reclaim any proofs that are no longer pending
         match wallet.reclaim_unspent(pending_proofs).await {
             Ok(()) => println!("Successfully reclaimed pending proofs"),
-            Err(e) => println!("Error reclaimed pending proofs: {}", e),
+            Err(e) => println!("Error reclaimed pending proofs: {e}"),
         }
     }
     Ok(())

+ 3 - 1
crates/cdk-redb/src/wallet/mod.rs

@@ -497,12 +497,14 @@ impl WalletDatabase for WalletRedbDatabase {
     async fn add_keys(&self, keyset: KeySet) -> Result<(), Self::Err> {
         let write_txn = self.db.begin_write().map_err(Error::from)?;
 
+        keyset.verify_id()?;
+
         {
             let mut table = write_txn.open_table(MINT_KEYS_TABLE).map_err(Error::from)?;
             table
                 .insert(
                     keyset.id.to_string().as_str(),
-                    serde_json::to_string(&keyset)
+                    serde_json::to_string(&keyset.keys)
                         .map_err(Error::from)?
                         .as_str(),
                 )

+ 1 - 3
crates/cdk-signatory/src/db_signatory.rs

@@ -37,7 +37,7 @@ impl DbSignatory {
     pub async fn new(
         localstore: Arc<dyn database::MintKeysDatabase<Err = database::Error> + Send + Sync>,
         seed: &[u8],
-        mut supported_units: HashMap<CurrencyUnit, (u64, u8)>,
+        supported_units: HashMap<CurrencyUnit, (u64, u8)>,
         custom_paths: HashMap<CurrencyUnit, DerivationPath>,
     ) -> Result<Self, Error> {
         let secp_ctx = Secp256k1::new();
@@ -52,8 +52,6 @@ impl DbSignatory {
         )
         .await?;
 
-        supported_units.entry(CurrencyUnit::Auth).or_insert((0, 1));
-
         let mut tx = localstore.begin_transaction().await?;
 
         // Create new keysets for supported units that aren't covered by the current keysets

+ 9 - 1
crates/cdk/src/mint/builder.rs

@@ -340,6 +340,14 @@ impl MintBuilder {
             .ok_or(anyhow!("Localstore not set"))?;
         let ln = self.ln.clone().ok_or(anyhow!("Ln backends not set"))?;
 
+        #[allow(unused_mut)]
+        let mut supported_units = self.supported_units.clone();
+
+        #[cfg(feature = "auth")]
+        if self.openid_discovery.is_some() {
+            supported_units.entry(CurrencyUnit::Auth).or_insert((0, 1));
+        }
+
         let signatory = if let Some(signatory) = self.signatory.as_ref() {
             signatory.clone()
         } else {
@@ -347,7 +355,7 @@ impl MintBuilder {
             let in_memory_signatory = cdk_signatory::db_signatory::DbSignatory::new(
                 self.keystore.clone().ok_or(anyhow!("keystore not set"))?,
                 seed,
-                self.supported_units.clone(),
+                supported_units,
                 HashMap::new(),
             )
             .await?;

+ 43 - 0
misc/convert_redb_to_sqlite.sh

@@ -0,0 +1,43 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+# Configuration
+BINARY_URL="https://github.com/thesimplekid/cdk-convert-redb-to-sqlite/releases/download/v0.1.1/cdk-convert-redb-to-sqlite"
+BINARY_NAME="cdk-convert-redb-to-sqlite"
+EXPECTED_SHA256="5af74b7fa1d20a8e53694bb31c6234dfdaae9d8222047e361785cc8420496709"
+
+# Create temporary directory for downloading
+TMP_DIR=$(mktemp -d)
+trap 'rm -rf "$TMP_DIR"' EXIT
+
+echo "Downloading binary to temporary directory: $TMP_DIR"
+cd "$TMP_DIR" || exit 1
+
+echo "Downloading binary from $BINARY_URL..."
+if ! curl -L -o "$BINARY_NAME" "$BINARY_URL"; then
+    echo "Failed to download binary"
+    exit 1
+fi
+
+# Verify SHA256 checksum
+echo "Verifying SHA256 checksum..."
+ACTUAL_SHA256=$(sha256sum "$BINARY_NAME" | cut -d ' ' -f 1)
+
+if [ "$ACTUAL_SHA256" != "$EXPECTED_SHA256" ]; then
+    echo "Checksum verification failed!"
+    echo "Expected: $EXPECTED_SHA256"
+    echo "Got:      $ACTUAL_SHA256"
+    exit 1
+fi
+
+echo "Checksum verified successfully!"
+
+echo "Making binary executable..."
+if ! chmod +x "$BINARY_NAME"; then
+    echo "Failed to make binary executable"
+    exit 1
+fi
+
+echo "Running binary from temporary directory: $TMP_DIR"
+"$TMP_DIR/$BINARY_NAME"