SoftchatIdentity

A local Nostr identity backed by Rust-owned secret material.

Import is synchronous and copies the caller's bytes into Rust. The caller should clear its own ByteArray after import returns. Keep the identity in an ordinary val for the authenticated session; it is not a closeable resource and does not require use. The generated native owner is reclaimed automatically when this object becomes unreachable.

erase is an optional security action for logout or early key removal. It waits for native work already in flight, is idempotent, and makes later calls fail with SoftchatException.IdentityErased. Operations and erasure are safe to invoke from different JVM or Android threads.

Phase 1 operations are synchronous CPU work. No coroutine dependency is introduced merely to wrap them; applications choose their own dispatcher when moving work off the Android main thread.

Types

Link copied to clipboard
object Companion

Import constructors for local identities.

Properties

Link copied to clipboard

This identity's canonical public key.

Functions

Link copied to clipboard

Create directly signed and self-encrypted kind-30079 data.

Link copied to clipboard

Create one directly signed generic NIP-78 value.

Link copied to clipboard

Create a complete canonical message through the retained identity.

Link copied to clipboard
fun SoftchatIdentity.createDeletion(participants: List<NostrPublicKey>, eventIds: List<NostrEventId>, reason: String = "", createdAt: Long): Deletion

Create a canonical private deletion request.

Link copied to clipboard
fun SoftchatIdentity.createEdit(participants: List<NostrPublicKey>, originalEventId: NostrEventId, content: String, emojiTags: List<List<String>> = emptyList(), createdAt: Long): Edit

Create a canonical text-and-emoji edit.

Link copied to clipboard

Create one canonical private author-copy contact list.

Link copied to clipboard
fun createNip17TextMessage(recipient: NostrPublicKey, createdAt: Long, content: String): Nip17TextMessage

Create one minimal one-to-one NIP-17 text-message rumor.

Link copied to clipboard

Create a NIP-42 authentication event bound to one relay challenge.

Link copied to clipboard

Create a NIP-98 authorization plan bound to one exact HTTP request.

Link copied to clipboard
fun SoftchatIdentity.createReaction(participants: List<NostrPublicKey>, parentId: NostrEventId, parentAuthor: NostrPublicKey, parentKind: NostrEventKind, reaction: String, customEmojiUrl: String? = null, createdAt: Long): Reaction

Create a canonical private reaction.

Link copied to clipboard

Create one unsigned rumor authored by this identity.

Link copied to clipboard

Create a canonical group-subject update.

Link copied to clipboard
fun SoftchatIdentity.createTyping(participants: List<NostrPublicKey>, createdAt: Long): Typing

Create an ephemeral typing notification.

Link copied to clipboard

Create canonical private kind-0 user metadata.

Link copied to clipboard

Authenticate and decrypt one received message as UTF-8.

Link copied to clipboard

Authenticate and decrypt one self-authored kind-30079 event.

Link copied to clipboard
fun encrypt(recipient: NostrPublicKey, plaintext: String): EncryptedMessage

Encrypt one non-empty UTF-8 message for recipient.

Link copied to clipboard
fun erase()

Irreversibly erase native secret state before normal reclamation.

Link copied to clipboard

Create one fresh NIP-59 envelope for exactly one recipient.

Link copied to clipboard

Sign one explicit NIP-01 event draft.

Link copied to clipboard
open override fun toString(): String

Return a description that never includes secret key material.

Link copied to clipboard

Authenticate every NIP-59 layer and return the enclosed rumor.