kjwt

Kotlin multiplatform JWT library

https://github.com/mooncloak/kjwt

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.4%) to scientific vocabulary

Keywords

jws jwt kjwt kmp kmp-library kotlin kotlin-multiplatform kotlin-multiplatform-library
Last synced: 6 months ago · JSON representation ·

Repository

Kotlin multiplatform JWT library

Basic Info
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
jws jwt kjwt kmp kmp-library kotlin kotlin-multiplatform kotlin-multiplatform-library
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme Code of conduct Citation Codeowners Security

README.md

kjwt

kjwt = Kotlin JSON Web Tokens

Kotlin multi-platform JSON Web Token (JWT/JWS) library.

GitHub tag (latest by date)

Status

[!Warning] This project is being actively developed but is in an early experimental state. Use the library cautiously and report back any issues. mooncloak is not responsible for any issues faced when using the library.

Getting Started 🏁

Checkout the releases page to get the latest version.

GitHub tag (latest by date)

Repository

kotlin repositories { maven("https://repo.repsy.io/mvn/mooncloak/public") }

Dependencies

kotlin implementation("com.mooncloak.kodetools.kjwt:kjwt-core:VERSION")

Usage

The following library usage examples, and more, can be found in the sample module.

Creating a JWT (Signed JWS)

The following example illustrates how to create a CompactedJwt. The full source code can be found here.

```kotlin Jwt { header { signatureAlgorithm = algorithm keyId = "MYKEYID" // ... }

payload {
    this.issuedAt = Clock.System.now()
    this["custom_claim"] = JsonPrimitive("CUSTOM_CLAIM_VALUE")
    this.putValue(key = "other_custom_claim", value = 0)
    // ...
}

}.sign( resolver = keyResolver ).compact() ```

Parsing a compacted JWS

The following example illustrates how to parse a CompactedJwt. The full source code can be found here.

kotlin val (header, payload, signature) = Jws.parse( compacted = compactedJwt, resolver = keyResolver )

JSON Web Keys (JWKs and JWKSets)

JWKs are used to sign, verify, encrypt, and decrypt JWTs. They are essential for working with JWTs and it is up to an application to define where it obtains its JWKs. This library provides Jwk and JwkSet components, as well as a KeyResolver component which is used to obtain a JWK.

Creating a JWK

To create a JSON Web Key, use the [Jwk.invoke] constructor function:

kotlin Jwk(keyType = KeyType.RSA) { keyId = "abc123" signatureAlgorithm = SignatureAlgorithm.HS256 keyOperations = listOf(KeyOperation.Sign, KeyOperation.Verify) use = KeyUse.Sig // ... }

The full source code can be found here

Documentation 📃

More detailed documentation is available in the docs folder. The entry point to the documentation can be found here.

Security 🛡️

For security vulnerabilities, concerns, or issues, please refer to the security policy for more information on appropriate approaches for disclosure.

Contributing ✍️

Outside contributions are welcome for this project. Please follow the code of conduct and coding conventions when contributing. If contributing code, please add thorough documents and tests. Thank you!

License ⚖️

``` Copyright 2024 mooncloak

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ```

Owner

  • Name: mooncloak
  • Login: mooncloak
  • Kind: organization
  • Email: support@mooncloak.com

Privacy focused apps

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
    - alias: "kodetools@mooncloak.com"
      website: "https://kodetools.mooncloak.codes"
contact:
    - alias: "kodetools@mooncloak.com"
      website: "https://kodetools.mooncloak.codes"
title: "kjwt"
type: "software"
abstract: "Kotlin multi-platform JSON Web Tokens (JWT/JWS)."
license: "Apache-2.0"
keywords:
    - "kotlin"
    - "multiplatform"
    - "JWT"
    - "JSON Web Token"
    - "JWS"
repository-code: "https://github.com/mooncloak/kjwt"
url: "https://github.com/mooncloak/kjwt"

GitHub Events

Total
  • Public event: 1
Last Year
  • Public event: 1

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 65
  • Total Committers: 1
  • Avg Commits per committer: 65.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 65
  • Committers: 1
  • Avg Commits per committer: 65.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Chris Keenan 1****N 65

Issues and Pull Requests

Last synced: 8 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/gradle_wrapper_validation.yml actions
  • actions/checkout v3 composite
  • gradle/wrapper-validation-action v1 composite
.github/workflows/refresh_versions.yml actions
  • EndBug/add-and-commit v9 composite
  • actions/checkout v3 composite
  • actions/setup-java v3 composite
  • gradle/gradle-build-action v2 composite
  • peterjgrainger/action-create-branch v2.2.0 composite
  • repo-sync/pull-request v2 composite
build-logic/build.gradle.kts maven
  • com.mooncloak.kodetools.kenv:kenv-core _ implementation
build.gradle.kts maven
kjwt-core/build.gradle.kts maven
  • com.benasher44:uuid _ implementation
  • com.ionspin.kotlin:bignum _ implementation
  • org.kotlincrypto.hash:md _ implementation
  • org.kotlincrypto.hash:sha1 _ implementation
  • org.kotlincrypto.hash:sha2 _ implementation
  • org.kotlincrypto.macs:hmac-sha2 _ implementation
  • org.kotlincrypto:secure-random _ implementation
sample/build.gradle.kts maven
kotlin-js-store/yarn.lock npm
  • 348 dependencies