WardrikDaemon.CLIToken (wardrik_daemon v0.1.0-rc.1)

Copy Markdown

Issues the token the wardrik command acts with.

Each time the daemon starts, it revokes the last token and makes a new one: an owner token on every resource, good for a year. It's written to cli_token in the data home, readable only by you, as JSON with the token's id, its secret, and the url the HTTP API listens at.

Summary

Functions

Revokes the token at path, makes a new one on wardrik, and writes it to path with url.

Returns the url and secret of the token at path, or :error if there's none.

Functions

issue(wardrik, path, url)

@spec issue(atom(), Path.t(), String.t()) :: :ok

Revokes the token at path, makes a new one on wardrik, and writes it to path with url.

read(path)

@spec read(Path.t()) :: {:ok, %{url: String.t(), secret: String.t()}} | :error

Returns the url and secret of the token at path, or :error if there's none.