{"id":22326214,"url":"https://github.com/aircastdev/nats-jwt","last_synced_at":"2025-07-29T16:33:50.776Z","repository":{"id":43781148,"uuid":"389344616","full_name":"AircastDev/nats-jwt","owner":"AircastDev","description":"JWT library for creating NATS JWTs in Rust","archived":false,"fork":false,"pushed_at":"2024-06-11T21:50:52.000Z","size":78,"stargazers_count":11,"open_issues_count":1,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-15T00:48:07.551Z","etag":null,"topics":["jwt","nats","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/nats-jwt","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AircastDev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-25T12:41:18.000Z","updated_at":"2024-07-31T08:40:38.000Z","dependencies_parsed_at":"2022-09-09T22:04:34.151Z","dependency_job_id":"70d59672-3238-41fd-8602-d37152d2d007","html_url":"https://github.com/AircastDev/nats-jwt","commit_stats":{"total_commits":4,"total_committers":2,"mean_commits":2.0,"dds":0.25,"last_synced_commit":"3bc8b814357c1bd16c6e85c7d1063d1f64723209"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AircastDev%2Fnats-jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AircastDev%2Fnats-jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AircastDev%2Fnats-jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AircastDev%2Fnats-jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AircastDev","download_url":"https://codeload.github.com/AircastDev/nats-jwt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228029987,"owners_count":17858432,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jwt","nats","rust"],"created_at":"2024-12-04T02:16:19.251Z","updated_at":"2024-12-04T02:16:19.721Z","avatar_url":"https://github.com/AircastDev.png","language":"Rust","readme":"# NATS JWT (Rust)\n\n![Crates.io](https://img.shields.io/crates/l/nats-jwt)\n[![Crates.io](https://img.shields.io/crates/v/nats-jwt)](https://crates.io/crates/nats-jwt)\n[![Docs.rs](https://docs.rs/nats-jwt/badge.svg)](https://docs.rs/nats-jwt)\n\n\u003c!-- cargo-sync-readme start --\u003e\n\nGenerate JWTs signed using NKEYs for use with [NATS](https://nats.io)\n\nSupports generating account and user JWTs, operator JWTs are not typically generated on the fly\nand so aren't supported, although a PR adding support would be accepted.\n\n## Example\n\n```rust\nuse nats_jwt::{KeyPair, Token};\n\n// You would probably load the operator's seed via a config and use KeyPair::from_seed\nlet operator_signing_key = KeyPair::new_operator();\n\nlet account_keypair = KeyPair::new_account();\nlet account_signing_key = KeyPair::new_account();\nlet account_token = Token::new_account(account_keypair.public_key())\n    .name(\"My Account\")\n    .add_signing_key(account_signing_key.public_key())\n    .max_connections(100)\n    .sign(\u0026operator_signing_key);\nprintln!(\"account_token: {}\", account_token);\n\nlet user_keypair = KeyPair::new_user();\nlet user_key_pub = user_keypair.public_key();\nlet user_token = Token::new_user(account_keypair.public_key(), user_key_pub)\n    .bearer_token(true)\n    .name(\"My User\")\n    .max_subscriptions(10)\n    .max_payload(1024 * 1024) // 1MiB\n    .allow_publish(\"service.hello.world\")\n    .allow_subscribe(\"_INBOX.\u003e\")\n    .sign(\u0026account_signing_key);\nprintln!(\"user_token: {}\", user_token);\n```\n\n## License\n\nLicensed under either of\n\n-   Apache License, Version 2.0\n    ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n-   MIT license\n    ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n\n\u003c!-- cargo-sync-readme end --\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faircastdev%2Fnats-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faircastdev%2Fnats-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faircastdev%2Fnats-jwt/lists"}