[migrating]: https://github.com/kixel-ai/rind/blob/main/MIGRATING.md

# Run str0m on rind

This page describes rind-str0m as `main` has it, ahead of [rind-str0m 0.25.2](https://crates.io/crates/rind-str0m/0.25.2) on crates.io. Until its next release, take it from git at the commit this page describes. Beside the lines below, add this line under the `[patch.crates-io]` table of your workspace's root `Cargo.toml` (add the table if it has none), then run `cargo update -p rind-str0m`:

```toml
rind-str0m = { git = "https://github.com/kixel-ai/rind", rev = "80fc7ba544b53a6ca9ab21ba9a946c275eb19a06" }
```

That moves every crate in your tree that depends on rind-str0m, and `cargo tree -i rind-str0m` then shows it from `git+https://github.com/kixel-ai/rind`.

This crate provides a `CryptoProvider` for [str0m](https://github.com/algesten/str0m), backed by [rind](https://github.com/kixel-ai/rind/), a fork of [Graviola](https://github.com/ctz/graviola/).

Build str0m with `default-features = false`, since its default features compile aws-lc-rs:

```toml
[dependencies]
str0m = { version = "0.25", default-features = false }
rind-str0m = "0.25"
```

Then hand the provider to each connection, where `str0m_aws_lc_rs::default_provider()` went:

```rust
use std::sync::Arc;
use std::time::Instant;

let provider = rind_str0m::default_provider();
let rtc = str0m::Rtc::builder()
    .set_crypto_provider(Arc::new(provider))
    .build(Instant::now());
```

Or install it for the process with `str0m::crypto::CryptoProvider::install_process_default`.

It protects SRTP with AES-128-CM-HMAC-SHA1-80, AEAD-AES-128-GCM, and AEAD-AES-256-GCM, signs STUN with HMAC-SHA1, and hashes certificate fingerprints with SHA-1 and SHA-256.
DTLS 1.2 and 1.3 run through dimpl on [rind-dimpl](https://github.com/kixel-ai/rind/tree/main/rind-dimpl), with a self-signed ECDSA P-256 certificate generated by [rind-rcgen](https://github.com/kixel-ai/rind/tree/main/rind-rcgen).
`dimpl_crypto_provider()` returns that dimpl provider, for building your own `dimpl::Config`, as `str0m_aws_lc_rs::dimpl_crypto_provider()` does.

## What rind cannot back

Nothing: it offers each item str0m-aws-lc-rs does.

## Behaves differently

Where str0m-aws-lc-rs lets dimpl panic on an empty DTLS certificate or a private key it cannot load, this returns an error.

A generated certificate's private key is returned in dimpl's `DtlsCertificate`, whose plain `Vec<u8>` str0m owns and nothing wipes when it is dropped.

## WebAssembly

It builds for `wasm32-wasip2` and `wasm32-unknown-unknown`, the browser, where
rind needs its JavaScript random source, `getrandom = { version = "0.4",
features = ["wasm_js"] }`. [PLATFORMS.md](https://github.com/kixel-ai/rind/blob/main/PLATFORMS.md) lists what each adapter's
upstream needs there too, and why rind's constant-time checks do not cover wasm.
In the browser it only builds: str0m takes its time as a `std::time::Instant`,
which `wasm32-unknown-unknown`'s std cannot produce (`Instant::now()` panics),
so the example above and str0m itself cannot run there with any provider.

## Switch with an agent

Paste this into your coding agent, in your repository:

```text
Move this repository from ring or aws-lc-rs to rind, following
https://raw.githubusercontent.com/kixel-ai/rind/main/MIGRATE.md
```

It migrates on a local branch, reports the build time, binary size,
benchmarks, and tests before and after, and asks before opening a PR or
filing an issue. To migrate by hand, [MIGRATING.md][migrating] maps each
ring and aws-lc-rs item to rind's.

## Other libraries

- [ring](/from/ring)
- [aws-lc-rs](/from/aws-lc-rs)
- [rustls](/from/rustls)
- [rcgen](/from/rcgen)
- [jsonwebtoken](/from/jsonwebtoken)
- [dimpl](/from/dimpl)
- [object_store](/from/object_store)
- [openmls](/from/openmls)
- [Crates with their own crypto backend](/from)
