canton_admin/lib.rs
1//! Canton administrative client: party management, user self-inspect, and
2//! topology read.
3//!
4//! Canton exposes these across **two** gRPC endpoints, so this crate provides
5//! two clients:
6//!
7//! - [`AdminClient`] — party management ([`PartyManagementService`]) and user
8//! self-inspect ([`UserManagementService`]), served on the **Ledger API**
9//! port (e.g. `:3901`), the same channel/auth as the ledger client. Party
10//! admin RPCs require the `ParticipantAdmin` right; self-inspect
11//! ([`AdminClient::current_user`] / [`AdminClient::current_user_rights`])
12//! works with any authenticated token.
13//! - [`TopologyClient`] — topology **read** (party→participant mappings,
14//! namespace delegations, vetted packages) via `TopologyManagerReadService`,
15//! served on the Canton **admin API** port (e.g. `:3902`).
16//!
17//! Both build on the shared [`canton_core::Config`] (endpoint, auth, TLS,
18//! retry).
19//!
20//! # Scope
21//!
22//! Party management here is **allocation and discovery**: allocate a party,
23//! list the parties a participant knows, look specific ones up. Updating a
24//! party's details (`UpdatePartyDetails`), the identity-provider fields, and
25//! the participant-permission options of `AllocateParty` are deliberately not
26//! wrapped — Milestone 1 covers the client surface an application needs to act
27//! on the ledger, and party *administration* beyond that belongs to the
28//! operator tooling rather than to an SDK's first release. Anything not
29//! wrapped is still reachable through [`canton_proto`] on the same channel.
30//!
31//! [`PartyManagementService`]: https://docs.daml.com
32//! [`UserManagementService`]: https://docs.daml.com
33//!
34//! ```no_run
35//! # async fn run() -> canton_admin::Result<()> {
36//! use canton_admin::{AdminClient, Config};
37//!
38//! let admin = AdminClient::connect_lazy(Config::new("http://localhost:3901"))?;
39//! let me = admin.current_user().await?;
40//! println!("acting as: {:?}", admin.acting_parties().await?);
41//! # let _ = me;
42//! # Ok(())
43//! # }
44//! ```
45#![cfg_attr(docsrs, feature(doc_cfg))]
46
47mod client;
48mod topology;
49
50pub use canton_core::{Config, Error, Result, RetryConfig, TlsConfig};
51pub use canton_proto::com::daml::ledger::api::v2::PackageStatus;
52pub use client::AdminClient;
53pub use topology::{Entry, Store, TopologyClient};
54
55/// Generated Ledger API admin protobuf types (party & user management).
56pub use canton_proto::com::daml::ledger::api::v2::admin as proto;
57/// Generated Canton protocol types (topology mapping items).
58pub use canton_proto::com::digitalasset::canton::protocol::v30 as protocol_proto;
59/// Generated Canton admin-API topology types (query/result envelopes).
60pub use canton_proto::com::digitalasset::canton::topology::admin::v30 as topology_proto;