#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

#433 in Authentication

Download history 1422/week @ 2024-07-20 1052/week @ 2024-07-27 1188/week @ 2024-08-03 1163/week @ 2024-08-10 1419/week @ 2024-08-17 1019/week @ 2024-08-24 1110/week @ 2024-08-31 1274/week @ 2024-09-07 1437/week @ 2024-09-14 1524/week @ 2024-09-21 2108/week @ 2024-09-28 1815/week @ 2024-10-05 1080/week @ 2024-10-12 1089/week @ 2024-10-19 1267/week @ 2024-10-26 1576/week @ 2024-11-02

5,090 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.3MB
~26K SLoC