Skip to content

Commit

Permalink
Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
saschpe committed Jul 1, 2022
1 parent 26f1e2b commit b47541c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
![Maven Central](https://img.shields.io/maven-central/v/de.peilicke.sascha/kase64)
[![Build Status](https://github.com/saschpe/kase64/workflows/Main%20CI/badge.svg)](https://github.com/saschpe/kase64/actions)
![badge-android](http://img.shields.io/badge/platform-android-brightgreen.svg?style=flat)
![badge-ios](http://img.shields.io/badge/platform-ios-brightgreen.svg?style=flat)
![badge-native](http://img.shields.io/badge/platform-native-lightgrey.svg?style=flat)
![badge-js](http://img.shields.io/badge/platform-js-yellow.svg?style=flat)
![badge-jvm](http://img.shields.io/badge/platform-jvm-orange.svg?style=flat)
![Kotlin Version](https://img.shields.io/badge/kotlin-v1.3.60-F88909?style=flat&logo=kotlin)

Base64 encoder/decoder for Kotlin/Multiplatform. Supports Android, iOS, JavaScript and plain JVM environments.

**Supported encodings**

- [Standard (Rfc 4648 section 4)](https://www.ietf.org/rfc/rfc4648.html#section-4)
- [URL-safe (Rfc 4648 section 5)](https://www.ietf.org/rfc/rfc4648.html#section-5)

## Download

Artifacts are published to [Maven Central][maven-central]:
Expand All @@ -25,6 +31,26 @@ dependencies {
}
```

## Usage

Standard Base64 decoding and encoding:

```kotlin
import saschpe.kase64.*

val helloWorld = "SGVsbG8sIHdvcmxkIQ==".base64Decoded // "Hello, world!"
println("Hello, world!".base64Encoded) // Prints "SGVsbG8sIHdvcmxkIQ=="
```

URL-safe Base64 decoding and encoding:

```kotlin
import saschpe.kase64.*

val helloWorld = "SGVsbG8sIHdvcmxkIQ".base64UrlDecoded // "Hello, world!"
println("Hello, world!".base64UrlEncoded) // Prints "SGVsbG8sIHdvcmxkIQ"
```

## License

Copyright 2022 Sascha Peilicke
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
kotlin("jvm") version "1.6.21"
kotlin("jvm") version "1.6.21" apply false
id("com.android.library") version "7.0.4" apply false
id("com.diffplug.spotless") version "6.5.1"
id("com.diffplug.spotless") version "6.7.2"
id("com.github.ben-manes.versions") version "0.42.0"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class Base64UrlTest {
assertEquals("Word", "V29yZA==".base64UrlDecoded)
assertEquals("Hello", "SGVsbG8=".base64UrlDecoded)
assertEquals("World!", "V29ybGQh".base64UrlDecoded)
assertEquals("Hello, world!", "SGVsbG8sIHdvcmxkIQ".base64UrlDecoded)
assertEquals("Hello, world!", "SGVsbG8sIHdvcmxkIQ==".base64UrlDecoded)
assertEquals(
Encoding.Standard.alphabet,
Expand Down

0 comments on commit b47541c

Please sign in to comment.