feat: integrate token authentication
This commit is contained in:
parent
1d0f8ecd00
commit
725a16d1f5
6 changed files with 154 additions and 32 deletions
|
@ -1,13 +1,13 @@
|
|||
use getrandom::fill;
|
||||
use hex::encode;
|
||||
|
||||
fn generate_access_token() -> Result<String, getrandom::Error> {
|
||||
pub fn generate_access_token() -> Result<String, getrandom::Error> {
|
||||
let mut buf = [0u8; 16];
|
||||
fill(&mut buf)?;
|
||||
Ok(encode(&buf))
|
||||
}
|
||||
|
||||
fn generate_refresh_token() -> Result<String, getrandom::Error> {
|
||||
pub fn generate_refresh_token() -> Result<String, getrandom::Error> {
|
||||
let mut buf = [0u8; 32];
|
||||
fill(&mut buf)?;
|
||||
Ok(encode(&buf))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue