{"id":13408570,"url":"https://github.com/essentialkaos/branca","last_synced_at":"2025-04-06T03:11:12.003Z","repository":{"id":34996576,"uuid":"163521841","full_name":"essentialkaos/branca","owner":"essentialkaos","description":"Authenticated encrypted API tokens (IETF XChaCha20-Poly1305 AEAD) for Golang","archived":false,"fork":false,"pushed_at":"2025-01-07T03:45:16.000Z","size":188,"stargazers_count":88,"open_issues_count":1,"forks_count":8,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-07T09:43:18.889Z","etag":null,"topics":["branca","golang","jwt","tokens"],"latest_commit_sha":null,"homepage":"https://kaos.sh/g/branca.v2","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/essentialkaos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/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":"2018-12-29T15:38:30.000Z","updated_at":"2025-01-04T08:17:42.000Z","dependencies_parsed_at":"2022-08-08T04:00:15.256Z","dependency_job_id":"acad4645-6bba-4409-bdbc-6a49532a379b","html_url":"https://github.com/essentialkaos/branca","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/essentialkaos%2Fbranca","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/essentialkaos%2Fbranca/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/essentialkaos%2Fbranca/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/essentialkaos%2Fbranca/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/essentialkaos","download_url":"https://codeload.github.com/essentialkaos/branca/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247427006,"owners_count":20937201,"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":["branca","golang","jwt","tokens"],"created_at":"2024-07-30T20:00:53.714Z","updated_at":"2025-04-06T03:11:11.987Z","avatar_url":"https://github.com/essentialkaos.png","language":"Go","funding_links":[],"categories":["Authentication and OAuth","身份验证和OAuth","Authentication and Authorization","Uncategorized"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003ca href=\"#readme\"\u003e\u003cimg src=\".github/images/card.svg\"/\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://kaos.sh/g/branca.v2\"\u003e\u003cimg src=\".github/images/godoc.svg\" alt=\"PkgGoDev\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://kaos.sh/r/branca\"\u003e\u003cimg src=\"https://kaos.sh/r/branca.svg\" alt=\"GoReportCard\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://kaos.sh/y/branca\"\u003e\u003cimg src=\"https://kaos.sh/y/93833817a18343c1888050402e7d8d41.svg\" alt=\"Codacy\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://kaos.sh/l/branca\"\u003e\u003cimg src=\"https://kaos.sh/l/974757272a5d2b6bd52b.svg\" alt=\"Code Climate Maintainability\" /\u003e\u003c/a\u003e\n  \u003cbr/\u003e\n  \u003ca href=\"https://kaos.sh/c/branca\"\u003e\u003cimg src=\"https://kaos.sh/c/branca.svg\" alt=\"Coverage Status\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://kaos.sh/w/branca/ci\"\u003e\u003cimg src=\"https://kaos.sh/w/branca/ci.svg\" alt=\"GitHub Actions CI Status\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://kaos.sh/w/branca/codeql\"\u003e\u003cimg src=\"https://kaos.sh/w/branca/codeql.svg\" alt=\"GitHub Actions CodeQL Status\" /\u003e\u003c/a\u003e\n  \u003ca href=\"#license\"\u003e\u003cimg src=\".github/images/license.svg\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e • \u003ca href=\"#usage-example\"\u003eUsage example\u003c/a\u003e • \u003ca href=\"#benchmarks\"\u003eBenchmarks\u003c/a\u003e • \u003ca href=\"#build-status\"\u003eBuild Status\u003c/a\u003e • \u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\u003c/p\u003e\n\n\u003cbr/\u003e\n\n`branca.go` is [branca token specification](https://github.com/tuupola/branca-spec) implementation for [Go 1.22+](https://github.com/essentialkaos/.github/blob/master/GO-VERSION-SUPPORT.md).\n\nFeatures and benefits:\n\n* Pure Go implementation;\n* No third-party dependencies at all;\n* 100% code coverage;\n* Fuzz tests.\n\n### Installation\n\nMake sure you have a working [Go 1.22+](https://github.com/essentialkaos/.github/blob/master/GO-VERSION-SUPPORT.md) workspace (_[instructions](https://go.dev/doc/install)_), then:\n\n\n```bash\ngo get -u github.com/essentialkaos/branca/v2\n```\n\n### Usage example\n\n```go\npackage main\n\nimport (\n  \"fmt\"\n  \n  \"github.com/essentialkaos/branca/v2\"\n)\n\nfunc main() {\n  key := \"abcd1234abcd1234abcd1234abcd1234\"\n  brc, err := branca.NewBranca([]byte(key))\n\n  if err != nil {\n    fmt.Printf(\"Error: %v\\n\", err)\n    return\n  }\n\n  payload := \"MySuperSecretData\"\n  token, err := brc.EncodeToString([]byte(payload))\n\n   if err != nil {\n    fmt.Printf(\"Error: %v\\n\", err)\n    return\n  }\n\n  fmt.Printf(\"Token: %s\\n\", token)\n}\n\n```\n\n### Benchmarks\n\nYou can run benchmarks by yourself using `make benchmark` command.\n\n```\ngo version go1.23.2 linux/amd64\n\nBrancaSuite.BenchmarkBase62Decoding            1000000   1106 ns/op   408 B/op    7 allocs/op\nBrancaSuite.BenchmarkBase62Encoding            1000000   1105 ns/op   512 B/op    6 allocs/op\nBrancaSuite.BenchmarkBrancaDecoding            5000000    421 ns/op    48 B/op    2 allocs/op\nBrancaSuite.BenchmarkBrancaDecodingFromString  1000000   1632 ns/op   456 B/op    9 allocs/op\nBrancaSuite.BenchmarkBrancaEncoding            1000000   2108 ns/op   152 B/op    4 allocs/op\nBrancaSuite.BenchmarkBrancaEncodingToString     500000   3854 ns/op   664 B/op   10 allocs/op\n```\n\n### Build Status\n\n| Branch | Status |\n|--------|----------|\n| `master` | [![CI](https://kaos.sh/w/branca/ci.svg?branch=master)](https://kaos.sh/w/branca/ci?query=branch:master) |\n| `develop` | [![CI](https://kaos.sh/w/branca/ci.svg?branch=develop)](https://kaos.sh/w/branca/ci?query=branch:develop) |\n\n### License\n\n[MIT](LICENSE)\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://essentialkaos.com\"\u003e\u003cimg src=\"https://gh.kaos.st/ekgh.svg\"/\u003e\u003c/a\u003e\u003c/p\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fessentialkaos%2Fbranca","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fessentialkaos%2Fbranca","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fessentialkaos%2Fbranca/lists"}