pub struct ControllerBuilder<R: RngCore + Clone, D: Digest + FixedOutputReset> { /* private fields */ }
Implementations§
Source§impl<R: RngCore + Clone, D: Digest + FixedOutputReset> ControllerBuilder<R, D>
impl<R: RngCore + Clone, D: Digest + FixedOutputReset> ControllerBuilder<R, D>
pub fn new() -> ControllerBuilder<R, D>
Sourcepub fn finalize(self) -> Result<PrefixedApiKeyController<R, D>, BuilderError>
pub fn finalize(self) -> Result<PrefixedApiKeyController<R, D>, BuilderError>
Finishes building the controller, returning Err if any necessary configs are missing.
Sourcepub fn default_lengths(self) -> Self
pub fn default_lengths(self) -> Self
Helper for setting the default short and long token length based on the defaults set in the typescript version Prefixed API Key module.
Sourcepub fn prefix(self, prefix: String) -> Self
pub fn prefix(self, prefix: String) -> Self
Sets the token prefix. This should be the name of your company or organization.
Sourcepub fn rng(self, rng: R) -> Self
pub fn rng(self, rng: R) -> Self
Sets an rng source that implements RngCore, which will be used for generating bytes used in the short and long tokens of the key.
Sourcepub fn short_token_prefix(self, short_token_prefix: Option<String>) -> Self
pub fn short_token_prefix(self, short_token_prefix: Option<String>) -> Self
An optional prefix for the short tokens. The length of this value should
be less than the value you set for the short_token_length
, and should
leave enough space to avoid collisions with other short tokens.
Default: None
Sourcepub fn short_token_length(self, short_token_length: usize) -> Self
pub fn short_token_length(self, short_token_length: usize) -> Self
The length of the short token
Sourcepub fn long_token_length(self, long_token_length: usize) -> Self
pub fn long_token_length(self, long_token_length: usize) -> Self
The length of the secret long token
Source§impl<D: Digest + FixedOutputReset + Clone> ControllerBuilder<OsRng, D>
impl<D: Digest + FixedOutputReset + Clone> ControllerBuilder<OsRng, D>
Sourcepub fn rng_osrng(self) -> Self
pub fn rng_osrng(self) -> Self
Helper function for configuring the Controller with an instance of OsRng.
Warning: The RNG you pick is an important decision. Please familiarize yourself with the types of RNGs, and then read the descriptions of each of the RNGs provided in the rand crate to determine the most appropriate RNG for your use case.
Source§impl<D: Digest + FixedOutputReset + Clone> ControllerBuilder<ThreadRng, D>
impl<D: Digest + FixedOutputReset + Clone> ControllerBuilder<ThreadRng, D>
Sourcepub fn rng_threadrng(self) -> Self
pub fn rng_threadrng(self) -> Self
Helper function for configuring the Controller with an instance of ThreadRng created by calling default.
Warning: The RNG you pick is an important decision. Please familiarize yourself with the types of RNGs, and then read the descriptions of each of the RNGs provided in the rand crate to determine the most appropriate RNG for your use case.
Source§impl<D: Digest + FixedOutputReset + Clone> ControllerBuilder<StdRng, D>
impl<D: Digest + FixedOutputReset + Clone> ControllerBuilder<StdRng, D>
Sourcepub fn rng_stdrng(self) -> Self
pub fn rng_stdrng(self) -> Self
Helper function for configuring the Controller with an instance of StdRng created by calling from_entropy.
Warning: The RNG you pick is an important decision. Please familiarize yourself with the types of RNGs, and then read the descriptions of each of the RNGs provided in the rand crate to determine the most appropriate RNG for your use case.
Source§impl ControllerBuilder<OsRng, Sha256>
impl ControllerBuilder<OsRng, Sha256>
Sourcepub fn seam_defaults(self) -> Self
pub fn seam_defaults(self) -> Self
Helper function for configuring the Controller with a new Sha256 instance
Requires the “sha2” feature
Source§impl<R: RngCore + Clone> ControllerBuilder<R, Sha224>
impl<R: RngCore + Clone> ControllerBuilder<R, Sha224>
Sourcepub fn digest_sha224(self) -> Self
pub fn digest_sha224(self) -> Self
Helper function for configuring the Controller with a new Sha224 instance
Requires the “sha2” feature
Source§impl<R: RngCore + Clone> ControllerBuilder<R, Sha256>
impl<R: RngCore + Clone> ControllerBuilder<R, Sha256>
Sourcepub fn digest_sha256(self) -> Self
pub fn digest_sha256(self) -> Self
Helper function for configuring the Controller with a new Sha256 instance
Requires the “sha2” feature
Source§impl<R: RngCore + Clone> ControllerBuilder<R, Sha384>
impl<R: RngCore + Clone> ControllerBuilder<R, Sha384>
Sourcepub fn digest_sha384(self) -> Self
pub fn digest_sha384(self) -> Self
Helper function for configuring the Controller with a new Sha384 instance
Requires the “sha2” feature
Source§impl<R: RngCore + Clone> ControllerBuilder<R, Sha512>
impl<R: RngCore + Clone> ControllerBuilder<R, Sha512>
Sourcepub fn digest_sha512(self) -> Self
pub fn digest_sha512(self) -> Self
Helper function for configuring the Controller with a new Sha512 instance
Requires the “sha2” feature
Source§impl<R: RngCore + Clone> ControllerBuilder<R, Sha512_224>
impl<R: RngCore + Clone> ControllerBuilder<R, Sha512_224>
Sourcepub fn digest_sha512_224(self) -> Self
pub fn digest_sha512_224(self) -> Self
Helper function for configuring the Controller with a new Sha512_224 instance
Requires the “sha2” feature
Source§impl<R: RngCore + Clone> ControllerBuilder<R, Sha512_256>
impl<R: RngCore + Clone> ControllerBuilder<R, Sha512_256>
Sourcepub fn digest_sha512_256(self) -> Self
pub fn digest_sha512_256(self) -> Self
Helper function for configuring the Controller with a new Sha512_256 instance
Requires the “sha2” feature