{"id":15067630,"url":"https://github.com/conradludgate/pasta-tokens","last_synced_at":"2026-03-12T01:38:09.868Z","repository":{"id":197573299,"uuid":"673983104","full_name":"conradludgate/pasta-tokens","owner":"conradludgate","description":"A correct, fast and ergonomic PASETO library for Rust","archived":false,"fork":false,"pushed_at":"2023-10-03T14:23:10.000Z","size":521,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-08T10:47:28.587Z","etag":null,"topics":["authentication","paserk","paseto","rust","tokens"],"latest_commit_sha":null,"homepage":"","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/conradludgate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"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,"zenodo":null}},"created_at":"2023-08-02T21:53:26.000Z","updated_at":"2025-09-05T02:46:53.000Z","dependencies_parsed_at":"2023-10-03T16:38:34.328Z","dependency_job_id":null,"html_url":"https://github.com/conradludgate/pasta-tokens","commit_stats":null,"previous_names":["conradludgate/pasta-tokens"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/conradludgate/pasta-tokens","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conradludgate%2Fpasta-tokens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conradludgate%2Fpasta-tokens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conradludgate%2Fpasta-tokens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conradludgate%2Fpasta-tokens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/conradludgate","download_url":"https://codeload.github.com/conradludgate/pasta-tokens/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conradludgate%2Fpasta-tokens/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30412090,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T00:40:14.898Z","status":"ssl_error","status_checked_at":"2026-03-12T00:40:08.439Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["authentication","paserk","paseto","rust","tokens"],"created_at":"2024-09-25T01:25:25.261Z","updated_at":"2026-03-12T01:38:09.853Z","avatar_url":"https://github.com/conradludgate.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pasta_tokens\n\nPASETO implementation for Rust.\n\n## Examples\n\n```rust\nuse pasta_tokens::{v4, paserk::k4, purpose::public::Public, Json};\n\n#[derive(serde::Serialize, serde::Deserialize)]\nstruct Footer {\n    /// The ID of the key used to sign the PASETO.\n    /// A footer should only contain types that are `SafeForFooter`\n    kid: k4::KeyId\u003cPublic\u003e,\n}\n\n#[derive(serde::Serialize, serde::Deserialize)]\nstruct Payload {\n    /// The expiration date of the token\n    #[serde(with = \"time::serde::rfc3339\", rename = \"exp\")]\n    expiration: time::OffsetDateTime,\n    /// The subject of the token\n    #[serde(rename = \"sub\")]\n    user_id: uuid::Uuid,\n}\n\n// load your secret key\nlet secret_key = hex::decode(\"407796f4bc4b8184e9fe0c54b336822d34823092ad873d87ba14c3efb9db8c1d\").unwrap();\nlet secret_key = v4::SecretKey::from_secret_key(secret_key.try_into().unwrap());\n\nlet user_id = uuid::Uuid::new_v4();\n\n// create the token payload and footer.\nlet token = v4::UnsignedToken::new_v4_public(Payload {\n    // expires in 1 hour\n    expiration: time::OffsetDateTime::now_utc() + time::Duration::hours(1),\n    user_id,\n})\n.with_footer(Json(Footer {\n    kid: secret_key.public_key().to_id(),\n}))\n// sign with the secret key\n.sign(\u0026secret_key)\n.unwrap()\n.to_string();\n\n// Send off the token to the client\nprintln!(\"{token}\");\n// \"v4.public.eyJleHAiOiIyMDIzLTEwLTAxVDE0OjQ4OjI2LjM0NjA5MloiLCJzdWIiOiIxOTBhZjFmYS1lZGVlLTRiNGUtOGQxMC05ZmUwZjQ1ZGQ5OTQifXo-Vsr45NroJZ9pLkuN3xcxgFncGF3eject5GdZH7WwTEfCgmo6hD-zNh0txsLvZi1vC601oNCgXq_2cK4XKQw.eyJraWQiOiJrNC5waWQuQUdQQ09CUkI4UHowQ3dNOFFfQnNVUEw0OF8zZjRUbE0yc2Z0R3Y0ejkzVFkifQ\"\n\n// load your public keys\nlet public_key = hex::decode(\"b7715bd661458d928654d3e832f53ff5c9480542e0e3d4c9b032c768c7ce6023\").unwrap();\nlet public_key = v4::PublicKey::from_public_key(\u0026public_key).unwrap();\n\n// keep a key cache of key IDs to public keys.\n// this will let you securely rotate your secret keys\n// and still validate multiple public keys safely\nlet keys = std::collections::HashMap::from([\n    (public_key.to_id(), public_key)\n]);\n\n// Parse the token from the client\nlet token: v4::SignedToken\u003cJson\u003cFooter\u003e\u003e = token.parse().expect(\"should be a valid token format\");\n\n// using the key ID, search for the public key\nlet key = \u0026keys[\u0026token.unverified_footer().0.kid];\n\n// verify the token signature\nlet token: v4::VerifiedToken\u003cPayload, _\u003e = token.verify(key).expect(\"token should be signed by us\");\n\n// check if the token has expired\nassert!(token.message.expiration \u003e time::OffsetDateTime::now_utc());\n\n// proceed to use the payload as you wish!\nassert_eq!(token.message.user_id, user_id);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconradludgate%2Fpasta-tokens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconradludgate%2Fpasta-tokens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconradludgate%2Fpasta-tokens/lists"}