{"id":26199700,"url":"https://github.com/mooncloak/kjwt","last_synced_at":"2025-06-16T09:37:25.459Z","repository":{"id":274694810,"uuid":"827508153","full_name":"mooncloak/kjwt","owner":"mooncloak","description":"Kotlin multiplatform JWT library","archived":false,"fork":false,"pushed_at":"2024-09-03T11:55:23.000Z","size":480,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-12T01:57:15.520Z","etag":null,"topics":["jws","jwt","kjwt","kmp","kmp-library","kotlin","kotlin-multiplatform","kotlin-multiplatform-library"],"latest_commit_sha":null,"homepage":"https://kodetools.com/@kjwt","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mooncloak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-11T19:37:59.000Z","updated_at":"2025-01-04T20:21:21.000Z","dependencies_parsed_at":"2025-01-28T20:36:22.117Z","dependency_job_id":"e660bde4-5061-4b9d-84d0-579959666ea2","html_url":"https://github.com/mooncloak/kjwt","commit_stats":null,"previous_names":["mooncloak/kjwt"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mooncloak/kjwt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mooncloak%2Fkjwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mooncloak%2Fkjwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mooncloak%2Fkjwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mooncloak%2Fkjwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mooncloak","download_url":"https://codeload.github.com/mooncloak/kjwt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mooncloak%2Fkjwt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260134157,"owners_count":22963856,"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":["jws","jwt","kjwt","kmp","kmp-library","kotlin","kotlin-multiplatform","kotlin-multiplatform-library"],"created_at":"2025-03-12T02:59:39.587Z","updated_at":"2025-06-16T09:37:25.440Z","avatar_url":"https://github.com/mooncloak.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kjwt\n\n**kjwt** = **K**otlin **J**SON **W**eb **T**okens\n\nKotlin multi-platform JSON Web Token (JWT/JWS) library.\n\n\u003cimg alt=\"GitHub tag (latest by date)\" src=\"https://img.shields.io/github/v/tag/mooncloak/kjwt\"\u003e\n\n## Status\n\n\u003e [!Warning]\n\u003e This project is being actively developed but is in an early experimental state. Use the library\n\u003e cautiously and report back any issues. mooncloak is not responsible for any issues faced when\n\u003e using\n\u003e the library.\n\n## Getting Started 🏁\n\nCheckout the [releases page](https://github.com/mooncloak/kjwt/releases) to get the latest version.\n\u003cbr/\u003e\u003cbr/\u003e\n\u003cimg alt=\"GitHub tag (latest by date)\" src=\"https://img.shields.io/github/v/tag/mooncloak/kjwt\"\u003e\n\n### Repository\n\n```kotlin\nrepositories {\n    maven(\"https://repo.repsy.io/mvn/mooncloak/public\")\n}\n```\n\n### Dependencies\n\n```kotlin\nimplementation(\"com.mooncloak.kodetools.kjwt:kjwt-core:VERSION\")\n```\n\n## Usage\n\nThe following library usage examples, and more, can be found in the [sample module](sample).\n\n### Creating a JWT (Signed JWS)\n\nThe following example illustrates how to create a [CompactedJwt](docs/). The full source code can be\nfound [here](sample/src/commonMain/kotlin/com/mooncloak/kodetools/kjwt/sample/CreateJwt.kt).\n\n```kotlin\nJwt {\n    header {\n        signatureAlgorithm = algorithm\n        keyId = \"MY_KEY_ID\"\n        // ...\n    }\n\n    payload {\n        this.issuedAt = Clock.System.now()\n        this[\"custom_claim\"] = JsonPrimitive(\"CUSTOM_CLAIM_VALUE\")\n        this.putValue(key = \"other_custom_claim\", value = 0)\n        // ...\n    }\n}.sign(\n    resolver = keyResolver\n).compact()\n```\n\n### Parsing a compacted JWS\n\nThe following example illustrates how to parse a [CompactedJwt](docs/). The full source code can be\nfound [here](sample/src/commonMain/kotlin/com/mooncloak/kodetools/kjwt/sample/ParseCompactedJwt.kt).\n\n```kotlin\nval (header, payload, signature) = Jws.parse(\n    compacted = compactedJwt,\n    resolver = keyResolver\n)\n```\n\n### JSON Web Keys (JWKs and JWKSets)\n\nJWKs are used to sign, verify, encrypt, and decrypt JWTs. They are essential for working with JWTs\nand it is up to an application to define where it obtains its JWKs. This library\nprovides [Jwk](docs/kjwt-core/kjwt-core/com.mooncloak.kodetools.kjwt.core.key/-jwk/index.md)\nand [JwkSet](docs/kjwt-core/kjwt-core/com.mooncloak.kodetools.kjwt.core.key/-jwkset/index.md)\ncomponents, as well as\na [KeyResolver](docs/kjwt-core/kjwt-core/com.mooncloak.kodetools.kjwt.core.key/-key-resolver/index.md)\ncomponent which is used to obtain a JWK.\n\n#### Creating a JWK\n\nTo create a JSON Web Key, use the [Jwk.invoke] constructor function:\n\n```kotlin\nJwk(keyType = KeyType.RSA) {\n    keyId = \"abc123\"\n    signatureAlgorithm = SignatureAlgorithm.HS256\n    keyOperations = listOf(KeyOperation.Sign, KeyOperation.Verify)\n    use = KeyUse.Sig\n    // ...\n}\n```\n\nThe full source code can be\nfound [here](sample/src/commonMain/kotlin/com/mooncloak/kodetools/kjwt/sample/CreateJwk.kt)\n\n## Documentation 📃\n\nMore detailed documentation is available in the [docs](docs/) folder. The entry point to the\ndocumentation can be\nfound [here](docs/index.md).\n\n## Security 🛡️\n\nFor security vulnerabilities, concerns, or issues, please refer to\nthe [security policy](SECURITY.md) for more\ninformation on appropriate approaches for disclosure.\n\n## Contributing ✍️\n\nOutside contributions are welcome for this project. Please follow\nthe [code of conduct](CODE_OF_CONDUCT.md)\nand [coding conventions](CODING_CONVENTIONS.md) when contributing. If contributing code, please add\nthorough documents\nand tests. Thank you!\n\n## License ⚖️\n\n```\nCopyright 2024 mooncloak\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmooncloak%2Fkjwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmooncloak%2Fkjwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmooncloak%2Fkjwt/lists"}