drm v0.1.2 Drm View Source

Documentation for Drm. license functions for creating, storing and exporting aes encrypted keys.

Link to this section Summary

Functions

Create a new license

Decode a license

Delete a license

Encode a license

Export the license file

Validate a license

Link to this section Functions

Create a new license

Parameters

  • hash: the license key string
  • meta: a map of meta data to enclude in the license
  • policy: a map of the main policy for the license

    Parameters

    • name : the name of the policy
    • type: the type of policy "free | commercial"
    • expiration: the license experation date this is a Datetime.t -> int ie. DateTime.utc_now() |> to_unix
    • validation_type: the validation type "strict | floating | concurrent"
    • checkin: when to checkin "true | false"
    • checkin_interval: when to checkin "nil | daily | weekly | monthly"
    • max_fingerprints: the number of max fingerprints for this license
    • fingerprint: the fingerprint for this license

    Validation Types

    • strict: a license that implements the policy will be considered invalid if its machine limit is surpassed
    • floating: a license that implements the policy will be valid across multiple machines
    • concurrent: a licensing model, where you allow a set number of machines to be activated at one time, and exceeding that limit may invalidate all current sessions.

    Types

    • free: a free license
    • commercial: a free license

Examples

iex> license =  %{hash: "license-key", meta: %{email: "demo@example.com", name: "licensee name"}, policy: %{name: "policy name", type: "free", expiration: nil, validation_type: "strict", checkin: false, checkin_interval: nil, max_fingerprints: nil, fingerprint: "main-app-name-umbrella-app-hash-id"}}
iex> License.create(license)

Decode a license

Examples

 iex> license_string = ""
 iex> License.decode(license_string)

Delete a license

Examples

   iex> License.delete("3454453444")
   :error

Encode a license

Parameters

  • hash: the license key string
  • meta: a map of meta data to enclude in the license
  • policy: a map of the main policy for the license

    Parameters

    • name : the name of the policy
    • type: the type of policy "free | commercial"
    • expiration: the license experation date this is a Datetime.t -> int ie. DateTime.utc_now() |> to_unix
    • validation_type: the validation type "strict | floating | concurrent"
    • checkin: when to checkin "true | false"
    • checkin_interval: when to checkin "nil | daily | weekly | monthly"
    • max_fingerprints: the number of max fingerprints for this license
    • fingerprint: the fingerprint for this license

    Validation Types

    • strict: a license that implements the policy will be considered invalid if its machine limit is surpassed
    • floating: a license that implements the policy will be valid across multiple machines
    • concurrent: a licensing model, where you allow a set number of machines to be activated at one time, and exceeding that limit may invalidate all current sessions.

    Types

    • free: a free license
    • commercial: a free license

Examples

iex> license =  %{hash: "license-key", meta: %{email: "demo@example.com", name: "licensee name"}, policy: %{name: "policy name", type: "free", expiration: nil, validation_type: "strict", checkin: false, checkin_interval: nil, max_fingerprints: nil, fingerprint: "main-app-name-umbrella-app-hash-id"}}
iex> License.encode(license)
Link to this function

export(id, type \\ "list") View Source

Export the license file

Examples

 iex> fingerprint = "umbrella-app-id"
 iex> License.export(fingerprint)
 :error
Link to this function

generate_key(hash, number, delimeter \\ "-") View Source

Link to this function

valid?(license_string) View Source
valid?(String.t()) :: any()

Validate a license

Examples

 iex> license_string = "3454453444"
 iex> License.valid?(license_string)
 false
Link to this function

valid?(license_string, fingerprint_in_question) View Source
valid?(String.t(), String.t()) :: any()

Validate a license

Examples

iex> license_string = "3454453444"
iex> fingerprint = "umbrella-app-id"
iex> License.valid?(license_string, fingerprint)
false