{"id":13425382,"url":"https://github.com/hako/branca","last_synced_at":"2025-04-09T14:14:56.068Z","repository":{"id":52194439,"uuid":"116833802","full_name":"hako/branca","owner":"hako","description":":key: Secure alternative to JWT. Authenticated Encrypted API Tokens for Go.","archived":false,"fork":false,"pushed_at":"2020-08-07T06:24:03.000Z","size":22,"stargazers_count":173,"open_issues_count":0,"forks_count":19,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-02T13:03:08.678Z","etag":null,"topics":["api","api-token","branca","crypto","cryptography","go","golang","jwt","token-authentication","token-authetication","xchacha20-poly1305"],"latest_commit_sha":null,"homepage":"https://branca.io","language":"Go","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/hako.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}},"created_at":"2018-01-09T15:27:31.000Z","updated_at":"2025-01-03T21:46:46.000Z","dependencies_parsed_at":"2022-08-13T01:21:50.350Z","dependency_job_id":null,"html_url":"https://github.com/hako/branca","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hako%2Fbranca","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hako%2Fbranca/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hako%2Fbranca/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hako%2Fbranca/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hako","download_url":"https://codeload.github.com/hako/branca/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054193,"owners_count":21039952,"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":["api","api-token","branca","crypto","cryptography","go","golang","jwt","token-authentication","token-authetication","xchacha20-poly1305"],"created_at":"2024-07-31T00:01:11.253Z","updated_at":"2025-04-09T14:14:56.052Z","avatar_url":"https://github.com/hako.png","language":"Go","funding_links":[],"categories":["Authentication and OAuth","开源类库","身份验证和OAuth","Open source library","Uncategorized","认证和OAuth授权","Go"],"sub_categories":["Auth","Contents"],"readme":"# branca\n\n[![Build Status](https://travis-ci.org/hako/branca.svg?branch=master)](https://travis-ci.org/hako/branca) [![Go Report Card](https://goreportcard.com/badge/github.com/hako/branca)](https://goreportcard.com/report/github.com/hako/branca)\n[![GoDoc](https://godoc.org/github.com/hako/branca?status.svg)](https://godoc.org/github.com/hako/branca) \n\nbranca is a secure alternative to JWT, This implementation is written in pure Go (no cgo dependencies) and implements the [branca token specification](https://github.com/tuupola/branca-spec).\n\n# Requirements\n\nGo 1.13+\n\n# Install\n\n```\ngo get -u github.com/hako/branca\n```\n\n# Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/hako/branca\"\n)\n\nfunc main() {\n\tb := branca.NewBranca(\"supersecretkeyyoushouldnotcommit\") // This key must be exactly 32 bytes long.\n\t\n\t// Encode String to Branca Token.\n\ttoken, err := b.EncodeToString(\"Hello world!\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\t\t\t\t\n    //b.SetTTL(3600) // Uncomment this to set an expiration (or ttl) of the token (in seconds).\n    //token = \"87y8daMzSkn7PA7JsvrTT0JUq1OhCjw9K8w2eyY99DKru9FrVKMfeXWW8yB42C7u0I6jNhOdL5ZqL\" // This token will be not allowed if a ttl is set.\n\t\n\t// Decode Branca Token.\n\tmessage, err := b.DecodeToString(token)\n\tif err != nil {\n\t\tfmt.Println(err) // token is expired.\n\t\treturn\n\t}\n\tfmt.Println(token) // 87y8da....\n\tfmt.Println(message) // Hello world!\n}\n```\n\n# Todo\n\nHere are a few things that need to be done:\n\n- [x] Remove cgo dependencies.\n- [x] Move to a pure XChaCha20 algorithm in Go.\n- [x] Add more tests than just acceptance tests.\n- [x] Increase test coverage.\n- [ ] Additional Methods. (Encode, Decode []byte)\n- [ ] Performance benchmarks.\n- [ ] More comments, examples and documentation.\n\n# Contributing\n\nContributions are welcome! Fork this repo and add your changes and submit a PR.\n\nIf you would like to fix a bug, add a feature or provide feedback you can do so in the issues section.\n\nYou can run tests by runnning `go test`. Running `go test; go vet; golint` is recommended.\n\n# License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhako%2Fbranca","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhako%2Fbranca","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhako%2Fbranca/lists"}