pub struct DeviceAuthBuilder { /* private fields */ }Expand description
Builds a DeviceAuth. Everything the module cannot decide for a
venture — who its clients are, who may approve, what a credential looks
like, where entropy comes from — is set here.
Implementations§
Source§impl DeviceAuthBuilder
impl DeviceAuthBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
The RFC 8628 defaults: a ten-minute code, a five-second poll interval and a five-wrong-entry allowance.
Sourcepub fn client(self, client: DeviceClient) -> Self
pub fn client(self, client: DeviceClient) -> Self
Adds one client. Repeatable.
Sourcepub fn clients(self, clients: impl IntoIterator<Item = DeviceClient>) -> Self
pub fn clients(self, clients: impl IntoIterator<Item = DeviceClient>) -> Self
Declares the whole client list. Replaces any previous one.
Sourcepub fn approver(self, approver: impl Approver + 'static) -> Self
pub fn approver(self, approver: impl Approver + 'static) -> Self
Sets the approver hook. Without one, the module uses
CallerApprover over the Auth port when a deployment mounts
one.
Sourcepub fn random(self, random: impl RandomBytes + 'static) -> Self
pub fn random(self, random: impl RandomBytes + 'static) -> Self
Sets the entropy source the two codes are drawn from. Required: core carries no CSPRNG, so the venture supplies one (ADR 0002).
Sourcepub fn sign_in_url(self, url: impl Into<String>) -> Self
pub fn sign_in_url(self, url: impl Into<String>) -> Self
Where the stock CallerApprover sends an anonymous browser.
Defaults to /login.
Sourcepub fn expires_in(self, ttl: Duration) -> Self
pub fn expires_in(self, ttl: Duration) -> Self
How long a device code stays usable. Clamped to at least one
second, and at most MAX_EXPIRES_IN.
Sourcepub fn interval(self, interval: Duration) -> Self
pub fn interval(self, interval: Duration) -> Self
The poll interval a client is told to use, and the shortest gap a poll may arrive at. Clamped to at least one second.
Sourcepub fn max_wrong_entries(self, allowance: u32) -> Self
pub fn max_wrong_entries(self, allowance: u32) -> Self
The wrong-entry allowance per approver before the limiter refuses. Clamped to at least one.
Sourcepub fn build(self) -> DeviceAuth
pub fn build(self) -> DeviceAuth
Builds the module.