Wardrik. Operations. Tokens
(wardrik v0.1.0-rc.1)
Copy Markdown
Operations on the deployment's API tokens: creating, listing and revoking.
Only the SHA-256 of a token's secret is stored. The secret is returned once, when the token is
created. A resource that names an org, as acme/agent/*, must name a known org. A wildcard org,
as */agent/*, covers whichever orgs exist.
Summary
Functions
Returns the scope of the token secret, or an unauthorized error.
Creates a token that acts for the scope's principal. Returns the token and its secret.
Lists tokens, oldest first, without secrets.
Revokes a token. Returns the revoked token.
Functions
@spec authenticate(Wardrik.t(), String.t()) :: {:ok, Wardrik.Scope.t()} | {:error, Wardrik.Error.t()}
Returns the scope of the token secret, or an unauthorized error.
@spec create(Wardrik.Scope.t(), map()) :: {:ok, map()} | {:error, Wardrik.Error.t()}
Creates a token that acts for the scope's principal. Returns the token and its secret.
The token can't do more than scope, be held to a different policy, or outlast it.
@spec list(Wardrik.Scope.t(), map()) :: {:ok, map()}
Lists tokens, oldest first, without secrets.
With "resources", lists only the tokens whose resources those patterns all cover.
@spec revoke(Wardrik.Scope.t(), map()) :: {:ok, map()} | {:error, Wardrik.Error.t()}
Revokes a token. Returns the revoked token.