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
use std::io;
/// Errors returned by Trellis auth and admin-session helpers.
#[derive(Debug, thiserror::Error)]
pub enum TrellisAuthError {
/// The supplied contract JSON could not be parsed.
#[error("invalid contract json: {0}")]
ContractJson(#[from] serde_json::Error),
/// Contract digest calculation failed.
#[error("contract digest error: {0}")]
ContractDigest(#[from] trellis_contracts::ContractsError),
/// A configured auth or portal URL was invalid.
#[error("invalid url: {0}")]
Url(#[from] url::ParseError),
/// The HTTP transport used for agent login or bind requests failed.
#[error("http client error: {0}")]
Http(#[from] reqwest::Error),
/// Local filesystem persistence or socket I/O failed.
#[error("io error: {0}")]
Io(#[from] io::Error),
/// The underlying Trellis RPC client returned an error.
#[error("{0}")]
TrellisClient(#[from] crate::client::TrellisClientError),
/// Agent login never completed before the timeout.
#[error("timed out waiting for agent login")]
LoginTimedOut,
/// The detached login flow shut down before completion.
#[error("agent login was interrupted")]
LoginInterrupted,
/// The auth service returned a terminal flow error.
#[error("auth flow failed: {0}")]
AuthFlowFailed(String),
/// The low-level bind endpoint returned a non-success HTTP response.
#[error("bind failed: {0} {1}")]
BindHttpFailure(u16, String),
/// The auth-start endpoint returned a non-success HTTP response.
#[error("auth request failed: {0} {1}")]
AuthRequestHttpFailure(u16, String),
/// The bind endpoint returned a response shape this crate does not understand.
#[error("unexpected bind status: {0}")]
UnexpectedBindStatus(String),
/// The auth-start endpoint returned a response shape this crate does not understand.
#[error("unexpected auth request status: {0}")]
UnexpectedAuthRequestStatus(String),
/// The caller supplied arguments that violate the Trellis auth invariants.
#[error("invalid argument: {0}")]
InvalidArgument(String),
/// A helper wrapped operation finished without a usable successful result.
#[error("operation failed: {0}")]
OperationFailed(String),
/// A device activation wait request returned a non-success HTTP response.
#[error("device activation wait failed: {0} {1}")]
DeviceActivationWaitFailure(u16, String),
/// A device activation start request returned a non-success HTTP response.
#[error("device activation start failed: {0} {1}")]
DeviceActivationStartFailure(u16, String),
/// A device connect-info request returned a non-success HTTP response.
#[error("device connect info failed: {0} {1}")]
DeviceConnectInfoFailure(u16, String),
/// A device connect-info request returned a response status this crate cannot use.
#[error("unexpected device connect info status: {0}")]
UnexpectedDeviceConnectInfoStatus(String),
/// Device activation was explicitly rejected.
#[error("device activation rejected{0}")]
DeviceActivationRejected(String),
/// The authenticated user completed login successfully but lacks admin capability.
#[error("logged in user is not an admin")]
NotAdmin,
/// The current session belongs to a non-user participant.
#[error("current session is not a user session: participantKind={0}")]
NotUserSession(String),
}