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
Validate a license
Link to this section Functions
Link to this function
create(map) View Source
Create a new license
Parameters
hash
: the license key stringmeta
: a map of meta data to enclude in the licensepolicy
: a map of the main policy for the licenseParameters
name
: the name of the policytype
: the type of policy "free | commercial"expiration
: the license experation date this is a Datetime.t -> int ie. DateTime.utc_now() |> to_unixvalidation_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 licensefingerprint
: the fingerprint for this license
Validation Types
strict
: a license that implements the policy will be considered invalid if its machine limit is surpassedfloating
: a license that implements the policy will be valid across multiple machinesconcurrent
: 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 licensecommercial
: 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)
Link to this function
decode(license) View Source
Decode a license
Examples
iex> license_string = ""
iex> License.decode(license_string)
Link to this function
delete(file) View Source
Delete a license
Examples
iex> License.delete("3454453444")
:error
Link to this function
encode(license) View Source
Encode a license
Parameters
hash
: the license key stringmeta
: a map of meta data to enclude in the licensepolicy
: a map of the main policy for the licenseParameters
name
: the name of the policytype
: the type of policy "free | commercial"expiration
: the license experation date this is a Datetime.t -> int ie. DateTime.utc_now() |> to_unixvalidation_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 licensefingerprint
: the fingerprint for this license
Validation Types
strict
: a license that implements the policy will be considered invalid if its machine limit is surpassedfloating
: a license that implements the policy will be valid across multiple machinesconcurrent
: 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 licensecommercial
: 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
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
Validate a license
Examples
iex> license_string = "3454453444"
iex> fingerprint = "umbrella-app-id"
iex> License.valid?(license_string, fingerprint)
false