Skip to main content

Getting started

The quickest useful integration is: import an account identity once, clear the caller-owned secret buffer, validate a peer key, encrypt, persist or transmit the immutable result, then decrypt on the receiving identity.

Pre-release packages

The coordinates below are canonical, but public registry publication is not a completed release gate. Today, build and test the matching artifact from this repository before adding it to an application.

Add the package

[dependencies]
softchat = { path = "../softchat-sdk/crates/softchat" }

The crate currently depends on reviewed, unpublished Softrelay Git revisions, so cargo package is intentionally not presented as a crates.io install.

Complete one encrypted round trip

The sample secret is deliberately omitted. Load 32 secret bytes from your platform authority, never from source code.

use softchat::LocalIdentity;

let alice = LocalIdentity::from_secret_bytes(&alice_secret)?;
alice_secret.fill(0);
let bob = LocalIdentity::from_secret_bytes(&bob_secret)?;
bob_secret.fill(0);
let bob_public = bob.public_key();

let encrypted = alice.encrypt_utf8(&bob_public, "hello")?;
let plaintext = bob.decrypt_utf8(&encrypted)?;
assert_eq!(plaintext, "hello");
# Ok::<(), softchat::SoftchatError>(())

Next

Learn the identity lifecycle, then choose the family you need: Nostr and cryptography, private messaging, chat and account events, relay and persistence, Noise and synchronization, or media and HTTP plans.