Aker.Client (Aker v0.1.0)

Copy Markdown View Source

The app's calls to the licensing server, under /api/v1, JSON both ways.

  • activate/3 sends an activation code and this install's activation request, and gets the first licence back. It is the one call the install key does not sign: the code is the credential, and the request inside is signed by the install key.
  • renew/3 and refresh/3 carry the licence id and serial, and are signed by the install key (Aker.SignedCall).

Every call is made once: retries and redirects are off, so a failing server costs one call per attempt. The answer is read raw and capped at 64 KB as it arrives. A server's answer is {:ok, licence_file_bytes} or {:error, reason}, where a refusal code the server names is {:refused, code} with the code kept as text: at most 64 bytes of A-Z a-z 0-9 _ . : -, else "http_<status>", never turned into an atom.

server options:

  • :base_url: the server, https:// only;
  • :allow_http: true lets an http:// base URL through, for tests;
  • :req_options: merged into each Req call, such as a test plug;
  • :setting: the setting name a log line tells the operator to set when there is no base URL (default "server_url").

Summary

Functions

Activates with code, sending the activation request's bytes.

Asks for this term's licence with the current seats, signed by install_key.

Asks for the next term's licence, signed by install_key.

Functions

activate(server, code, request_bytes)

@spec activate(keyword(), String.t(), binary()) :: {:ok, binary()} | {:error, term()}

Activates with code, sending the activation request's bytes.

refresh(server, install_key, licence)

@spec refresh(keyword(), {module(), keyword()}, map()) ::
  {:ok, binary()} | {:error, term()}

Asks for this term's licence with the current seats, signed by install_key.

renew(server, install_key, licence)

@spec renew(keyword(), {module(), keyword()}, map()) ::
  {:ok, binary()} | {:error, term()}

Asks for the next term's licence, signed by install_key.