bindings: add MintKeySet

This commit is contained in:
thesimplekid
2023-09-02 10:39:48 +01:00
parent cf9bf49685
commit 2edce622ae
6 changed files with 43 additions and 4 deletions

View File

@@ -118,6 +118,11 @@ interface KeySet {
Keys keys();
};
interface MintKeySet {
[Name=generate]
constructor(string secret, string derivation_path, u8 max_order);
};
interface KeySetResponse {
constructor(sequence<string> keyset_ids);
sequence<string> keyset_ids();

View File

@@ -14,7 +14,7 @@ mod ffi {
pub use crate::nuts::nut01::keys::Keys;
pub use crate::nuts::nut01::public_key::PublicKey;
pub use crate::nuts::nut01::secret_key::SecretKey;
pub use crate::nuts::nut02::key_set::{KeySet, KeySetResponse};
pub use crate::nuts::nut02::{KeySet, KeySetResponse, MintKeySet};
pub use crate::nuts::nut03::RequestMintResponse;
pub use crate::nuts::nut04::{MintRequest, PostMintResponse};
pub use crate::nuts::nut05::{

View File

@@ -0,0 +1,22 @@
use std::ops::Deref;
use cashu::nuts::nut02::mint::KeySet as KeySetSdk;
pub struct MintKeySet {
inner: KeySetSdk,
}
impl Deref for MintKeySet {
type Target = KeySetSdk;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl MintKeySet {
pub fn generate(secret: String, derivation_path: String, max_order: u8) -> Self {
Self {
inner: KeySetSdk::generate(secret, derivation_path, max_order),
}
}
}

View File

@@ -1 +1,5 @@
pub mod key_set;
pub mod mint_keyset;
pub use key_set::{KeySet, KeySetResponse};
pub use mint_keyset::MintKeySet;

View File

@@ -121,6 +121,12 @@ interface KeySet {
Keys keys();
};
interface MintKeySet {
[Name=generate]
constructor(string secret, string derivation_path, u8 max_order);
};
interface KeySetResponse {
constructor(sequence<string> keyset_ids);
sequence<string> keyset_ids();

View File

@@ -1,5 +1,6 @@
mod client;
mod error;
mod mint;
mod types;
mod wallet;
@@ -8,13 +9,14 @@ mod ffi {
Amount, BlindedMessage, BlindedMessages, BlindedSignature, Bolt11Invoice, CashuError,
CheckFeesRequest, CheckFeesResponse, CheckSpendableRequest, CheckSpendableResponse,
InvoiceStatus, KeyPair, KeySet, KeySetResponse, Keys, MeltRequest, MeltResponse, MintInfo,
MintProof, MintProofs, MintRequest, MintVersion, Nut05MeltRequest, Nut05MeltResponse,
PostMintResponse, Proof, PublicKey, RequestMintResponse, SecretKey, SplitRequest,
SplitResponse, Token,
MintKeySet, MintProof, MintProofs, MintRequest, MintVersion, Nut05MeltRequest,
Nut05MeltResponse, PostMintResponse, Proof, PublicKey, RequestMintResponse, SecretKey,
SplitRequest, SplitResponse, Token,
};
pub use crate::client::Client;
pub use crate::error::CashuSdkError;
pub use crate::mint::Mint;
pub use crate::types::{Melted, ProofsStatus, SendProofs};
pub use crate::wallet::Wallet;