mod#

exception rizemind.authentication.mod.NoAccountAuthenticationModError[source]#

Bases: RizemindException

No account configuration is available in the context state.

exception rizemind.authentication.mod.NoSwarmAuthenticationModError[source]#

Bases: RizemindException

No swarm configuration is available in the context state.

exception rizemind.authentication.mod.WrongSwarmAuthenticationModError(expected: ChecksumAddress | None, received: ChecksumAddress)[source]#

Bases: RizemindException

The requested swarm domain does not match the configured domain.

rizemind.authentication.mod.authentication_mod(msg: Message, ctx: Context, call_next: Callable[[Message, Context], Message]) Message[source]#

Handle authentication for GET_PROPERTIES messages.

Invokes the next callable to populate the context, then, for messages carrying training-auth instructions, verifies the swarm domain and returns a signed authentication response.

Parameters:
  • msg – Incoming message to process.

  • ctx – Flower context carrying client state.

  • call_next – Next app callable to delegate to.

Returns:

The resulting message. If authentication applies, this is a GET_PROPERTIES response containing the signature; otherwise, the delegated reply.

Raises: