pub struct PlatformContext {
pub github_username: Option<String>,
pub npm_username: Option<String>,
pub pypi_username: Option<String>,
}Expand description
Verified platform identity context for cross-referencing during namespace verification.
SECURITY: This struct must ONLY be populated from server-verified platform claims
(i.e., claims with verified_at IS NOT NULL in the registry). Never accept
self-asserted usernames from CLI arguments — the CLI must fetch verified claims
from the registry before building this context.
The verification chain is:
- User runs
auths id claim github→ OAuth proves they control the GitHub account - Registry stores the verified claim with
verified_at - User runs
auths namespace claim→ CLI fetches verified claims from registry - This context is built from those verified claims only
- The namespace verifier cross-references against the ecosystem API (e.g., crates.io)
Usage:
ⓘ
// CORRECT: populated from registry-verified claims
let ctx = fetch_verified_platform_context(®istry_url, &did).await?;
// WRONG: self-asserted from CLI args (vulnerable to spoofing)
// let ctx = PlatformContext { github_username: Some(cli_arg), .. };Fields§
§github_username: Option<String>GitHub username from a verified platform claim.
npm_username: Option<String>npm username from a verified platform claim.
pypi_username: Option<String>PyPI username from a verified platform claim.
Trait Implementations§
Source§impl Clone for PlatformContext
impl Clone for PlatformContext
Source§fn clone(&self) -> PlatformContext
fn clone(&self) -> PlatformContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PlatformContext
impl Debug for PlatformContext
Source§impl Default for PlatformContext
impl Default for PlatformContext
Source§fn default() -> PlatformContext
fn default() -> PlatformContext
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PlatformContext
impl<'de> Deserialize<'de> for PlatformContext
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PlatformContext
impl RefUnwindSafe for PlatformContext
impl Send for PlatformContext
impl Sync for PlatformContext
impl Unpin for PlatformContext
impl UnsafeUnpin for PlatformContext
impl UnwindSafe for PlatformContext
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
Mutably borrows from an owned value. Read more