Browse Source

feat: make mint/wallet fns public

thesimplekid 8 months ago
parent
commit
b9b72c362a
2 changed files with 10 additions and 7 deletions
  1. 7 4
      crates/cdk/src/mint/mod.rs
  2. 3 3
      crates/cdk/src/wallet/mod.rs

+ 7 - 4
crates/cdk/src/mint/mod.rs

@@ -302,7 +302,10 @@ impl Mint {
     }
 
     /// Blind Sign
-    async fn blind_sign(&self, blinded_message: &BlindedMessage) -> Result<BlindSignature, Error> {
+    pub async fn blind_sign(
+        &self,
+        blinded_message: &BlindedMessage,
+    ) -> Result<BlindSignature, Error> {
         let BlindedMessage {
             amount,
             blinded_secret,
@@ -456,7 +459,7 @@ impl Mint {
     }
 
     /// Verify [`Proof`] meets conditions and is signed
-    async fn verify_proof(&self, proof: &Proof) -> Result<(), Error> {
+    pub async fn verify_proof(&self, proof: &Proof) -> Result<(), Error> {
         // Check if secret is a nut10 secret with conditions
         if let Ok(secret) =
             <&crate::secret::Secret as TryInto<crate::nuts::nut10::Secret>>::try_into(&proof.secret)
@@ -744,7 +747,7 @@ impl Mint {
     }
 
     /// Ensure Keyset is loaded in mint
-    async fn ensure_keyset_loaded(&self, id: &Id) -> Result<(), Error> {
+    pub async fn ensure_keyset_loaded(&self, id: &Id) -> Result<(), Error> {
         let keysets = self.keysets.read().await;
         if keysets.contains_key(id) {
             return Ok(());
@@ -763,7 +766,7 @@ impl Mint {
     }
 
     /// Generate [`MintKeySet`] from [`MintKeySetInfo`]
-    fn generate_keyset(&self, keyset_info: MintKeySetInfo) -> MintKeySet {
+    pub fn generate_keyset(&self, keyset_info: MintKeySetInfo) -> MintKeySet {
         MintKeySet::generate_from_xpriv(&self.secp_ctx, self.xpriv, keyset_info)
     }
 }

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

@@ -335,7 +335,7 @@ impl Wallet {
     }
 
     #[instrument(skip(self), fields(mint_url = %mint_url))]
-    async fn active_mint_keyset(
+    pub async fn active_mint_keyset(
         &self,
         mint_url: &UncheckedUrl,
         unit: &CurrencyUnit,
@@ -366,7 +366,7 @@ impl Wallet {
     }
 
     #[instrument(skip(self), fields(mint_url = %mint_url))]
-    async fn active_keys(
+    pub async fn active_keys(
         &self,
         mint_url: &UncheckedUrl,
         unit: &CurrencyUnit,
@@ -779,7 +779,7 @@ impl Wallet {
 
     /// Create Swap Payload
     #[instrument(skip(self, proofs), fields(mint_url = %mint_url))]
-    async fn create_swap(
+    pub async fn create_swap(
         &self,
         mint_url: &UncheckedUrl,
         unit: &CurrencyUnit,