pub struct SupportCode {
pub scope: String,
pub hash: String,
pub label: Option<String>,
pub ttl_minutes: Option<u32>,
pub disabled: bool,
}Expand description
One operator-issued support code — the “裏コマンド” that reveals
client.unlock-scoped jobs in the Client App (see
crate::manifest::ClientHint::unlock).
Only the argon2id hash is stored. Verification needs no plaintext, so unlike the SMTP password (#884, which must stay in the HKLM registry because SMTP AUTH needs the real string) a support code can live in KV safely — an agent reads the hash to verify a typed code locally, which is what keeps unlocking working while the backend is down, exactly when the desk needs it most.
The plaintext exists only in transit: the operator types it once into the
SPA, the backend hashes it, and no layer ever stores or returns it. The
API blanks hash on the way out too — an operator rotating
a code sets a new one, they never read the old one back.
Fields§
§scope: StringThe scope this code opens, matched byte-for-byte against a job’s
client.unlock. Unique within the list; a slug ([A-Za-z0-9._-]).
hash: Stringargon2id PHC-format hash of the code. Empty ⇒ no code configured for this scope, which fails closed (nothing can be unlocked with it) — that’s also what an API response looks like, since the hash is blanked before it leaves the backend.
label: Option<String>Human label for the code ("ヘルプデスク一次窓口"), shown in the
Client App’s support-mode banner so the user can see which desk opened
their machine. None ⇒ the banner falls back to the scope slug.
ttl_minutes: Option<u32>How long a grant from this code lasts, in minutes. None ⇒
DEFAULT_SUPPORT_UNLOCK_TTL_MINUTES. Clamped to
1..=MAX_SUPPORT_UNLOCK_TTL_MINUTES.
disabled: boolTemporarily suspend the code without deleting it (and without having
to re-issue a new secret afterwards) — a disabled code never verifies.
false (the default) ⇒ live.
Implementations§
Source§impl SupportCode
impl SupportCode
Sourcepub fn effective_ttl_minutes(&self) -> u32
pub fn effective_ttl_minutes(&self) -> u32
The grant window this code mints, in minutes: the configured value if
set, else DEFAULT_SUPPORT_UNLOCK_TTL_MINUTES. Floored at 1 and
clamped to MAX_SUPPORT_UNLOCK_TTL_MINUTES so a 0 (which would
mint an already-expired grant, i.e. an unlock that silently does
nothing) or an out-of-band giant value can’t reach the grant store.
Trait Implementations§
Source§impl Clone for SupportCode
impl Clone for SupportCode
Source§fn clone(&self) -> SupportCode
fn clone(&self) -> SupportCode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SupportCode
impl Debug for SupportCode
Source§impl Default for SupportCode
impl Default for SupportCode
Source§fn default() -> SupportCode
fn default() -> SupportCode
Source§impl<'de> Deserialize<'de> for SupportCodewhere
SupportCode: Default,
impl<'de> Deserialize<'de> for SupportCodewhere
SupportCode: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for SupportCode
Source§impl PartialEq for SupportCode
impl PartialEq for SupportCode
Source§impl Serialize for SupportCode
impl Serialize for SupportCode
impl StructuralPartialEq for SupportCode
Auto Trait Implementations§
impl Freeze for SupportCode
impl RefUnwindSafe for SupportCode
impl Send for SupportCode
impl Sync for SupportCode
impl Unpin for SupportCode
impl UnsafeUnpin for SupportCode
impl UnwindSafe for SupportCode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.