teal.websocket_dispatcher.protocol – TeaL websocket dispatcher protocol#

class teal.websocket_dispatcher.protocol.CallbackCreation(*, type: Literal['callback'], state: str, final_redirect_url: HttpUrl | None = None, with_fragment: bool = False, expires_at: datetime)#

Bases: BaseModel

Data to create a stored callback data.

expires_at: datetime#

Expiration date for the callback creation.

final_redirect_url: HttpUrl | None#

Final redirect URL.

state: str#

The state to create.

type: Literal['callback']#

Callback creation type, as a discriminant.

with_fragment: bool#

Whether to get the fragment with the redirect or not.

class teal.websocket_dispatcher.protocol.CallbackCreationFailedServerMessage(*, type: Literal['callback_creation_failure'] = 'callback_creation_failure', state: str, detail: str)#

Bases: BaseModel

Message signalling that registering a callback has failed.

detail: str#

Human-readable creation failure detail.

state: str#

State for which the callback event binding has failed.

type: Literal['callback_creation_failure']#

Message type, for allowing discrimination at caller level.

class teal.websocket_dispatcher.protocol.CallbackRegistration(*, type: Literal['callback'], state: str)#

Bases: BaseModel

Registration for callback states.

state: str#

The state to register to.

type: Literal['callback']#

Callback register type, as a discriminant.

class teal.websocket_dispatcher.protocol.CallbackServerMessage(*, type: Literal['callback'] = 'callback', timestamp: datetime, url: str, state: str)#

Bases: BaseModel

Message produced by the server when a callback event occurs.

state: str#

State for which the callback is emitted.

timestamp: datetime#

Timestamp at which the message was emitted.

type: Literal['callback']#

Message type, for allowing discrimination at caller level.

url: str#

Resulting callback URL with parameters and fragment.

class teal.websocket_dispatcher.protocol.ClientMessage(*, create: CallbackCreation | None = None, register_to: CallbackRegistration | OpenIDCIBACallbackRegistration | PowensDomainRegistration | None = None)#

Bases: BaseModel

Message for registering to one or more set of events.

create: CallbackCreation | None#

Element to create in the database.

register_to: CallbackRegistration | OpenIDCIBACallbackRegistration | PowensDomainRegistration | None#

Event to register to.

class teal.websocket_dispatcher.protocol.OpenIDCIBACallbackRegistration(*, type: Literal['openid_ciba_callback'], request_id: str)#

Bases: BaseModel

Registration for OpenID CIBA callbacks for a given request.

request_id: str#

The request identifier to register to.

type: Literal['openid_ciba_callback']#

OpenID CIBA callback registration type, as a discriminant.

class teal.websocket_dispatcher.protocol.OpenIDCIBACallbackServerMessage(*, type: Literal['openid_ciba_callback'] = 'openid_ciba_callback', timestamp: datetime, request_id: str, access_token: str, push_token: OpenIDCIBAPushToken | None = None, push_error: OpenIDCIBAPushError | None = None)#

Bases: BaseModel

Message produced by the server when an OpenID callback event occurs.

access_token: str#

The access token used to authenticate the ping/push callback.

push_error: OpenIDCIBAPushError | None#

The error data, in case the callback is a push error.

push_token: OpenIDCIBAPushToken | None#

The token data, in case the callback is a push token.

request_id: str#

Authentication request identifier.

timestamp: datetime#

Timestamp at which the message was emitted.

type: Literal['openid_ciba_callback']#

Message type, for allowing discrimination at caller level.

class teal.websocket_dispatcher.protocol.PowensDomainRegistration(*, type: Literal['powens_domain'], powens_domain: str)#

Bases: BaseModel

Registration for events related to a Powens domain.

powens_domain: str#

The Powens domain to register, without the ‘.biapi.pro’ domain part.

type: Literal['powens_domain']#

Powens domain register type.

class teal.websocket_dispatcher.protocol.PowensWebhookServerMessage(*, type: Literal['powens_webhook'] = 'powens_webhook', timestamp: datetime, domain: str, event: str, hmac_signature: PowensHMACSignature | None = None, user_token: str | None = None, payload: str)#

Bases: BaseModel

Message produced by the server when a Powens webhook is called.

domain: str#

Domain for which the webhook is emitted.

event: str#

Event for which the webhook is emitted.

hmac_signature: PowensHMACSignature | None#

The HMAC signature, if present.

payload: str#

The UTF-8 decoded payload.

timestamp: datetime#

Timestamp at which the message was emitted.

type: Literal['powens_webhook']#

Message type, for allowing discrimination at caller level.

user_token: str | None#

User scoped token with which the webhook is authenticated.