Skip to main content

ApiKeyConfig

Struct ApiKeyConfig 

Source
pub struct ApiKeyConfig {
Show 27 fields pub config_id: String, pub references: ApiKeyReferences, pub storage: ApiKeyStorageMode, pub fallback_to_database: bool, pub secondary_storage: Option<Arc<dyn CacheAdapter>>, pub custom_storage: Option<Arc<dyn ApiKeyStorage>>, pub key_length: f64, pub prefix: Option<String>, pub default_permissions: Option<ApiKeyPermissions>, pub custom_key_generator: Option<Arc<dyn ApiKeyGenerator>>, pub default_permissions_callback: Option<Arc<dyn ApiKeyDefaultPermissions>>, pub api_key_headers: Vec<String>, pub custom_api_key_getter: Option<Arc<dyn ApiKeyGetter>>, pub custom_api_key_validator: Option<Arc<dyn ApiKeyValidator>>, pub disable_key_hashing: bool, pub starting_characters_length: f64, pub store_starting_characters: bool, pub max_prefix_length: f64, pub min_prefix_length: f64, pub max_name_length: f64, pub min_name_length: f64, pub require_name: bool, pub enable_metadata: bool, pub key_expiration: KeyExpirationConfig, pub rate_limit: RateLimitDefaults, pub enable_session_for_api_keys: bool, pub defer_updates: bool,
}
Expand description

Configuration for the API Key plugin, aligned with the TypeScript ApiKeyOptions.

Fields§

§config_id: String

Name of this configuration, stored on every key it creates. Upstream defaults it to "default".

§references: ApiKeyReferences

Whether keys from this configuration belong to a user or to an organization.

§storage: ApiKeyStorageMode

Database persistence (default) or application-owned secondary storage.

§fallback_to_database: bool

Use database rows for durable writes and admission in secondary mode.

§secondary_storage: Option<Arc<dyn CacheAdapter>>

Shared secondary cache for this plugin, independent of session persistence.

§custom_storage: Option<Arc<dyn ApiKeyStorage>>

Application storage overriding the plugin’s secondary cache.

§key_length: f64

Raw length excluding the prefix. Zero and NaN use 64; the built-in generator admits safely terminating fractions from 0.5 upward. A custom generator receives the number unchanged after that fallback.

§prefix: Option<String>§default_permissions: Option<ApiKeyPermissions>

Permissions applied when creation does not supply explicit permissions.

§custom_key_generator: Option<Arc<dyn ApiKeyGenerator>>

Optional application generator, receiving only length and effective prefix.

§default_permissions_callback: Option<Arc<dyn ApiKeyDefaultPermissions>>

Dynamic defaults replace static default_permissions when configured.

§api_key_headers: Vec<String>§custom_api_key_getter: Option<Arc<dyn ApiKeyGetter>>

Trusted application lookup, replacing api_key_headers when configured.

§custom_api_key_validator: Option<Arc<dyn ApiKeyValidator>>

Trusted acceptance predicate, checked before quota and rate-limit writes.

§disable_key_hashing: bool§starting_characters_length: f64

UTF-16 substring end: finite fractions truncate, negative/NaN select an empty prefix, and positive infinity selects the whole credential. SQLite retains a cut through a surrogate pair as actual WTF-8 TEXT.

§store_starting_characters: bool§max_prefix_length: f64

Compare the actual UTF-16 prefix length against this raw number.

§min_prefix_length: f64

Compare the actual UTF-16 prefix length against this raw number.

§max_name_length: f64

Compare the actual UTF-16 name length against this raw number.

§min_name_length: f64

Compare the actual UTF-16 name length against this raw number.

§require_name: bool§enable_metadata: bool§key_expiration: KeyExpirationConfig§rate_limit: RateLimitDefaults§enable_session_for_api_keys: bool§defer_updates: bool

Start secondary-only usage merges and automatic cleanup in background work. The application background handler receives completion observations. Successful trusted verification launches cleanup only when enabled. Database quota and rate-limit admission remain atomic and awaited.

Trait Implementations§

Source§

impl Clone for ApiKeyConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ApiKeyConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ApiKeyConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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