From a5b419dea1cd5d7fdd21898c8ad233e3fa3d0d02 Mon Sep 17 00:00:00 2001 From: edouard Date: Sat, 19 Jun 2021 18:11:38 +0200 Subject: [PATCH] rename service for auth --- Cargo.toml | 6 +++--- README.md | 5 +---- examples/lnurl_auth.rs | 6 +++--- src/{service.rs => auth.rs} | 0 src/lib.rs | 4 ++-- 5 files changed, 9 insertions(+), 12 deletions(-) rename src/{service.rs => auth.rs} (100%) diff --git a/Cargo.toml b/Cargo.toml index 314a672..3943477 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lnurl" -version = "0.1.1" +version = "0.2" authors = ["Edouard Paris "] description = "Helpers for LNURL" readme = "README.md" @@ -15,7 +15,7 @@ name = "lnurl" [features] # Include nothing by default default = [] -service = ["hex", "secp256k1"] +auth = ["hex", "secp256k1"] [dependencies] hex = { version = "0.4.2", optional = true } @@ -39,4 +39,4 @@ warp = "0.2.4" [[example]] name = "lnurl_auth" -required-features = ["service"] +required-features = ["auth"] diff --git a/README.md b/README.md index 3ba79b3..f6f0a7c 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ _Readings about **lnurl**_ ## Progress - [x] lnurl-withdraw -- [ ] lnurl-auth +- [x] lnurl-auth - [ ] lnurl-pay - [ ] lnurl-channel @@ -57,6 +57,3 @@ if let Err(_) = invoice.parse::() { .body(Body::from(res)).unwrap()) } ``` - -See [lnurl-examples](https://github.com/edouardparis/lnurl-examples) - diff --git a/examples/lnurl_auth.rs b/examples/lnurl_auth.rs index 9e52415..170cdf9 100644 --- a/examples/lnurl_auth.rs +++ b/examples/lnurl_auth.rs @@ -13,7 +13,7 @@ async fn main() { .init(); let url = env::var("SERVICE_URL").unwrap(); - let verifier = lnurl::service::AuthVerifier::new(); + let verifier = lnurl::auth::AuthVerifier::new(); let db = model::new_db(); let api = filter::api(url, db, verifier).with(warp::log("api")); warp::serve(api).run(([127, 0, 0, 1], 8383)).await; @@ -23,7 +23,7 @@ mod filter { use super::auth; use super::handler; use super::model::DB; - use lnurl::service::AuthVerifier; + use lnurl::auth::AuthVerifier; use warp::Filter; pub fn api( @@ -104,7 +104,7 @@ mod handler { pub async fn auth( db: DB, - verifier: lnurl::service::AuthVerifier, + verifier: lnurl::auth::AuthVerifier, credentials: auth::Auth, ) -> Result { let mut sessions = db.lock().await; diff --git a/src/service.rs b/src/auth.rs similarity index 100% rename from src/service.rs rename to src/auth.rs diff --git a/src/lib.rs b/src/lib.rs index 20a13b0..bafec73 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,7 @@ use serde::{Deserialize, Serialize}; -#[cfg(feature = "service")] -pub mod service; +#[cfg(feature = "auth")] +pub mod auth; #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Event {