pub struct Device { /* private fields */ }Expand description
Bark iOS device target and its device-level settings.
Device tokens are normalized when a Device is created: surrounding angle
brackets and ASCII whitespace are removed. Encryption settings, when
present, should match the Push Encryption configuration in the Bark app for
this device.
Implementations§
Source§impl Device
impl Device
Sourcepub fn encrypt<K>(
self,
algorithm: EncryptionAlgorithm,
mode: EncryptionMode,
key: K,
) -> Result<Self>
pub fn encrypt<K>( self, algorithm: EncryptionAlgorithm, mode: EncryptionMode, key: K, ) -> Result<Self>
Configures Bark Push Encryption for this device.
The algorithm, mode, and key should match this device’s Push Encryption settings in the Bark app. The key is validated immediately against the selected AES algorithm, so invalid device configuration fails before any APNs request is attempted.
This method only stores the device-level encryption configuration. It
does not force every message sent to this device to be encrypted; mark
individual messages with Message::encrypt when encrypted delivery is
desired.
CBC and GCM IVs are generated for each encrypted APNs payload, not stored on the device. CBC uses a 16-byte IV, GCM uses a 12-byte nonce/IV, and ECB sends no IV.
§Errors
Returns Error::InvalidKeyLength if the key length does not match the
selected algorithm.
Trait Implementations§
impl Eq for Device
impl StructuralPartialEq for Device
Auto Trait Implementations§
impl Freeze for Device
impl RefUnwindSafe for Device
impl Send for Device
impl Sync for Device
impl Unpin for Device
impl UnsafeUnpin for Device
impl UnwindSafe for Device
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,
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.