Skip to main content

Module device

Module device 

Source

Re-exportsΒ§

use std::time::Duration; πŸ”’
use std::time::SystemTime; πŸ”’
use ruma::OwnedUserId; πŸ”’
use ruma::UserId; πŸ”’
use serde::Deserialize; πŸ”’
use serde::Deserialize; πŸ”’
use serde::Serialize; πŸ”’
use serde::Serialize; πŸ”’
use tuwunel_core::Err; πŸ”’
use tuwunel_core::Result; πŸ”’
use tuwunel_core::err; πŸ”’
use tuwunel_core::implement; πŸ”’
use tuwunel_core::smallstr::SmallString; πŸ”’
use tuwunel_core::utils; πŸ”’
use tuwunel_database::Cbor; πŸ”’
use tuwunel_database::Deserialized; πŸ”’

StructsΒ§

ApprovedDeviceGrant
The approved grant data the token endpoint consumes to issue tokens.
Authentication πŸ”’
DeviceGrant
A pending RFC 8628 device authorization grant, keyed in the store by its device_code and reachable for the browser approval step through a separate user_code index.

EnumsΒ§

DeviceGrantPoll
The outcome of a token-endpoint poll, mapped to the RFC 8628 Β§3.5 error codes by the caller.
DeviceGrantStatus

ConstantsΒ§

DEVICE_CODE_LENGTH πŸ”’
DEVICE_GRANT_INTERVAL_SECS
DEVICE_GRANT_LIFETIME
MAX_VERIFY_ATTEMPTS πŸ”’
Cap on how many times one grant’s user_code may be brought to the consent step before it self-invalidates (RFC 8628 Β§5.1 per-code attempt cap / Β§5.4 possession limit), generous enough for a page reload.
USER_CODE_CHARSET πŸ”’
RFC 8628 Β§6.1 base-20 alphabet: uppercase consonants only, so a user can type the code without modifier keys and without forming words or hitting a confusable digit.
USER_CODE_LENGTH πŸ”’
user_code length. Ten base-20 characters is ~43 bits: with the always-on per-IP throttle over the grant lifetime that keeps a single source well under the RFC 8628 Β§5.1 brute-force ceiling, while staying short enough to type.

FunctionsΒ§

device_authentication_matches πŸ”’
format_user_code
Render a stored user code for display, grouped with a single hyphen.
normalize_user_code πŸ”’
Fold user input back to the stored form: uppercase, keeping only charset bytes (RFC 8628 Β§6.1) so hyphens, spaces and case do not defeat the lookup.

Type AliasesΒ§

ProviderId πŸ”’