pub struct JwtSigningKeys {
pub encoding_key: EncodingKey,
pub decoding_key: DecodingKey,
}Expand description
Load or generate new Ed25519 signing keys.
JwtSigningKeys::load_or_create should be called only once at the boot of the server.
If there’s any issue during generating new keys or loading exiting one application will panic.
Examples:
use actix_jwt_session::*;
pub fn boot_server() {
let keys = JwtSigningKeys::load_or_create();
}Fields§
§encoding_key: EncodingKey§decoding_key: DecodingKeyImplementations§
Source§impl JwtSigningKeys
impl JwtSigningKeys
Sourcepub fn load_or_create() -> Self
pub fn load_or_create() -> Self
Loads signing keys from ./config directory or creates new pair and
save it to directory.
Pair is composed of encode key and decode key saved in
./config/jwt-encoding.bin and ./config/jwt-decoding.bin
written as binary file.
Decode key can be transform to base64 and shared with clients if this is required.
Files must be shared between restarts otherwise all old sessions will be invalidated.
pub fn generate(save: bool) -> Result<Self, Box<dyn Error>>
pub fn load_from_files() -> Result<Self>
Auto Trait Implementations§
impl Freeze for JwtSigningKeys
impl RefUnwindSafe for JwtSigningKeys
impl Send for JwtSigningKeys
impl Sync for JwtSigningKeys
impl Unpin for JwtSigningKeys
impl UnsafeUnpin for JwtSigningKeys
impl UnwindSafe for JwtSigningKeys
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more