Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e91af657e |
No files matched your search
@@ -25,6 +25,10 @@ pub mod access_level {
|
||||
pub const PRIVATE: &str = "PRIVATE";
|
||||
}
|
||||
|
||||
pub mod token {
|
||||
pub const TOKEN_TYPE: &str = "JWT";
|
||||
}
|
||||
|
||||
pub mod error {
|
||||
pub const DIRECTORY_NOT_INITIALIZED: &str = "Directory has not been initialized";
|
||||
pub const FILENAME_NOT_INITIALIZED: &str = "Filename has not bee initialized";
|
||||
|
||||
+1
-3
@@ -111,15 +111,13 @@ pub struct TokenResource {
|
||||
pub id: uuid::Uuid,
|
||||
}
|
||||
|
||||
const TOKEN_TYPE: &str = "JWT";
|
||||
|
||||
pub fn create_token(
|
||||
key: &String,
|
||||
token_resource: &TokenResource,
|
||||
duration: time::Duration,
|
||||
) -> Result<(String, i64), josekit::JoseError> {
|
||||
let mut header = josekit::jws::JwsHeader::new();
|
||||
header.set_token_type(TOKEN_TYPE);
|
||||
header.set_token_type(super::constants::token::TOKEN_TYPE);
|
||||
|
||||
let mut payload = josekit::jwt::JwtPayload::new();
|
||||
let message = &token_resource.message;
|
||||
|
||||
Reference in new issue
Block a user