#oauth #challenge #verifier #verify

pkce

Library for generating PKCE code verifiers and challenges

3 unstable releases

0.2.0 Feb 26, 2023
0.1.1 Jan 14, 2021
0.1.0 Jul 13, 2020

#449 in Authentication

Download history 1037/week @ 2024-08-26 1123/week @ 2024-09-02 1337/week @ 2024-09-09 1352/week @ 2024-09-16 1559/week @ 2024-09-23 2133/week @ 2024-09-30 1739/week @ 2024-10-07 1100/week @ 2024-10-14 1100/week @ 2024-10-21 1266/week @ 2024-10-28 1551/week @ 2024-11-04 978/week @ 2024-11-11 1139/week @ 2024-11-18 935/week @ 2024-11-25 3576/week @ 2024-12-02 2719/week @ 2024-12-09

8,379 downloads per month
Used in 7 crates

MIT/Apache

5KB

pkce-rs

A very simple library for generating code verifiers and challenges to use for OAuth Proof Key for Code Exchange. It is not rocket science.

extern crate pkce;

fn main() {
    // Generate a random 128-byte code verifier (must be between 43 and 128 bytes)
    let code_verify = pkce::code_verifier(128);
    // Generate an encrypted code challenge accordingly
    let code_challenge = pkce::code_challenge(&code_verify);

    println!("Code challenge generated: {}", code_challenge);
}

Wow, it really is that simple.

Features

In order to support WebAssembly enable feature js.


lib.rs:

This is a minimal library with functions to generate random code verifiers and challenges to be used for OAuth Proof Key for Code Exchange.

extern crate pkce;

fn main() {
    let code_verify = pkce::code_verifier(128);
    let code_challenge = pkce::code_challenge(&code_verify);

    println!("Code challenge generated: {}", code_challenge);
}

Dependencies

~0.8–1.4MB
~26K SLoC