Appearance
Identity (Rust)
Your app works with cryptographic identities — real people and devices, not usernames and passwords. Reach the identity API through app.identity().
Listing identities
identity().list() () -> Vec<Identity>
List the identities available to your app — own identities and contacts (remote identities you've been introduced to). Own identities have privkey: true; the key itself stays in wish-core.
rust
for id in app.identity().list()? {
let kind = if id.privkey { "(own)" } else { "(contact)" };
println!("{} {}", id.name.as_deref().unwrap_or("?"), kind);
}Identity:
| Field | Type | Description |
|---|---|---|
uid | Vec<u8> | Identity UID (32 bytes) — stable, never changes |
name | Option<String> | Display name |
privkey | bool | true for own identities, false for contacts |
Getting identity details
identity().get(uid) (uid: &[u8]) -> IdentityFull
Get full details for an identity — signers, contacts, and hosts.
rust
let identity = app.identity().get(&uid)?;
for host in &identity.hosts {
println!(" {}", host.name.as_deref().unwrap_or("unnamed"));
}IdentityFull adds:
| Field | Type | Description |
|---|---|---|
signers | Vec<Signer> | Cryptographic keys that can act as this identity — { signer_id, name? } |
contacts | Vec<Vec<u8>> | Contact UIDs (own identities only) |
hosts | Vec<IdentityHost> | Known devices — { host_id, name?, role?, transports, .. } |
Signing and verification
identity.sign / identity.verify are not namespaced in wish-sdk-rs yet — call the endpoints directly:
rust
let signed: ciborium::value::Value =
app.rpc().request("identity.sign", sign_args)?;
let result: ciborium::value::Value =
app.rpc().request("identity.verify", vec![signed_document])?;The claim passed to identity.sign is an arbitrary byte string that becomes part of the signed statement.
Reacting to changes
The identity signal fires whenever identities change — new identity created, contact added, name updated. Subscribe via app.signals() and re-fetch app.identity().list() to stay current.