auths_sdk/result.rs
1use auths_core::storage::keychain::{IdentityDID, KeyAlias};
2use auths_verifier::Capability;
3use auths_verifier::core::ResourceId;
4use auths_verifier::types::DeviceDID;
5
6/// Outcome of a successful developer identity setup.
7///
8/// Usage:
9/// ```ignore
10/// let result: SetupResult = sdk.setup_developer(config).await?;
11/// println!("Created identity: {}", result.identity_did);
12/// ```
13#[derive(Debug, Clone)]
14pub struct SetupResult {
15 /// The controller DID of the created identity.
16 pub identity_did: IdentityDID,
17 /// The device DID bound to this identity.
18 pub device_did: DeviceDID,
19 /// The keychain alias used for the signing key.
20 pub key_alias: KeyAlias,
21 /// Result of platform verification, if performed.
22 pub platform_claim: Option<PlatformClaimResult>,
23 /// Whether git commit signing was configured.
24 pub git_signing_configured: bool,
25 /// Result of registry registration, if performed.
26 pub registered: Option<RegistrationOutcome>,
27}
28
29/// Outcome of a successful CI/ephemeral identity setup.
30///
31/// Usage:
32/// ```ignore
33/// let result: CiSetupResult = sdk.setup_ci(config).await?;
34/// for line in &result.env_block {
35/// println!("{line}");
36/// }
37/// ```
38#[derive(Debug, Clone)]
39pub struct CiSetupResult {
40 /// The controller DID of the CI identity.
41 pub identity_did: IdentityDID,
42 /// The device DID bound to this CI identity.
43 pub device_did: DeviceDID,
44 /// Shell `export` lines for configuring CI environment variables.
45 pub env_block: Vec<String>,
46}
47
48/// Outcome of a successful agent identity setup.
49///
50/// Usage:
51/// ```ignore
52/// let result: AgentSetupResult = sdk.setup_agent(config).await?;
53/// println!("Agent {} delegated by {}", result.agent_did, result.parent_did);
54/// ```
55#[derive(Debug, Clone)]
56pub struct AgentSetupResult {
57 /// The DID of the newly created agent identity.
58 pub agent_did: IdentityDID,
59 /// The DID of the parent identity that delegated authority.
60 pub parent_did: IdentityDID,
61 /// The capabilities granted to the agent.
62 pub capabilities: Vec<Capability>,
63}
64
65/// Outcome of a successful device link operation.
66///
67/// Usage:
68/// ```ignore
69/// let result: DeviceLinkResult = sdk.link_device(config).await?;
70/// println!("Linked device {} via attestation {}", result.device_did, result.attestation_id);
71/// ```
72#[derive(Debug, Clone)]
73pub struct DeviceLinkResult {
74 /// The DID of the linked device.
75 pub device_did: DeviceDID,
76 /// The resource identifier of the created attestation.
77 pub attestation_id: ResourceId,
78}
79
80/// Outcome of a successful identity rotation.
81///
82/// Usage:
83/// ```ignore
84/// let result: RotationResult = rotate_identity(config, provider)?;
85/// println!("Rotated DID: {}", result.controller_did);
86/// println!("New key: {}...", result.new_key_fingerprint);
87/// println!("Old key: {}...", result.previous_key_fingerprint);
88/// ```
89#[derive(Debug, Clone)]
90pub struct RotationResult {
91 /// The controller DID of the rotated identity.
92 pub controller_did: IdentityDID,
93 /// Hex-encoded fingerprint of the new signing key.
94 pub new_key_fingerprint: String,
95 /// Hex-encoded fingerprint of the previous signing key.
96 pub previous_key_fingerprint: String,
97}
98
99/// Outcome of a successful device authorization extension.
100///
101/// Usage:
102/// ```ignore
103/// let result: DeviceExtensionResult = extend_device_authorization(config, provider)?;
104/// println!("Extended {} until {}", result.device_did, result.new_expires_at.date_naive());
105/// ```
106#[derive(Debug, Clone)]
107pub struct DeviceExtensionResult {
108 /// The DID of the device whose authorization was extended.
109 pub device_did: DeviceDID,
110 /// The new expiration timestamp for the device authorization.
111 pub new_expires_at: chrono::DateTime<chrono::Utc>,
112}
113
114/// Outcome of a successful platform claim verification.
115///
116/// Usage:
117/// ```ignore
118/// let claim: PlatformClaimResult = sdk.platform_claim(platform).await?;
119/// println!("Verified as {} on {}", claim.username, claim.platform);
120/// ```
121#[derive(Debug, Clone)]
122pub struct PlatformClaimResult {
123 /// The platform name (e.g. `"github"`).
124 pub platform: String,
125 /// The verified username on the platform.
126 pub username: String,
127 /// Optional URL to the public proof artifact (e.g. a GitHub gist).
128 pub proof_url: Option<String>,
129}
130
131/// Outcome of a successful registry registration.
132///
133/// Usage:
134/// ```ignore
135/// if let Some(reg) = result.registered {
136/// println!("Registered {} at {}", reg.did_prefix, reg.registry);
137/// }
138/// ```
139#[derive(Debug, Clone)]
140pub struct RegistrationOutcome {
141 /// The KERI prefix portion of the registered DID.
142 pub did_prefix: String,
143 /// The registry URL where the identity was registered.
144 pub registry: String,
145 /// Number of platform claims indexed by the registry.
146 pub platform_claims_indexed: usize,
147}