Skip to content

tokens

etl_craft.services.operations.tokens

Create, revoke and authenticate opaque API tokens without retaining their values.

TokenView dataclass

A token's identity and lifetime, without its value or hash.

actor property

actor: Actor

Attribute requests to the token's validated name.

TokensView dataclass

Token metadata visible to an administrator.

CreatedToken dataclass

The value returned once, alongside safe token metadata.

create_token

create_token(ctx: OperationContext, name: str, role: str, expires: str | None = None) -> CreatedToken

Print-once credentials contain 256 random bits; only their SHA-256 is stored.

list_tokens

list_tokens(ctx: OperationContext) -> TokensView

Return safe metadata; credential hashes never enter operation JSON.

revoke_token

revoke_token(ctx: OperationContext, token_id: int) -> TokensView

Revoke a token immediately; each request authenticates against current storage.

authenticate

authenticate(ctx: OperationContext, token: str) -> TokenView | None

Refuse unknown, expired, revoked and unsupported project-scoped tokens.