Aker.Request (Aker v0.1.0)

Copy Markdown View Source

The activation request an install sends the licensing server to get its licence.

One JSON object with two base64 fields: request, the request JSON bytes, and signature, the install key's DER signature of them. The signature proves the sender holds the private half of the key it names. The request names the product and its version, the install public key and its kind (software or TPM), the machine id hash, the time and a 16-byte random nonce.

Summary

Functions

A new request for this install, as the file's bytes.

The largest request verify/2 reads, in bytes.

Whether name is a product name: 1 to 64 characters of a-z, 0-9, _ and -.

The request's fields, when bytes is a request for the product opts[:product] signed by the key it names. The sign task reads a request through this.

Functions

build(opts)

@spec build(keyword()) :: {:ok, binary()} | {:error, atom()}

A new request for this install, as the file's bytes.

Options:

  • :product - the product's name (required, see product?/1);
  • :product_version - the app's version, 1 to 64 characters of 0-9 A-Z a-z . + - (required);
  • :install_key - {module, opts} (required);
  • :machine_id_hash - from Aker.MachineId.hash/1, 64 hex characters (required);
  • :now - the time the request names (default now).

max_bytes()

@spec max_bytes() :: pos_integer()

The largest request verify/2 reads, in bytes.

product?(name)

@spec product?(term()) :: boolean()

Whether name is a product name: 1 to 64 characters of a-z, 0-9, _ and -.

verify(bytes, opts)

@spec verify(binary(), keyword()) ::
  {:ok, %{install_public_key: binary(), machine_id_hash: String.t()}}
  | {:error, :bad_request}

The request's fields, when bytes is a request for the product opts[:product] signed by the key it names. The sign task reads a request through this.