roboto.domain.tokens#
Submodules#
Package Contents#
- class roboto.domain.tokens.CreateTokenRequest(/, **data)#
Bases:
pydantic.BaseModel
Request payload to create a new token
- Parameters:
data (Any)
- description: str | None = None#
- expiry_days: int = None#
- name: str = None#
- class roboto.domain.tokens.Token(record, roboto_client=None)#
A token allows users and devices to authenticate requests to Roboto.
When a token is generated, a secret value is created which is shared with the user exactly once. This value is required for authentication, if lost a token can be deleted and a new token can be generated.
- Parameters:
roboto_client (Optional[roboto.http.RobotoClient])
- classmethod create(name, description=None, expiry_days=30, roboto_client=None)#
This returns a tuple of the token and the one-time generated secret. After creation, you’ll never be able to retrieve the secret again, so you should save it!
- Parameters:
name (str)
description (Optional[str])
expiry_days (int)
roboto_client (Optional[roboto.http.RobotoClient])
- Return type:
tuple[Token, str]
- delete()#
- Return type:
None
- classmethod for_self(roboto_client=None)#
- Parameters:
roboto_client (Optional[roboto.http.RobotoClient])
- Return type:
collections.abc.Collection[Token]
- classmethod from_id(token_id, roboto_client=None)#
- Parameters:
token_id (str)
roboto_client (Optional[roboto.http.RobotoClient])
- Return type:
- property record: roboto.domain.tokens.record.TokenRecord#
- Return type:
- to_dict()#
- Return type:
dict[str, Any]
- property token_id: str#
- Return type:
str
- property user_id: str#
- Return type:
str
- class roboto.domain.tokens.TokenContext(/, **data)#
Bases:
pydantic.BaseModel
Context for token usage
- Parameters:
data (Any)
- description: str | None = None#
- enabled: bool = True#
- expires: datetime.datetime#
- last_used: datetime.datetime | None = None#
- name: str#
- token_id: str#
- class roboto.domain.tokens.TokenRecord(/, **data)#
Bases:
pydantic.BaseModel
A wire-transmissible representation of a token.
- Parameters:
data (Any)
- context: TokenContext | None = None#
- secret: str | None = None#
- user_id: str | None = None#