pub struct PairingToken {
pub controller_did: String,
pub endpoint: String,
pub short_code: String,
pub ephemeral_pubkey: String,
pub expires_at: DateTime<Utc>,
pub capabilities: Vec<String>,
}Expand description
A pairing token for initiating cross-device identity linking.
The initiating device generates this token and displays it as a QR code
or short code. The responding device scans/enters it and sends back
a PairingResponse with its device public key plus X25519 ECDH exchange.
Fields§
§controller_did: StringIdentity DID of the initiator (controller).
endpoint: StringRegistry endpoint URL.
short_code: String6-char alphanumeric short code (no ambiguous chars).
ephemeral_pubkey: StringX25519 ephemeral public key (base64url encoded).
expires_at: DateTime<Utc>Token expiration time.
capabilities: Vec<String>Capabilities to grant to the paired device.
Implementations§
Source§impl PairingToken
impl PairingToken
Sourcepub fn generate(
now: DateTime<Utc>,
controller_did: String,
endpoint: String,
capabilities: Vec<String>,
) -> Result<PairingSession, PairingError>
pub fn generate( now: DateTime<Utc>, controller_did: String, endpoint: String, capabilities: Vec<String>, ) -> Result<PairingSession, PairingError>
Generate a new pairing token with a 5-minute expiry.
Sourcepub fn generate_with_expiry(
now: DateTime<Utc>,
controller_did: String,
endpoint: String,
capabilities: Vec<String>,
expiry: Duration,
) -> Result<PairingSession, PairingError>
pub fn generate_with_expiry( now: DateTime<Utc>, controller_did: String, endpoint: String, capabilities: Vec<String>, expiry: Duration, ) -> Result<PairingSession, PairingError>
Generate a new pairing token with custom expiry.
Sourcepub fn is_expired(&self, now: DateTime<Utc>) -> bool
pub fn is_expired(&self, now: DateTime<Utc>) -> bool
Check if the token has expired.
Sourcepub fn to_uri(&self) -> String
pub fn to_uri(&self) -> String
Convert to an auths:// URI for QR code or deep linking.
Format: auths://pair?d=<did>&e=<endpoint_b64>&k=<pubkey>&sc=<code>&x=<expires>&c=<caps>
Sourcepub fn from_uri(uri: &str) -> Result<Self, PairingError>
pub fn from_uri(uri: &str) -> Result<Self, PairingError>
Parse a pairing token from an auths:// URI.
Sourcepub fn ephemeral_pubkey_bytes(&self) -> Result<[u8; 32], PairingError>
pub fn ephemeral_pubkey_bytes(&self) -> Result<[u8; 32], PairingError>
Get the ephemeral public key as bytes.
Trait Implementations§
Source§impl Clone for PairingToken
impl Clone for PairingToken
Source§fn clone(&self) -> PairingToken
fn clone(&self) -> PairingToken
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more