Skip to main content

VapidKeygen

Struct VapidKeygen 

Source
pub struct VapidKeygen { /* private fields */ }
Expand description

A generated VAPID key pair.

render never contains the private key: printing it is a separate call (private_key_disclosure), so the default path cannot leak it by getting a boolean the wrong way round.

Implementations§

Source§

impl VapidKeygen

Source

pub fn public_key(&self) -> &str

The applicationServerKey a browser passes to pushManager.subscribe(): base64url, no padding, of the 65-byte uncompressed P-256 point.

Source

pub fn rotated(&self) -> bool

Whether an existing key was overwritten — a rotation, whose cost is every existing subscription.

Source

pub fn warning(&self) -> Option<String>

The warning a rotation earns, or None when nothing was replaced.

Separate from render because it belongs on stderr: stdout is what the README’s own recipe reads the public key off, and a diagnostic in that stream is a diagnostic in somebody’s applicationServerKey.

Source

pub fn render(&self) -> String

What fz push vapid keygen prints on stdout. Never the private key, and never the rotation warning — see warning.

Source

pub fn private_key_disclosure(&self) -> Zeroizing<String>

The private key, for --print-private only. A separate call so that no default path can print it.

Cleared on drop, like the field it copies from: a plain String here would put the key back in an uncleared heap buffer and undo the Zeroizing the field is deliberately stored in.

Trait Implementations§

Source§

impl Debug for VapidKeygen

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Never prints the private key — the same rule VapidKeys, Es256Signer and Recipient follow.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more