pub struct RS256JwtGenerator { /* private fields */ }Expand description
RS256 JWT generator using RSA private keys.
This is the standard implementation for GitHub App authentication. It uses RSA-SHA256 signing as required by GitHub’s API.
§Examples
let private_key = PrivateKey::from_pem(key_pem).unwrap();
let generator = RS256JwtGenerator::new(private_key);
// Generator is ready to produce JWTsImplementations§
Source§impl RS256JwtGenerator
impl RS256JwtGenerator
Sourcepub fn new(private_key: PrivateKey) -> Self
pub fn new(private_key: PrivateKey) -> Self
Sourcepub fn with_expiration(
private_key: PrivateKey,
expiration_duration: Duration,
) -> Self
pub fn with_expiration( private_key: PrivateKey, expiration_duration: Duration, ) -> Self
Create a new RS256 JWT generator with custom expiration duration.
§Arguments
private_key- RSA private key for signing JWTsexpiration_duration- How long JWTs should be valid (max 10 minutes)
§Panics
Panics if expiration_duration exceeds 10 minutes.
§Examples
let private_key = PrivateKey::from_pem(key_pem).unwrap();
// Use 8-minute expiration for extra safety margin
let generator = RS256JwtGenerator::with_expiration(
private_key,
Duration::minutes(8)
);Trait Implementations§
Source§impl JwtGenerator for RS256JwtGenerator
impl JwtGenerator for RS256JwtGenerator
Source§fn generate_jwt<'life0, 'async_trait>(
&'life0 self,
app_id: GitHubAppId,
) -> Pin<Box<dyn Future<Output = Result<JsonWebToken, AuthError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn generate_jwt<'life0, 'async_trait>(
&'life0 self,
app_id: GitHubAppId,
) -> Pin<Box<dyn Future<Output = Result<JsonWebToken, AuthError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate a JWT token for GitHub App authentication. Read more
Source§fn expiration_duration(&self) -> Duration
fn expiration_duration(&self) -> Duration
Get the JWT expiration duration configured for this generator. Read more
Auto Trait Implementations§
impl Freeze for RS256JwtGenerator
impl RefUnwindSafe for RS256JwtGenerator
impl Send for RS256JwtGenerator
impl Sync for RS256JwtGenerator
impl Unpin for RS256JwtGenerator
impl UnsafeUnpin for RS256JwtGenerator
impl UnwindSafe for RS256JwtGenerator
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