
Magic Wormhole protocol implementation enabling direct, end-to-end encrypted file and text transfer via short codes; supports transit relay, direct TCP, and streamed zipped-folder unpacking.
A Kotlin Multiplatform implementation of the Magic Wormhole protocol.
Move files and text between two devices over a direct, end-to-end encrypted connection — paired with a short code, no accounts required.
wormhole CLI.What is supported:
What is missing:
Read the full documentation at docs/usage.md, or the API reference.
val wormhole = Wormhole()
// Send a file or a whole folder or text
wormhole.sendFile(Path("photo.jpg")).collect { println(it) }
wormhole.sendDirectory(Path("holiday")).collect { println(it) }
wormhole.sendText("Hello, World!").collect { println(it) }
// Receive
wormhole.receive("7-guitarist-revenge").collect { event ->
when (event) {
is ReceiveEvent.TextReceived -> println(event.text)
is ReceiveEvent.FileOffered -> {
// Saves as `Downloads/photo.jpg`, or unpacks a folder into `Downloads/holiday`
event.acceptInto(Path("Downloads")) // Or call `event.reject()`
}
is ReceiveEvent.Progress -> println("${event.receivedBytes} / ${event.totalBytes}")
ReceiveEvent.Unpacking -> println("Unpacking the folder")
is ReceiveEvent.FileReceived -> println("Saved to ${event.saved?.location}")
}
}Using Gradle, in a Kotlin Multiplatform module, add it to commonMain — the library resolves to
the right platform artifact (JVM, iOS) automatically:
kotlin {
sourceSets {
commonMain.dependencies {
implementation("io.github.lux-uno:magic-wormhole:1.0.1")
}
}
}For a JVM-only project:
dependencies {
implementation("io.github.lux-uno:magic-wormhole:1.0.1")
}For local development, include this repository as a composite build:
// settings.gradle.kts of your app
includeBuild("../magic-wormhole-kotlin")./gradlew jvmTestInterop tests against the real wormhole CLI and the public relay are skipped by default. Run them
with WORMHOLE_INTEROP=1 ./gradlew jvmTest (needs wormhole on PATH and internet access).
MIT. See LICENSE and THIRD_PARTY_NOTICES.md.
A Kotlin Multiplatform implementation of the Magic Wormhole protocol.
Move files and text between two devices over a direct, end-to-end encrypted connection — paired with a short code, no accounts required.
wormhole CLI.What is supported:
What is missing:
Read the full documentation at docs/usage.md, or the API reference.
val wormhole = Wormhole()
// Send a file or a whole folder or text
wormhole.sendFile(Path("photo.jpg")).collect { println(it) }
wormhole.sendDirectory(Path("holiday")).collect { println(it) }
wormhole.sendText("Hello, World!").collect { println(it) }
// Receive
wormhole.receive("7-guitarist-revenge").collect { event ->
when (event) {
is ReceiveEvent.TextReceived -> println(event.text)
is ReceiveEvent.FileOffered -> {
// Saves as `Downloads/photo.jpg`, or unpacks a folder into `Downloads/holiday`
event.acceptInto(Path("Downloads")) // Or call `event.reject()`
}
is ReceiveEvent.Progress -> println("${event.receivedBytes} / ${event.totalBytes}")
ReceiveEvent.Unpacking -> println("Unpacking the folder")
is ReceiveEvent.FileReceived -> println("Saved to ${event.saved?.location}")
}
}Using Gradle, in a Kotlin Multiplatform module, add it to commonMain — the library resolves to
the right platform artifact (JVM, iOS) automatically:
kotlin {
sourceSets {
commonMain.dependencies {
implementation("io.github.lux-uno:magic-wormhole:1.0.1")
}
}
}For a JVM-only project:
dependencies {
implementation("io.github.lux-uno:magic-wormhole:1.0.1")
}For local development, include this repository as a composite build:
// settings.gradle.kts of your app
includeBuild("../magic-wormhole-kotlin")./gradlew jvmTestInterop tests against the real wormhole CLI and the public relay are skipped by default. Run them
with WORMHOLE_INTEROP=1 ./gradlew jvmTest (needs wormhole on PATH and internet access).
MIT. See LICENSE and THIRD_PARTY_NOTICES.md.