Skip to content

About

Marmot Implementation using Quartz and MLS-kmp

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Marmot KMP

GitHub downloads Last Version JitPack snapshots CI License: MIT

Marmot, MLS group messaging over Nostr, for Kotlin Multiplatform: JVM, Android, iOS, macOS and Linux. It implements MIP-00 to MIP-05 (KeyPackages, groups, Welcomes, group messages, encrypted media, push notifications) and the current Marmot profile on top of Quartz and the RFC 9420 engine mls-kmp, and ships a headless client, MarmotManager, that a front end drives to create, join, send to and sync groups.

It is the Marmot layer of Amethyst, its desktop app and the amy CLI, and is tested against MDK, the reference implementation.

dependencies {
    implementation("com.vitorpamplona.marmot:marmot:<version>")
}

Releases are on Nostr + Blossom, through Magpie (Maven Central up to 2.2.1), and so are the libraries it depends on. Add Magpie's settings plugin in settings.gradle.kts: it serves these groups, trusting only the key vitorpamplona.com/.well-known/nostr.json names as releases. Commit the gradle/magpie.lock it writes; Gradle has to run on Java 21 or newer:

plugins {
    id("com.vitorpamplona.magpie") version "0.2.3"
}

magpie {
    group("com.vitorpamplona.marmot")
    group("com.vitorpamplona.quartz")
    group("com.vitorpamplona.crypto")
    group("com.vitorpamplona.schnorr256k1")
    group("com.vitorpamplona.negentropy")
    group("com.vitorpamplona.mls")
    group("com.vitorpamplona.quic")
}

The Marmot event classes (KeyPackageEvent, WelcomeEvent, GroupEvent, the push events) are part of Quartz, under com.vitorpamplona.quartz.marmot, so they parse typed with no setup.

val marmot =
    MarmotManager(
        signer = signer,                       // a Quartz NostrSigner
        store = myEncryptedMlsGroupStateStore, // persist group state; must encrypt at rest
        messageStore = myMessageStore,
        keyPackageStore = myKeyPackageStore,
        publisher = MarmotPublisher { event, relays -> client.publishAndConfirm(event, relays) },
    )
marmot.restoreAll()

The store interfaces live in com.vitorpamplona.marmot.groups and com.vitorpamplona.marmot.mip00KeyPackages; in-memory versions exist for tests.

Agent text stream previews over raw QUIC (transports/quic.md) are a second artifact, for the JVM and Android only, on quic-kmp:

dependencies {
    implementation("com.vitorpamplona.marmot:marmot-quic:<version>")
}

See marmot-quic/README.md. marmot-bench measures this library against MDK, operation for operation.

Developer Setup

./gradlew installGitHook
./gradlew -PquartzDir=../quartz :marmot:jvmTest   # -PquartzDir until the pinned Quartz is released

AGENTS.md has the project rules, for people and coding agents alike.

About

Marmot Implementation using Quartz and MLS-kmp

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages