4 releases

0.3.1 May 2, 2024
0.3.0 Sep 8, 2023
0.1.1 Aug 16, 2023
0.1.0 Aug 16, 2023

#1302 in Cryptography

Download history 59011/week @ 2025-09-20 67629/week @ 2025-09-27 103345/week @ 2025-10-04 85287/week @ 2025-10-11 72520/week @ 2025-10-18 74638/week @ 2025-10-25 64914/week @ 2025-11-01 57103/week @ 2025-11-08 70905/week @ 2025-11-15 54540/week @ 2025-11-22 55394/week @ 2025-11-29 55683/week @ 2025-12-06 65358/week @ 2025-12-13 30066/week @ 2025-12-20 26908/week @ 2025-12-27 65482/week @ 2026-01-03

200,156 downloads per month
Used in snowflake-api

Apache-2.0

15KB
95 lines

Custom serialization of OffsetDateTime to conform with the JWT spec (RFC 7519 section 2, "Numeric Date")


snowflake-jwt

Generates JWT token in Snowflake-compatible format, see Using Key Pair Authentication.

Can be used in order to run queries against SQL REST API.

Usage

[dependencies]
snowflake-jwt = "0.1.0"

Check examples for working programs using the library.

use anyhow::Result;
use std::fs;
use snowflake_jwt;

fn get_token(private_key_path: &str, account_identifier: &str, username: &str) -> Result<String> {
    let pem = fs::read_to_string(private_key_path)?;
    let full_identifier = format!("{}.{}", account_identifier, username);
    let jwt = snowflake_jwt::generate_jwt_token(&pem, &full_identifier)?;

    Ok(jwt)
}

Dependencies

~6–18MB
~223K SLoC