{"id":17163674,"url":"https://github.com/cyberdelia/macaroon","last_synced_at":"2026-02-27T04:04:59.269Z","repository":{"id":37985925,"uuid":"458687460","full_name":"cyberdelia/macaroon","owner":"cyberdelia","description":"Cookies with contextual caveats","archived":false,"fork":false,"pushed_at":"2025-02-03T02:29:06.000Z","size":139,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-13T14:48:31.476Z","etag":null,"topics":["macaroons"],"latest_commit_sha":null,"homepage":"https://github.com/cyberdelia/macaroon","language":"Kotlin","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/cyberdelia.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}},"created_at":"2022-02-13T02:14:41.000Z","updated_at":"2024-12-02T02:45:56.000Z","dependencies_parsed_at":"2023-11-06T03:28:03.483Z","dependency_job_id":"10d49659-7d54-4c62-b903-c1b56dc7a925","html_url":"https://github.com/cyberdelia/macaroon","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/cyberdelia/macaroon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyberdelia%2Fmacaroon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyberdelia%2Fmacaroon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyberdelia%2Fmacaroon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyberdelia%2Fmacaroon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyberdelia","download_url":"https://codeload.github.com/cyberdelia/macaroon/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyberdelia%2Fmacaroon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29884515,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T23:51:21.483Z","status":"online","status_checked_at":"2026-02-27T02:00:06.759Z","response_time":57,"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":["macaroons"],"created_at":"2024-10-14T22:49:44.618Z","updated_at":"2026-02-27T04:04:59.234Z","avatar_url":"https://github.com/cyberdelia.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Macaroon\n\n## Setup\n\nAdd the latest Macaroon version to your project:\n\n### Using Gradle:\n\n```kotlin\nimplementation(\"com.lapanthere:macaroon:0.1\")\n```\n\n### Using Maven:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.lapanthere\u003c/groupId\u003e\n    \u003cartifactId\u003emacaroon\u003c/artifactId\u003e\n    \u003cversion\u003e0.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Getting started\n\nTo start, you'll need to generate a secret key:\n\n```kotlin\nval key = generateSecretKey()\n```\n\n```java\nvar key = Keys.generateSecretKey()\n```\n\nOr using a public/private key setup:\n\n```kotlin\nval privateKey = generatePrivateKey()\nval publicKey = generatePublicKey()\nval key = sharedSecret(publicKey, privateKey)\n```\n\n```java\nvar privateKey = Keys.generatePrivateKey();\nvar publicKey = Keys.generatePublicKey();\nvar key = Keys.sharedSecret(publicKey,privateKey);\n```\n\nOnce you have a secret key, you can now build a macaroon:\n\n```kotlin\nval macaroon = buildMacaroon(location = \"macaroon/kotlin\", identifier = \"kotlinUsage\", key) {\n    require(\"account = 1234\")\n    require(field(\"actions\") containsAll listOf(\"read\", \"write\"))\n    require(field(\"time\") lt Instant.now().plusSeconds(60))\n}\n```\n\n```java\nvar macaroon = new Macaroon.Builder(\"macaroon/java\", \"javaUsage\", key)\n    .require(\"account = 1234\")\n    .require(field(\"time\").lessThan(Instant.now().plusSeconds(60))\n    .require(field(\"actions\").containsAll(List.of(\"read\",\"write\")))\n    .build();\n```\n\nYou can then verify said macaroon:\n\n```kotlin\nval verifier = buildVerifier(macaroon) {\n    satisfy(\"account = 1234\")\n    satisfy { caveat -\u003e caveat.isFirstParty }\n    satisfy(\"actions\", \"read\", \"write\")\n    satisfy(\"time\", Instant.now())\n}\nverifier.isValid(key)\n```\n\n```java\nvar verifier = new Verifier.Builder(macaroon)\n    .satisfy(\"account = 1234\")\n    .satisfy(Caveat::isFirstParty)\n    .satisfy(\"admin\", true)\n    .satisfy(\"actions\", List.of(\"read\"), String.class)\n    .build();\nverifier.isValid(key);\n```\n\nTo de/serialize a macaroon (using the v2 format):\n\n```kotlin\nval serialized = macaroon.serialize()\nval macaroon = Macaroon(serialized)\n```\n\n```java\nvar serialized = macaroon.serialize();\nvar macaroon = Macaroon.from(serialized);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyberdelia%2Fmacaroon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyberdelia%2Fmacaroon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyberdelia%2Fmacaroon/lists"}