{"id":18812421,"url":"https://github.com/warrant-dev/warrant-go","last_synced_at":"2025-04-13T21:14:14.180Z","repository":{"id":40399152,"uuid":"379431843","full_name":"warrant-dev/warrant-go","owner":"warrant-dev","description":"Go SDK for Warrant","archived":false,"fork":false,"pushed_at":"2024-11-25T08:42:21.000Z","size":3411,"stargazers_count":17,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T21:14:08.519Z","etag":null,"topics":["abac","access-control","acl","attribute-based-access-control","authorization","authz","go","golang","permissions","rbac","role-based-access-control"],"latest_commit_sha":null,"homepage":"","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/warrant-dev.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}},"created_at":"2021-06-23T00:11:13.000Z","updated_at":"2024-12-04T01:29:27.000Z","dependencies_parsed_at":"2023-10-11T07:09:31.069Z","dependency_job_id":"78a9783f-e876-4acc-9394-ab821b75ab21","html_url":"https://github.com/warrant-dev/warrant-go","commit_stats":{"total_commits":33,"total_committers":6,"mean_commits":5.5,"dds":0.7575757575757576,"last_synced_commit":"d334e2229c8b58a6e5e36b8679c7c8d945e7c9be"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/warrant-dev%2Fwarrant-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/warrant-dev%2Fwarrant-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/warrant-dev%2Fwarrant-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/warrant-dev%2Fwarrant-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/warrant-dev","download_url":"https://codeload.github.com/warrant-dev/warrant-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248782260,"owners_count":21160717,"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":["abac","access-control","acl","attribute-based-access-control","authorization","authz","go","golang","permissions","rbac","role-based-access-control"],"created_at":"2024-11-07T23:32:52.701Z","updated_at":"2025-04-13T21:14:14.161Z","avatar_url":"https://github.com/warrant-dev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Warrant Go Library\n\nUse [Warrant](https://warrant.dev/) in server-side Go projects.\n\n## Installation\n\n```shell\ngo get github.com/warrant-dev/warrant-go/v6\n```\n\n## Usage\n\nYou can use the Warrant SDK with or without a client. Instantiating a client allows you to create different client instances each with their own config (API key, API endpoint, etc).\n\n### Without a Client\n\n```go\nimport \"github.com/warrant-dev/warrant-go/v6\"\n\n// Setup\nwarrant.ApiKey = \"api_test_f5dsKVeYnVSLHGje44zAygqgqXiLJBICbFzCiAg1E=\"\n\n// Create warrant\nwarrant, err := warrant.Create(\u0026warrant.WarrantParams{})\n\n// Create tenant\ntenant, err := tenant.Create(\u0026tenant.TenantParams{})\n```\n\n### With a Client\n\nInstantiate the Warrant client with your API key to get started:\n```go\nimport \"github.com/warrant-dev/warrant-go/v6\"\nimport \"github.com/warrant-dev/warrant-go/v6/config\"\n\nclient := warrant.NewClient(config.ClientConfig{\n\tApiKey: \"api_test_f5dsKVeYnVSLHGje44zAygqgqXiLJBICbFzCiAg1E=\",\n\tApiEndpoint: \"https://api.warrant.dev\",\n\tAuthorizeEndpoint: \"https://api.warrant.dev\",\n\tSelfServiceDashEndpoint: \"https://self-serve.warrant.dev\",\n})\n```\n\n## Configuring Endpoints\nThe API, Authorize, Self-Service endpoints and http client are configurable via the `warrant.ApiEndpoint`, `warrant.AuthorizeEndpoint`, `warrant.SelfServiceDashEndpoint`, and `warrant.HttpClient` attributes:\n\n```go\nimport \"github.com/warrant-dev/warrant-go/v6\"\nimport \"github.com/warrant-dev/warrant-go/v6/config\"\n\n// Without client initialization\n// Set api and authorize endpoints to http://localhost:8000\n// Set http client to a http.Client instance returned by yourHttpClient()\nwarrant.ApiEndpoint = \"http://localhost:8000\"\nwarrant.AuthorizeEndpoint = \"http://localhost:8000\"\nwarrant.HttpClient = yourHttpClient()\n\n// With client initialization\n// Set api and authorize endpoints to http://localhost:8000 and self-service endpoint to http://localhost:8080\n// Set http client to a http.Client instance returned by yourHttpClient()\nclient := warrant.NewClient(config.ClientConfig{\n\tApiKey: \"api_test_f5dsKVeYnVSLHGje44zAygqgqXiLJBICbFzCiAg1E=\",\n\tApiEndpoint: \"http://localhost:8000\",\n\tAuthorizeEndpoint: \"http://localhost:8000\",\n\tSelfServiceDashEndpoint: \"http://localhost:8080\",\n\tHttpClient: yourHttpClient(),\n})\n```\n\n## Examples\n\n### Users\n\n```go\n// Create\ncreatedUser, err := user.Create(\u0026warrant.UserParams{\n    UserId: \"userId\",\n})\n\n// Get\nuser, err := user.Get(\"userId\")\n\n\n// Delete\nerr = user.Delete(\"userId\")\n```\n\n### Warrants\n\n```go\n\n// Create\ncreatedWarrant, err := warrant.Create(\u0026warrant.WarrantParams{\n\tObjectType: \"tenant\",\n\tObjectId:   \"1\",\n\tRelation:   \"member\",\n\tSubject: warrant.Subject{\n\t\tObjectType: \"user\",\n\t\tObjectId:   \"1\",\n\t},\n})\n\n// Delete\nerr = warrant.Delete(\u0026warrant.WarrantParams{\n\tObjectType: \"tenant\",\n\tObjectId:   \"1\",\n\tRelation:   \"member\",\n\tSubject: warrant.Subject{\n\t\tObjectType: \"user\",\n\t\tObjectId:   \"1\",\n\t},\n})\n\n// Check access\nisAuthorized, err := warrant.Check(\u0026warrant.WarrantCheckParams{\n\tObject: warrant.Object{\n\t\tObjectType: \"tenant\",\n\t\tObjectId:   \"1\",\n\t},\n\tRelation: \"member\",\n\tSubject: warrant.Subject{\n\t\tObjectType: \"user\",\n\t\tObjectId:   \"1\",\n\t},\n})\n```\n\n\nWe’ve used a random API key in these code examples. Replace it with your\n[actual publishable API keys](https://app.warrant.dev) to\ntest this code through your own Warrant account.\n\nFor more information on how to use the Warrant API, please refer to the\n[Warrant API reference](https://docs.warrant.dev).\n\nNote that we may release new [minor and patch](https://semver.org/) versions of this library with small but backwards-incompatible fixes to the type declarations. These changes will not affect Warrant itself.\n\n## Warrant Documentation\n\n- [Warrant Docs](https://docs.warrant.dev/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwarrant-dev%2Fwarrant-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwarrant-dev%2Fwarrant-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwarrant-dev%2Fwarrant-go/lists"}