#[non_exhaustive]pub struct RefreshTokenRecord {
pub token: String,
pub chain_id: String,
pub parent: Option<String>,
pub user_id: UserId,
pub device_id: DeviceId,
pub issued_at: i64,
pub expires_at: i64,
pub consumed: bool,
pub revoked: bool,
}Expand description
One row in a refresh-token rotation chain.
This struct is the persistence contract the rotation impls
(RefreshRotator) write against. The
struct is #[non_exhaustive] (so adding fields stays SemVer-clean for
downstream consumers), which blocks external struct-literal construction —
use RefreshTokenRecord::new from a RefreshStore impl that needs to
build one (e.g. in a get query handler).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.token: StringStorage key for this token: the SHA-256 hash (hex) of the opaque secret
the client holds, computed by the rotator. The raw secret is never
persisted, so a read-only store leak yields hashes, not usable tokens.
RefreshStore impls treat this as an opaque primary key.
chain_id: StringStable identifier shared across every token in this rotation chain.
parent: Option<String>The token (hash) this one rotated from (None for the chain root).
user_id: UserId§device_id: DeviceId§issued_at: i64§expires_at: i64§consumed: booltrue once this token has minted a successor. Re-presenting a
consumed token MUST revoke the whole chain (replay).
revoked: booltrue once the chain has been revoked — by replay detection,
explicit logout, or device revocation.
Implementations§
Source§impl RefreshTokenRecord
impl RefreshTokenRecord
Sourcepub fn new(
token: String,
chain_id: String,
parent: Option<String>,
user_id: UserId,
device_id: DeviceId,
issued_at: i64,
expires_at: i64,
consumed: bool,
revoked: bool,
) -> Self
pub fn new( token: String, chain_id: String, parent: Option<String>, user_id: UserId, device_id: DeviceId, issued_at: i64, expires_at: i64, consumed: bool, revoked: bool, ) -> Self
Construct a record from its constituent fields. Use this from external
RefreshStore impls (the struct is #[non_exhaustive], so direct
struct-literal construction is crate-local only). New fields land here
behind the #[non_exhaustive] shield so existing callers stay green.
Trait Implementations§
Source§impl Clone for RefreshTokenRecord
impl Clone for RefreshTokenRecord
Source§fn clone(&self) -> RefreshTokenRecord
fn clone(&self) -> RefreshTokenRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more