Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Auth #510

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ jobs:
uses: DeterminateSystems/magic-nix-cache-action@v6
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Clippy
run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
- name: Test
run: nix develop -i -L .#stable --command just itest ${{ matrix.database }}

Expand Down Expand Up @@ -153,9 +151,11 @@ jobs:
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Clippy
run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
run: nix develop -i -L .#stable --command cargo clippy -- -D warnings
- name: Test fake mint
run: nix develop -i -L .#stable --command just fake-mint-itest ${{ matrix.database }}
- name: Test Mint tests
run: nix develop -i -L .#stable --command cargo test -p cdk-integration-tests --test mint

msrv-build:
name: "MSRV build"
Expand Down
6 changes: 6 additions & 0 deletions .helix/languages.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
[language-server.rust-analyzer.config]
cargo = { features = ["wallet", "mint", "swagger", "redis"] }
inlayHints.bindingModeHints.enable = true
inlayHints.closingBraceHints.enable = true
inlayHints.chainingHints.enable = true
inlayHints.parameterHints.enable = true
inlayHints.typeHints.enable = true
command = "rust-analyzer"
194 changes: 46 additions & 148 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions crates/cashu/src/nuts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ pub mod nut17;
pub mod nut18;
pub mod nut19;
pub mod nut20;
pub mod nutxx;
pub mod nutxx1;

pub use nut00::{
BlindSignature, BlindedMessage, CurrencyUnit, PaymentMethod, Proof, Proofs, ProofsMethods,
Expand Down Expand Up @@ -55,3 +57,5 @@ pub use nut14::HTLCWitness;
pub use nut15::{Mpp, MppMethodSettings, Settings as NUT15Settings};
pub use nut17::NotificationPayload;
pub use nut18::{PaymentRequest, PaymentRequestPayload, Transport};
pub use nutxx::{Method, ProtectedEndpoint, RoutePath};
pub use nutxx1::{AuthProof, AuthRequired, AuthToken, BlindAuthToken};
5 changes: 5 additions & 0 deletions crates/cashu/src/nuts/nut00/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,8 @@ pub enum CurrencyUnit {
Usd,
/// Euro
Eur,
/// Auth
Auth,
/// Custom currency unit
Custom(String),
}
Expand All @@ -395,6 +397,7 @@ impl CurrencyUnit {
Self::Msat => Some(1),
Self::Usd => Some(2),
Self::Eur => Some(3),
Self::Auth => Some(4),
_ => None,
}
}
Expand All @@ -409,6 +412,7 @@ impl FromStr for CurrencyUnit {
"MSAT" => Ok(Self::Msat),
"USD" => Ok(Self::Usd),
"EUR" => Ok(Self::Eur),
"AUTH" => Ok(Self::Auth),
c => Ok(Self::Custom(c.to_string())),
}
}
Expand All @@ -421,6 +425,7 @@ impl fmt::Display for CurrencyUnit {
CurrencyUnit::Msat => "MSAT",
CurrencyUnit::Usd => "USD",
CurrencyUnit::Eur => "EUR",
CurrencyUnit::Auth => "AUTH",
CurrencyUnit::Custom(unit) => unit,
};
if let Some(width) = f.width() {
Expand Down
12 changes: 11 additions & 1 deletion crates/cashu/src/nuts/nut06.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
use super::nut01::PublicKey;
use super::nut17::SupportedMethods;
use super::nut19::CachedEndpoint;
use super::{nut04, nut05, nut15, nut19, MppMethodSettings};
use super::{nut04, nut05, nut15, nut19, nutxx, nutxx1, MppMethodSettings};

/// Mint Version
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
Expand Down Expand Up @@ -249,6 +249,16 @@ pub struct Nuts {
#[serde(default)]
#[serde(rename = "20")]
pub nut20: SupportedSettings,
/// NUTXX Settings
#[serde(default)]
#[serde(rename = "XX")]
#[serde(skip_serializing_if = "Option::is_none")]
pub nutxx: Option<nutxx::Settings>,
/// NUTXX1 Settings
#[serde(default)]
#[serde(rename = "XX+1")]
#[serde(skip_serializing_if = "Option::is_none")]
pub nutxx1: Option<nutxx1::Settings>,
}

impl Nuts {
Expand Down
Loading
Loading