pub struct LocalDevice {
pub device_id: DeviceId,
pub user_id: UserId,
pub label: String,
pub created_at_ms: u64,
/* private fields */
}Expand description
Local device — owns its signing keypair. Never leaves the device that created it.
Fields§
§device_id: DeviceId§user_id: UserId§label: String§created_at_ms: u64Implementations§
Source§impl LocalDevice
impl LocalDevice
pub fn generate(user_id: UserId, label: String, now_ms: u64) -> Self
Sourcepub fn from_signing_secret(
user_id: UserId,
label: String,
now_ms: u64,
secret_key: &[u8; 32],
) -> Self
pub fn from_signing_secret( user_id: UserId, label: String, now_ms: u64, secret_key: &[u8; 32], ) -> Self
Construct a LocalDevice from a caller-supplied 32-byte Ed25519
secret key. Used when the host wants the SDK’s device_id (and
therefore the sender_device on every emitted envelope) to
match an externally-owned key — typically the auth layer’s
device_signing_key, whose public-key SHA-256 the BE uses as
the JWT device_id claim.
Without this path the SDK generates a random signing key on
first init and writes it to storage; the resulting device_id
has no relationship to any other identifier the host already
owns, which forces server-side relax of any expected_sender_device
validation. Pass the same 32 bytes here and the SDK’s
sender_device aligns with the JWT device_id claim by
construction.
pub fn public_key(&self) -> VerifyingKey
pub fn info(&self, last_seen_ms: u64) -> DeviceInfo
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LocalDevice
impl RefUnwindSafe for LocalDevice
impl Send for LocalDevice
impl Sync for LocalDevice
impl Unpin for LocalDevice
impl UnsafeUnpin for LocalDevice
impl UnwindSafe for LocalDevice
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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 more