Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/petersamokhin/kbranca
Branca Kotlin implementation
https://github.com/petersamokhin/kbranca
branca encryption kotlin
Last synced: 5 days ago
JSON representation
Branca Kotlin implementation
- Host: GitHub
- URL: https://github.com/petersamokhin/kbranca
- Owner: petersamokhin
- License: apache-2.0
- Created: 2019-06-01T14:31:40.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-06-01T14:45:53.000Z (over 5 years ago)
- Last Synced: 2024-10-30T01:04:04.697Z (about 2 months ago)
- Topics: branca, encryption, kotlin
- Language: Kotlin
- Homepage: https://branca.io/
- Size: 58.6 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Branca
Branca is a secure alternative to JWT, This implementation is written in Kotlin and implements the [branca token specification](https://github.com/tuupola/branca-spec).Original Java implementation: [jbranca](https://github.com/bjoernw/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
```kotlin
val key = "SecretKeyYouShouldNeverCommit!!!" // exactly 32 charsval 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
- [Bouncycastle](https://www.bouncycastle.org/java.html)
- [seruco/base62](https://github.com/seruco/base62)