Wraith.ApiKeys (Wraith v0.1.0)

View Source

Keys for the JSON APIs. Two kinds, as in Ghost:

  • "content" — read-only, public content (/api/content/*), passed as ?key= like Ghost's Content API key
  • "admin" — full access (/api/admin/*), sent as Authorization: Bearer <key>

A key is <id>:<secret>; only the SHA-256 of the secret is stored.

Summary

Functions

Create a key; the raw key is returned once.

The key record a raw <id>:<secret> identifies, if it is live and of kind.

Functions

create(label, kind)

@spec create(String.t(), String.t()) ::
  {:ok, String.t(), map()} | {:error, String.t()}

Create a key; the raw key is returned once.

delete(id)

list()

verify(raw, kind)

@spec verify(String.t() | nil, String.t()) :: {:ok, map()} | :error

The key record a raw <id>:<secret> identifies, if it is live and of kind.