pub struct ApiKey {Show 21 fields
pub id: Id,
pub name: Option<String>,
pub start: Option<String>,
pub prefix: Option<String>,
pub key_hash: Hash,
pub user_id: Id,
pub enabled: bool,
pub expires_at: Option<OffsetDateTime>,
pub rate_limit_enabled: bool,
pub rate_limit_time_window: Option<i64>,
pub rate_limit_max: Option<i64>,
pub request_count: i64,
pub last_request: Option<OffsetDateTime>,
pub remaining: Option<i64>,
pub refill_amount: Option<i64>,
pub refill_interval: Option<i64>,
pub last_refill_at: Option<OffsetDateTime>,
pub permissions: Option<Json<Permissions>>,
pub metadata: Option<Json<Value>>,
pub created_at: OffsetDateTime,
pub updated_at: OffsetDateTime,
}Expand description
A row of apikey. Only the SHA-256 of the key is stored; the key itself is returned
once, by /api-key/create.
Fields§
§id: Id§name: Option<String>A label the owner picked.
start: Option<String>The first characters of the key, so owners can tell keys apart.
prefix: Option<String>The prefix the key starts with, when it has one.
key_hash: HashSHA-256 of the full key.
user_id: IdThe user the key acts as.
enabled: boolA disabled key fails verification with KEY_DISABLED.
expires_at: Option<OffsetDateTime>After this, verification deletes the key and fails with KEY_EXPIRED.
rate_limit_enabled: boolWhether the per-key rate limit applies.
rate_limit_time_window: Option<i64>The rate-limit window in milliseconds.
rate_limit_max: Option<i64>Requests allowed per window.
request_count: i64Requests counted in the current window.
last_request: Option<OffsetDateTime>When the key was last verified.
remaining: Option<i64>Verifications left; None is unlimited.
refill_amount: Option<i64>What remaining is reset to every refill_interval.
refill_interval: Option<i64>The refill interval in milliseconds.
last_refill_at: Option<OffsetDateTime>When remaining was last refilled.
permissions: Option<Json<Permissions>>§metadata: Option<Json<Value>>§created_at: OffsetDateTime§updated_at: OffsetDateTimeImplementations§
Source§impl ApiKey
impl ApiKey
Sourcepub const START: Col<ApiKey, Option<String>>
pub const START: Col<ApiKey, Option<String>>
The first characters of the key, so owners can tell keys apart.
Sourcepub const EXPIRES_AT: Col<ApiKey, Option<OffsetDateTime>>
pub const EXPIRES_AT: Col<ApiKey, Option<OffsetDateTime>>
After this, verification deletes the key and fails with KEY_EXPIRED.
Sourcepub const RATE_LIMIT_ENABLED: Col<ApiKey, bool>
pub const RATE_LIMIT_ENABLED: Col<ApiKey, bool>
Whether the per-key rate limit applies.
Sourcepub const RATE_LIMIT_TIME_WINDOW: Col<ApiKey, Option<i64>>
pub const RATE_LIMIT_TIME_WINDOW: Col<ApiKey, Option<i64>>
The rate-limit window in milliseconds.
Sourcepub const REQUEST_COUNT: Col<ApiKey, i64>
pub const REQUEST_COUNT: Col<ApiKey, i64>
Requests counted in the current window.
Sourcepub const LAST_REQUEST: Col<ApiKey, Option<OffsetDateTime>>
pub const LAST_REQUEST: Col<ApiKey, Option<OffsetDateTime>>
When the key was last verified.
Sourcepub const REFILL_AMOUNT: Col<ApiKey, Option<i64>>
pub const REFILL_AMOUNT: Col<ApiKey, Option<i64>>
What remaining is reset to every refill_interval.
Sourcepub const LAST_REFILL_AT: Col<ApiKey, Option<OffsetDateTime>>
pub const LAST_REFILL_AT: Col<ApiKey, Option<OffsetDateTime>>
When remaining was last refilled.
Sourcepub const PERMISSIONS: Col<ApiKey, Option<Json<Permissions>>>
pub const PERMISSIONS: Col<ApiKey, Option<Json<Permissions>>>
The permissions column.
Sourcepub const CREATED_AT: Col<ApiKey, OffsetDateTime>
pub const CREATED_AT: Col<ApiKey, OffsetDateTime>
The created_at column.
Sourcepub const UPDATED_AT: Col<ApiKey, OffsetDateTime>
pub const UPDATED_AT: Col<ApiKey, OffsetDateTime>
The updated_at column.