pub struct ProfilePublicKeyData {
pub expires_at: SystemTime,
pub key: RsaPublicKey,
pub key_signature: Vec<u8>,
}Expand description
Profile public key data containing key, expiry, and Mojang signature.
Equivalent to ProfilePublicKey.Data in Minecraft.
Fields§
§expires_at: SystemTimeWhen this key expires
key: RsaPublicKeyThe RSA public key
key_signature: Vec<u8>Signature of this key signed by Mojang’s services
Implementations§
Source§impl ProfilePublicKeyData
impl ProfilePublicKeyData
Sourcepub const fn new(
expires_at: SystemTime,
key: RsaPublicKey,
key_signature: Vec<u8>,
) -> Self
pub const fn new( expires_at: SystemTime, key: RsaPublicKey, key_signature: Vec<u8>, ) -> Self
Creates new profile public key data
Sourcepub fn has_expired(&self) -> bool
pub fn has_expired(&self) -> bool
Checks if the key has expired (without grace period)
Sourcepub fn has_expired_with_grace(&self, grace_period: Duration) -> bool
pub fn has_expired_with_grace(&self, grace_period: Duration) -> bool
Checks if the key has expired, with a grace period
Sourcepub fn validate_signature(
&self,
profile_id: Uuid,
validator: &dyn SignatureValidator,
) -> Result<(), ValidationError>
pub fn validate_signature( &self, profile_id: Uuid, validator: &dyn SignatureValidator, ) -> Result<(), ValidationError>
Validates the key signature using Mojang’s signature validator.
The signature covers: profileId + expiresAt + key bytes
§Errors
Returns ValidationError if signature validation fails or cryptographic operations fail
Sourcefn signed_payload(&self, profile_id: Uuid) -> Result<Vec<u8>, ValidationError>
fn signed_payload(&self, profile_id: Uuid) -> Result<Vec<u8>, ValidationError>
Constructs the byte payload that was signed by Mojang.
Format: profileId (16 bytes) + expiresAt (8 bytes) + key bytes
Sourcepub fn to_bytes(&self) -> Result<Vec<u8>, ValidationError>
pub fn to_bytes(&self) -> Result<Vec<u8>, ValidationError>
Serializes the key data for network transmission
§Errors
Returns ValidationError if key encoding fails
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, ValidationError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, ValidationError>
Trait Implementations§
Source§impl Clone for ProfilePublicKeyData
impl Clone for ProfilePublicKeyData
Source§fn clone(&self) -> ProfilePublicKeyData
fn clone(&self) -> ProfilePublicKeyData
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ProfilePublicKeyData
impl RefUnwindSafe for ProfilePublicKeyData
impl Send for ProfilePublicKeyData
impl Sync for ProfilePublicKeyData
impl Unpin for ProfilePublicKeyData
impl UnsafeUnpin for ProfilePublicKeyData
impl UnwindSafe for ProfilePublicKeyData
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreArc<SyncMutex<>>