Commit 02324ca6 authored by Ricki Hirner's avatar Ricki Hirner

Use Kotlin-friendly okio 2.x instead of 1.x

parent 4f7fc76a
Pipeline #46267580 passed with stages
in 3 minutes and 51 seconds
[![build status](https://gitlab.com/bitfireAT/dav4jvm/badges/master/build.svg)](https://gitlab.com/bitfireAT/dav4jvm/commits/master)
# dav4jvm
dav4jvm is a WebDAV/CalDAV/CardDAV library for JVM (Java/Kotlin). It was
developed for [DAVx⁵](https://www.davx5.com) initially.
Original repository: https://gitlab.com/bitfireAT/dav4jvm/
Repository: https://gitlab.com/bitfireAT/dav4jvm/
Generated KDoc: https://bitfireAT.gitlab.io/dav4jvm/dokka/dav4jvm/
......@@ -16,13 +13,13 @@ Generated KDoc: https://bitfireAT.gitlab.io/dav4jvm/dokka/dav4jvm/
dav4jvm is licensed under [Mozilla Public License, v. 2.0](LICENSE).
For questions, suggestions etc. please use this forum:
For questions, suggestions etc. use this forum (tag the post with "dav4jvm"):
https://forums.bitfire.at/category/18/libraries
If you want to contribute, please work in your own repository and then
notify us on your changes so that we can backport them.
send a merge requests.
Email: [play@bitfire.at](mailto:play@bitfire.at)
Email: [play@bitfire.at](mailto:play@bitfire.at) (please use the forum instead)
## Contributors
......
......@@ -18,6 +18,7 @@ repositories {
dependencies {
implementation(kotlin("stdlib"))
api("com.squareup.okio:okio:2.+")
api("com.squareup.okhttp3:okhttp:${Libs.okhttpVersion}")
implementation("org.ogce:xpp3:${Libs.xpp3Version}") // XmlPullParser
......
......@@ -14,6 +14,7 @@ import java.io.IOException
import java.nio.ByteBuffer
import java.util.*
import java.util.concurrent.atomic.AtomicInteger
import okio.ByteString.Companion.toByteString
/**
* Handler to manage authentication against a given service (may be limited to one domain).
......@@ -41,12 +42,12 @@ class BasicDigestAuthHandler(
var nonceCount = AtomicInteger(1)
fun quotedString(s: String) = "\"" + s.replace("\"", "\\\"") + "\""
fun h(data: String) = ByteString.of(ByteBuffer.wrap(data.toByteArray())).md5().hex()!!
fun h(data: String) = data.toByteArray().toByteString().md5().hex()
fun h(body: RequestBody): String {
val buffer = Buffer()
body.writeTo(buffer)
return ByteString.of(ByteBuffer.wrap(buffer.readByteArray())).md5().hex()
return buffer.readByteArray().toByteString().md5().hex()
}
fun kd(secret: String, data: String) = h("$secret:$data")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment