{"id":22281547,"url":"https://github.com/rrrodzilla/rusty_paseto","last_synced_at":"2025-04-13T09:50:26.476Z","repository":{"id":46287436,"uuid":"418609469","full_name":"rrrodzilla/rusty_paseto","owner":"rrrodzilla","description":"A type-driven, ergonomic RUST implementation of the PASETO protocol for secure stateless tokens.","archived":false,"fork":false,"pushed_at":"2024-05-28T12:01:16.000Z","size":681,"stargazers_count":57,"open_issues_count":3,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-29T03:23:21.722Z","etag":null,"topics":["auth","authentication","cryptography","ed25519","encryption","encryption-algorithms","jwt","jwt-auth","jwt-authorization","jwt-bearer-tokens","jwt-token","paseto","paseto-tokens","privacy","rust","rust-crate","rust-lang","rust-library","security","xchacha20-poly1305"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/rusty_paseto","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rrrodzilla.png","metadata":{"files":{"readme":"readme.md","changelog":"Changelog.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-18T17:50:20.000Z","updated_at":"2024-06-01T01:29:20.690Z","dependencies_parsed_at":"2024-06-01T01:29:19.363Z","dependency_job_id":null,"html_url":"https://github.com/rrrodzilla/rusty_paseto","commit_stats":{"total_commits":154,"total_committers":3,"mean_commits":"51.333333333333336","dds":"0.24025974025974028","last_synced_commit":"c76bd4fd1e9bf3cf0f95415cb6badb817d8b8ea0"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrrodzilla%2Frusty_paseto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrrodzilla%2Frusty_paseto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrrodzilla%2Frusty_paseto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrrodzilla%2Frusty_paseto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rrrodzilla","download_url":"https://codeload.github.com/rrrodzilla/rusty_paseto/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248695229,"owners_count":21146951,"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":["auth","authentication","cryptography","ed25519","encryption","encryption-algorithms","jwt","jwt-auth","jwt-authorization","jwt-bearer-tokens","jwt-token","paseto","paseto-tokens","privacy","rust","rust-crate","rust-lang","rust-library","security","xchacha20-poly1305"],"created_at":"2024-12-03T16:19:15.288Z","updated_at":"2025-04-13T09:50:26.425Z","avatar_url":"https://github.com/rrrodzilla.png","language":"Rust","readme":"\n\u003ch1 align=\"center\"\u003erusty_paseto\u003c/h1\u003e\n\n\u003ccenter\u003e\u003cimg align=\"center\" style=\"display:block; margin-left:auto;margin-right:auto;\" width=\"150\" src=\"https://github.com/rrrodzilla/rusty_paseto/raw/main/assets/RustyPasetoLogo.png\" /\u003e\u003c/center\u003e\n\n\u003cp align=\"center\"\u003e A type-driven, ergonomic implementation of the \u003ca href=\"https://github.com/paseto-standard/paseto-spec\"\u003ePASETO\u003c/a\u003e protocol\u003cbr /\u003e for secure stateless tokens.\u003c/p\u003e\n\n\n![unit tests](https://github.com/rrrodzilla/rusty_paseto/actions/workflows/rust.yml/badge.svg)\n![GitHub](https://img.shields.io/github/license/rrrodzilla/rusty_paseto?label=License)\n[![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/)\n[![Crates.io](https://img.shields.io/crates/v/rusty_paseto.svg)](https://crates.io/crates/rusty_paseto)\n[![Documentation](https://docs.rs/rusty_paseto/badge.svg)](https://docs.rs/rusty_paseto/)\n\n---\n\n## Table of Contents\n\n1) [About PASETO](#user-content-about-paseto)\n2) [Examples](#user-content-examples)\n    - [Building and parsing tokens](#user-content-building-and-parsing-tokens)\n    - [A default token](#user-content-a-default-token)\n    - [A default parser](#user-content-a-default-parser)\n    - [A token with a footer](#user-content-a-token-with-a-footer)\n    - [A token with an implicit assertion (V3/V4 only)](#user-content-a-token-with-an-implicit-assertion-v3-or-v4-versioned-tokens-only)\n    - [Setting a different expiration time](#user-content-setting-a-different-expiration-time)\n    - [Tokens that never expire](#user-content-tokens-that-never-expire)\n    - [Setting PASETO claims](#user-content-setting-paseto-claims)\n    - [Setting your own Custom Claims](#user-content-setting-your-own-custom-claims)\n    - [Validating claims](#user-content-validating-claims)\n        - [Checking claims](#user-content-checking-claims)\n        - [Custom validation](#user-content-custom-validation)\n3) [Architecture](#user-content-architecture)\n    - [Feature gates](#user-content-feature-gates)\n        - [default](#user-content-default)\n        - [batteries_included](#user-content-batteries_included)\n        - [generic](#user-content-generic)\n        - [core](#user-content-core)\n4) [Roadmap and Current Feature Status](#user-content-roadmap-and-current-feature-status)\n    - [PASETO Specification](#user-content-paseto-specification)\n    - [PASERK Specification](#user-content-paserk-specification)\n5) [Acknowledgments](#user-content-acknowledgments)\n6) [Support](#user-content-support)\n7) [Like this crate](#user-content-like-this-crate)\n\n---\n\n## About PASETO\n\n### PASETO: Platform-Agnostic Security Tokens\n\nPaseto is everything you love about JOSE (JWT, JWE, JWS) without any of the\n[many design deficits that plague the JOSE standards](https://paragonie.com/blog/2017/03/jwt-json-web-tokens-is-bad-standard-that-everyone-should-avoid).\n\n**rusty_paseto** is meant to be flexible and configurable for your specific use case.  Whether you want to [get started quickly](#user-content-default) with sensible defaults, [create your own version of rusty_paseto](#user-content-generic) in order to customize your own defaults and functionality or just want to use the [core PASETO crypto features](#user-content-core), the crate is heavily [feature gated](#user-content-feature-gates) to allow for your needs.  \n\n\n\n ## Examples\n\n ### Building and parsing tokens \n\n Here's a basic, default token with the [batteries_included](#user-content-batteries_included) feature:\n ```rust\n use rusty_paseto::prelude::*;\n\n // create a key specifying the PASETO version and purpose\n let key = PasetoSymmetricKey::\u003cV4, Local\u003e::from(Key::from(b\"wubbalubbadubdubwubbalubbadubdub\"));\n // use a default token builder with the same PASETO version and purpose\n let token = PasetoBuilder::\u003cV4, Local\u003e::default().build(\u0026key)?;\n // token is a String in the form: \"v4.local.encoded-payload\"\n\n ```\n\n ### A default token\n\n * Has no [footer](https://github.com/paseto-standard/paseto-spec/tree/master/docs)\n * Has no [implicit assertion](https://github.com/paseto-standard/paseto-spec/tree/master/docs)\n for V3 or V4 versioned tokens\n * Expires in **1 hour** after creation (due to an included default ExpirationClaim)\n * Contains an IssuedAtClaim defaulting to the current utc time the token was created\n * Contains a NotBeforeClaim defaulting to the current utc time the token was created\n\n\n You can parse and validate an existing token with the following:\n ```rust\n let key = PasetoSymmetricKey::\u003cV4, Local\u003e::from(Key::from(b\"wubbalubbadubdubwubbalubbadubdub\"));\n // now we can parse and validate the token with a parser that returns a serde_json::Value\n let json_value = PasetoParser::\u003cV4, Local\u003e::default().parse(\u0026token, \u0026key)?;\n\n //the ExpirationClaim\n assert!(json_value[\"exp\"].is_string());\n //the IssuedAtClaim\n assert!(json_value[\"iat\"].is_string());\n\n ```\n\n### A default parser\n\n * Validates the token structure and decryptes the payload or verifies the signature of the content\n * Validates the [footer](https://github.com/paseto-standard/paseto-spec/tree/master/docs) if\n one was provided\n * Validates the [implicit assertion](https://github.com/paseto-standard/paseto-spec/tree/master/docs) if one was provided (for V3 or V4 versioned tokens only)\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n### A token with a footer\n\n PASETO tokens can have an [optional footer](https://github.com/paseto-standard/paseto-spec/tree/master/docs).  In rusty_paseto we have strict types for most things. So we can extend the previous example to add a footer to the token by using code like the\n following:\n ```rust\n use rusty_paseto::prelude::*;\n let key = PasetoSymmetricKey::\u003cV4, Local\u003e::from(Key::from(b\"wubbalubbadubdubwubbalubbadubdub\"));\n let token = PasetoBuilder::\u003cV4, Local\u003e::default()\n   // note how we set the footer here\n   .set_footer(Footer::from(\"Sometimes science is more art than science\"))\n   .build(\u0026key)?;\n\n // token is now a String in the form: \"v4.local.encoded-payload.footer\"\n\n ```\n And parse it by passing in the same expected footer\n ```rust\n // now we can parse and validate the token with a parser that returns a serde_json::Value\n let json_value = PasetoParser::\u003cV4, Local\u003e::default()\n   .set_footer(Footer::from(\"Sometimes science is more art than science\"))\n   .parse(\u0026token, \u0026key)?;\n\n //the ExpirationClaim\n assert!(json_value[\"exp\"].is_string());\n //the IssuedAtClaim\n assert!(json_value[\"iat\"].is_string());\n\n ```\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n### A token with an implicit assertion (V3 or V4 versioned tokens only)\n\n Version 3 (V3) and Version 4 (V4) PASETO tokens can have an [optional implicit assertion](https://github.com/paseto-standard/paseto-spec/tree/master/docs).\n So we can extend the previous example to add an implicit assertion to the token by using code like the\n following:\n ```rust\n use rusty_paseto::prelude::*;\n let key = PasetoSymmetricKey::\u003cV4, Local\u003e::from(Key::from(b\"wubbalubbadubdubwubbalubbadubdub\"));\n let token = PasetoBuilder::\u003cV4, Local\u003e::default()\n   .set_footer(Footer::from(\"Sometimes science is more art than science\"))\n   // note how we set the implicit assertion here\n   .set_implicit_assertion(ImplicitAssertion::from(\"There’s a lesson here, and I’m not going to be the one to figure it out.\"))\n   .build(\u0026key)?;\n\n // token is now a String in the form: \"v4.local.encoded-payload.footer\"\n\n ```\n And parse it by passing in the same expected implicit assertion at parse time\n ```rust\n // now we can parse and validate the token with a parser that returns a serde_json::Value\n let json_value = PasetoParser::\u003cV4, Local\u003e::default()\n   .set_footer(Footer::from(\"Sometimes science is more art than science\"))\n   .set_implicit_assertion(ImplicitAssertion::from(\"There’s a lesson here, and I’m not going to be the one to figure it out.\"))\n   .parse(\u0026token, \u0026key)?;\n\n ```\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n### Setting a different expiration time\n\n As mentioned, default tokens expire **1 hour** from creation time.  You can set your own\n expiration time by adding an ExpirationClaim which takes an ISO 8601 (Rfc3339) compliant datetime string.\n #### Note: *claims taking an ISO 8601 (Rfc3339) string use the TryFrom trait and return a Result\u003c(),PasetoClaimError\u003e*\n ```rust\nuse rusty_paseto::prelude::*;\n // must include\n use std::convert::TryFrom;\n let key = PasetoSymmetricKey::\u003cV4, Local\u003e::from(Key::from(b\"wubbalubbadubdubwubbalubbadubdub\"));\n // real-world example using the time crate to expire 5 minutes from now\n\n let token = PasetoBuilder::\u003cV4, Local\u003e::default()\n   // note the TryFrom implmentation for ExpirationClaim\n   //.set_claim(ExpirationClaim::try_from(\"2019-01-01T00:00:00+00:00\")?)\n   .set_claim(ExpirationClaim::try_from(in_5_minutes)?)\n   .set_footer(Footer::from(\"Sometimes science is more art than science\"))\n   .build(\u0026key)?;\n\n // token is a String in the form: \"v4.local.encoded-payload.footer\"\n\n ```\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n### Tokens that never expire\n\n A **1 hour** ExpirationClaim is set by default because the use case for non-expiring tokens in the world of security tokens is fairly limited.\n Omitting an expiration claim or forgetting to require one when processing them\n is almost certainly an oversight rather than a deliberate choice.  \n\n When it is a deliberate choice, you have the opportunity to deliberately remove this claim from the Builder.\n The method call required to do so ensures readers of the code understand the implicit risk.\n ```rust\n let token = PasetoBuilder::\u003cV4, Local\u003e::default()\n   .set_claim(ExpirationClaim::try_from(in_5_minutes)?)\n   // even if you set an expiration claim (as above) it will be ignored\n   // due to the method call below\n   .set_no_expiration_danger_acknowledged()\n   .build(\u0026key)?;\n\n ```\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n### Setting PASETO Claims\n\n The PASETO specification includes [seven reserved claims](https://github.com/paseto-standard/paseto-spec/blob/master/docs/02-Implementation-Guide/04-Claims.md) which you can set with their explicit types:\n ```rust\n // real-world example using the time crate to prevent the token from being used before 2\n // minutes from now\n let in_2_minutes = (time::OffsetDateTime::now_utc() + time::Duration::minutes(2)).format(\u0026Rfc3339)?;\n\n let token = PasetoBuilder::\u003cV4, Local\u003e::default()\n   //json payload key: \"exp\"\n   .set_claim(ExpirationClaim::try_from(in_5_minutes)?)\n   //json payload key: \"iat\"\n   // the IssueAtClaim is automatically set to UTC NOW by default\n   // but you can override it here\n   // .set_claim(IssuedAtClaim::try_from(\"2019-01-01T00:00:00+00:00\")?)\n   //json payload key: \"nbf\"\n   //don't use this token before two minutes after UTC NOW\n   .set_claim(NotBeforeClaim::try_from(in_2_minutes)?)\n   //json payload key: \"aud\"\n   .set_claim(AudienceClaim::from(\"Cromulons\"))\n   //json payload key: \"sub\"\n   .set_claim(SubjectClaim::from(\"Get schwifty\"))\n   //json payload key: \"iss\"\n   .set_claim(IssuerClaim::from(\"Earth Cesium-137\"))\n   //json payload key: \"jti\"\n   .set_claim(TokenIdentifierClaim::from(\"Planet Music - Season 988\"))\n   .build(\u0026key)?;\n\n ```\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n### Setting your own Custom Claims\n\n The CustomClaim struct takes a tuple in the form of `(key: String, value: T)` where T is any\n serializable type\n #### Note: *CustomClaims use the TryFrom trait and return a Result\u003c(), PasetoClaimError\u003e if you attempt to use one of the [reserved PASETO keys](https://github.com/paseto-standard/paseto-spec/blob/master/docs/02-Implementation-Guide/04-Claims.md) in your CustomClaim*\n ```rust\n let token = PasetoBuilder::\u003cV4, Local\u003e::default()\n   .set_claim(CustomClaim::try_from((\"Co-star\", \"Morty Smith\"))?)\n   .set_claim(CustomClaim::try_from((\"Universe\", 137))?)\n   .build(\u0026key)?;\n\n ```\n This throws an error:\n ```rust\n // \"exp\" is a reserved PASETO claim key, you should use the ExpirationClaim type\n let token = PasetoBuilder::\u003cV4, Local\u003e::default()\n   .set_claim(CustomClaim::try_from((\"exp\", \"Some expiration value\"))?)\n   .build(\u0026key)?;\n\n ```\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n### Validating claims\n rusty_paseto allows for flexible claim validation at parse time\n\n#### Checking claims\n\n Let's see how we can check particular claims exist with expected values.\n ```rust\n // use a default token builder with the same PASETO version and purpose\n let token = PasetoBuilder::\u003cV4, Local\u003e::default()\n   .set_claim(SubjectClaim::from(\"Get schwifty\"))\n   .set_claim(CustomClaim::try_from((\"Contestant\", \"Earth\"))?)\n   .set_claim(CustomClaim::try_from((\"Universe\", 137))?)\n   .build(\u0026key)?;\n\n PasetoParser::\u003cV4, Local\u003e::default()\n   // you can check any claim even custom claims\n   .check_claim(SubjectClaim::from(\"Get schwifty\"))\n   .check_claim(CustomClaim::try_from((\"Contestant\", \"Earth\"))?)\n   .check_claim(CustomClaim::try_from((\"Universe\", 137))?)\n   .parse(\u0026token, \u0026key)?;\n\n // no need for the assertions below since the check_claim methods\n // above accomplish the same but at parse time!\n\n //assert_eq!(json_value[\"sub\"], \"Get schwifty\");\n //assert_eq!(json_value[\"Contestant\"], \"Earth\");\n //assert_eq!(json_value[\"Universe\"], 137);\n ```\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n#### Custom validation\n\n What if we have more complex validation requirements? You can pass in a reference to a closure which receives\n the key and value of the claim you want to validate so you can implement any validation logic\n you choose.  \n\n Let's see how we can validate our tokens only contain universe values with prime numbers:\n ```rust\n // use a default token builder with the same PASETO version and purpose\n let token = PasetoBuilder::\u003cV4, Local\u003e::default()\n   .set_claim(SubjectClaim::from(\"Get schwifty\"))\n   .set_claim(CustomClaim::try_from((\"Contestant\", \"Earth\"))?)\n   .set_claim(CustomClaim::try_from((\"Universe\", 137))?)\n   .build(\u0026key)?;\n\n PasetoParser::\u003cV4, Local\u003e::default()\n   .check_claim(SubjectClaim::from(\"Get schwifty\"))\n   .check_claim(CustomClaim::try_from((\"Contestant\", \"Earth\"))?)\n    .validate_claim(CustomClaim::try_from(\"Universe\")?, \u0026|key, value| {\n      //let's get the value\n      let universe = value\n        .as_u64()\n        .ok_or(PasetoClaimError::Unexpected(key.to_string()))?;\n      // we only accept prime universes in this app\n      if primes::is_prime(universe) {\n        Ok(())\n      } else {\n        Err(PasetoClaimError::CustomValidation(key.to_string()))\n      }\n    })\n   .parse(\u0026token, \u0026key)?;\n\n ```\n\n This token will fail to parse with the validation code above:\n ```rust\n // 136 is not a prime number\n let token = PasetoBuilder::\u003cV4, Local\u003e::default()\n   .set_claim(CustomClaim::try_from((\"Universe\", 136))?)\n   .build(\u0026key)?;\n\n ```\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n---\n\n## Architecture\n\n The rusty_paseto crate architecture is composed of three layers (batteries_included, generic and core) which can be further refined by the PASETO version(s) and purpose(s) required for your needs.  All layers use a common crypto core which includes various cipher crates depending on the version and purpose you choose.  The crate is heavily featured gated to allow you to use only the versions and purposes you need for your app which minimizes download compile times for using rusty_paseto.  A description of each architectural layer, their uses and limitations and how to minimize your required dependencies based on your required PASETO version and purpose follows:\n\n \u003cimg src=\"https://github.com/rrrodzilla/rusty_paseto/raw/main/assets/RustyPasetoPreludeArchitecture.png\" width=\"150\" /\u003e  \u003cimg src=\"https://github.com/rrrodzilla/rusty_paseto/raw/main/assets/RustyPasetoGenericArchitecture.png\" width=\"150\" /\u003e \u003cimg src=\"https://github.com/rrrodzilla/rusty_paseto/raw/main/assets/RustyPasetoCoreArchitecture.png\" width=\"150\" /\u003e\n\n batteries_included  --\u003e generic --\u003e core\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n### Feature gates\n\n Valid version/purpose feature combinations are as follows:\n - \"v1_local\" (NIST Original Symmetric Encryption)\n - \"v2_local\" (Sodium Original Symmetric Encryption)\n - \"v3_local\" (NIST Modern Symmetric Encryption)\n - \"v4_local\" (Sodium Modern Symmetric Encryption)\n - \"v1_public\" (NIST Original Asymmetric Authentication)\n - \"v2_public\" (Sodium Original Asymmetric Authentication)\n - \"v3_public\" (NIST Modern Asymmetric Authentication)\n - \"v4_public\" (Sodium Modern Asymmetric Authentication)\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n#### default\n\n The default feature is the quickest way to get started using rusty_paseto.\n\n \u003cimg src=\"https://github.com/rrrodzilla/rusty_paseto/raw/main/assets/RustyPasetoPreludeArchitecture.png\" width=\"150\" /\u003e\n\n The default feature includes the outermost architectural layer called batteries_included (described below) as well as the two latest PASETO versions (V3 - NIST MODERN, V4 - SODIUM MODERN) and the Public (Asymmetric) and Local (Symmetric) purposed key types for each of these versions.  That should be four specific version and purpose combinations however at the time of this writing I have yet to implement the V3 - Public combination, so there are 3 in the default feature.  Additionally, this feature includes JWT style claims and business rules for your PASETO token (default, but customizable expiration, issued at, not-before times, etc as described in the usage documentation and examples further below).\n\n ```toml\n ## Includes V3 (local) and V4 (local, public) versions, \n ## purposes and ciphers.\n\n rusty_paseto = \"latest\"\n ```\n ```\n // at the top of your source file\n use rusty_paseto::prelude::*;\n ```\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n#### batteries_included\n\n The outermost architectural layer is called batteries_included.  This is what most people will need.  This feature includes JWT style claims and business rules for your PASETO token (default, but customizable expiration, issued at, not-before times, etc as described in the usage documentation and examples below).\n\n  \u003cimg src=\"https://github.com/rrrodzilla/rusty_paseto/raw/main/assets/RustyPasetoBatteriesIncludedArchitecture.png\" width=\"150\" /\u003e\n You must specify a version and purpose with this feature in order to reduce the size of your dependencies like in the following Cargo.toml entry which only includes the V4 - Local types with batteries_included functionality:\n\n ```toml\n ## Includes only v4 modern sodium cipher crypto core \n ## and local (symmetric) key types with all claims and default business rules.\n\n rusty_paseto = {version = \"latest\", features = [\"batteries_included\", \"v4_local\"] }\n ```\n \u003cimg src=\"https://github.com/rrrodzilla/rusty_paseto/raw/main/assets/RustyPasetoV4LocalArchitecture.png\" width=\"150\" /\u003e\n\n ```\n // at the top of your source file\n use rusty_paseto::prelude::*;\n ```\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n#### generic\n\n The generic architectural and feature layer allows you to create your own custom version of the batteries_included layer by following the same pattern I've used in the source code to create your own custom builder and parser.  This is probably not what you need as it is for advanced usage.  The feature includes a generic builder and parser along with claims for you to extend.\n\n \u003cimg src=\"https://github.com/rrrodzilla/rusty_paseto/raw/main/assets/RustyPasetoGenericArchitecture.png\" width=\"150\" /\u003e\n\n It includes all the PASETO and custom claims but allows you to create different default claims in your custom builder and parser or use a different time crate or make up your own default business rules.  As with the batteries_included layer, parsed tokens get returned as a serder_json Value. Again, specify the version and purpose to include in the crypto core:\n\n\n ```toml\n ## Includes only v4 modern sodium cipher crypto core and local (symmetric)\n ## key types with all claims and default business rules.\n\n rusty_paseto = {version = \"latest\", features = [\"generic\", \"v4_local\"] }\n ```\n ```\n // at the top of your source file\n use rusty_paseto::generic::*;\n ```\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n#### core\n\n The core architectural layer is the most basic PASETO implementation as it accepts a Payload, optional Footer and (if v3 or v4) an optional Implicit Assertion along with the appropriate key to encrypt/sign and decrypt/verify basic strings.  \n\n \u003cimg src=\"https://github.com/rrrodzilla/rusty_paseto/raw/main/assets/RustyPasetoCoreArchitecture.png\" width=\"150\" /\u003e\n\n There are no default claims or included claim structures, business rules or anything other than basic PASETO crypto functions.  Serde crates are not included in this feature so it is extremely lightweight.  You can use this when you don't need JWT-esque functionality but still want to leverage the safe cipher combinations and algorithm lucidity afforded by the PASETO specification.\n\n ```toml\n ## Includes only v4 modern sodium cipher crypto core and local (symmetric)\n ## key types with NO claims, defaults or validation, just basic PASETO\n ## encrypt/signing and decrypt/verification.\n\n rusty_paseto = {version = \"latest\", features = [\"core\", \"v4_local\"] }\n ```\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n---\n\n ## Roadmap and Current Feature Status\n\n ### [PASETO](https://github.com/paseto-standard/paseto-spec) specification\n\n| APIs, Tests \u0026 Documentation |v1.L|v1.P|v2.L|v2.P|v3.L|v3.P|v4.L|v4.P|\n| ------------: |:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|\n| PASETO Token Builder\t\t|🟢|🟢|🟢|🟢|🟢|🟢|🟢|🟢|\n| PASETO Token Parser\t\t|🟢|🟢|🟢|🟢|🟢|🟢|🟢|🟢|\n| Flexible Claim Validation\t|🟢|🟢|🟢|🟢|🟢|🟢|🟢|🟢|\n| Generic Token Builder\t\t|🟢|🟢|🟢|🟢|🟢|🟢|🟢|🟢|\n| Generic Token Parser\t\t|🟢|🟢|🟢|🟢|🟢|🟢|🟢|🟢|\n| Encryption/Signing\t\t|🟢|🟢|🟢|🟢|🟢|🟢|🟢|🟢|\n| Decryption/Verification\t|🟢|🟢|🟢|🟢|🟢|🟢|🟢|🟢|\n| [PASETO Test vectors](https://github.com/paseto-standard/test-vectors)  |🟢|🟢|🟢|🟢|🟢|🟢|🟢|🟢|\n| Feature - core\t|🟢|🟢|🟢|🟢|🟢|🟢|🟢|🟢|\n| Feature - generic\t|🟢|🟢|🟢|🟢|🟢|🟢|🟢|🟢|\n| Feature - batteries_included\t|🟢|🟢|🟢|🟢|🟢|🟢|🟢|🟢|\n| Docs - [core](#user-content-core)\t\t\t|🟢|🟢|🟢|🟢|🟢|🟢|🟢|🟢|\n| Docs - [generic](#user-content-generic)\t\t\t|🟢|🟢|🟢|🟢|🟢|🟢|🟢|🟢|\n| Docs - [batteries_included](#user-content-batteries_included)\t\t\t|🟢|🟢|🟢|🟢|🟢|🟢|🟢|🟢|\n\n \u003cdiv align=\"center\"\u003e\u003cp\u003e🟢 - completed\u0026nbsp;⚫ - planned\u003c/p\u003e\u003c/div\u003e\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n ### [PASERK](https://github.com/paseto-standard/paserk) specification\n\n|lid|local|seal|local-wrap|local-pw|sid|public|pid|secret|secret-wrap|secret-pw|\n|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|\n|⚫|⚫|⚫|⚫|⚫|⚫|⚫|⚫|⚫|⚫|⚫|\n \u003cdiv align=\"center\"\u003e\u003cp\u003e🟢 - completed\u0026nbsp;⚫ - planned\u003c/p\u003e\u003c/div\u003e\n\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n---\n\n## Support\n\nFile an [issue](https://github.com/rrrodzilla/rusty_paseto/issues/new/choose) or hit me up on [Twitter](https://twitter.com/rrrodzilla)!\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n---\n\n## Acknowledgments\n\n If the API of this crate doesn't suit your tastes, check out the other PASETO implementations\n in the Rust ecosystem which inspired rusty_paseto:\n\n - [paseto](https://crates.io/crates/paseto) - by [Cynthia Coan](https://crates.io/users/Mythra)\n - [pasetors](https://crates.io/crates/pasetors) - by [Johannes](https://crates.io/users/brycx)\n\n\u003ch6 align=\"right\"\u003e\u003ca href=\"#user-content-table-of-contents\"\u003eback to toc\u003c/a\u003e\u003c/h6\u003e\n\n--- \n\n## Like this crate?\n\n⭐ Star     https://github.com/rrrodzilla/rusty_paseto\n\n🐦 Follow   https://twitter.com/rrrodzilla\n\n---\n\n\u003ch5 align=\"center\"\u003ereadme created with \u003ca href=\"https://crates.io/crates/cargo-markdown\"\u003ecargo-markdown\u003c/a\u003e\u003c/h5\u003e\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frrrodzilla%2Frusty_paseto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frrrodzilla%2Frusty_paseto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frrrodzilla%2Frusty_paseto/lists"}