jsonwebtoken-google-wasm

Crates.iojsonwebtoken-google-wasm
lib.rsjsonwebtoken-google-wasm
version0.0.8
sourcesrc
created_at2023-09-20 13:47:59.659235
updated_at2023-09-21 09:56:31.504487
descriptionparse and validate google jwt token compliant with webassembly runtimes with jsonwebtoken
homepage
repositoryhttps://github.com/0xpaladinsecurity/jsonwebtoken-google-wasm
max_upload_size
id978137
size30,599
Paladin - Team Account (JorgeAtPaladin)

documentation

https://docs.rs/jsonwebtoken-google-wasm

README

Parse and validate Google JWT tokens within Rust WebAssembly

Developed for CloudFlare Workers. Experimental & non-reviewed. Use at own risk.

#[derive(Debug, Serialize, Deserialize)]
pub struct Token {
    pub email: String,
    pub aud: String,
    pub iss: String,
    pub exp: u64,
}

async fn main() {
    let parser = Parser::new("your-google-client-id");
    let claims = parser.parse::<Token>("your-token", Instant::now()).await.unwrap();
    // Instant::now() is not supported on Cloudflare workers and needs to be replaced.
}

Credits

Based upon avkviring/jsonwebtoken-google which can't target WASM due to a rand crate dependency.

Commit count: 0

cargo fmt