Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 1 KB

README.md

File metadata and controls

37 lines (30 loc) · 1 KB

Branca

Branca is a secure alternative to JWT, This implementation is written in Kotlin and implements the branca token specification.

Original Java implementation: jbranca

Install

  • Add jitpack.io to your repositories list
repositories {
    // ...
    maven { url 'https://jitpack.io' }
}
  • Add library to dependencies list
dependencies {
    implementation "com.github.petersamokhin:kbranca:$kbrancaVersion"
}

Latest version: https://github.com/petersamokhin/kbranca/releases/latest

Example

val key = "SecretKeyYouShouldNeverCommit!!!" // exactly 32 chars

val factory = BrancaTokenFactory(key)
val plaintext = """{"key": "example_value"}"""
val encoded = factory.encode(plaintext.toByteArray())
val decoded = factory.decode(encoded)
assertEquals(plaintext, String(decoded))

3rd party