-
Notifications
You must be signed in to change notification settings - Fork 14
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
HMAC added #32
HMAC added #32
Conversation
src/handlers/auth_handlers.rs
Outdated
@@ -188,6 +196,30 @@ pub async fn login_handler( | |||
}) | |||
} | |||
|
|||
fn generate_secure_token() -> (String, String) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be better if you create a new file in /utils
for functions related to hmac
.
This file should only contain routes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh okay,
Is the overall functionality of the code, I written is good ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems fine!!. I have got to test it. If you happen to test the route, provide us with details
src/handlers/auth_handlers.rs
Outdated
use rand::Rng; | ||
use base64::{Engine as _, engine::general_purpose}; | ||
|
||
const HMAC_SECRET: &[u8] = b"your-secret-key-here"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Store secrets in src/utils/constants
and then import them here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry for blunder
run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk this seems useless
Cargo.toml
Outdated
@@ -25,6 +25,7 @@ serde = "1.0.197" | |||
serde_json = "1.0.114" | |||
chrono = "0.4.38" | |||
sea-orm = { version = "1.0.0-rc.5", features = [ "sqlx-postgres", "runtime-tokio-rustls", "macros" ] } | |||
sqlx = { version = "0.5", features = [ "postgres", "runtime-tokio-rustls" ] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, why are you adding sqlx as a dependency tho?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to setup the db, and on cli, I don't know why but sqlx error was coming so I added it.
I forgot to review. I will remove it.
@ShashwatAgrawal20 , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good to me. SHIP IT!
closes #21