{"id":31462558,"url":"https://github.com/deatil/zig-paseto","last_synced_at":"2025-10-07T13:15:09.522Z","repository":{"id":316109383,"uuid":"1059138357","full_name":"deatil/zig-paseto","owner":"deatil","description":"A PASETO (Platform-Agnostic SEcurity TOkens) library for zig.","archived":false,"fork":false,"pushed_at":"2025-09-30T05:31:06.000Z","size":112,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-30T07:06:06.352Z","etag":null,"topics":["jwt","paseto","token","zig","zig-paseto"],"latest_commit_sha":null,"homepage":"https://github.com/deatil/zig-paseto","language":"Zig","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/deatil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-18T03:49:45.000Z","updated_at":"2025-09-30T05:31:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"944589c9-a30b-4a9e-83ab-1b45473ab7c2","html_url":"https://github.com/deatil/zig-paseto","commit_stats":null,"previous_names":["deatil/zig-paseto"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/deatil/zig-paseto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deatil%2Fzig-paseto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deatil%2Fzig-paseto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deatil%2Fzig-paseto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deatil%2Fzig-paseto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deatil","download_url":"https://codeload.github.com/deatil/zig-paseto/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deatil%2Fzig-paseto/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278780089,"owners_count":26044498,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["jwt","paseto","token","zig","zig-paseto"],"created_at":"2025-10-01T16:01:08.548Z","updated_at":"2025-10-07T13:15:09.505Z","avatar_url":"https://github.com/deatil.png","language":"Zig","readme":"## Zig-paseto \n\nA PASETO (Platform-Agnostic SEcurity TOkens) library for zig.\n\n\n### Env\n\n - Zig \u003e= 0.16.0-dev.164+bc7955306.\n\n\n### What is PASETO?\n\nPASETO (Platform-Agnostic SEcurity TOkens) is a specification and reference implementation\nfor secure stateless tokens.\n\n\n### Key Differences between PASETO and JWT\n\nUnlike JSON Web Tokens (JWT), which gives developers more than enough rope with which to\nhang themselves, PASETO only allows secure operations. JWT gives you \"algorithm agility\",\nPASETO gives you \"versioned protocols\". It's incredibly unlikely that you'll be able to\nuse PASETO in [an insecure way](https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries).\n\n\n### Adding zig-paseto as a dependency\n\nAdd the dependency to your project:\n\n```sh\nzig fetch --save=zig-paseto git+https://github.com/deatil/zig-paseto#main\n```\n\nor use local path to add dependency at `build.zig.zon` file\n\n```zig\n.{\n    .dependencies = .{\n        .@\"zig-paseto\" = .{\n            .path = \"./lib/zig-paseto\",\n        },\n        ...\n    }\n}\n```\n\nAnd the following to your `build.zig` file:\n\n```zig\nconst zig_paseto_dep = b.dependency(\"zig-paseto\", .{});\nexe.root_module.addImport(\"zig-paseto\", zig_paseto_dep.module(\"zig-paseto\"));\n```\n\nThe `zig-paseto` structure can be imported in your application with:\n\n```zig\nconst paseto = @import(\"zig-paseto\");\n```\n\n\n### Get Starting\n\n~~~zig\nconst std = @import(\"std\");\nconst crypto = std.crypto;\n\nconst paseto = @import(\"zig-paseto\");\n\npub fn main() !void {\n    const alloc = std.heap.page_allocator;\n\n    const key = \"707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f\";\n\n    var buf: [32]u8 = undefined;\n    const k = try std.fmt.hexToBytes(\u0026buf, key);\n\n    const m = \"{\\\"data\\\":\\\"this is a signed message\\\",\\\"exp\\\":\\\"2022-01-01T00:00:00+00:00\\\"}\";\n    const f = \"{\\\"kid\\\":\\\"zVhMiPBP9fRf2snEcT7gFTioeA9COcNy9DfgL1W60haN\\\"}\";\n    const i = \"{\\\"test-vector\\\":\\\"4-S-3\\\"}\";\n\n    var e = paseto.V4Local.init(alloc);\n    defer e.deinit();\n\n    try e.withMessage(m);\n    try e.withFooter(f);\n    try e.withImplicit(i);\n\n    const token = try e.encode(crypto.random, k);\n    defer alloc.free(token);\n    \n    // output: \n    // make paseto token: v4.local.G-ToOUO6A-LGTVrBKiVn7najk-XOBR2a4olurkkWrLgM9sKOf6tNlMpKbSZpI70E5MzgdnWq6yplehnR2VeLR4VTmGMZYDI0VMotPJpKJeBuS7xDoCsm8z_5wA9af2ZtTfrlMY5ErELyiqx5pqdVAzSBP9ZM6-Qxo4oHTnWAqjENeOHdYA.eyJraWQiOiJ6VmhNaVBCUDlmUmYyc25FY1Q3Z0ZUaW9lQTlDT2NOeTlEZmdMMVc2MGhhTiJ9\n    std.debug.print(\"make paseto token: {s} \\n\", .{token});\n\n    // ====================\n\n    // parse token\n    var p = paseto.V4Local.init(alloc);\n    defer p.deinit();\n\n    try p.withImplicit(i);\n\n    try p.decode(token, k);\n    \n    // output: \n    // message: this is a signed message\n    const message = try p.getMessage();\n    defer message.deinit();\n    std.debug.print(\"message: {s} \\n\", .{message.value.object.get(\"data\").?.string});\n}\n~~~\n\n\n### Encode Methods\n\nThe PASETO library have encode methods:\n\n - `v1.local`: paseto.V1Local\n - `v1.public`: paseto.V1Public\n\n - `v2.local`: paseto.V2Local\n - `v2.public`: paseto.V2Public\n\n - `v3.local`: paseto.V3Local\n - `v3.public`: paseto.V3Public\n\n - `v4.local`: paseto.V4Local\n - `v4.public`: paseto.V4Public\n\n\n### LICENSE\n\n*  The library LICENSE is `Apache2`, using the library need keep the LICENSE.\n\n\n### Copyright\n\n*  Copyright deatil(https://github.com/deatil).\n","funding_links":[],"categories":["Network \u0026 Web","Libraries"],"sub_categories":["Web Framework"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeatil%2Fzig-paseto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeatil%2Fzig-paseto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeatil%2Fzig-paseto/lists"}