1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
//! AXIAM SDK for Rust
//!
//! This crate provides the official Rust client SDK for AXIAM
//! (Access eXtended Identity and Authorization Management), a multi-tenant
//! IAM solution. It conforms to the cross-language SDK behavioral contract
//! in `../CONTRACT.md` §1–§11, and offers three interchangeable transports
//! behind Cargo features:
//!
//! - `rest` — [`client::AxiamClient`], built on `reqwest`; cookie-based
//! sessions with CSRF double-submit protection (§3/§4).
//! - `grpc` — [`grpc::AuthzGrpcClient`], for low-latency authorization
//! checks from a service mesh.
//! - `amqp` — [`amqp`], a closure-handler consumer for HMAC-signed,
//! replay-protected authorization/audit messages (§8), plus
//! [`amqp::reactor`] — the §22 reactor runtime, where the same HMAC runs in
//! **both** directions: the server signs the hook event, and the reactor
//! signs the allow/deny/mutate reply.
//!
//! An additional `actix` feature provides [`middleware::AxiamUser`], an
//! Actix-Web extractor that verifies sessions locally against a cached JWKS
//! (§10). The `macros` feature adds the §11 *declarative authorization
//! helpers* — the [`macro@require_access`], [`macro@require_auth`] and
//! [`macro@require_role`] attribute macros — layered on top of that extractor.
//! All access/refresh tokens are wrapped in [`Sensitive`] so they are never
//! accidentally logged or displayed.
//!
//! # Example: login then check access (REST transport)
//!
//! ```no_run
//! use axiam_sdk::client::AxiamClient;
//!
//! # async fn run() -> Result<(), axiam_sdk::AxiamError> {
//! let client = AxiamClient::builder()
//! .base_url("https://axiam.example.com")?
//! .tenant_slug("acme")
//! .org_slug("acme")
//! .build()?;
//!
//! client.login("user@example.com", "hunter2").await?;
//!
//! let allowed = client
//! .can("read", "resource-uuid".parse().unwrap(), None)
//! .await?;
//! # Ok(())
//! # }
//! ```
// X-2: shared TLS-scheme guard for transport URLs (REST/gRPC/AMQP). Always
// compiled (transport modules below are feature-gated but all reuse this).
// CONTRACT.md §19 telemetry hooks. Deliberately ungated: the event types are
// pure data with no transport dependency, so a caller can name them (and write
// a sink) under any feature set.
// CONTRACT.md §16 bounded read-only retry policy. Internal — the policy is
// machinery, and §16.6 makes only the disable switch public surface. Gated on
// `rest` because it waits on the tokio timer.
// CONTRACT.md §17 client-side decision memo. Internal — §17.2 makes only the
// TTL public surface. Off by default; see the module docs for the staleness
// bound a caller accepts by enabling it.
/// The per-client cookie store, and the one place a browser build differs.
/// CONTRACT.md §23 Secure Remote Password — the protocol half, with no I/O.
/// Clock types that work on wasm32 as well as native — see the module docs for
/// why `std::time` cannot be used directly.
pub use ;
pub use Sensitive;
// Single owner of all Phase 16 module declarations (this file is final
// after plan 16-01; downstream plans 16-02..16-05 only fill in module
// bodies, never edit this file, to avoid parallel-execution merge
// conflicts).
// CONTRACT.md §27 — the management API. Documented by `src/management/mod.rs`'s
// own `//!` block; a `///` here would be merged with it by rustdoc and resolved
// in *this* scope, which breaks every intra-doc link the module makes to its own
// children (and reports the failure with no file or line to point at).
// CONTRACT.md §12 OIDC / SSO relying-party helpers — REST-only (built on the
// same `reqwest`-based transport as `rest`/`client`).
// CONTRACT.md §13 webhook signature verification (T-145). Pure computation
// over caller-supplied bytes — no transport of its own — so it is gated on
// `any(rest, amqp)` rather than on a transport: those are exactly the two
// feature sets that already vendor its inputs (`hmac`, `sha2`, `hex`,
// `subtle`), which is why it adds no dependency to either. `rest` is the
// natural home (webhooks arrive over HTTP and `rest` is on by default, so
// `verify_webhook` is available out of the box); `amqp` is included because an
// AMQP-only consumer already has the identical crypto stack and gating a pure
// HMAC helper away from it would be arbitrary.
// CONTRACT.md §32.7: the SSF receiver helper (SET verification and RFC 8936
// polling). REST-only: it fetches the JWKS and polls over the REST transport.
// §11 declarative authorization helpers: re-export the proc-macro attributes
// from the companion `axiam-sdk-macros` crate so consumers write
// `use axiam_sdk::require_access;` and never name the macro crate directly.
// The macros expand to the runtime helpers in [`middleware::authz`].
pub use ;
// §22.14 declarative reactor handler binding: `#[reactor_handler("...")]`, from
// the same companion crate. Gated on its own feature rather than on `macros`
// because `macros` implies `actix` — a reactor is an AMQP daemon with no HTTP
// surface at all, and making one pull actix-web in to get an attribute macro
// would be a dependency for nothing.
pub use reactor_handler;
/// The range of Rust toolchains this SDK is built and tested against.
///
/// The floor enforces itself, and does so well: `rust-version` in `Cargo.toml` is a
/// hard constraint Cargo checks during resolution, so a consumer on an older
/// toolchain gets a message naming the crate and the version it needs rather than a
/// compile error deep in someone else's source.
///
/// Nothing enforces the upper end, and nothing can — there is no "maximum Rust" to
/// declare. Code that compiles on the MSRV keeps compiling on newer toolchains
/// almost always, but "almost" is where new `deny`-by-default lints, tightened
/// inference, and edition-adjacent behaviour changes live. Only a build on a current
/// toolchain settles it.
///
/// This SDK has gated on both ends since it was written (D-10), which is why it was
/// the model the other ten AXIAM SDKs were brought in line with. These constants make
/// the range readable from code, matching the equivalent surface those SDKs now
/// expose.
///
/// `tests/version_policy.rs` asserts both against `Cargo.toml` and the CI matrix, so
/// neither can go stale.