snowflake-jwt

Crates.iosnowflake-jwt
lib.rssnowflake-jwt
version0.3.1
sourcesrc
created_at2023-08-16 14:34:51.808766
updated_at2024-05-02 17:04:40.085611
descriptionSnowflake JWT token generator
homepage
repositoryhttps://github.com/mycelial/snowflake-rs
max_upload_size
id945988
size46,959
(andrusha)

documentation

http://docs.rs/snowflake-jwt/

README

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)
}
Commit count: 106

cargo fmt