{"id":19817269,"url":"https://github.com/appstractive/jwt-kt","last_synced_at":"2025-05-01T11:30:38.480Z","repository":{"id":253241280,"uuid":"841588830","full_name":"Appstractive/jwt-kt","owner":"Appstractive","description":"A kotlin multiplatform library for creating, parsing, signing and verifying JWTs.","archived":false,"fork":false,"pushed_at":"2024-11-05T17:23:27.000Z","size":194,"stargazers_count":7,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-05T18:31:08.631Z","etag":null,"topics":["android","ios","jwt","kotlin","kotlin-multiplatform","macos","multiplatform"],"latest_commit_sha":null,"homepage":"","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/Appstractive.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":"2024-08-12T17:52:59.000Z","updated_at":"2024-11-05T17:23:29.000Z","dependencies_parsed_at":"2024-08-26T18:32:26.968Z","dependency_job_id":"c976bf7d-31ab-4b10-9d56-922b31b91cf1","html_url":"https://github.com/Appstractive/jwt-kt","commit_stats":null,"previous_names":["appstractive/jwt-kt"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Appstractive%2Fjwt-kt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Appstractive%2Fjwt-kt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Appstractive%2Fjwt-kt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Appstractive%2Fjwt-kt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Appstractive","download_url":"https://codeload.github.com/Appstractive/jwt-kt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224253401,"owners_count":17280934,"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":["android","ios","jwt","kotlin","kotlin-multiplatform","macos","multiplatform"],"created_at":"2024-11-12T10:12:13.021Z","updated_at":"2025-05-01T11:30:38.474Z","avatar_url":"https://github.com/Appstractive.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# JWT Kotlin Multiplatform\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.appstractive/jwt-kt?label=Maven%20Central)](https://central.sonatype.com/artifact/com.appstractive/jwt-kt)\n\n![badge][badge-android]\n![badge][badge-apple]\n![badge][badge-jvm]\n![badge][badge-js]\n![badge][badge-win]\n![badge][badge-linux]\n\nA kotlin multiplatform library for creating, parsing, signing and verifying JWTs.\n\n## Supported Algorithms\n\n- HS256\n- HS384\n- HS512\n- RS256\n- RS384\n- RS512\n- PS256\n- PS384\n- PS512\n- ES256\n- ES384\n- ES512\n\n## Usage\n\n### Installation\n\nGradle:\n\n```\ncommonMain.dependencies { \n    implementation(\"com.appstractive:jwt-kt:1.1.0\")\n}\n```\n\n### Create JWT\n\n```kotlin\nval jwt: UnsignedJWT = jwt {\n    claims {\n        issuer = \"example.com\"\n        subject = \"me\"\n        audience = \"api.example.com\"\n        expires(Clock.System.now() + 24.hours)\n        notBefore()\n        issuedAt()\n        id = \"123456\"\n\n        claim(\"double\", 1.1)\n        claim(\"long\", 1L)\n        claim(\"bool\", true)\n        claim(\"string\", \"test\")\n        claim(\"null\", null)\n        objectClaim(\"object\") { put(\"key\", JsonPrimitive(\"value\")) }\n        arrayClaim(\"list\") {\n            add(JsonPrimitive(0))\n            add(JsonPrimitive(1))\n            add(JsonPrimitive(2))\n        }\n    }\n}\n```\n\n### Parse JWT\n\n```kotlin\nval jwt = JWT.from(\"eyJraWQiOiJzLWRmZmZkMDJlLTlhNDItNDQzMC1hNT...\")\n\nval userId = jwt.subject\n```\n\n### Sign JWT\n\nFor specific algorithms see:\n\n- [HMAC](jwt-hmac/README.md)\n- [RSA](jwt-rsa/README.md)\n- [ECDSA](jwt-ecdsa/README.md)\n\n### Verify JWT\n\n```kotlin\nval jwt = JWT.from(\"eyJraWQiOiJzLWRmZmZkMDJlLTlhNDItNDQzMC1hNT...\")\n\nval isValid = jwt.verify {\n    // verify issuer\n    issuer(\"example.com\")\n    // verify audience\n    audience(\"api.example.com\")\n    // verify expiration\n    expiresAt()\n    // verify not before time\n    notBefore()\n}\n```\n\nFor signature verification see:\n\n- [HMAC](jwt-hmac/README.md)\n- [RSA](jwt-rsa/README.md)\n- [ECDSA](jwt-ecdsa/README.md)\n\n## License\n\n```\nCopyright 2024 Andreas Schulz.\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\n[badge-android]: http://img.shields.io/badge/platform-android-6EDB8D.svg?style=flat\n\n[badge-apple]: http://img.shields.io/badge/platform-apple-111111.svg?style=flat\n\n[badge-jvm]: http://img.shields.io/badge/platform-jvm-CDCDCD.svg?style=flat\n\n[badge-js]: http://img.shields.io/badge/platform-js-f7df1e.svg?style=flat\n\n[badge-win]: http://img.shields.io/badge/platform-win-357EC7.svg?style=flat\n\n[badge-linux]: http://img.shields.io/badge/platform-linux-CDCDCD.svg?style=flat","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappstractive%2Fjwt-kt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappstractive%2Fjwt-kt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappstractive%2Fjwt-kt/lists"}